• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Inputting Damage done as a value

Status
Not open for further replies.
Level 5
Joined
Apr 8, 2007
Messages
116
Well, first background: what I'm basically trying to do is create a trigger that causes a ground unit, when attacked, to lose 10% of damage done from his mana. And no, feedback is not viable because there is no editable portion that removes mana according to how much damage is dealt, you can only edit how much bonus life is lost and the maximum mana that can be drained, both of which don't really work for my trigger.

So I need to input 'damage done' as a value in my trigger to get it to work properly; and yet again, event - unit takes damage doesn't work either as that only is only available for a specific unit trigger, whereas mine needs to be a generic unit trigger (as it effects all ground units including all those that would be made in the future).

Anyhoo, I've got:

Event - unit attacked
Action:
-Set LifeofUnit(a "Real" variable, and I'm assuming that real also covers unit properties, since an integer variable is unable to be input in my trigger- perhaps I'm using the wrong variable?) = Life of Attacked unit

-Unit set mana of (attacked unit) to ((mana of (attacked unit )) - (((LifeofUnit - Life of (Attacked Unit)) / 10.00))

..so..any helpful ideas?
 
Level 4
Joined
Dec 16, 2007
Messages
134
Well, first background: what I'm basically trying to do is create a trigger that causes a ground unit, when attacked, to lose 10% of damage done from his mana. And no, feedback is not viable because there is no editable portion that removes mana according to how much damage is dealt, you can only edit how much bonus life is lost and the maximum mana that can be drained, both of which don't really work for my trigger.

So I need to input 'damage done' as a value in my trigger to get it to work properly; and yet again, event - unit takes damage doesn't work either as that only is only available for a specific unit trigger, whereas mine needs to be a generic unit trigger (as it effects all ground units including all those that would be made in the future).

Anyhoo, I've got:

Event - unit attacked
Action:
-Set LifeofUnit(a "Real" variable, and I'm assuming that real also covers unit properties, since an integer variable is unable to be input in my trigger- perhaps I'm using the wrong variable?) = Life of Attacked unit

-Unit set mana of (attacked unit) to ((mana of (attacked unit )) - (((LifeofUnit - Life of (Attacked Unit)) / 10.00))

..so..any helpful ideas?

Try this if will give you some ideas. :

  • Untitled Trigger 021
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Trigger - Add to (This trigger) the event (Unit - (Picked unit) Takes damage)
 
Level 5
Joined
Apr 8, 2007
Messages
116
Try this if will give you some ideas. :

  • Untitled Trigger 021
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Trigger - Add to (This trigger) the event (Unit - (Picked unit) Takes damage)

Thanks for the idea, but I don't think it'll work, since I also want to include units that'll be created in the future :/
 
Well, I think these triggers should work, but they may bug themselves if attack animation with a unit is too high or something like that...
  • Mana Spell Update
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Issued order) Equal to (Order(attack))
          • (Unit-type of (Ordered unit)) Equal to Your_Unit
    • Actions
      • Set LifeofAttackedUnit_Before = (Life of (Target unit of issued order))
  • Mana Spell
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Your_Unit
    • Actions
      • Set LifeofAttackedUnit_After = (Life of (Attacking unit))
      • Unit - Set mana of (Attacked unit) to ((Mana of (Attacked unit)) - ((LifeofAttackedUnit_Before - LifeofAttackedUnit_After) / 10.00))
BTW: The Variables are all "Reals".
 
Level 5
Joined
Apr 8, 2007
Messages
116
Well, I think these triggers should work, but they may bug themselves if attack animation with a unit is too high or something like that...
  • Mana Spell Update
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Issued order) Equal to (Order(attack))
          • (Unit-type of (Ordered unit)) Equal to Your_Unit
    • Actions
      • Set LifeofAttackedUnit_Before = (Life of (Target unit of issued order))
  • Mana Spell
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Your_Unit
    • Actions
      • Set LifeofAttackedUnit_After = (Life of (Attacking unit))
      • Unit - Set mana of (Attacked unit) to ((Mana of (Attacked unit)) - ((LifeofAttackedUnit_Before - LifeofAttackedUnit_After) / 10.00))
BTW: The Variables are all "Reals".

At first they didn't work, but iwth a bit (often odd) tweaks, it works! :grin: thx :p
 
Status
Not open for further replies.
Top