HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Unreliable triggers

04-27-2006, 04:59 PM#1
Anitarf
Collapse JASS:
    local unit t = GetTriggerUnit()
    local real d = GetEventDamage()
    ...
    call BJDebugMsg("HV TARGET DAMAGED")
    if d >= GetUnitState(t, UNIT_STATE_LIFE) then
        call BJDebugMsg("HV LETHAL DAMAGE")
        ...
So, this normaly works, except this one time when the damaged unit died, but I didn't get the second debug message.

I remember reading someplace that units don't die when their hp goes below 0, but below 1, if it's true, then this is most likely the cause of my bug.


Unrelated to this, here's another wierd trigger:
Trigger:
no casting outside arena1
Collapse Events
Unit - A unit Is issued an order with no target
Collapse Conditions
(Issued order) Not equal to (Order(stop))
(Issued order) Not equal to (Order(hold))
(Main Arena <gen> contains (Ordered unit)) Equal to False
Collapse Actions
Unit - Order (Ordered unit) to Stop
I guess it's obvious what the trigger should do, but the problem is, it doesn't stop the units entirely. When ordered to cast a spell, the spell isn't cast and it's cooldown doesn't start, but the mana for the spell is used up anyway; in the case of a morphing spell based on RoboGoblin, the unit morphs even though the spell doesn't really start, since it still shows it's default icon and not it's turn off icon.

Speaking of Robo Goblin, I seem to remember (not sure about it, though) that there were problems with modifying it when it first came out, since you couldn't change the armour and hp bonus, well now it seems like you can.
04-27-2006, 05:06 PM#2
blu_da_noob
For the first one, a unit dies when its hp gets to 0.405 or lower. That is probably the problem.

For the second, pause the unit, issue the stop order, then unpause it again.
04-27-2006, 05:52 PM#3
Anitarf
0.405? Odd number.

Well, if I add it to the unit's life in that real comparison, the problem should be fixed, then.

Right, I completely forgot I was planning to test the pausing/unpausing anyway. Thanks for reminding me.
04-28-2006, 09:48 AM#4
Anitarf
Pausing/unpausing the unit didn't do the trick. Oh, and about the robo goblin, it was the other way around, the unit didn't morph, but the spell changed it's icon.
04-28-2006, 11:24 AM#5
vile
When a unit is damaged, if you add a condition that checks its life, it will always return that its alive, because when its damaged, it checks on the actual damage, and not after it. if you want to check you have to add a .01 timer that THEN checks its life.
04-28-2006, 11:32 AM#6
Blade.dk
I didn't know that, buf it it is true, then you do not need a timer, you can just use GetWidgetLife(unit)-GetEventDamage().
04-28-2006, 11:34 AM#7
blu_da_noob
Quote:
Originally Posted by vile
When a unit is damaged, if you add a condition that checks its life, it will always return that its alive, because when its damaged, it checks on the actual damage, and not after it. if you want to check you have to add a .01 timer that THEN checks its life.

He is checking if the damage is greater than its life remaining, which will accurately find if the unit is killed or not (once the 0.405 thing is taken into account).
04-28-2006, 12:16 PM#8
vile
That's weird, .405.. you tested that?
04-28-2006, 02:39 PM#9
blu_da_noob
Vex did originally (discover it). I tested it myself, and it is indeed correct.
04-28-2006, 09:39 PM#10
Anitarf
Thanks for your help. The first problem should now be solved, but the second one remains a mystery.
04-28-2006, 09:47 PM#11
blu_da_noob
For the second one, it appears you are trying to stop spells. There are no non-spell abilities with no target (that I can think of). You could try "A unit starts casting an ability" and do the pause/issue stop/unpause then.