Jump to content
Sign in to follow this  
rakowozz

OPFOR AI & Parachutes

Recommended Posts

Hey, guys. I've been trying some solutions, but enemy reinforcements will either arrive by falling like a brick from the skies or, a bit better: they'll deploy their parachutes, but hop off of it a few seconds later.

And then you just see an empty deployed parachute -- which actually looks good from a distance, until you notice there's nobody in it :icon_lol:

I'm using this:

_vehicle = _this select 0;
_units = _this select 1;
_delay = _this select 2;
{
  unassignVehicle _x;
  _x action ["EJECT", _vehicle];
  sleep _delay;
} foreach _units;

...activated by this:

nul = [vehicle, [unit1,unit2,unitn], 2] execVM "scripts\paradrop.sqf"

I tried searching for a few days and found nothing, but was wondering if there's a way to adapt the land safely part of this I found in another thread, where the editor wants to deploy an object from the air safely:

_para = createVehicle ["B_Parachute_02_F", [0,0,100], [], 0, ""];
_para setPosATL (player modelToWorld[0,0,200]);
_veh = createVehicle ["C_SUV_01_F", [0,0,80], [], 0, ""];
_veh attachTo [_para,[0,0,0]]; 

// Land safely
WaitUntil {((((position _veh) select 2) < 0.6) || (isNil "_para"))};
detach _veh;
_veh SetVelocity [0,0,-5];           
sleep 0.3;
_veh setPos [(position _veh) select 0, (position _veh) select 1, 1];
_veh SetVelocity [0,0,0];  

Share this post


Link to post
Share on other sites

Here's what I use in Arma3 for paradropping AI. The Ai then proceed to hunt the player. The helo also joins the para group. This is a really effective way to simply get the helo to engage ground units. Since the para group essentially serves as his spotter. The helo spawns flying above a marker and flys towards another marker. I have it so when the helo is in a triggers list, it makes a variable (condition) true, and ejects 1 Ai out of the chopper every 0.8 seconds, as he's flying.


helo1 = [[(getMarkerPos "b1") select 0,(getMarkerPos "b1") select 1,300], 0, "O_Heli_Light_02_F", east] call Bis_fnc_spawnvehicle;
para = [getMarkerPos "b1", EAST, (configFile >> "CfgGroups" >> "east" >> "OPF_F" >> "Infantry" >> "OIA_Infsquad")] call BIS_fnc_spawnGroup;
{_x MoveInCargo (helo1 Select 0)} ForEach Units para;
(helo1 Select 0) flyinheight 300;
(helo1 select 0) DoMove GetMarkerPos "b2";
{_x disableCollisionWith (helo1 Select 0)} Foreach Units para; 

WaitUntil { SomeCondition; };

_chute = "NonSteerable_Parachute_F";

  {
     unassignVehicle (_x);
     (_x) action ["EJECT", vehicle _x];
     sleep 0.8;
  } foreach units para;	



  {
     waitUntil {(getPosATL _x select 2) < 200};
     _para1 = _chute  createVehicle (position _x);
     _xpos = getPos _x;
     _para1 setPos _xpos;
     _x moveIndriver _para1;

  } foreach units para;

  {[_x] join para} Foreach Crew (helo1 select 0);
  (helo1 Select 0) FlyInHeight 100;
  para setBehaviour "COMBAT";
  para setCombatMode "RED";

  While {{alive _x} count units para > 0} Do
  {
     {para reveal [_x, 1.7]} ForEach units alpha;
     {_x DoMove getPosATL player} ForEach units para;
     Sleep 60;
  };

Edited by Pac Man

Share this post


Link to post
Share on other sites
Good work Pac Man! Cant wait for helo bad guy re-enforce again

Well.. idk about good, but it's how i do it atm! :p Writ it up just yesterday after a member posted here with a problem and it gave me an idea lol.

Edited by Pac Man

Share this post


Link to post
Share on other sites
Well.. idk about good, but it's how i do it atm! :p Writ it up just yesterday after a member posted here with a problem and it gave me an idea lol.

Is this MP compatible?

Share this post


Link to post
Share on other sites

Alright,

This is what im using.

NOTE: it uses upsmon but you can very easily change that and use some bis functions or w/e.

