As a complete newbie to OFP scripting, I obviously have some problems, even reading and understanding the existing scripts.
What I'm trying to setup is the following:
Three choppers who flyes to a given waypoint where each ejects a separate group and moves on to their next waypoint and dissappears. The groups of men (named MyGrp01 etc) are moved into their respective chopper by the following snippet attached to the group leader:
mygrp02 = group this; "_x moveincargo chop02" foreach units mygrp02
Does this moveincargo command also _assign_ them to the chopper?
Anyways, the various scripts I have tried, including many (to me rather cryptic) ways of unassigning the units from the chopper, the chopper still lands and the units get back in. If I take leader position, all is fine though and I have control of my men, but the two other flanking teams always leave me stranded behind.
I would like to make this work regardless of my position.
The eject waypoint (type MOVE) has the following snippet in the "On Activation" field (correct one?):
aP globalchat "Green light. Everyone out!"; [mygrp02,chop02] exec "groupeject.sqs"; [mygrp02] allowgetIn false
Not using [mygrp02] caused the copilot to get out
And the globalchat stuff, whatever it is, doesn't work anymore.
The actual script goes like this:
; Get the script arguments from the _this variable
_grp = _this select 0
_vehicle = _this select 1
_aunits = units _grp
_i = 0
_j = count _aunits
#Here
(_aunits select _i) action ["EJECT",_vehicle]
; my humble attempt on unassigning
unassignvehicle (_aunits select _i)
{unassignvehicle _x} foreach units mygrp02
(_aunits select _i) ordergetin false
; my humble attempt ends here
_i=_i+1
~1
?_j>_i:goto "Here"
exit
Can anyone help me make this work?
Then lastly, just a couple of generic questions, since I'm just learning this stuff:
1. Under the #Here function above, can you do the stuff I'm doing, such as trying out multiple methods of unassigning within the same function, or is commenting out good practice? Can it cause havoc by doing this?
2. In such cases, can you make the script generic to whatever is calling it, or should you have one script per group of men? Any preferable method of thinking?
3. Any special considerations I need to have in mind if I want to make it work under a multiplayer game? I like to test in singleplayer for obvious reasons.