Jump to content
bangabob

Insurgency style respawn

Recommended Posts

I've searched all over the web and i have found this script that gives a menu where to spawn and each spawn point is defined by the name of an object. For example 'flag1' is a spawn point.

doogetloc = {
private "_loc";
_loc = nearestlocations [_this, ["NameCityCapital", "NameCity", "NameVillage", "NameLocal", "Hill", "Namemarine"], 1500];
if (count _loc != 0) then {
	if (text (_loc select 0) != "") then {
		text (_loc select 0)
	} else {
		mapgridposition _this
	};
} else {
	mapgridposition _this
};
};

doorespawnarray = [flag1, flag2];
titletext ["", "black faded"];



if not isserver exitwith {};

I have tried naming players as flag1 and it works until they are killed and respawn. So my question is ' how can i get an object named 'flag1' to follow a defined player even after death?'

There are ofcourse other scripts that are needed with the mission to make this work. Just ask if you want to see them all

Edited by BangaBob
  • Like 1

Share this post


Link to post
Share on other sites

i've been looking for something similar and would like to see the rest.

Share this post


Link to post
Share on other sites

its quite easy to rip the insurgency revie script out ill get it tomoz and upload it if thats what you really whant

---------- Post added at 20:54 ---------- Previous post was at 20:47 ----------

but as far as following a player even after death use

this p.s this is a marker that follows a unit named sgt

//call it from your init.sqf using    execVM "whateveryoucallit.sqf":
_setmkr = 1;

   while {true} do
   {	
       _marker = createMarker ["respawn",getPosATL sgt];
	_marker setMarkerType "milDot";
	_marker setMarkerColor "ColorRed";
	_marker setMarkerAlpha 0;

    while {alive sgt} do 
	{
                 _marker setMarkerPos getPosATL sgt;
                                sleep 0.5;
                                };
deleteMarker _marker;
               execVM "theMARKERscriptAGAIN.sqf":
     };

   };

Share this post


Link to post
Share on other sites
its quite easy to rip the insurgency revie script out ill get it tomoz and upload it if thats what you really whant

Everybody said this, but no one could do it. If you will do (and not just say), you will be the first one.

Share this post


Link to post
Share on other sites

I tried something and it almost works.

The idea is to set up respawn countdown to 300 seconds and then I create a camera at the back of my living squadmates. I can change the selected squadmates with left/right key and when I selected the right soldier, just press Enter button and then I setMarkerPos the respawn_west marker to getPos selected soldier and then set the respawn countdown to 5. So the player will respawn after 5 seconds.

The only problem is, the player will not respawn the new place of respawn_west marker, but the original, where it was when the player died. How can I change the respawn place AFTER the player died?

Share this post


Link to post
Share on other sites

please share what you have sofar. i'm working on something like this too but my thread got zero replies.

to answer your question. the default respawn types you can set in the description.ext don't have that feature. what you want to do is either use setmarkerpos to move the respawn_west marker to a new position. the respawn setting you need for that is called "BASE". or just let people respawn somewhere outside the map use disablesimulation or something and then use setpos to move them to their new position.

anyways. please share your findings so we can have a useful discussion.

Share this post


Link to post
Share on other sites

CAUTION! Don't use this scripts, these are not complete! It's just for sharing knowledge.

Ok. So I use BASE respawn. I have a respawn_west marker and a GameLogic named glbase (for emergency situation when every member of squad is dead) place somewhere safe. The player's squad name is pgrp. And all players' init has this line:

xhandle = this addEventHandler ["killed", "_this execvm 'lackoRespawn.sqf'"]

The main script file is lackoRespawn.sqf:

_unit = _this select 0;
private ['_magazines','_weapons','_backpack','_backpackweap','_backpackmags'];

_weapons = weapons _unit;
_magazines = magazines _unit;

_backpack = typeOf unitBackpack _unit;
_backpackmags = getMagazineCargo unitBackpack _unit;
_backpackweap = getWeaponCargo unitBackpack _unit;


