One way you could do this is by creating a behavior buff, in the behavor modfictions sections under the bahvior flag you would have invunerable set to enabled, so basicly this behavior will make the unit invunerable, then set its flags field to hidden and finnaly what makes it really work is under behavior vaildators disable put in a vaidlatior that checks a units hieght field so say like in your example you want less then or equal to 0, setup a vaildatior with a hight check for the unit being greater then 0 and place it in the bahvior under the vaildators disable field.
What happens is whenever that vaidlatior returns false it disables the behavior completely, thus making the unit vunerable again.
I've done something simlar for catching a unit before it dies to help simulate a death instead of that unit dying, so it does work. As to what vaildator to use my best guess would be to create a new vaildator of the type Unit Compare Field since as far as I can see there is no direct vaildaitor to check the units height. Change the Vaildator field entry to the same field entry id for the unit height (i'm assuming it will have to the raw id so to get that simply goto a unit and click the view raw data button and look for the unit id height in this case i've done it for you and the raw id is CUnit_Height (yes case senstive! so make it eact)) then in Vaildator - Value field but the height you want to compare, in this case 0 and change the Vaildator Compare to Greater Then and you should have a vaidlator that compare the unit height to see if its greater then 0.
Just add that to the behavior disable as I said and anytime that vaildator returns false the behavior gets disabled. Whats great about this is if the unit comes below 0 as you want then hes vunerbale but if he goes above 0 again hes now invunerable and back and forth. Please note I havn't tested this exact idea but from everything i've done and messed with this should work. I hope it does and I hope i helps!
One way you could do this is by creating a behavior buff, in the behavor modfictions sections under the bahvior flag you would have invunerable set to enabled, so basicly this behavior will make the unit invunerable, then set its flags field to hidden and finnaly what makes it really work is under behavior vaildators disable put in a vaidlatior that checks a units hieght field so say like in your example you want less then or equal to 0, setup a vaildatior with a hight check for the unit being greater then 0 and place it in the bahvior under the vaildators disable field.
What happens is whenever that vaidlatior returns false it disables the behavior completely, thus making the unit vunerable again. I've done something simlar for catching a unit before it dies to help simulate a death instead of that unit dying, so it does work. As to what vaildator to use my best guess would be to create a new vaildator of the type Unit Compare Field since as far as I can see there is no direct vaildaitor to check the units height. Change the Vaildator field entry to the same field entry id for the unit height (i'm assuming it will have to the raw id so to get that simply goto a unit and click the view raw data button and look for the unit id height in this case i've done it for you and the raw id is CUnit_Height (yes case senstive! so make it eact)) then in Vaildator - Value field but the height you want to compare, in this case 0 and change the Vaildator Compare to Greater Then and you should have a vaidlator that compare the unit height to see if its greater then 0.
Just add that to the behavior disable as I said and anytime that vaildator returns false the behavior gets disabled. Whats great about this is if the unit comes below 0 as you want then hes vunerbale but if he goes above 0 again hes now invunerable and back and forth. Please note I havn't tested this exact idea but from everything i've done and messed with this should work. I hope it does and I hope i helps!
Works wonders.
However, I found it to be a little complex, so I decided to simplify it quite a bit. To make things less complicated, I applied the behavior to the units beforehand, and it has a duration. Since it takes 0.9 seconds for it to drop to the ground, I decided that the behavior would last 0.9 seconds.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
How can I force a unit to be invincible when its height is greater than 1?
I want it so that when its height is <= 0, it loses its invincibility.
@Nothing5: Go
One way you could do this is by creating a behavior buff, in the behavor modfictions sections under the bahvior flag you would have invunerable set to enabled, so basicly this behavior will make the unit invunerable, then set its flags field to hidden and finnaly what makes it really work is under behavior vaildators disable put in a vaidlatior that checks a units hieght field so say like in your example you want less then or equal to 0, setup a vaildatior with a hight check for the unit being greater then 0 and place it in the bahvior under the vaildators disable field.
What happens is whenever that vaidlatior returns false it disables the behavior completely, thus making the unit vunerable again. I've done something simlar for catching a unit before it dies to help simulate a death instead of that unit dying, so it does work. As to what vaildator to use my best guess would be to create a new vaildator of the type Unit Compare Field since as far as I can see there is no direct vaildaitor to check the units height. Change the Vaildator field entry to the same field entry id for the unit height (i'm assuming it will have to the raw id so to get that simply goto a unit and click the view raw data button and look for the unit id height in this case i've done it for you and the raw id is CUnit_Height (yes case senstive! so make it eact)) then in Vaildator - Value field but the height you want to compare, in this case 0 and change the Vaildator Compare to Greater Then and you should have a vaidlator that compare the unit height to see if its greater then 0.
Just add that to the behavior disable as I said and anytime that vaildator returns false the behavior gets disabled. Whats great about this is if the unit comes below 0 as you want then hes vunerbale but if he goes above 0 again hes now invunerable and back and forth. Please note I havn't tested this exact idea but from everything i've done and messed with this should work. I hope it does and I hope i helps!
Works wonders. However, I found it to be a little complex, so I decided to simplify it quite a bit. To make things less complicated, I applied the behavior to the units beforehand, and it has a duration. Since it takes 0.9 seconds for it to drop to the ground, I decided that the behavior would last 0.9 seconds.