Jump to content
Sign in to follow this  
Nephris1

Respawn / Removebody

Recommended Posts

Hi folks,

an actually old topic since OFP but i dont get it managed without errors in my RPT.

I initialized my respawn in init.sqf

if ( isNil{player getVariable "respawned"} ) then 
{
player addEventHandler ["killed", 
{ 
	[] spawn {
		waitUntil { alive player }; // waitUntil player has respawned 
		hideBody _this;
		[player] execvm "insertion.sqf";			
           sleep 10;
           deleteVehicle _this;
	};	
}];

player setVariable ["respawned", true];


};


my insertion.sqf

_unit = _this select 0;


_unit setpos [(getpos _unit select 0)+(random 1000)-1000,(getpos _unit select 1)+(random 1000)-1000,400];
sleep 0.05;

[_unit] exec "ca\air2\halo\data\Scripts\HALO.sqs";

//hint"insertion klar"


if ( isNil{player getVariable "respawned"} ) then 
{
player addEventHandler ["killed", 
{ 
	[] spawn {
		waitUntil { alive player }; // waitUntil player has respawned
		[player] execvm "insertion.sqf";
	};	
}];
player setVariable ["respawned", true];
};

For some reason the respawn doesent seem to get initialized.

Do u see the error...or know a more elegant solution (dedi)?

Edited by Nephris1

Share this post


Link to post
Share on other sites

Perhabs i didnt point my problem out clear.

Is it possible to add to a player 2 different eventhandlers killed?

So that i could use one EH killed for the respawn and another to delete the body after the respawn.

edit:

fixxed, thx.

Edited by Nephris1

Share this post


Link to post
Share on other sites

I thought that EH is unique (can be only in one example), and you can overwrite it only... but I haven't tested it yet...

---------- Post added at 17:42 ---------- Previous post was at 17:40 ----------

ou...

but, here http://community.bistudio.com/wiki/addEventHandler

is said:

if you add an event handler of type "killed" and there already exists one, the old one doesn't get overwritten
... so I'm wrong...sorry :)

---------- Post added at 17:44 ---------- Previous post was at 17:42 ----------

I think, then you will just add another actions to the EH and they will be executed when EH fires

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  

×