Jump to content
Sign in to follow this  
eble

Player height after respawn

Recommended Posts

I'm creating a map with 5 respawn points, which is working fine, two of the respawn points are on top of buildings, this is where my problem is.

Prior to using the multi point dialog script I could get the AI and myself to spawn on roofs etc.

I wanted to know if anyone could look over the multi-respawn script and let me know where I need to insert the height/position for the character.

init script :

Quote[/b] ]RespawnLocation = "m_Start"; // marker name, init start location

player setPos getMarkerPos RespawnLocation;

//player addeventhandler ["Killed", {_this execVM "scripts\respawn_player.sqf"}]; // would rather use event handler

player execVM "scripts\respawn_player.sqf"; // infinite loop, controls respawning

I have this active in the init field of each player, with the player set as flying it basically drops them onto the roof.

this setpos[(getpos this select 0),(getpos this select 1), 12.80]

This is the respawn_player.sqf:

Quote[/b] ]// Desc: A respawn control script

for [{}, {true}, {true}] do

{

 //waitUntil { !(alive player) };

 while { alive player } do { sleep 1.0 };

 

 nul=[] execVM "Dialogs\Respawn_Dialog.sqf";

 // wait for respawn countdown to finish and for the selection to be made from the dialog

 // (Upon auto respawning after countdown, you will respawn at "RespawnWest" marker.)

 //waitUntil { alive player && !dialog };

 while { !alive player || dialog } do { sleep 1.0 };

 

 // player spawned at "RespawnWest" marker initially, so move him to final selected spawn location

 player setPos getMarkerPos RespawnLocation;

};

As the dialog box looks so good I would still like to keep it but more importantly I need my players to spawn at the highest point of 12.80 if they select that building.

I'm still quite new to this, so sorry if this is a very straight forward thing to sort out.

Cheers!

Share this post


Link to post
Share on other sites

getMarkerPos would return the x and y coordinates - not the z coordinate. You'd need to check if the selected respawn point is on top of a building, and set the height if so.

Do something like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

switch (selectedBase) do

{

  case loc1: {player setPos getMarkerPos RespawnLocation;};//if the selected base is loc1, then go along as normal

  case loc2: {player setPos [(getMarkerPos RespawnLocation) select 0, (getMarkerPos RespawnLocation) select 1, 12.80];};//if selected base is loc2, then change the height

  case etc: {};

};

Now, I don't know how the rest of your scripts look, but I assume the name of the base is stored in a variable (here selectedBase). I went with switch do instead of if because you said you had 5 different bases (then again, only two were on buildings, but nvm tounge2.gif).

Alternatively, you could use a gameLogic or invisible H instead of your RespawnLocation marker (assuming you set the height of that one somewhere in your scripts).

Share this post


Link to post
Share on other sites

Hey mate I would just like to say a big thanks, I came home tonight and re-did the script including:

player setPos [(getMarkerPos RespawnLocation) select 0, (getMarkerPos RespawnLocation) select 1, 12.80];

it basically drops the player from 12.80, which is the height of one of the spawn locations, the other roof is a little lower.

For players selecting a different location the drop a little but I willing to live with that to get the whole 'spawning' on a roof/rooftops thing.

Thanks again mate.

Look out for my map in the mapping section when complete.

Southy

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  

×