Jump to content
Sign in to follow this  
SinBad1956

AI Parachute Script Creates Double The Chutes.

Recommended Posts

The problem is (as usual) it works in SP/Local but not in MP. There are 8 AI in the group, the helo brings them in and they eject via trigger. In MP, there are twice as many parachutes created, i.e., 16. The 8 AI move into 8 chutes leaving 8 empty. How do I create only the number of chutes required for the group? Other than that, it works fine except a TON of lag when the chutes open. I've looked at a number of parachute scripts, but couldn't noodle it through.

Here is the code I'm using:

_chute = "NonSteerable_Parachute_F";

{
  unassignVehicle (_x);
  (_x) action ["EJECT", vehicle _x];

} foreach units ec1group;	


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

} foreach units ec1group;	

Ideas?

//SinBad

Share this post


Link to post
Share on other sites

Heyo,

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


 /* declare variables etc */

 _location = _this select 0;
 _locMark = _this select 1;
 _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

};


That's my Paradrop function. Keep in mind that it uses UPSMON (though you can just replace that).

you can call it like this:

[POSITION, Marker] spawn para;

it returns the group paratroopers.

Feel free to just modify it. You could just replace the marker in the parameter with a number if you want to use waypoint or whatever instead.

Share this post


Link to post
Share on other sites

Thanks mantls for the reply, but I couldn't follow the entire code. I picked out the "Initial Drop" and replaced mine. Same thing in MP, double the chutes, half of which was empty. Not sure why it creates two chutes for every createvehicle function.

//SinBad

Share this post


Link to post
Share on other sites

Ok.. so since it appears no one has an explanation or fix for this, is this happening for anyone else who has AI parachute in or is it just me? I even modified the script to do 'one at a time' and it still is happening in MP.

Seriously getting sick of the disconnect between MP and SP/local editing results.

//SinBad

Share this post


Link to post
Share on other sites

Never spawn something from a trigger without limiting it to sever only. Triggers run on all clients.

Share this post


Link to post
Share on other sites

Seriously getting sick of the disconnect between MP and SP/local editing results.

Know EXACTLY how you feel. Have a few 'head-shaped' dents in my wall from this.

Always dread having to test over my network to see what the next list of problems

are going to be. Zioks!

Never spawn something from a trigger without limiting it to sever only. Triggers run on all clients.

What would you recommend? Or how would you design the Map around this? I believe we can

just Group the triggers to a specific Unit correct? If needed I was using multiple Triggers then

Grouping to each of them to be assigned to each of us individually for a work-around.

Share this post


Link to post
Share on other sites

Rarely group triggers to objects. The best is to have the trigger call a function that spawns things and limit the spawning by either wrapping all the code in a:

if (isServer) then {
// spawn here
};

or dumping clients out at the beginning of the function:

if (!isServer) exitWith {};

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  

×