• 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.

Way to check damage?

Status
Not open for further replies.
Level 25
Joined
May 11, 2007
Messages
4,650
I want to use a units' damage in a spell, but the only way I know to check how much the damage of the unit is, is to do UNIT takes damage, and as this is a spell, I really can't have predefined units in the trigger, is there any other way to check the damage of an unit without having to make it attack an unit?
 
I want to use a units' damage in a spell, but the only way I know to check how much the damage of the unit is, is to do UNIT takes damage, and as this is a spell, I really can't have predefined units in the trigger, is there any other way to check the damage of an unit without having to make it attack an unit?

maybe use the formula for the damage... example if a unit's base damage is 10 then in the gameplay constants you set that every point of primary attribut you gain 1 damage then you can set the triggered damage to (10 + X(Include Bonuses)) X = Primary Attribute Of Hero.......
 
Level 2
Joined
Oct 3, 2009
Messages
20
I want to use a units' damage in a spell, but the only way I know to check how much the damage of the unit is, is to do UNIT takes damage, and as this is a spell, I really can't have predefined units in the trigger, is there any other way to check the damage of an unit without having to make it attack an unit?

  • unit spawns
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Trigger - Add to check 4 dmg <gen> the event (Unit - (Triggering unit) takes Damage)

  • check 4 dmg
    • Events
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (String((Damage taken)))
 
Level 25
Joined
May 11, 2007
Messages
4,650
  • unit spawns
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Trigger - Add to check 4 dmg <gen> the event (Unit - (Triggering unit) takes Damage)

  • check 4 dmg
    • Events
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (String((Damage taken)))

Yeah, forgot bout that one, thx +rep!
But doesn't that create leaks?..
 
Level 2
Joined
Oct 3, 2009
Messages
20
Thanks for Rep :)

Dont know about leaking though - wasn't able to find a function that would unregister the event :/
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
Just download a damage detection engine. (almost same as kukeiko suggested, but with more efficiency and much more sophisticated)
When you start the spell, you make the unit do damange on a dummy (0 armor i suppose), and check with the damage detection engine how much it was. Then you have it and use it in the spell! (Make sure to disable any possible critical hit stuff etc.)

Dont know about leaking though - wasn't able to find a function that would unregister the event :/
Unregistering events is impossible, that is why it is called REGISTER and not ADD.
 
Status
Not open for further replies.
Top