Home   Help Search Login Register  

Author Topic: Edit Spawn Script  (Read 910 times)

0 Members and 1 Guest are viewing this topic.

Offline Ghost644

  • Members
  • *
    • Ghostland
Edit Spawn Script
« on: 06 Jul 2006, 01:37:01 »
I am currently using the CHSBAS.sqs which looks like this:
Code: [Select]
;------------------------------------------------------------------;
;--- Scripted by Chaos --- for Operation Flashpoint RESISTANCE ----;
;--------------------------- in December 2005 ---------------------;
;------------------------------------------------------------------;
;------------------------------------ http://www.ofpmdb.de.vu -----;
;------------------------------------------------------------------;
; Syntax:
;   [doorpos,createpoint,direction,basisgroup,leader enemy group] exec "CHSBAS.sqs"
;
; WHAT IS WHAT ?
;   doorpos     - position of the door
;   createpoint - point of creation (units)
;   direction   - direction of the units after they pass the door
;   basisgroup  - basisgroup of the units
;   ldr. e. grp - leader of the enemy group (player group ?)
;
; Example:
;   [pt1,crepointE,180,basisR,leader amis] exec "CHSBAS.sqs"
;
;
; Using of addons:
;   If you want to use addons, you must change the names of positions
;   _men1 to _men12 with these of the addon units
;
; Example:
;   _men1 = "BAS_JRangerGLS"
;   _men2 = "BAS_JRangerRTOS"
;   ..... etc.
;
;------------------------------------------------------------------;

_pt = _this select 0
_cp = _this select 1
_dr = _this select 2
_bas = _this select 3
_enemy = _this select 4

_SPA = getPos _cp select 0
_SPB = getPos _cp select 1
_SPC = getPos _cp select 2

_n = 0

_men1 = "OfficerE"
_men2 = "SoldierEMG"
_men3 = "SoldierEG"
_men4 = "SoldierEB"
_men5 = "SoldierELAW"
_men6 = "HeavyGrenadier"
_men7 = "SoldierEAT"
_men8 = "SoldierEAA"
_men9 = "SoldierEMiner"
_men10 = "SoldierEMedic"
_men11 = "SoldierESaboteurPipeHG"
_men12 = "SoldierESaboteurPipe"

;-------------------------------
;    ZEITLICHE VARIABLITÄT
;       TIME VARIABLITY
;-------------------------------

_ZUX = Random 6
? _ZUX < 1 : _t = 2; goTo "ZT"
? _ZUX < 2 : _t = 4; goTo "ZT"
? _ZUX < 3 : _t = 6; goTo "ZT"
? _ZUX < 4 : _t = 7; goTo "ZT"
? _ZUX < 5 : _t = 8; goTo "ZT"
? _ZUX < 6 : _t = 9; goTo "ZT"

#ZT
~_t

;----------------------------
;     VARIANTEN WÄHLEN
;      CHOOSE VARIANTS
;----------------------------

_FUX = Random 12
? _FUX < 1 : _nmb = 1; goTo "variant"
? _FUX < 2 : _nmb = 2; goTo "variant"
? _FUX < 3 : _nmb = 3; goTo "variant"
? _FUX < 4 : _nmb = 4; goTo "variant"
? _FUX < 5 : _nmb = 5; goTo "variant"
? _FUX < 6 : _nmb = 6; goTo "variant"
? _FUX < 7 : _nmb = 7; goTo "variant"
? _FUX < 8 : _nmb = 8; goTo "variant"
? _FUX < 9 : _nmb = 9; goTo "variant"
? _FUX < 10 : _nmb = 10; goTo "variant"
? _FUX < 11 : _nmb = 11; goTo "variant"
? _FUX < 12 : _nmb = 12; goTo "variant"

;----------------------------
;         VARIANTEN
;          VARIANTS
;----------------------------

#variant
_men1 createUnit [[(_SPA),(_SPB),(_SPC)], _bas,"",0.65,"Sergeant"];
_ldr = (units _bas) select 1
[_ldr] join grpNull
_newgroup = group _ldr
_ldr = Leader _newgroup