if (_unit == player) then {

 setPlayerRespawnTime 300;

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

 actualmate = 0;
 _elozoactual=actualmate;
 keyout = 0;
 player globalchat format ["sq db=%1, act=%2", count lck_livingmates, name (lck_livingmates select 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 false;
 _cam camsettarget (lck_livingmates select actualmate);
 _cam camsetrelpos [0,-7,3];
 _cam camcommit 0;

 TitleText["Right Arrow = next squadmate\nLeft Arrow = previous squadmate\nEnter = respawn","PLAIN DOWN"];

 while {true} do {
   if (keyout > 0) exitwith {};

   if (! alive (lck_livingmates select actualmate)) then {
     _dead = lck_livingmates select actualmate;
     lck_livingmates = lck_livingmates - [_dead];
     if (count lck_livingmates == 0) exitwith {};

     actualmate = actualmate + 1; 
     if (actualmate >= count lck_livingmates) then {
       actualmate = 0;
     };
   };
   if (count lck_livingmates == 0) exitwith {};
   if (actualmate != _elozoactual) then {
     _elozoactual=actualmate;
     player globalchat format ["sq db=%1, act=%2", count lck_livingmates, name (lck_livingmates select actualmate)];
   };

   _cam camsettarget (lck_livingmates select actualmate);
   _cam camsetrelpos [0,-7,3];
   _cam camcommit 0;    

   waituntil{camCommitted _cam};
   sleep 0.02;
 };

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

   if ((_newpos select 0)>50 and (_newpos select 1)>50) then {
     "respawn_west" setMarkerPos _newpos;
   } else {
     player globalchat "baserespawn";
     "respawn_west" setMarkerPos getPos glbase;
   };
 } else {
     player globalchat "baserespawn";
     "respawn_west" setMarkerPos getPos glbase;
 };

 player cameraEffect ["terminate","back"];
 camdestroy _cam;
 (findDisplay 46) displayRemoveAllEventHandlers "KeyDown";
 0 fadesound 1;  

 setPlayerRespawnTime 5;





 waituntil {alive player};

 _unit = player;
 removeallweapons _unit;
 removeAllItems _unit;
 removeBackpack _unit;

 {_unit addmagazine _x} foreach _magazines;
 {_unit addweapon _x} foreach _weapons;
 _primw = primaryWeapon _unit;
 if (_primw != "") then {
     _unit selectWeapon _primw;
     // Fix for weapons with grenade launcher
     _muzzles = getArray(configFile>>"cfgWeapons" >> _primw >> "muzzles");
     _unit selectWeapon (_muzzles select 0);
 };
 if(_backpack != "") then {
     _unit addBackpack _backpack; 
     clearWeaponCargo (unitBackpack _unit); 
     clearMagazineCargo (unitBackpack _unit);

     for "_i" from 0 to (count (_backpackmags select 0) - 1) do {
(unitBackpack _unit) addMagazineCargo [(_backpackmags select 0) select _i,(_backpackmags select 1) select _i];
     };
     for "_i" from 0 to (count (_backpackweap select 0) - 1) do {
(unitBackpack _unit) addWeaponCargo [(_backpackweap select 0) select _i,(_backpackweap select 1) select _i];
     };
 };


};

And there is an other for detect key pressing, lackoRespawn_keydown.sqf:

_key = _this select 1;

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

//right arrow
if (_key == 205) then { 
 actualmate = actualmate + 1; 
 if (actualmate >= count lck_livingmates) then {
   actualmate = 0;
 };
 player globalchat format ["right arrow actmate=%1", actualmate];  
}; 
//left arrow
if (_key == 203) then { 
 actualmate = actualmate - 1; 
 if (actualmate < 0) then {
   actualmate = (count lck_livingmates)-1;
 };
 player globalchat format ["left arrow actmate=%1", actualmate];  
}; 

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 }; 

The globalChat are for debug.

And of course I know there is a lot of trouble not handle in this script, because it's a draft only. And if it will work in the very basic situation, I will polish the details. Eg: now it's don't handle if any of your squad mate respawned (alive).

Share this post


Link to post
Share on other sites

