Jump to content
Play3r

[SOLVED] spawn helicopter, see if player is inside thru trigger

Recommended Posts

Hi all

i have this script i use to spawn a heli, and it land at my location like planed

But how do i make so that a trigger fires when i get inside the heli.

 

i  have tried with  COND: BOB in P3REndHeli.

also COND: BOB in EndHeli.

but no joy, anyone got some ideas.

 

Cheers Play3r

private _P3REndHeli = createVehicle ["B_Heli_Transport_03_F", getMarkerPos "HeliSpawn", [], 0, "FLY"];
createVehicleCrew _P3REndHeli;
_P3REndHeli setVehicleVarName "EndHeli";
systemChat str _P3REndHeli;
private _LandingPad = "Land_HelipadEmpty_F" createVehicle position player;
_waypointPickup = group driver _P3REndHeli addWaypoint [position _LandingPad,0];
_waypointPickup setWaypointType "SCRIPTED";
_waypointPickup setWaypointScript "A3\functions_f\waypoints\fn_wpLand.sqf";

Share this post


Link to post
Share on other sites
private _P3REndHeli = createVehicle ["B_Heli_Transport_03_F", getMarkerPos "HeliSpawn", [], 0, "FLY"];
createVehicleCrew _P3REndHeli;
_P3REndHeli setVehicleVarName "EndHeli";
EndHeli = _P3REndHeli;  //  <<-- you forgot this
systemChat str _P3REndHeli;
private _LandingPad = "Land_HelipadEmpty_F" createVehicle position player;
_waypointPickup = group driver _P3REndHeli addWaypoint [position _LandingPad,0];
_waypointPickup setWaypointType "SCRIPTED";
_waypointPickup setWaypointScript "A3\functions_f\waypoints\fn_wpLand.sqf";

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

 

Note that in MP, you will also need to publicVariable "EndHeli".

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

In MP, you need also to remoteExec setVehicleVarName

 

Anyway, giving name to helo is not mandatory. You can script like this (the taxi back is included):


 

private _startingPad = "Land_HelipadEmpty_F" createVehicle getMarkerPos "HeliSpawn";
private _P3REndHeli = createVehicle ["B_Heli_Transport_03_F", getMarkerPos "HeliSpawn", [], 0, "FLY"];
createVehicleCrew _P3REndHeli;
private _LandingPad = "Land_HelipadEmpty_F" createVehicle position player;
private _waypointPickup = group driver _P3REndHeli addWaypoint [position _LandingPad,0];
_waypointPickup setWaypointType "MOVE";
_waypointPickup setWaypointStatements [
  "true",
  "vehicle this land 'get in';
  this spawn {
    waitUntil {BOB in vehicle _this};
    private _wp = group _this addWaypoint [getMarkerPos 'helispawn',0];
    _wp setWaypointStatements ['true','vehicle this land ""land""']
  }"
];

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
9 hours ago, Harzach said:

private _P3REndHeli = createVehicle ["B_Heli_Transport_03_F", getMarkerPos "HeliSpawn", [], 0, "FLY"];
createVehicleCrew _P3REndHeli;
_P3REndHeli setVehicleVarName "EndHeli";
EndHeli = _P3REndHeli;  //  <<-- you forgot this
systemChat str _P3REndHeli;
private _LandingPad = "Land_HelipadEmpty_F" createVehicle position player;
_waypointPickup = group driver _P3REndHeli addWaypoint [position _LandingPad,0];
_waypointPickup setWaypointType "SCRIPTED";
_waypointPickup setWaypointScript "A3\functions_f\waypoints\fn_wpLand.sqf";

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

 

Note that in MP, you will also need to publicVariable "EndHeli".

Hi @Harzach 
I did look at the Wiki page but did not find anything about the <EndHeli = _P3REndHeli; // <<-- you forgot this>

i was in on the page before i posted here.

 

4 hours ago, pierremgi said:

In MP, you need also to remoteExec setVehicleVarName

 

Anyway, giving name to helo is not mandatory. You can script like this (the taxi back is included):


 


private _startingPad = "Land_HelipadEmpty_F" createVehicle getMarkerPos "HeliSpawn";
private _P3REndHeli = createVehicle ["B_Heli_Transport_03_F", getMarkerPos "HeliSpawn", [], 0, "FLY"];
createVehicleCrew _P3REndHeli;
private _LandingPad = "Land_HelipadEmpty_F" createVehicle position player;
private _waypointPickup = group driver _P3REndHeli addWaypoint [position _LandingPad,0];
_waypointPickup setWaypointType "MOVE";
_waypointPickup setWaypointStatements [
  "true",
  "vehicle this land 'get in';
  this spawn {
    waitUntil {BOB in vehicle _this};
    private _wp = group _this addWaypoint [getMarkerPos 'helispawn',0];
    _wp setWaypointStatements ['true','vehicle this land ""land""']
  }"
];

 

Hi @pierremgi 

This here is great it actually answers my next question how to add a new Wp to the heli.

 

I thank you two for your help..

 

Share this post


Link to post
Share on other sites
50 minutes ago, Play3r said:

did not find anything

 

Read example 1.

  • Thanks 1

Share this post


Link to post
Share on other sites
4 minutes ago, Harzach said:

 

Read example 1.

