OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: THobson on 28 Dec 2004, 20:31:55
-
I want the crew of certain vehicles to abandon the vehicle and walk. I have the following code in a script:
if ((canMove _veh) and (fuel _veh > 0.05) and (side driver _veh == west)) then {goto"VehOkay_1"}
_crew = crew _veh
{unassignVehicle _x} forEach _crew
_crew orderGetIn false
#VehOkay_1
I tested it with a vehicle that had setFuel 0
The result was the Gunner and the Driver got out and the Gunner then got back in!
How do I get them all out and keep them out?
-
Remove his ammo maybe?
Planck
-
Did you try locking the vehicle?
if ((canMove _veh) and (fuel _veh > 0.05) and (side driver _veh == west)) then {goto"VehOkay_1"}
_crew = crew _veh
{unassignVehicle _x} forEach _crew
_crew orderGetIn false
_veh Lock True
#VehOkay_1
-
locking only works on players, it has no affect on AI att all
-
try using veh remove all magaziens/ammo(dont know which,
-
Cracked it. It seems that telling the crew of a vehicle to unassignVehicle does not work on its own. Somehow the crew are uniquely linked to the vehicle. The code that solves my problem is:
if ((canMove _veh) and (fuel _veh > 0.05) and (side driver _veh == west)) then {goto"VehOkay_1"}
_crew = crew _veh
[_crew select 0] join grpNull
{unassignVehicle _x} forEach _crew
{[_x] join (_crew select 0)} forEach _crew
#VehOkay_1It seems that it is necessary to assign the crew members to a group that is in noway associated with the vehicle - otherwise they just keep trying to get beck in.
I did not get chance to try the ammo/magzines bit - but anyway that would have spoiled what I was trying to achieve.
-
Was this a vehicle placed via the editor fully crewed?
Planck
-
Yes. Is this a known issue?
-
Sort of
They do the same thing if you issue:
fredc action ["getout", fred]
fredd action ["getout", fred]
fredg action ["getout", fred]
fred being the vehicle.
Planck
-
I used action "eject" but they still kept getting back in.
Giving them a new group seem to have solved it though
-
I had this problem. I solved it with
"unAssignVehicle _x" forEach units _group
units _group orderGetIn false
units _group allowGetIn false
I don't know which of these commands does the trick, or if its the combination of the two.... having eventually got it to work I couldn't face figuring out why, although it seems allowGetIn might be the crucial one.
-
I remember that code. I didn't understand it, but at least it works. If I had remembered I would have saved myself some trouble, anyway, giving the guys a new group to belong to works as well.
-
It's classic ofp code - tell a loon to do something, then bang him on the head with something else to make sure he does it.
-
Lol ;D