Para =
{
 private ["_pos","_chute","_location","_locationSize","_dir","_dest","_transport","_transportGrp","_wp","_grp"];
 if (!isServer) exitWith {};


 /* declare variables etc */


 _locMark = _this select 0;
 _location = gerMarkerPos _locMark; 
_locationSizearray = (getMarkerSize _locMark);
 _locationSize = _locationSizearray select 0;
 _dir = random 359;
 _pos = [_location, 2500, _dir] call bis_fnc_relPos;

 _dest = [_location,2500, (_dir - 180)] call bis_fnc_relPos;


 _transport = [_pos,(_dir - 180),"O_Heli_Light_02_unarmed_F",EAST] call BIS_fnc_spawnVehicle;
 //player setPos _pos;
 _transportGrp = (_transport select 2);
 {_x setBehaviour "CARELESS"; _x flyinHeight 60;} forEach units _transportGrp;
 _wp = _transportGrp addWaypoint [_location,(_locationSize - (_locationSize / 10)),0];
 _wp = _transportGrp addWaypoint [_dest,0,1];
 _wp setWaypointSpeed "FULL";




 _grp = [_pos, EAST, (configfile >> "CfgGroups" >> "EAST" >> "OPF_F" >> "Infantry" >> "OIA_InfSquad"),[],[],[0.25,0.4]] call bis_fnc_spawnGroup;
 {_x MoveInCargo (_transport select 0); _x assignasCargo (_transport select 0)} forEach units _grp;
 waitUntil {sleep 1;(getPos (_transport select 0)) distance _location < (_locationSize + (_locationSize / 10))};

 /* Initial Drop */

 {
  unAssignVehicle _x; 
  _x allowDamage false; 
  moveOut _x; 
  sleep 0.35; 
  _chute = createVehicle ["NonSteerable_Parachute_F", (getPos _x), [], 0, "NONE"];
  _chute setPos (getPos _x);
  _x moveinDriver _chute;
  _x allowDamage true;
  sleep 0.5;
 } forEach units _grp;

 /* Assign a task */

 //[_grp, _location, _locationSize] call CBA_fnc_taskAttack;
  null = [leader _grp, _locMark, "spawned", "showmarker", "full"] execVM "scripts\UPSMON.sqf";
  /* Initiate CleanUp */
  _i = 0;
  waitUntil {sleep 1;_i = _i + 1; ((getpos (_transport select 0)) distance _location > 1750) || _i >= 70;};

 {deleteVehicle _x} foreach units _transportGrp;
 deleteGroup _transportGrp;
 deleteVehicle (_transport select 0);

 /* Return handle */
 /* _____________ */

  _grp

};

just call it like:

["marker"] spawn para;

or via ExecVM.

Share this post


Link to post
Share on other sites

Thanks for the replies!

So, I've tried Pac Man's script in multiplayer, just replacing the move order that follows the player for a marker -- which is probably not enough. It did work flawlessly when I tested it on my own, while creating a local server, but it ended up dropping everyone's framerate to below 10 when actually playing it. I then went and created a mission with nothing but the paradrop, and now the helicopter would just spawn and explode (again, in multiplayer only).

I'm not really all that experienced in Arma scripting, I can't seem to understand why it behaves THAT differently in multiplayer.

I'll give mantls' a shot later and see if I can't learn how to adapt stuff for multiplayer. Again, thanks for sharing so much information.

Share this post


Link to post
Share on other sites
but it ended up dropping everyone's framerate to below 10 when actually playing it.

That's weird. There's nothing in pac's script that would kill fps that badly. It's fairly straight forward. Ofcourse you will need to run it on the server in the MP environment so that it doesn't spawn a group, helo & parachute for every player. That would cause lag.

Share this post


Link to post
Share on other sites

I'm trying to figure out how to use PacMan's script, but I'm having problems. The helicopter is named helo1 and a squad is grouped as para? I need a marker somewhere named b1. What is the best way to execute the script?

Share this post


Link to post
Share on other sites
That's weird. There's nothing in pac's script that would kill fps that badly. It's fairly straight forward. Ofcourse you will need to run it on the server in the MP environment so that it doesn't spawn a group, helo & parachute for every player. That would cause lag.

That's more than likely the problem yeah. I see too many scripts like this not run in (isServer) and it leads to some hilarious situations but they're not very good for the server/clients computers.

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  

×