OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Surdus Priest on 21 Jun 2007, 21:26:38

Title: God mode
Post by: Surdus Priest on 21 Jun 2007, 21:26:38
i need to know how to set a god mode on a player in a mission, ideally for the effect of explosions tossing the player about during game play, but instead of being dead, being badly injured.

thank you
Title: Re: godemode
Post by: Cheetah on 22 Jun 2007, 02:22:18
You could use the eventHandler "HIT" or "DAMAGED" trick:
detect if the player gets hit, when true, set health to 1.

In your case, after he survived the explosion, set his health to 0.1 or anywhere to make him look injured.
Title: Re: godemode
Post by: Surdus Priest on 22 Jun 2007, 03:02:26
well, its a bit arkward.  i know that going setdamage 0 give full health, but i cant figure out the getting hit or damaged part for the condition, and even if i did find it, the repeating trigger doesnt seem to be working on the condition: not alive unit activation: unit setdamage 0 for AI units or anything
Title: Re: godemode
Post by: Mr.Peanut on 22 Jun 2007, 03:25:55
Code: [Select]
this addEventHandler["killed",{(_this select 0) setDamage 0}];this addEventHandler["hit",{(_this select 0) setDamage 0}]
Add this to the init of an infantry unit and only a headshot or large explosion can kill it. If you want the unit to get injured then change the 0 of the setDamage to a higher number. To reset the unit back to normal use:
Code: [Select]
_unit removeAllEventHandlers "killed";_unit removeAllEventHandlers "hit"presuming that no other of these types of event handlers have been added.