Home   Help Search Login Register  

Author Topic: God mode  (Read 1203 times)

0 Members and 1 Guest are viewing this topic.

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
God mode
« 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
« Last Edit: 22 Jun 2007, 03:26:28 by Mr.Peanut »
Campaigns are hard, I'll stick with scripting for now!

Offline Cheetah

  • Former Staff
  • ****
Re: godemode
« Reply #1 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.
Like missions? Help with Beta Testing! or take a look at the OFPEC Missions Depot for reviewed missions!

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
Re: godemode
« Reply #2 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
Campaigns are hard, I'll stick with scripting for now!

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: godemode
« Reply #3 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.
« Last Edit: 22 Jun 2007, 03:29:41 by Mr.Peanut »
urp!