Damm did not see that at all yesterday when i was trying to make it work.
Thanks for the guidens.. 👍

 

Cheers

Share this post


Link to post
Share on other sites
On 4/2/2022 at 6:27 AM, pierremgi said:

In MP, you need also to remoteExec setVehicleVarName

 

Anyway, giving name to helo is not mandatory. You can script like this (the taxi back is included):


 


private _startingPad = "Land_HelipadEmpty_F" createVehicle getMarkerPos "HeliSpawn";
private _P3REndHeli = createVehicle ["B_Heli_Transport_03_F", getMarkerPos "HeliSpawn", [], 0, "FLY"];
createVehicleCrew _P3REndHeli;
private _LandingPad = "Land_HelipadEmpty_F" createVehicle position player;
private _waypointPickup = group driver _P3REndHeli addWaypoint [position _LandingPad,0];
_waypointPickup setWaypointType "MOVE";
_waypointPickup setWaypointStatements [
  "true",
  "vehicle this land 'get in';
  this spawn {
    waitUntil {BOB in vehicle _this};
    private _wp = group _this addWaypoint [getMarkerPos 'helispawn',0];
    _wp setWaypointStatements ['true','vehicle this land ""land""']
  }"
];

 

Hi Pierremgi

 

i have used your script for a mission that i plan to release to friends, but i have a problem with the Heli that spawns in:
If i stand inside a house it tries to land on the roof, since it is made to spawn when a unit is dead, so if i shoot him tru a window from inside a house it lands on the roof.

Are there anyway to make it land on the ground, i have tried with 6 Helipath(invisible) around the town where the unit are, that has to be killed, but no joy.

so are there anyway to make a kind of check to see if there is a "free space" to land on.

i have searched a bit on the A3 wiki but did not find anything..

 

regards Play3r  

Share this post


Link to post
Share on other sites
On 6/25/2022 at 10:13 PM, Harzach said:


Hi Harzach

i have been trying to find the way to use the BIS_fnc_findSafePos command but i can't seem to figure out where to put the command.
i have tried to make a variable in my Init.sqf like 
private _ExfillLoc = [player, 1, 150, 3, 0, 20, 0] call BIS_fnc_findSafePos;

and then make the script look like this:


private _startingPad = "Land_HelipadEmpty_F" createVehicle getMarkerPos "HeliSpawn"; 
private _P3REndHeli = createVehicle ["CUP_B_UH60M_US", getMarkerPos "HeliSpawn", [], 0, "FLY"]; 
createVehicleCrew _P3REndHeli; 
private _LandingPad = "Land_HelipadEmpty_F" createVehicle getpos _ExfillLoc;                         <------- like this but no joy ,also like this  : [position _ExfillLoc] also with ( ...)
private _waypointPickup = group driver _P3REndHeli addWaypoint [position _LandingPad,0]; 
_waypointPickup setWaypointType "MOVE"; 
_waypointPickup setWaypointStatements [ 
  "true", 
  "vehicle this land 'get in'; 
  this spawn { 
    waitUntil {BOB in vehicle _this}; 
    private _wp = group _this addWaypoint [getMarkerPos 'helispawn',0]; 
    _wp setWaypointStatements ['true','vehicle this land ""land""'] 
  }" 
];

 

Any chance you have some wise guidens so i can get it to work..

Share this post


Link to post
Share on other sites
2 minutes ago, Play3r said:

i have tried to make a variable in my Init.sqf like 
private _ExfillLoc

 

You are creating a local variable. And even if you made it global/public, it creates one position that is always used, no matter where you need the heli to land. AND, it does this every time a new player joins.

 

Create it dynamically as you need it:

 

private _startingPad = "Land_HelipadEmpty_F" createVehicle getMarkerPos "HeliSpawn";
private _P3REndHeli = createVehicle ["B_Heli_Transport_03_F", getMarkerPos "HeliSpawn", [], 0, "FLY"];
createVehicleCrew _P3REndHeli;

private _pos = [player, 1, 100, 10, 0, 15, 0] call BIS_fnc_findSafePos;
private _LandingPad = "Land_HelipadEmpty_F" createVehicle _pos;
private _waypointPickup = group driver _P3REndHeli addWaypoint [position _LandingPad,0];
_waypointPickup setWaypointType "MOVE";
_waypointPickup setWaypointStatements [
  "true",
  "vehicle this land 'get in';
  this spawn {
    waitUntil {BOB in vehicle _this};
    private _wp = group _this addWaypoint [getMarkerPos 'helispawn',0];
    _wp setWaypointStatements ['true','vehicle this land ""land""']
  }"
];

 

But there is still a problem if this is indeed a multiplayer mission. Depending on how you call this script, "player" can be null, one player, or all players. It is not advised to use this command in MP scripting.

 

So, is this a MP scenario? If so, how are you calling the script?

 

 

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
32 minutes ago, Harzach said:

 

But there is still a problem if this is indeed a multiplayer mission. Depending on how you call this script, "player" can be null, one player, or all players. It is not advised to use this command in MP scripting.

 

So, is this a MP scenario? If so, how are you calling the script?

 

 

 

 

Hi it is a SP scenario. 
i call it tru a trigger when a COND is True..

 

But thanks for the help @Harzach

 

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

×