OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Ex-RoNiN on 23 Feb 2004, 19:55:23
-
I have the following script, which gets activated once a trigger gets activated. I have a gamelogic and an empty group that give the created unit/group its name and starting position.
_pos = _this select 0
_groupname = _this select 1
_tank = "AAV7" createvehicle (getpos _pos)
"SoldierWCrew" createUnit [(getpos _pos), _groupname, "", 0.7, "CAPTAIN"]
"SoldierWCrew" createUnit [(getpos _pos), _groupname, "", 0.7, "CAPTAIN"]
"SoldierWCrew" createUnit [(getpos _pos), _groupname, "", 0.7, "CAPTAIN"]
~0.5
((units _groupname) select 0) moveindriver _tank
((units _groupname) select 1) moveincommander _tank
((units _groupname) select 2) moveingunner _tank
exit
I want to expand this now, so that the AAV also has 4 Marine soldiers in its cargo. I experimented with this and tried the following:
_pos = _this select 0
_groupname = _this select 1
_tank = "AAV7" createvehicle (getpos _pos)
"SoldierWCrew" createUnit [(getpos _pos), _groupname, "", 0.7, "CAPTAIN"]
"SoldierWCrew" createUnit [(getpos _pos), _groupname, "", 0.7, "CAPTAIN"]
"SoldierWCrew" createUnit [(getpos _pos), _groupname, "", 0.7, "CAPTAIN"]
"SUCHusmcrifle" createUnit [(getpos _pos), _groupname, "", 0.7, "LIEUTENANT"]
~0.5
((units _groupname) select 0) moveindriver _tank
((units _groupname) select 1) moveincommander _tank
((units _groupname) select 2) moveingunner _tank
((units _groupname) select 3) moveincargo _tank
exit
This, however, didn't work.
So my questions are this:
1) How do I add soldiers to the cargo of the AAV?
2) Where is the individual units' "init" field?
3) How do I set the entire group's behaviour to "aware"? Is it g1 setbehaviour "aware" after I am finished with adding soldiers to the AAV (g1=groupname)?
4) How do I tell the group to go to the position of unitname and follow unitname wherever unitname goes?
Thanks a lot in advance :)
-
1.-2.
The init field is the "" you've in the createUnit array... No guarantees but u can try and put there something like "this moveInCargo _tank"...
3.
Yup... At least according to the Comref :P
4.
Again, no guarantees, but something like:
"_x doMove (getPos unitname)" forEach units groupname
"_x doFollow unitname" forEach units groupname
-
AWW... :-[
Some stupidity I just spread there... Only the part in red is right, forget the rest in that particular answer segment... :-\
1.-2. The init field is the "" you've in the createUnit array... No guarantees but u can try and put there something like "this moveInCargo _tank"...
U need to name the units you create also, not just the AAV... And after that unit creation put a few lines in vein of _unit1 moveInCargo _tank and so on
-
Greetings,
Wait a moment, 'lancer...
Almost right... ;)
However, due to a bug, createUnit doesn't return anything, so you cannot put:
_unit1 = createUnit [...blah, blah...]
However, you could use the init field to accomplish the same thing:
"SoldierWCrew" createUnit [(getpos _pos), _groupname, "curUnit = this", 0.7, "CAPTAIN"]
_unit1 = curUnit
"SoldierWCrew" createUnit [(getpos _pos), _groupname, "curUnit = this", 0.7, "CAPTAIN"]
_unit2 = curUnit
and so on. Other than that, the rest seems to be right.
One other thing: you could apply the forEach command to the setbehaviour command as well: "_x setbehaviour ""AWARE""" forEach units _groupname.
Resources: ComRef (http://www.flashpoint1985.com/docs/comref_102002/comref.html)
-Supreme Commander PsyWarrior
-Psychic Productions Studios
-
I knew that... ::) ;D
For some reason I've been missing a good 98% of my brain for the past few weeks... :P :beat: