OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started 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
???
-
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.
-
thanks mac ... will try asap ...
;)
-
to monitor every unit, use a hit eventhandler which then runs a check script
far more cpu efficient
something like
INIT.SQS
_UnitArray = [W1,W2,W3,W4 etc etc etc]
{_x addEventHandler ["Hit", {_this exec "Unit_Hit.sqs"}]}foreach _unitArray
UNIT_HIT.SQS
_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
-
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
-
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.
-
thanks guys ..
everything i needed to know
;)
shark attack