OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: BRAVO-TWO on 16 Dec 2005, 16:22:31

Title: units health
Post by: BRAVO-TWO on 16 Dec 2005, 16:22:31
Just one more thing...(In my best columbo voice)

here s  what im trying to do ....

Execute a script  should an enemys health level fall below maximum ( injured)
without reaching minimum (dead)... what could i put  in condition field of trigger to achieve this..?

                                                  shark attack

                                                         ???

 
Title: Re:units health
Post by: macguba on 16 Dec 2005, 16:35:39
Condition:   (getDammage loon1 > 0.2) and (getDammage loon1 < 0.8)

Syntax not guaranteed.

In OFP don't think about health:  think about damage.  (In some commands it is misspelled 'dammage'.)  If you think of it as health you'll get yourself the wrong way round.
Title: Re:units health
Post by: BRAVO-TWO on 16 Dec 2005, 16:46:58
thanks mac  ...  will try asap  ...
                     
                      ;)
Title: Re:units health
Post by: Terox on 16 Dec 2005, 16:53:18
to monitor every unit, use a hit eventhandler which then runs a check script

far more cpu efficient

something like

INIT.SQS
Quote
_UnitArray = [W1,W2,W3,W4 etc etc etc]
{_x addEventHandler ["Hit", {_this exec "Unit_Hit.sqs"}]}foreach _unitArray


UNIT_HIT.SQS
Quote
_unit = _this select 0
_unit removeallevcenthandlers "Hit"
_MinHealth = 0.3
#START

if (getdammage _unit > _MinHealth)then{hint "Do whatever"}
_delay = 1 + (random 1)
~ _delay
if !(alive _unit)then{exit}else{goto"START"}


this way you can monitor as many units as you want, and monitoring will only occur once the unit has been hit


_minhealth is the minimum danmage that you will allow the unit to sustain before your system does whatever you require to the unit
Title: Re:units health
Post by: THobson on 16 Dec 2005, 17:46:22
I don't think hit event handlers activate when a unit is damaged by an explosion, say with a handgrenade or a LAW for example.

You might want to look at a dammaged Event Handler
Title: Re:units health
Post by: RujiK on 16 Dec 2005, 18:35:12
Easiest way would be simply put a trigger and for in the trigger:

Condition:(alive dude)&&(getdammage dude != 0)
Activation:Hint"OH! I DONT FEEL SO GOOD!"

Similar to what max said although this will hint if ANY dammage is given and the unit is still alive.
Title: Re:units health
Post by: BRAVO-TWO on 17 Dec 2005, 18:46:53
thanks guys ..
everything i needed to know
                   ;)

           shark attack