OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Jiggy E on 03 Feb 2004, 14:10:40

Title: getdammage logic
Post by: Jiggy E on 03 Feb 2004, 14:10:40
Okay. Here's the deal.. I'm making a script to call reinforcements, seen a hundred, tried a hundred, none of them do quite what I want.

First, does 100% damage to a unit mean it's dead? I used a trigger: condition: getdammage unit <= 1
activation: unit2 domove getpos unit1

well, when you do a headshot, that is 100% damage, but you have to shoot the corpse to get unit2 to move. so, basically damage == 1 !true?

Second trigger (for a loaded bmp)
condition: getdammage unit2 <=.01
activation: group1 leavevehicle unit2

I noticed when it's in the middle of executing the first trigger, it will not stop to execute the second. Now when it completes the first, it will then disembark troops.. How do I get it to stop where it is, unload infantry, and move on to it's objective?
Title: Re:getdammage logic
Post by: Wildebeest on 03 Feb 2004, 14:57:47
I don't know about that transport business but regarding what you wrote: condition: getdammage unit <= 1
I just wonder why you don't use not alive unit instead? Maybe I'm getting you wrong there or you haven't heard of the command?

Hope I could be of any help tho I'm a n00b.
Title: Re:getdammage logic
Post by: Jiggy E on 03 Feb 2004, 15:48:29
Hey that worked like a charm. No, I didn't know about it, thanks :). Felt like a total retard, but hey, it's all a learning process..
Title: Re:getdammage logic
Post by: gundernak on 03 Feb 2004, 20:12:50
 getDammage unitname <= 1 as a condition does not equal with 'alive' or 'not alive'.

It has simply no meaning as a condition, because it is always true.

'= 1' means the unit is 'not alive'
'< 1' means the unit is 'alive'
but '<= 1' means unit is 'alive or not alive'

therefore it is not a condition...

'condition: getdammage unit2 <=.01' means the unit is almost at full health.

When the mission starts this will be instantly 'true', if you have not modified his health at the mission start....
Title: Re:getdammage logic
Post by: Jiggy E on 04 Feb 2004, 02:37:26
Right, I understand that. But if unit2 meets the required .01 or less health, what is keeping it from stopping immediately and disembarking the troops? It is in the middle of an already activated trigger, which is this:
condition: not alive unit3
activation: unit2 domove getpos unit3
causing unit2 to move to the dead body of unit3. How do I get it to stop where it is at when it takes a single bullet to meet the required .01 health?
It will disembark the troops..eventually, when it meets the requirements of trigger 1.
Title: Re:getdammage logic
Post by: macguba on 04 Feb 2004, 10:52:17
Debugging triggers can be tricky.    To simplify matters  you need to separate condition and activation to see where the problem lies.

condition:  true
activation:   whatever you're testing

condition:  whatever you're testing
activation:  hint "trigger firing"

Dammage 0.01 is too small a number for what you are doing.   OFP can sometimes have a bit of trouble with small numbers and boundary conditions and it's not impossible that it's just being its usual flighty self here.    

Also, a unit can collect that tiny amount of damage just by bumping into something.  If you are trying to detect a bullet hit then 0.2 should do fine.    You can easily make a wee test mission to discover what the right number is.
Title: Re:getdammage logic
Post by: gundernak on 04 Feb 2004, 12:20:32
As I wrote :'condition: getdammage unit2 <=.01' means the unit is almost at full health.

just to clear:

getDammage == 1 : the unit is dead
getDammage == 0 : the unit is unharmed ( total health)
getDammage > 0 : the unit has some injury (have not defined how much) or he maybe dead
getDammage < 1 : the unit is alive (maybe he is unharmed, maybe he needs a scratch to die)
getDammage <= 0.5 : the unit's health  maybe in halfway, maybe less then halfway, maybe unharmed!!!
 
therefore if a unit is unharmed and you got a condition 'getDammage <= 0.5', this condition is true

you can specify you condition this way:
'getDammage <= 0.5 and getDammage > 0'

this means the unit has injury and the injury is below or equal 0.5.
Off course you can change 0.5 to another value.


Title: Re:getdammage logic
Post by: Jiggy E on 04 Feb 2004, 17:37:47
Oh! okay okay, now it's clear. First off I was getting my < and > confused (just in the message, it was right in the script :) ), but I got it now. Thanks for your help everyone.