Jump to content
Sign in to follow this  
Taxen0

help with a respawn script

Recommended Posts

I am working a a small deathmatch mission with helicopters, and I would like the players and their helicopters to respawn when there is only one person alive.

I think I know how to do most of the stuff, but how can I bring the dead back to life? regular respawn wont work since I want them to respawn at a specific time, not while still spectating the rest of the players.

Share this post


Link to post
Share on other sites

can anyone point me in the right direction? still haven't found anything in my searches =(

Share this post


Link to post
Share on other sites

I think I've seen something like this for A2 - wave respawn script or something but I cannot find it. Worked by holding the respawns until a timer expired (ie: every 5 minutes) and respawned any dead players all at once. Not exactly what you are looking for but if you can find it or someone else knows what I am talking about it might help

Share this post


Link to post
Share on other sites

something like that could probably work, would just have to replace the timer with another condition.

Share this post


Link to post
Share on other sites

thanks savage!

I looked around in different revive scripts but could not figure out how to do it =(

but with the approach from your link I got it kinda working.

//reset script
_westIterator = 0;
_eastIterator = 0;
{
_markername = "";
switch(true) do
{
	case(side _x == west):
	{
		_x sideRadio "i made it into the case"; //debug
	[b]	_markername = Format ["bluSpawn_%1", _westIterator];[/b]
		_westIterator = _westIterator + 1;
		break;
	};
	case(side _x == east):
	{
		[b]_markername = Format ["eastSpawn_%1", _eastIterator];[/b]
		_eastIterator = _eastIterator + 1;
		break;
	};
};
hint format ["marker: %1",_markername];
sleep 2; //DEBUG
_x setVariable ["dead", false, true];
_x setCaptive false;
_x allowDamage true;
[b]_veh = createVehicle ["B_AH9_F", getMarkerPos _markername, [], 0, "FLY"];[/b]
_veh setDir 45;
_x moveInDriver _veh;
_veh lock true;
} ForEach PlayableUnits;

I have this on raido alpha at the moment. and the first time I press it it works fine. but the 2nd time (after I have died and the script is run from the "killed" event handler) markername is empty, so I get spawned at the edge of the map.

//killed eventhandler
//init vars
_killed = _this select 0;
_killer = _this select 1;

//show kill message
hint format ["%1 has been shot down by %2",_killed,_killer];

//set as dead
_killed setVariable ["dead", true, true]; 

//start spectator script
//des not seem to be any spectator scripts available yet

//check if any side has won
_aliveWest = {side _x == west AND _x getVariable "dead"} count PlayableUnits;
_aliveEast = {side _x == east AND _x getVariable "dead"} count PlayableUnits;

hint format["alive west: %1 alive east: %2",_aliveWest,_aliveEast];

switch(true) do 
{
case(_aliveWest == 0): //all west are dead
{
	hint "East win!";
	sleep 10; //respawn is 5
	[b]nul = [] execVM "reset.sqf";[/b]
	break;
};
	case(_aliveEast == 0): //all east are dead
{
	hint "East win!";
	sleep 10; //respawn is 5
	[b]nul = [] execVM "reset.sqf";[/b]
	break;
};
};

do anyone see anything bad?

EDIT: I noticed that side apparently sets to "civ" after the 1st respawn. So I had to add a variable tracking the side of the units.

now I have another problem, but I'm gonna search some more before bothering you guys =)

Edited by Taxen0

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  

×