? _nmb == 1 : goTo "flw"
~.2
_men2 createUnit [[(_SPA),(_SPB),(_SPC)],_newgroup,"",0.5,"Corporal"];
? _nmb == 2 : goTo "flw"
~.2
_men3 createUnit [[(_SPA),(_SPB),(_SPC)],_newgroup,"",0.45,"Private"];
? _nmb == 3 : goTo "flw"
~.2
_men4 createUnit [[(_SPA),(_SPB),(_SPC)],_newgroup,"",0.45,"Private"];
? _nmb == 4 : goTo "flw"
~.2
_men5 createUnit [[(_SPA),(_SPB),(_SPC)],_newgroup,"",0.45,"Private"];
? _nmb == 5 : goTo "flw"
~.2
_men6 createUnit [[(_SPA),(_SPB),(_SPC)],_newgroup,"",0.45,"Private"];
? _nmb == 6 : goTo "flw"
~.2
_men7 createUnit [[(_SPA),(_SPB),(_SPC)],_newgroup,"",0.45,"Private"];
? _nmb == 7 : goTo "flw"
~.2
_men8 createUnit [[(_SPA),(_SPB),(_SPC)],_newgroup,"",0.45,"Private"];
? _nmb == 8 : goTo "flw"
~.2
_men9 createUnit [[(_SPA),(_SPB),(_SPC)],_newgroup,"",0.45,"Private"];
? _nmb == 9 : goTo "flw"
~.2
_men10 createUnit [[(_SPA),(_SPB),(_SPC)],_newgroup,"",0.45,"Private"];
? _nmb == 10 : goTo "flw"
~.2
_men11 createUnit [[(_SPA),(_SPB),(_SPC)],_newgroup,"",0.45,"Private"];
? _nmb == 11 : goTo "flw"
~.2
_men12 createUnit [[(_SPA),(_SPB),(_SPC)],_newgroup,"",0.45,"Private"];

#flw
~1
_ldr setFormDir _dr

#loop0
_men = units _newgroup select _n
_men setUnitPos "up"
_men setBehaviour "aware"
_men setSpeedMode "full"
_men setCombatMode "red"
_men setDir _dr
~1
_n = _n + 1
? _n >= count units _newgroup : _n = 0; goTo "loop1"
goTo "loop0"

#loop1
_men = units _newgroup select _n
_men move getPos _enemy
_men setPos getPos _pt
_men setDir _dr
~2
_n = _n + 1
? _n >= count units _newgroup : _n = 0; goTo "nxt1"
goTo "loop1"

#nxt1
_ldr setFormation "wedge"
_ldr setSpeedMode "full"
_ldr setCombatMode "red"
_ldr setBehaviour "aware"
_ldr setUnitPos "up"
_ldr move getPos _enemy

~15

#loop2
_men = units _newgroup select _n
_men setUnitPos "auto"
~2
_n = _n + 1
? _n >= count units _newgroup : _n = 0; goTo "nxt2"
goTo "loop2"

#nxt2

exit
I am trying to get the units to spawn into a C-130 as cargo. then the C-130 reaches a trigger which will run a Para script. I have 3 C-130's not grouped together set on a cycle so that they will fly over the target over and over dropping off paras. In the above script i tried adding
Code: [Select]
"_men1 = this; this moveincargo herc1" so it would look like this for every units init field:
Code: [Select]
_men1 createUnit [[(_SPA),(_SPB),(_SPC)], _bas,"",0.65,"Sergeant",

"_men1 = this; this moveincargo herc1"];
in the init field of the spawned units but i get errors.
So in summary i want any C-130 to fly to a trigger and exec this script. When the script is exec it will spawn 12 units incargo of the C-130. Also can i add a line somewhere to make the spawned units move to GPS coords and attack? I would prefer not to have to have 3 different vers of this script each run on 1 of the C-130's, I would like whatever C-130 activates the trigger, to get units spawned in cargo. Then the next C-130 that activates a trigger to do the same. Thanks in advance and hope i gave enough information.
Ghost