Jump to content
Aurora152

Force eject all non-crew from vehicle

Recommended Posts

Hello all,

 

I have made a mission where you are to transport groups of soldiers from point A to B.

 

Group spawns on a marker, via a trigger, using this:

_this = [getMarkerPos "spawn", west, (configfile >> "CfgGroups" >> "West" >> "BLU_T_F" >> "Infantry" >> "B_T_InfSquad_Weapons")] call BIS_fnc_spawnGroup;   
  
_wpt1 = _this addWaypoint [getMarkerPos "pad", 0];  
  _wpt1 setWaypointType "GETIN NEAREST";  
  _wpt1 setWaypointBehaviour "AWARE";  
  _wpt1 setWaypointCombatMode "YELLOW";  
  
_wpt2 = _this addWaypoint [getMarkerPos [["mrk1","mrk2","mrk3"] call BIS_fnc_selectRandom], 0];  
  _wpt2 setWaypointType "MOVE";  
  _wpt2 setWaypointBehaviour "AWARE";  
  _wpt2 setWaypointCombatMode "YELLOW";

Problem 1: The group ignores the first waypoint when the helicopter has all crew positions taken. there are still 8 passenger slots available. How would I fix this? 

 

I then want to be able to force eject this group when the helicopter has landed via an addAction Command. I have got this so far:

heli2 addAction ["Kick Out Passengers", {{doGetOut _x} foreach assignedCargo (vehicle heli2)}];

Problem 2: This only ejects single units at a time, which then get back in because the group leader is in the helicopter still. How would I fix this?

The helicopter has gunners in it, so I can't just eject everything except the player.

I haven't given the group spawned a specific name as I want this to be able to happen multiple times.

 

Any help would be much appreciated. :)

 

Regards,

Aurora

 

Share this post


Link to post
Share on other sites
16 hours ago, Aurora152 said:

Problem 1: The group ignores the first waypoint when the helicopter has all crew positions taken. there are still 8 passenger slots available. How would I fix this? 

 

try "LOAD" wp instead (just a guess)

 

16 hours ago, Aurora152 said:

Problem 2: This only ejects single units at a time, which then get back in because the group leader is in the helicopter still. How would I fix this?

 

allowGetIn should fix that

 

heli2 addAction ["Kick Out Passengers", 
{

{
doGetOut _x;

[_x] allowGetIn false;

} foreach assignedCargo (vehicle heli2);


}];

 

also you might need unassignVehicle command

 

  • Like 2

Share this post


Link to post
Share on other sites
14 minutes ago, gc8 said:

heli2 addAction ["Kick Out Passengers", { { doGetOut _x; [_x] allowGetIn false; } foreach assignedCargo (vehicle heli2); }];

Perfect that has worked! Thanks.

 

I have started putting the unit spawn into the addAction, and so far its working okay. However, I can't seem to remove the action with removeAction.

I have a trigger, where it activates when any player is present with this in:

Activation:

{_x Setdammage 0} Foreach thislist;   
  
_spawn = player addAction ["Spawn Units", "spawn.sqf"];

Deactivation:

player removeAction _spawn;

But the action won't go away when the player leaves the trigger area. Any idea how to fix this? I see that you can add an actionID to the addAction, but for the life of me can't figure out how it works...

 

Share this post


Link to post
Share on other sites
14 minutes ago, Aurora152 said:

But the action won't go away when the player leaves the trigger area. Any idea how to fix this?

_spawn isn't available inside "On deact." field, but you can save action ID in the trigger object:

- On act.:

thisTrigger setVariable ["actionId", player addAction ["Spawn Units", "spawn.sqf"]];

- On deact.:

_actionId = thisTrigger getVariable ["actionId", -1];

if (_actionId >= 0) then {
    player removeAction _actionId;
};

 

  • Like 3

Share this post


Link to post
Share on other sites
4 hours ago, Schatten said:

_spawn isn't available inside "On deact." field, but you can save action ID in the trigger object:

- On act.:


thisTrigger setVariable ["actionId", player addAction ["Spawn Units", "spawn.sqf"]];

- On deact.:


_actionId = thisTrigger getVariable ["actionId", -1];

if (_actionId >= 0) then {
    player removeAction _actionId;
};

 

 That has worked perfectly! Thank you very much!

Share this post


Link to post
Share on other sites

@Schatten

 

Just doing some testing with it and I have discovered that the action does not appear after the helicopter respawns. Would there be a way to keep the action after the helicopter respawns?

 

Edit: Fixed it... Just set the condition to be that the helicopter is alive rather than true.

  • Like 1
  • Confused 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×