Jump to content
Sign in to follow this  
Newsparta

Spawning objects mid game

Recommended Posts

I am trying to make something that allows players to place a few fortifications around an area and have been using the players position to place the objects. However i have noticed that it does not place the objects in consistent locations, and i was wondering if anyone had some insight on why it does this or how i may be able to improve the system. I was thinking of how ACE places explosives but didnt know of any better way besides just referencing the players location and spawning on that spot.


private ["_player","_tower","_pos"];

hint "Placing Tower At Your Position In 15 Seconds";
_player = (_this select 1);

sleep 15;

_pos = [_player, 1, getDir _player] call BIS_fnc_relPos;
_tower = "Land_Cargo_Patrol_V4_F" createVehicle _pos;
_tower setDir ((getDir _player)- 180);

cTower = cTower + 1;

if (cTower == 2) then {
	[kit, (_this select 2)] remoteExec ["removeAction", 0, false];
};

Share this post


Link to post
Share on other sites

However i have noticed that it does not place the objects in consistent locations, and i was wondering if anyone had some insight on why it does this or how i may be able to improve the system.

Inconsistent positioning using createVehicle might relate to colliding terrain objects - see createVehicle array syntax

 

Nikander

Share this post


Link to post
Share on other sites

Instead of BIS_fnc_relPos, use

origin getPos [distance, heading];

It's faster.

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  

×