OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: surpher on 31 May 2004, 17:14:04
-
Hi All :wave:
I'm have a bit of trouble with my script. I've created a tank with the createVehicle command, and I've also created a crew to go in the tank. My problem is getting the crew into the tank. I can get the leader in no problem :).
(leader groupname) moveInCommander tankName
It's just the driver and gunner giving me trouble :(, how would i refer to these other members of the group
-
I haven't done much with create vehicle. but maybe you can name the guys when creating them. Then do
tanker1 moveingunner bigtank
tanker2 moveindriver bigtank
Or you could just create three seperate guys and have them be in their own groups and script it so each guy goes in the right spot. Even if the tank isn't crewed by the same group it still works rather well. The commander tells the gunner to fire and the driver where to go. THe only problem is you cant make the CO say engage at will or danger.
-
Well I'm not sure how this would apply to a created vehicle ... but I know that if you were to place, say a tank on the map that was named T then the gunner of said tank should be named Tg , commander Tc , and driver Td
Been a while since i used those commands, but I'm about 80% sure thats right :P
-
Greets,
You could do this in a variety of ways.
If the group leader is the commander, then the second in the group will be the gunner, the third the driver, correct? Then:
_gunner = (units groupName) select 1
_gunner moveInGunner tankName
_driver = (units groupName) select 2
_driver moveInDriver tankName.
[EDIT: Added 'Units' command. You may or may not need the brackets, I can never get those right... :P ::)]
Would select the second and third members of the group, and make them the gunner/ driver.
-or-
An alternative method is this: One problem with the createUnit command is that it does not return anything. So you cannot put
_gunner = "SoldierWB" createUnit [blah, blah, blah]
However there is a workaround: This is MacGuba's example:
"SoldierWB" createUnit [getMarkerPos "marker_1", groupAlpha, "loon1 = this; this addweapon {binocular}", 0.6, "corporal"]
Where it says "loon1 = this; this addWeapon {binocular}", is the init line. This does exactly the same thing as the init field in the 'edit unit' dialog, in the editor. You could put "gunnerTank1 = this" in this area, and then use the code
gunnerTank1 assignAsGunner tank1
in your script.
A couple of workarounds for you... ;D
-Supreme Commander PsyWarrior
-Psychic Productions Command
-
Thanks PsyWarrior ;D
_gunner = (units groupName) select 1
_gunner moveInGunner tankName
_driver = (units groupName) select 2
_driver moveInDriver tankName
This solved my problem, you've rescued me again. :cheers: