Jump to content
Sign in to follow this  
Earacorn

How to? Eject AI

Recommended Posts

I'm looking for a script so I can have enemy divers eject over water.. Does anyone know how to do this? I've seen a few for arma 2 but I'm just not sure if they will work like I want.. I'll try them in the meantime I guess.

Share this post


Link to post
Share on other sites

It accepts the script but I still cant seem to get the heli to drop the divers while he is hovering over water.. I also need to get the heli to come down in altitude just a bit so the divers don't just jump to their deaths.

Share this post


Link to post
Share on other sites

Holy crap this is way over my head lol... I'll see what I can learn. I'll probably come back to this tomorrow my brain is scripted out. Thx for all the help Cobra :D

Share this post


Link to post
Share on other sites

Just start with this and experiment. Place it into a file and call it diveteam.sqf

Create your init.sqf and put this into it: [getmarkerpos "start",player] execVM "diveteam.sqf" or you can do a radio trigger to test.

Create a marker named start and place your player out into the water.

Start your mission and a helicopter should spawn in, fly to your position, fly to a height of 5 meters, than drop of 4 divers, the helicopter will then fly back to its starting point, and the divers will just be sitting in the water.

_start = _this select 0;
_target = _this select 1;

//if the target is not on water cancel the mission
if (!surfaceIsWater position _target) exitWith {hint "The target is on dry land."}; //for testing?

//create helicopter
_grp_heli = creategroup East;
_heliSpawn = [_Start, 180, "O_Ka60_F", _grp_heli] call bis_fnc_spawnvehicle;
_heli = _heliSpawn select 0;

//create dive team
_grp_diver = [_start, EAST, (configFile >> "CfgGroups" >> "East" >> "OPF_F" >> "SpecOps" >> "OI_diverTeam")] call BIS_fnc_spawnGroup;
_grpLeader = leader _grp_diver;

//assign dive team to helicopter and move in cargo
{_x assignasCargo _heli; _x moveinCargo _heli} foreach (units _grp_diver);

//create helicopter waypoint to target and its behavior
_grp_heli Move position _target;
_grp_heli setSpeedMode "FULL";
_grp_heli setBehaviour "SAFE";
_grp_heli setCombatMode "BLUE";

//wait until helicopter is near target and at 5 meters above sea level before dropping off divers
waitUntil {_heli distance _target < 150};
_heli flyinheight 5;
Waituntil {(getPosASLW _heli select 2) < 5};

//eject divers one at a time for every half second
sleep (random 3);
{unassignVehicle (_x);(_x) action ["EJECT", vehicle _x]; sleep 0.5} foreach (units _grp_diver);
waitUntil {{_x in _heli} count (units _grp_diver) == 0};
sleep 3; // added to keep the helicopter hovering for a couple seconds while divers enter the water

//move helicopter back to its starting position
_heli flyinHeight 40;
_heli doMove (_start);

Edited by cobra4v320

Share this post


Link to post
Share on other sites

There 2 ways it can be done one with waypoints and like the above script i spent a few hours on ejecting divers and worked it out perfect.

Share this post


Link to post
Share on other sites
Just start with this and experiment. Place it into a file and call it diveteam.sqf

Create your init.sqf and put this into it: [getmarkerpos "start",player] execVM "diveteam.sqf" or you can do a radio trigger to test.

Create a marker named start and place your player out into the water.

Start your mission and a helicopter should spawn in, fly to your position, fly to a height of 5 meters, than drop of 4 divers, the helicopter will then fly back to its starting point, and the divers will just be sitting in the water.

_start = _this select 0;
_target = _this select 1;

//if the target is not on water cancel the mission
if (!surfaceIsWater position _target) exitWith {hint "The target is on dry land."}; //for testing?

//create helicopter
_grp_heli = creategroup East;
_heliSpawn = [_Start, 180, "O_Ka60_F", _grp_heli] call bis_fnc_spawnvehicle;
_heli = _heliSpawn select 0;

//create dive team
_grp_diver = [_start, EAST, (configFile >> "CfgGroups" >> "East" >> "OPF_F" >> "SpecOps" >> "OI_diverTeam")] call BIS_fnc_spawnGroup;
_grpLeader = leader _grp_diver;

//assign dive team to helicopter and move in cargo
{_x assignasCargo _heli; _x moveinCargo _heli} foreach (units _grp_diver);

//create helicopter waypoint to target and its behavior
_grp_heli Move position _target;
_grp_heli setSpeedMode "FULL";
_grp_heli setBehaviour "SAFE";
_grp_heli setCombatMode "BLUE";

//wait until helicopter is near target and at 5 meters above sea level before dropping off divers
waitUntil {_heli distance _target < 150};
_heli flyinheight 5;
Waituntil {(getPosASLW _heli select 2) < 5};

//eject divers one at a time for every half second
sleep (random 3);
{unassignVehicle (_x);(_x) action ["EJECT", vehicle _x]; sleep 0.5} foreach (units _grp_diver);
waitUntil {{_x in _heli} count (units _grp_diver) == 0};
sleep 3; // added to keep the helicopter hovering for a couple seconds while divers enter the water

//move helicopter back to its starting position
_heli flyinHeight 40;
_heli doMove (_start);

Ok.. here's the thing, I've never done any scripting or editing out of the game everything up until this point has been done in game with the initialization thing... So when you say create diveteam.sqf and init.sqf are those just notepads that I copy all of that text into and just put into my mpmissions folder? Or is there something I'm missing here? Sorry I know this is a pain.

Share this post


Link to post
Share on other sites

lol.. again you kinda left me in the dust.. I haven't done any work with radio yet.. Am I supposed to somehow radio Alpha or bravo?

Share this post


Link to post
Share on other sites

Yea thats exactly what I was looking for. Do you mind if I use this in my mission? If I post it I'll give you credit.

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
Sign in to follow this  

×