OK. I guess I solved (not tested yet, I'm in the office), but I cant wait to test.

The main script changed:

_unit = _this select 0;
private ['_magazines','_weapons','_backpack','_backpackweap','_backpackmags'];

_weapons = weapons _unit;
_magazines = magazines _unit;

_backpack = typeOf unitBackpack _unit;
_backpackmags = getMagazineCargo unitBackpack _unit;
_backpackweap = getWeaponCargo unitBackpack _unit;


if (_unit == player) then {

 setPlayerRespawnTime 300;

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

 actualmate = 0;
 _elozoactual=actualmate;
 keyout = 0;
 player globalchat format ["sq db=%1, act=%2", count lck_livingmates, name (lck_livingmates select 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 false;
 _cam camsettarget (lck_livingmates select actualmate);
 _cam camsetrelpos [0,-7,3];
 _cam camcommit 0;


 while {true} do {
   TitleText["Right Arrow = next squadmate\nLeft Arrow = previous squadmate\nEnter = respawn","PLAIN DOWN"];

   if (keyout > 0) exitwith {};

   if (! alive (lck_livingmates select actualmate)) then {
     _dead = lck_livingmates select actualmate;
     lck_livingmates = lck_livingmates - [_dead];
     if (count lck_livingmates == 0) exitwith {};

     actualmate = actualmate + 1; 
     if (actualmate >= count lck_livingmates) then {
       actualmate = 0;
     };
   };
   if (count lck_livingmates == 0) exitwith {};
   if (actualmate != _elozoactual) then {
     _elozoactual=actualmate;
     player globalchat format ["sq db=%1, act=%2", count lck_livingmates, name (lck_livingmates select actualmate)];
   };

   _cam camsettarget (lck_livingmates select actualmate);
   _cam camsetrelpos [0,-7,3];
   _cam camcommit 0;    

   waituntil{camCommitted _cam};
   sleep 0.02;
 };

 TitleText[" ","PLAIN DOWN"];

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

   if ((_newpos select 0)>50 and (_newpos select 1)>50) then {
     //"respawn_west" setMarkerPos _newpos;
   } else {
     player globalchat "base respawn";
  _newpos = getPos glbase;
     //"respawn_west" setMarkerPos getPos glbase;
   };
 } else {
     player globalchat "baserespawn";
  _newpos = getPos glbase;
     //"respawn_west" setMarkerPos getPos glbase;
 };

 player cameraEffect ["terminate","back"];
 camdestroy _cam;
 (findDisplay 46) displayRemoveAllEventHandlers "KeyDown";
 0 fadesound 1;  

 setPlayerRespawnTime 5;





 waituntil {alive player};

 player setPos _newpos;

 _unit = player;
 removeallweapons _unit;
 removeAllItems _unit;
 removeBackpack _unit;

 {_unit addmagazine _x} foreach _magazines;
 {_unit addweapon _x} foreach _weapons;
 _primw = primaryWeapon _unit;
 if (_primw != "") then {
     _unit selectWeapon _primw;
     // Fix for weapons with grenade launcher
     _muzzles = getArray(configFile>>"cfgWeapons" >> _primw >> "muzzles");
     _unit selectWeapon (_muzzles select 0);
 };
 if(_backpack != "") then {
     _unit addBackpack _backpack; 
     clearWeaponCargo (unitBackpack _unit); 
     clearMagazineCargo (unitBackpack _unit);

     for "_i" from 0 to (count (_backpackmags select 0) - 1) do {
(unitBackpack _unit) addMagazineCargo [(_backpackmags select 0) select _i,(_backpackmags select 1) select _i];
     };
     for "_i" from 0 to (count (_backpackweap select 0) - 1) do {
(unitBackpack _unit) addWeaponCargo [(_backpackweap select 0) select _i,(_backpackweap select 1) select _i];
     };
 };


};

Not the respawn_west marker move to the respawn position (leave it in a safe respawn place), but AFTER the respawn, just teleport the player to the selected spot. I hope it will work and if true, I will develop the details.

Share this post


Link to post
Share on other sites

Okey. I tested it. And it works fine. We played all night with a mission equipped this respawn script. Of course it can be developed with extra features (like respawn to a vehicle). But now it's do what I wanted to do.

You need two file. The small one (lackoRespawn_keydown.sqf):

_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 }; 

The main script (lackoRespawn.sqf):

_unit = _this select 0;
private ['_magazines','_weapons','_backpack','_backpackweap','_backpackmags'];

_weapons = weapons _unit;
_magazines = magazines _unit;

_backpack = typeOf unitBackpack _unit;
_backpackmags = getMagazineCargo unitBackpack _unit;
_backpackweap = getWeaponCargo unitBackpack _unit;


if (_unit == player) then {

 setPlayerRespawnTime 500;

 _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;

 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 false;
 _cam camsettarget (lck_livingmates select lck_actualmate);
 _cam camsetrelpos [0,-5,2.5];
 _cam camcommit 0;

 TitleText["Right Arrow = next squadmate\nLeft Arrow = previous squadmate\nEnter = respawn","PLAIN DOWN"];

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

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

   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;
 };

 TitleText[" ","PLAIN DOWN"];

 (findDisplay 46) displayRemoveAllEventHandlers "KeyDown";
 setPlayerRespawnTime 5;

 _ido=0;
 while {_ido<=5} do {
   _cam camsettarget (lck_livingmates select lck_actualmate);
   _cam camsetrelpos [0,-5,2.5];
   _cam camcommit 0;    

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


 _newpos = getPos glbase;

 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 {
     player globalchat "good respawn";
   } else {
     player globalchat "base respawn";
     _newpos = getPos glbase;
   };
 } else {
     player globalchat "baserespawn";
     _newpos = getPos glbase;
 };


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




 waituntil {alive player};


 player setPos _newpos;

 _unit = player;
 removeallweapons _unit;
 removeAllItems _unit;
 removeBackpack _unit;

 {_unit addmagazine _x} foreach _magazines;
 {_unit addweapon _x} foreach _weapons;
 _primw = primaryWeapon _unit;
 if (_primw != "") then {
     _unit selectWeapon _primw;
     // Fix for weapons with grenade launcher
     _muzzles = getArray(configFile>>"cfgWeapons" >> _primw >> "muzzles");
     _unit selectWeapon (_muzzles select 0);
 };
 if(_backpack != "") then {
     _unit addBackpack _backpack; 
     clearWeaponCargo (unitBackpack _unit); 
     clearMagazineCargo (unitBackpack _unit);

     for "_i" from 0 to (count (_backpackmags select 0) - 1) do {
(unitBackpack _unit) addMagazineCargo [(_backpackmags select 0) select _i,(_backpackmags select 1) select _i];
     };
     for "_i" from 0 to (count (_backpackweap select 0) - 1) do {
(unitBackpack _unit) addWeaponCargo [(_backpackweap select 0) select _i,(_backpackweap select 1) select _i];
     };
 };


};

