OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: UH60MG on 06 Mar 2008, 20:12:43

Title: Respawning in single player
Post by: UH60MG on 06 Mar 2008, 20:12:43
Is it possible to allow respawning once the players character is dead as in multiplayer?
Title: Re: Respawning in single player
Post by: Mandoble on 06 Mar 2008, 20:25:08
You might do something similar with killed event handler. Add this to the init field of the player:
Code: [Select]
this addEventHandler ["killed", {(_this select 0) setDamage 0; (_this select 0) setPos getMarkerPos "mk_respawn"]}]
Title: Re: Respawning in single player
Post by: Wolfrug on 07 Mar 2008, 01:13:09
Mandoble's code won't work -> in ArmA, it's entirely impossible to revive a dead entity in SP, AI or Player.

However, you CAN "Respawn" a player simply by using selectPlayer/adding a new unit to the switchableUnits array (and allow the player to pick their teamswitch in the death-menu).

something like:

Code: [Select]
this addeventhandler ["killed", {addSwitchableUnit RespawnDude; selectPlayer RespawnDude}]

You could of course just keep creating new units named "RespawnDude" as well to make sure the "killed" eventhandler always has someone to respawn into. Or use some script. :) All is possible!

Good luck!

Wolfrug out.