• 🏆 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!

Damage Return Spell

Status
Not open for further replies.
Level 7
Joined
Dec 8, 2008
Messages
243
'lo folks. Could do with alil' help trying to get this spell to work. Think of it as Thorns Aura - but not. :| Yes, the units I've tested it on deal more than 10 damage.

[edit] specifying what part of the trigger isn't working; it doesn't set the value for 'Spell_InfernalShield'. When testing the floating text reads "0 dmg returned (Mallaboro)"

  • Infernal Shield Charge
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Attacked unit) Equal to Heroes[0]
          • (Attacked unit) Equal to Heroes[1]
          • (Attacked unit) Equal to Heroes[2]
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Attacked unit) has buff Infernal Shield ) Equal to True
        • Then - Actions
          • Set DegreesRandom[0] = (Random real number between 0.00 and 359.00)
          • Set Spell_InfernalShield[(Player number of (Owner of (Attacked unit)))] = ((Integer((Damage taken))) / 10)
          • Unit - Cause (Attacked unit) to damage (Attacking unit), dealing (Real(Spell_InfernalShield[(Player number of (Owner of (Attacked unit)))])) damage of attack type Normal and damage type Divine
          • Floating Text - Create floating text that reads ((String(Spell_InfernalShield[(Player number of (Owner of (Attacking unit)))])) + ( dmg returned + (( + ((Name of (Owner of (Attacked unit))) + ))))) above (Attacked unit) with Z offset 0.00, using font size 9.00, color (99.00%, 0.00%, 0.00%), and 60.00% transparency
          • Floating Text - Set the velocity of (Last created floating text) to 60.00 towards DegreesRandom[0] degrees
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
          • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
        • Else - Actions
 
Level 7
Joined
Dec 8, 2008
Messages
243
Updated my original post.
"specifying what part of the trigger isn't working; it doesn't set the value for 'Spell_InfernalShield'. When testing the floating text reads "0 dmg returned (Mallaboro)""
 
Level 7
Joined
Dec 8, 2008
Messages
243
I convert Damage Taken, because its recorded as a real, to an integer, so that Spell_InfernalShield can use it. If that makes sense.
 
"Damage taken" only works with "A unit is damaged", and not with your event.

But "A unit is damaged" is a single unit event, you can't use it as a generic event unless you use a vJass library or a system which add events (there are a lot of them, just use the search tool).
I'm not sure, but there is also an ability which returns damages. Maybe there are none which return damages depending on the damage taken though...
 
Level 7
Joined
Dec 8, 2008
Messages
243
"Damage taken" only works with "A unit is damaged", and not with your event.

But "A unit is damaged" is a single unit event, you can't use it as a generic event unless you use a vJass library or a system which add events (there are a lot of them, just use the search tool).
I'm not sure, but there is also an ability which returns damages. Maybe there are none which return damages depending on the damage taken though...

Alright. Thanks. :)
 
Level 6
Joined
May 15, 2008
Messages
146
"Damage taken" only works with "A unit is damaged", and not with your event.

But "A unit is damaged" is a single unit event, you can't use it as a generic event unless you use a vJass library or a system which add events (there are a lot of them, just use the search tool).
I'm not sure, but there is also an ability which returns damages. Maybe there are none which return damages depending on the damage taken though...

Yup, Tirlititi is right about thingie that "damage taken" reference works only with "A unit is damaged event".

You must set the floating text actions in the trigger that has "A unit is damaged event", also you can do it like this it's a little trick, create a trigger that adds the attacked units into the new trigger with action "Add new event", and set that the newly added event is the "A unit is damaged event", where you replace the unit with the attacked unit. Also add a checker to that trigger so that it check's if the unit has the valid buff (of course if this is a buff/aura ability).
The important thing you should know is to create a "unit group" variable and store the units you add the event so that do not be added more than once, cuz the trigger then runs two times for them. Also add the checker that removes the dead units from the "unit group variable", cuz they will not be in use, they are dead lolz.

Hope I helped :thumbs_up:
 
Status
Not open for further replies.
Top