Home   Help Search Login Register  

Author Topic: Respawning in single player  (Read 1172 times)

0 Members and 1 Guest are viewing this topic.

Offline UH60MG

  • Members
  • *
Respawning in single player
« on: 06 Mar 2008, 20:12:43 »
Is it possible to allow respawning once the players character is dead as in multiplayer?
« Last Edit: 09 Mar 2008, 06:18:55 by UH60MG »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Respawning in single player
« Reply #1 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"]}]

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: Respawning in single player
« Reply #2 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.
"When 900 years YOU reach, look as good you will not!"