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

Unit is attacked and attacked unit takes damage

Status
Not open for further replies.
Level 10
Joined
Mar 17, 2012
Messages
579
Hi there guys! Tell me please what's wrong with these triggers?

  • Magic Arrows
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Unit-type of (Attacking unit)) Equal to Naga Sea Witch
          • (Level of Magic Arrows for (Attacking unit)) Greater than 0
    • Actions
      • Trigger - Add to Magic Arrows work <gen> the event (Unit - (Attacked unit) Takes damage)
      • Trigger - Turn on Magic Arrows work <gen>
  • Magic Arrows work
    • Events
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Unit-type of (Attacking unit)) Equal to Naga Sea Witch
          • (Level of Magic Arrows for (Attacking unit)) Greater than 0
    • Actions
      • Set Player_Number_Int = (Player number of (Owner of (Attacking unit)))
      • Set Magic_Arrows_Attacker[Player_Number_Int] = (Attacking unit)
      • Set Magic_Arrows_Target[Player_Number_Int] = (Attacked unit)
      • Unit - Cause Magic_Arrows_Attacker[Player_Number_Int] to damage Magic_Arrows_Target[Player_Number_Int], dealing ((Real((Intelligence of Magic_Arrows_Attacker[Player_Number_Int] (Include bonuses)))) x (((Real((Level of Magic Arrows for Magic_Arrows_Attacker[Player_Number_Int]))) x 0.05) + 0.05)) damage of attack type Spells and damage type Fire
      • Special Effect - Create a special effect attached to the chest of Magic_Arrows_Target[Player_Number_Int] using Abilities\Spells\NightElf\Blink\BlinkCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • Trigger - Turn off (This trigger)
There are mistakes in these triggers but I can't see them :vw_wtf:
 
Level 19
Joined
Jul 14, 2011
Messages
875
Use Event Response - Damage Source in the second trigger.
Keep in mind that the triggers will fail if the hero attacks a second unit before the first projectile lands (assuming that its ranged).
Also, it leaks an event which may cause problems if the game gets longer.
 
Level 10
Joined
Mar 17, 2012
Messages
579
Use Event Response - Damage Source in the second trigger.
Keep in mind that the triggers will fail if the hero attacks a second unit before the first projectile lands (assuming that its ranged).
Also, it leaks an event which may cause problems if the game gets longer.

Is it possible to overcome this "event leak"?
 
Level 15
Joined
Aug 14, 2007
Messages
936
Secondly, use a unit group variable to record and check if they are already added, by the add event definition, the second time you attack the target which will add a second event OF the same unit when it's not controlled. This result in massive lag and up to infinite amount of execution, WHICH also means it will work literally like incinerate except this time without the buff limitation :p
 
Level 10
Joined
Mar 17, 2012
Messages
579
Secondly, use a unit group variable to record and check if they are already added, by the add event definition, the second time you attack the target which will add a second event OF the same unit when it's not controlled. This result in massive lag and up to infinite amount of execution, WHICH also means it will work literally like incinerate except this time without the buff limitation :p

:ogre_rage:

Thanks for help :)
 
Status
Not open for further replies.
Top