Jump to content
Sign in to follow this  
kibaBG

[Solved] HALO Jump from a plane help needed

Recommended Posts

I am trying to script realistic halo jump from a plane's ramp. I have this but it gives me syntax error (missing ; 😞 
 

flg addAction ["Teleport",{ 
openMap true; 
onMapSingleClick " 
openMap false;
_grp = createGroup [east, true];
_an = grp createUnit ["pook_AN12B_OPFOR",_pos,[],0,"NONE"];
[_an,2000,_pos] call BIS_fnc_setHeight;
_grp setBehaviourStrong "CARELESS";
_an flyInHeightASL [2000, 2000, 2000];
player moveInCargo [_an,1,true];
onMapSingleClick '';"; 
}];

Any help is appreciated. 

Share this post


Link to post
Share on other sites

I tried workaround when halo plane already exist. Its working but I don't know how to move the plane back to starting position (I want players to use it again) :
 

flg addAction ["Teleport",{ 
openMap true; 
onMapSingleClick " 
openMap false;
[an, 2000,_pos] call BIS_fnc_setHeight;
an flyInHeightASL [2000, 2000, 2000];
an engineOn true;
an setVelocity [300,0,0];
player moveInCargo [an,1,true];
//code above is working, code below is not
private _future = time + 20;
waitUntil { time >= _future };
an setVelocity [0,0,0];
an setPosATL [8008.87,10103.9,0];
an engineOn false;
onMapSingleClick '';"; 
}];

Problems are two - first it says it doesn't allow suspension and second I want the plane to be "teleported" back to starting position, I don't want to rely on waypoints to land because pilot AI will do wild things in the base. Any ideas, guys?    

Share this post


Link to post
Share on other sites

You are trying to suspend code (waitUntil) in an unscheduled environment, or whatever the onMapSingleClick environment is considered to be. Read more here:

 

https://community.bistudio.com/wiki/Scheduler

 

Solution: don't run everything inside the onMapSingleClick:

 

flg addAction ["Teleport",{ 

openMap true;
onMapSingleClick "
[an, 2000,_pos] call BIS_fnc_setHeight;
onMapSingleClick '';";
openMap false;

an flyInHeightASL [2000, 2000, 2000];
an engineOn true;
an setVelocity [300,0,0];
player moveInCargo [an,1,true];

private _future = time + 20;
waitUntil { time >= _future };

an setVelocity [0,0,0];
an setPosATL [8008.87,10103.9,0];
an engineOn false;

}];

 

  • Like 2

Share this post


Link to post
Share on other sites

Thank you for pointing this out. Works like a charm but I had unexpected difficulties with AI pilots. They don't want to stay on their starting position after the first halo jump. I tried setFuel and enableSimulationGlobal but they do more harm than good ... 
Then I got the "genius" idea to dump the pilots and manipulate the plane as empty object. 
 

an12b addAction ["Fly To Position",{     
openMap true;     
onMapSingleClick "     
openMap false;     
[an12b, 2000,_pos] call BIS_fnc_setHeight;    
an12b setDir 360;     
onEachFrame {an12b setVelocity [0, 20, 0];};       
onMapSingleClick '';";     
}];

This moves the plane immediately on halo jump position and is seems to "fly" good enough. The player can take a parachute and jump. The engines of the plane are constantly working because of this in initServer : 
 

while {true} do {
an12b engineOn true;
sleep 1;
};

During the long halo jump the player can use radio trigger to move the plane back to starting position and it stays there. 
 

onEachFrame {
an12b setVelocity [0, 0, 0];};
an12b setPosATL [8008.89,10104.2,0]; 
[an12b,[0,0,0]] call BIS_fnc_setObjectRotation;

 The only problem I have is with landing gear. Because there is no pilot I am trying to use "Actions" from here https://community.bistudio.com/wiki/Arma_3:_Actions. 

an12b action ["LandGearUp",an12b];

Works perfectly in a trigger after the plane leaves the starting position and  moves to the halo position with gear up. So I tried to make it land with gear down : 
 

an12b action ["LandGear",an12b];
onEachFrame {
an12b setVelocity [0, 0, 0];};
an12b setPosATL [8008.89,10104.2,0]; 
[an12b,[0,0,0]] call BIS_fnc_setObjectRotation;

But is does not work at all, plane is landing on its belly, no landing gear deployed. 😞 I have no idea why something so simple isn't working. Maybe it has no time to deploy them? 

Thanks for all your help @Harzach. I got is so far because of your tips, cheers.   
       

Share this post


Link to post
Share on other sites

So I understand the final hurdle is getting the landing gear to deploy without a pilot. 

Could you perhaps manually force the landing gear out using animate ?

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  

×