You have to write in the playable unit's init field: xhandle = this addEventHandler ["killed", "_this execvm 'lackoRespawn.sqf'"]

Share this post


Link to post
Share on other sites

great! thanks for sharing. i'll test this myself and come back with feedback.

Share this post


Link to post
Share on other sites

Thanks.

My new feedback:

1. I have to set short delay (3sec) before camera created, to give time to the player realize: his died. Now a little bit confusing to get killed and immediately see a mate's back.

2. I have to add the safe base to the queue of selectable respawn point. So when you selecting in your squad mates, the last one should be the safe base.

Edited by bardosy

Share this post


Link to post
Share on other sites

you could use a respawn event handler instead of a killed event handler. this way it should use the respawn delay you set in the description.ext and then give you the menu once you are alive again.

Share this post


Link to post
Share on other sites

I used killed, because this script is not just respawn, but give my equipment back after respawn.

And not all equipment what I own when I save equipment like in Insurgency, but the equipment what I own in the moment of my death. Probably it's not everybody's cup of tea, but I like it in my missions.

Please feel free to modify this script in your way.

And unfortunately it's not good in my missions if I left the player in the "safe base" while he select where he want respawn(teleport). So I have to teleport him very quickly, because the "safe base" is not so safe.

Well, probably this script is not soo general as I wanted, but it's perfect for me (this is what I wanted, but could not do before) and I hope other scripter (like you) could use it as a base to create his own good respawn script.

Share this post


Link to post
Share on other sites

well you could still use the killed eventhandler alongside the respawn eventhandler. the base thing could be solved by putting the respawn_west marker outside the map and using an object for the safe base instead and handle it like the other soldiers.

just sharing my thoughts here. not requesting anything ;)

i'll look into it myself when i get home for sure. again. thx alot for sharing it!

Share this post


Link to post
Share on other sites

Uh... awesome?? Will test this out first chance I get, thanks!!

Share this post


Link to post
Share on other sites

Awesome . I can't wait to test this myself. I have been searching for an insurgency style respawn for so long and I can't believe this has not been donenbefore

