• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Buildings Still Dying

Status
Not open for further replies.
Level 4
Joined
Mar 20, 2014
Messages
67
Hey Guys,
In my game you're supposed to destroy each others buildings but I can't for some reason figure out why the buildings are dying. They should be dying, but they still do. Any help? Here's what I'm using to determine if it's a building. It also fires on Unit Attacked so it should happen before the damage is dealt.
JASS:
if ( GetWidgetLife(u) <= 20) and (IsUnitType(u, UNIT_TYPE_STRUCTURE)) then
            call SetUnitAnimation( u, "death" )
            call UnitAddAbility(u, 'Aloc')

Thoughts?
 

Kazeon

Hosted Project: EC
Level 34
Joined
Oct 12, 2011
Messages
3,449
Huh? How should subtracting the damage dealt prevent the building from dying? He needs to HEAL the building by the amount of damage dealt to keep it from dying.

I meant = if (GetWidgetLife(u) - damageAmount <= 0)
because I guess damage event occurs right before the damage is dealt, so if Current health - damageAmount is less than 0, that indicates that the damageTarget will die soon, so just heal the target by damageAmount then play the death animation and give it locust so people think it's actually death, but the fact the building is still alive..
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
I have a feeling that this is exactly what I wrote my last submission for....

The difference is that my system doesn't actually make units untargetable. It is a possible future feature though.

Also, keep in mind that a unit dies when its health drops below 0.405, not 0. So some of the solutions posted here will occasionally bug.
 
Status
Not open for further replies.
Top