Originally Posted by NeoArmageddon
Place a script called onplayerkilled.sqs in your mission directory. It will execute if the player dies.
Write
Code:
waituntil {alive player};
in the script. If the player dies, the script will wait until he respawn. After that you can simply make a setpos to another location or do anything else with the repawned player.
Thats wrong! I forgot, that onplayerkilled.sqs just works if the player dies permanently. I just ave the problem on an own map. But there is another solution.
Write in you init.sqf:
Code:
_handlerid = player addEventHandler ["killed", {_this execVM "playerkilled.sqf"}];
This will work, like my mentioned above. Here is my "playerkilled"-script for comparision/copying:
Code:
waituntil {(alive player)};
if (side player==East) then {
player setpos getpos Jail;
} else {
_spawns=MBG_locsReal-[Logic_6];
_sp = _spawns select floor(random(count(_spawns)));
player setpos getpos _sp;
};