Share this post


Link to post
Share on other sites

I was surprised too, no one else create it before. I was looking for it too many times, because i thought i cannot do this. And i was right, this is not exactly the same as in Insurgency, but similar. I hope you will enjoy. And you can modify it as you want.

Share this post


Link to post
Share on other sites

My new ideas to improve:

1. If the player used a night vision gear in the moment when he died, the camera use NVG effect too. It's help the players in night mission to select the respawn place, but don't interfere with mood of a invasion44 missions (because in inv44 player cannot use NVG when he die)....

2. If player select to respawn a squad mate who is in a vehicle, the script have to check are there any unoccupied place in the vehicle and if are, move the player into the vehicle.

Share this post


Link to post
Share on other sites

I wanted to adopt this script in a base ArmA2 (without Arrowhead) mission and didn't work because of some commands don't exists in base ArmA2. But don't worry, I rewrite it for ArmA2 too. It's implemented Bad Benson's ideas:

1. player has to wait the timeout what mission designer set in the description.ext

2. player respawn (but respawn place could be in dangerous zone, so) teleport immediately to a GameLogic located in a very safe place.

3. camera start and you can choose squadmate where to respawn

4. teleport player to the selected squadmate

This version don't manipulate the respawn timer. Personally I like the previous script better, but you can use it in Arrowhead too, if you prefer this.

Only the main script file is changed (lackoRespawn.sqf):


_unit = _this select 0;
private ['_magazines','_weapons'];

_weapons = weapons _unit;
_magazines = magazines _unit;



if (_unit == player) then {

 waituntil {alive player};

 player setPos getPos safebasegl;

 _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 false;
 _cam camsettarget (lck_livingmates select lck_actualmate);
 _cam camsetrelpos [0,-5,2.5];
 _cam camcommit 0;

 TitleText["Right Arrow = next squadmate\nLeft Arrow = previous squadmate\nEnter = respawn","PLAIN DOWN"];

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

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

   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;
 };

 TitleText[" ","PLAIN DOWN"];

 (findDisplay 46) displayRemoveAllEventHandlers "KeyDown";

 _ido=0;
 while {_ido<=5} do {
   _cam camsettarget (lck_livingmates select lck_actualmate);
   _cam camsetrelpos [0,-5,2.5];
   _cam camcommit 0;    

   waituntil{camCommitted _cam};
   _ido = _ido + 1; 
   sleep 1;
   TitleText[format["Wait for respawn: %1 sec",5-_ido],"PLAIN DOWN"];
 };

 TitleText[" ","PLAIN DOWN"];
 _newpos = getPos safebasegl;

 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 {
     player globalchat "good respawn";
   } else {
     player globalchat "base respawn";
     _newpos = getPos safebasegl;
   };
 } else {
     player globalchat "baserespawn";
     _newpos = getPos safebasegl;
 };


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







 player setPos _newpos;

 _unit = player;
 removeallweapons _unit;
 removeAllItems _unit;


 {_unit addmagazine _x} foreach _magazines;
 {_unit addweapon _x} foreach _weapons;
 _primw = primaryWeapon _unit;
 if (_primw != "") then {
     _unit selectWeapon _primw;
     // Fix for weapons with grenade launcher
     _muzzles = getArray(configFile>>"cfgWeapons" >> _primw >> "muzzles");
     _unit selectWeapon (_muzzles select 0);
 };
};

Oh and this version has no backpack respawn part. So if you want use this in an Arrowhead mission, you have to copy the backpack part back.

Share this post


Link to post
Share on other sites

Great work. When you have a finalized version would it be possible to make a template mission for me.

That would be very helpful

Share this post


Link to post
Share on other sites

This respawn script works.

However there is a Big problem with the script.

If your using the ACE mod then the ACE buttons dont work after respawning. Maybe this is a simple fix? I have no idea.

Share this post


Link to post
Share on other sites
is there a way to get this to work so you can spawn into Any AI Player even if they are not in your Group ?

Yes.

Find this block in the code:

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

And change the last line to what you want. E.g. if you have four friendly squad named: fsquad1, fsquad2... then you have to change the last line for this:

 } foreach (units fsquad1)+(units fsquad2)+(units fsquad3)+(units fsquad4);

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

×