• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece!🔗 Click here to enter!

Way to check damage?

Status
Not open for further replies.
Level 25
Joined
May 11, 2007
Messages
4,651
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,651
  • 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