Jump to content
snakeplissken

How to assign a parachute to AI every 100m of altitude?

Recommended Posts

Hello, I'd like some help if possible.

What am I looking for and trying to add a parachute on each Ai unit when each unit is 100m off the ground.

 

The purpose of is to make the AI not open the parachute to the 300m from which the game has programmed for this, since I am doing a mission of which a group will jump from the plane and they (AI) should only open the parquedas when they are to 100m of height .

The problem is that the AI when it is already with the parachute, it automatically opens when it reaches 300m, which is programmed by the game.

 

I know I could solve this by creating triggers for each drive, and this triggers use the command below which would recognize that altitude and so the triggers would execute the command to add the parachute to it.

 

In trigger in COND

getPos NAMEUNIT select 2 < 110;

In trigger in ACT

NAMEUNIT addBackpack "B_Parachute";

 

 

But the problem is that when the character is already on the ground (before boarding the plane), the trigger already recognizes and already adds the parachute.

 

So to avoid this, decide to give a parachute for each unit when each of them reaches 100m from the ground.
I created a SQF file with the Waypoint that the aircraft should do and inside the script has all the commands where it removes the parachute after the jump (it prevents him from opening at 300m), and then places the parachute again 100m off the ground.


*"corvo" is name of group
**"pombo" is name of airplane

*** "red" is the pilot group name

if (!isServer) exitWith {};

/// waypoint of airplane

_waypoint0 = red addwaypoint[(getmarkerpos "Mk1"),0]; 											
_waypoint0 setwaypointtype "Move";
_waypoint0 setWaypointStatements ["true", "pombo flyInHeight 300; hint 'rising to 300m';"];

_waypoint1 = red addwaypoint[(getmarkerpos "Mk2"),0];
_waypoint1 setwaypointtype "Move";
_waypoint1 setWaypointStatements ["true", "pombo flyInHeight 500; hint 'rising to 500m'"];

_waypoint2 = red addwaypoint[(getmarkerpos "Mk3"),0];
_waypoint2 setwaypointtype "move"; 
_waypoint2 setWaypointStatements ["true", "pombo flyInHeight 700; hint 'rising to 700m'"];

_waypoint3 = red addwaypoint[(getmarkerpos "Mk4"),0];
_waypoint3 setwaypointtype "move"; 
_waypoint3 setWaypointStatements ["true", "pombo flyInHeight 1000; hint 'rising to 1000m'; pombo limitSpeed 150; {_x addBackpack 'B_Parachute'} foreach units corvo;"];

_waypoint4 = red addwaypoint[(getmarkerpos "Mk5"),0];
_waypoint4 setwaypointtype "move"; 
_waypoint4 setWaypointStatements ["true", "pombo flyInHeight 1000; hint 'Jump!'; {_x action ['EJECT', pombo]} foreach units corvo; pombo land 'land'"];


[red, 1] setWaypointBehaviour "CARELESS";
[red, 1] setWaypointCombatMode "BLUE";

/// Command from which to remove the parachute from BotAI as they leave the plane, and puts it back when one of them reaches a certain height

waitUntil {{!(_x in pombo)} foreach units corvo;};

{removeBackpack _x} foreach units corvo; /// Remove the parachute from the whole group
player addBackpackGlobal "B_Parachute";  /// Only places the parachute on the player

waitUntil {{getPos _x select 2 <= 120} foreach switchableUnits;};  /// Recognizes when one of the group BotAI arrives at the marked altitude

{_x addBackpack "B_Parachute"} foreach units corvo;  /// Put a parachute to everyone in the group

What I'm sure is that I am lost in these lines here, the first one recognizes as soon as the first AI reaches the altitude, and the second line adds the parachute to everyone in the group, I not the one that reached the altitude, where those still far above it the altitude, will receive the parachute as well.

 

waitUntil {{getPos _x select 2 <= 110} foreach switchableUnits;};  

{_x addBackpack 'B_Parachute'} foreach units corvo;  

What will solve this problem is some command line from which it recognizes one unit (AI) at a time when it reaches the marked altitude, and the parachute will be placed only in that unit (AI)

 

*Human players will keep the parachute with him as soon as he jumps out of the plane, because he will already know the right time to open the parachute.

 

**I found command that generates a parachute already open in the character (createVehicle ['Steerable_Parachute_F', position Player, [], 0, 'Fly'];), but I prefer to use a parachute even though it has all the animation to open it, and also if the player does not pay attention, it can smash to the ground.

*** The mission is Coop but it can also be SP, so I think it's best to insert a parachute backpack into the player and AI character.

 

Share this post


Link to post
Share on other sites

Some hints:

 

Place any group (corvo) on ground, I'll teleport them, players or not.

Space them. Make enough room between them to avoid collision! (not treated here)

 

In group icon write:

 

{_x setpos (getpos _x vectorAdd [0,0,1000]) } forEach units this;
 {
  _x spawn {   
    params ["_trooper"];
    if (local _trooper) then {
      waituntil {sleep 0.5; isNull objectParent _trooper && getPosAtl _trooper select 2 > 30 && (getPosAtl _trooper select 2 < 150 or isPlayer _trooper)};
      _trooper setVariable ["initBpk",unitBackpack _trooper];
      _trooper addBackpackGlobal "B_Parachute";
      if (isPlayer _trooper) then {
        waitUntil {getPosAtl _trooper select 2 < 150};
        _trooper action ["openparachute",_trooper]
      };
      waitUntil {isTouchingGround _trooper};
      uisleep 1;
      _trooper action ["AddBag",objectParent (_trooper getVariable "initBpk"),typeOf (_trooper getVariable "initBpk")];
    }
  };   
} forEach units this;

 

You see how it works? I dispatch parachute for players at once but at defined altitude for AI (if not, they open it too early)
I place a safety altitude for players.
I switch any backpack with parachute.

 

https://www.youtube.com/watch?v=2G5rfPISIwo

 

  • Like 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

×