Jump to content
Sign in to follow this  
Scorpious

onplayerrespawn

Recommended Posts

ok so i made a mission where i need to elevate one spawn point and the other has to be 0 is there a way to have two elevations for a respawn

respawn_west =base needs to be 16

respawn_west1 = fob needs to be 0

right now just using onplayerrespawn.sqf

is thee a way to make the respawn marker call for another script

Share this post


Link to post
Share on other sites

Not sure what you mean by "elevate" in this context.

We can't help you based on guesswork you know. So tell us the whole story.

Share this post


Link to post
Share on other sites

I assuming you mean height?

I'm also assuming you are using markers because of spawns.

Just send the command as an array [0,0,0] (x,y,z)

z being the height factor which you want set at 16.

Share this post


Link to post
Share on other sites

what I would do is in init.sqf

respawn_west setpos [getpos respawn_west select 0, getpos respawn_west select 1, 16];

EDIT

respawn_west setMarkerPos [getMarkerPos respawn_west select 0, getMarkerPos respawn_west select 1, 16];

Edited by Lala14

Share this post


Link to post
Share on other sites

I doubt that would do anything. Markers are positioned in 2d.

If this is indeed what he is looking for, then use a respawn eventhandler and teleport the player to the desired height when he spawns.

Assuming that both markers are in the same place, at different heights, you could use something like this:

_pos = position player;
_pos0 = getMarkerPos "respawn_west";
_pos1 = getMarkerPos "respawn_west1";

if ( (_pos distanceSqr _pos1) < (_pos distanceSqr _pos0) ) then {
_diff = [(_pos select 0) - (_pos1 select 0), (_pos select 1) - (_pos1 select 1)];
_newpos = [(_pos0 select 0) - (_diff select 0), (_pos0 select 1) - (_diff select 1), 16];
player setPos _newpos;
}

for that to work, respawn_west1 has to be moved to a slightly different position as it will only be used to detect which position the player spawned at.

Share this post


Link to post
Share on other sites

well I can confirm that setMarkerPos is 3D, I used this method for respawning units on the LHD in ArmA 2 and Ported over map in ArmA 3 Utes.

Share this post


Link to post
Share on other sites

Oh interesting, you're right. I completely missed that comment on the wiki:

The marker position can actually be set in 3D. This has a benefit for respawn markers, when placed at the correct altitude ASL on the LHD, the correct altitude will be used for respawn. There is no particular benefit for regular markers since markerPos will still return 0 for the altitude array element. Dr Eyeball 02:03, 7 August 2009 (CEST)

Share this post


Link to post
Share on other sites

ok so heres the deal i just made a utes arma 3 map to spawn on the carrier it has to be a height of 15

but i also made a trigger for a spawn point on the island which if spawned at 15 you fall and die so that needs to be 0

and since markers are only 2d the onplayerrespawn is the only way i know of to set height

i tried both peices of code and it will only spawn me on the carrier

my two spawn markers are respawn_west and respawn_west1

this is my onplayerrespawn for the carrier respawn

private ["_unit", "_axisx", "_axisy"];

_unit = _this select 0;

_axisx = getPos _unit select 0;

_axisy = getPos _unit select 1;

_axisx = getmarkerPos "respawn_west" select 0;

_axisy = getmarkerPos "respawn_west" select 1;

_unit setPos [_axisx, _axisy, 15];

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  

×