Jump to content
Sign in to follow this  
colonelmolerat

Making vehicle appear at Player Position + 100 altitude

Recommended Posts

I'm trying to set a trigger that, when activated, will call a car 200m above the player, to fall on them.

I can get a car to appear at the player's position, but not above them. I'm trying this script:

playerPos = getPos player; Car1 = "B_MRAP_01_F" createVehicle [(playerPos select 0),(playerPos select 1),(playerPos select 2 + 200)];

I've tried a few different variations, but had no luck. Even when I change (playerPos select 2 + 200) to simply (200), the car doesn't appear 200m up. Can anybody help?

Thanks.

Share this post


Link to post
Share on other sites

Tried first creating it somewhere and then setposing it?

Share this post


Link to post
Share on other sites

Use a separate "setPosATL" command on the newly created vehicle.

That is also more accurate as the createVehicle command will always look for a clearing to spawn the vehicle in, in order to avoid overlapping opjects.

Pos = getPosATL player;
Car1 = "B_MRAP_01_F" createVehicle Pos;
Car1 setPosATL [Pos select 0, Pos select 1, (Pos select 2) + 200];

Share this post


Link to post
Share on other sites

I use this script DropTank.sqf to create a tank ("B_MBT_01_cannon_F") in the air, and have it descend on parachute. I have it added to a Radio command but you can have it as a trigger.

// Drop Tank
// Add radio Command Resupply Tank
// Trigger set to 
// null = [this] execVM "DropTank.sqf";

private ["_para", "_veh","_unit"];
hint "Tank Deployed";

_unit = _this select 0;

_para = createVehicle ["B_Parachute_02_F", [0,0,100], [], 0, ""]; 
_para setPosATL (_unit modelToWorld[0,0,200]); 
_veh = createVehicle ["B_MBT_01_cannon_F", [0,0,80], [], 0, ""]; 
_veh attachTo [_para,[0,0,0]];
_veh allowdamage false;  

// 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, 0.6];  
deletevehicle _para;
_veh allowdamage true; 

The vehicle can hit the ground and remains undamaged.

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  

×