Jump to content
doomnet

Teammate Respawn Script and Base respawn not working together

Recommended Posts

Hi,

 

I have found a script with camera effect to select a player to respawn, it works great but when script is working all other respawn markers i have are ignored !

 

here is the script i tested is exactly what i need for my game mod:

_unit = _this select 0;
//-------------------Night Vision-----------------------------//
if (currentVisionMode player == 1) then
{
	camUseNVG true;
} else {
	camUseNVG false;
		
	};
////////////////////////////////////////////////////////////////
//------------------------------------------------------------//
if (_unit == player) then {
  waituntil {alive player};
  player setPos getPos Squad;

  _squad = group player;
  lck_livingmates = [];
  {
    if (alive _x and _x!=player) then {lck_livingmates = lck_livingmates + [_x];};
  } foreach units _squad;

  lck_actualmate = 0;
  _elozoactual=lck_actualmate;
  keyout = 0;
  //player globalchat format ["sq db=%1, act=%2", count lck_livingmates, name (lck_livingmates select lck_actualmate)];


  openMap false;
  0 fadesound 0;
  disableserialization;
  keyspressed = compile preprocessFile "lackoRespawn_keydown.sqf";
  _displayID = (findDisplay 46) displaySetEventHandler ["KeyDown","_this call keyspressed"];

  _cam = "camera" camcreate [0,0,0];
  _cam cameraeffect ["internal", "back"] ;
  showCinemaBorder true;
  _cam camsettarget (lck_livingmates select lck_actualmate);
  _cam camsetrelpos [0,-5,2.5];
  _cam camcommit 0;

  _ido=0;
  while {_ido<=500} do {

    if (_ido mod 10 == 0) then {
      TitleText["\n \n \nRight Arrow = next squadmate\nLeft Arrow = previous squadmate\nEnter = respawn","PLAIN DOWN",10];
    };

    if (keyout > 0) exitwith {};

    _currentmate = lck_livingmates select lck_actualmate;
    _tempcnt=0;

    lck_livingmates = [];
    {
      if (alive _x and _x!=player) then {
        lck_livingmates = lck_livingmates + [_x];
        if (_x==_currentmate) then {lck_actualmate = _tempcnt;};
        _tempcnt = _tempcnt + 1;
      };
    } foreach units _squad;

    if (count lck_livingmates == 0) exitwith {};

    _cam camsettarget (lck_livingmates select lck_actualmate);
    _cam camsetrelpos [0,-5,2.5];
    _cam camcommit 0;    

    waituntil{camCommitted _cam};
    _ido = _ido + 0.02; 
    sleep 0.02;
  };

  (findDisplay 46) displayRemoveAllEventHandlers "KeyDown";

  _ido=0;
  while {_ido<=90} do {
    _cam camsettarget (lck_livingmates select lck_actualmate);
    _cam camsetrelpos [0,-5,2.5];
    _cam camcommit 0;    
TitleText["","PLAIN DOWN"];
    waituntil{camCommitted _cam};
    _ido = _ido + 1; 
    sleep 0.02;
  };

  _newpos = getPos Squad;

  if (keyout > 0) then {
    _newpos = getPos (lck_livingmates select lck_actualmate);
    //player globalchat format ["cel=%1, x=%2, y=%3", name (lck_livingmates select lck_actualmate),(_newpos select 0),(_newpos select 1)];

    if ((_newpos select 0)>50 and (_newpos select 1)>50) then {
     
    } else {
     
      _newpos = getPos Squad;
    };
  } else {

      _newpos = getPos Squad;
  };
//-----------------Vehicle Spawn-----------------------------//
IF (vehicle (lck_livingmates select lck_actualmate) != (lck_livingmates select lck_actualmate)) THEN 
	{
	if ((vehicle (lck_livingmates select lck_actualmate)) emptyPositions "cargo"==0) 			
	then 
{
		null = [player] execVM "JIPspawn.sqf";
			}else{
			player moveincargo vehicle (lck_livingmates select lck_actualmate);
			camdestroy _cam;player cameraEffect ["terminate","back"];0 fadesound 1;
												
	};

		} else {
//////////////////////////////////////////////////////////////////
//------------------Set Unit Stance-----------------------------//
_return = stance (lck_livingmates select lck_actualmate);

if (_return == "stand") then {_return = "amovpknlmstpsraswrfldnon";};
sleep 0.02;
if (_return == "crouch") then {_return = "amovpknlmstpsraswrfldnon";};
sleep 0.02;
if (_return == "prone") then {_return = "AmovPpneMstpSrasWrflDnon";};

player switchMove _return;
//////////////////////////////////////////////////////////////////
	camdestroy _cam;
	player cameraEffect ["terminate","back"];
  	0 fadesound 1;

//------------------Show spawning screen-----------------------------//
titleText [format ["Spawning on %1", lck_livingmates select lck_actualmate], "BLACK FADED"];sleep 2;
titleText [format ["Spawning on %1", lck_livingmates select lck_actualmate], "BLACK in",2];
///////////////////////////////////////////////////////////////////////
		player setPos _newpos;

	};//if vehicle
};

and this for the key to select your teammate

_key = _this select 1;

//player globalchat format ["key=%1", _key];


//right arrow
if (_key == 205) then { 
  lck_actualmate = lck_actualmate + 1; 
  if (lck_actualmate >= count lck_livingmates) then {
    lck_actualmate = 0;
  };
}; 
//left arrow
if (_key == 203) then { 
  lck_actualmate = lck_actualmate - 1; 
  if (lck_actualmate < 0) then {
    lck_actualmate = (count lck_livingmates)-1;
  };
}; 

if (_key == 76) then {
  TitleText["Right Arrow = next squadmate\nLeft Arrow = previous squadmate\nEnter = respawn","PLAIN DOWN"];
};


//Enter key
if (_key == 28) then { keyout = _key };

and this to call the respawn script

[] spawn {sleep 0.5;null = [player] execVM "JIPspawn.sqf";};
xhandle = player addEventHandler ["killed", "_this execvm 'JIPspawn.sqf'"];

this respawn script works good, but i cannot select base respawn, all my other respawn is ignored, so if there is no players then you respawn in the sea !

how to ad base respawn markers within this script?

Share this post


Link to post
Share on other sites

I want to use space bar to respawn on markers like this

 

//space bar
if (_key == 57) then {
  getMarkerPos "respawn_west";
};

 

I tested a lot of things with this script but i cannot make it working

Share this post


Link to post
Share on other sites

So how to ad spacebar key to respawn on side marker within this teammate respawn script ?

Share this post


Link to post
Share on other sites

hi,

 

Is there someone willing to help me please with this respawn script ?

before this topic transform itself in a deadone !

 

thanks

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

×