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

[Trigger] A More Efficient Event For "Unit is attacked"

Status
Not open for further replies.
Level 9
Joined
Nov 4, 2007
Messages
931
[SOLVED]
I've been having trouble determining a way of getting a faster or better response for the event A Unit is attacked, however, when using this for an ammo system the process is pretty efficient, but when using it for passive custom abilities and such, this event is at times slow reacting, and sometimes registers more times than it should, so is there any solution to this? Thanks in advance for responding.
 
Last edited:
Level 28
Joined
Jan 26, 2007
Messages
4,789
First, create a trigger with no events and the actions you wish (like bash, for example).

Then, create a trigger that activates at map init.
This trigger should be about this:
  • Init
  • Events
    • Map initialization
  • Conditions
  • Actions
    • Set TempUGroup = (Units in (Playable map area))
    • Unit Group - Pick every unit in TempUGroup and do (Actions)
      • Loop - Actions
        • Trigger - Add to [Your ability-trigger without events] the event (Unit - (Picked unit) Takes damage)
    • Custom script: call DestroyGroup(udg_TempUGroup)
Now, create about the same trigger, but for when a unit enters a region
  • Entering Unit
  • Events
    • Unit - A unit enters (Playable map area)
  • Conditions
  • Actions
    • Trigger - Add to [Your ability-trigger without events] the event (Unit - (Triggering unit) Takes damage)
I guess that's it... now the trigger will activate only when the unit takes damage, instead of when an attack is triggered.
Good luck
 
Status
Not open for further replies.
Top