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

[Spell] Entangling roots aura

Status
Not open for further replies.
Level 4
Joined
Jan 6, 2023
Messages
33
I'm trying to make a spell that works in following way: Unit with [aura] gets attacked, then the attacking unit gets entangled with roots. Somehow can't get it to work. Thanks in advance!
:grin:
  • Nature's Wrath
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacked unit) has buff Nature's Wrath ) Equal to True
    • Actions
      • Set GN_Temppoint = (Position of (Triggering unit))
      • Set GN_Caster = (Casting unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Picked unit)) is an enemy of (Owner of GN_Caster)) Equal to True
        • Then - Actions
          • Unit - Create 1 dummy nature wrath for (Owner of GN_Caster) at GN_Temppoint facing generic building facing degrees
          • Unit - Set level of Entangling roots dummy for (Last created unit) to (Level of Nature's Wrath for (Triggering unit))
          • Unit - Order (Last created unit) to Night Elf Keeper of the Grove (Picked unit)
          • Unit - Add a 2.00 second generic expiration timer to (Last created unit)
        • Else - Actions
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,549
The issue is that your Event Responses are wrong.

There is no (Casting unit) because there is no spell being cast. There is no (Picked unit) because there is no Pick Every Unit action being used here.

Event Responses are exactly as they sound, a response to an Event. In this case your Event is "A unit is attacked" so the information available to you will be related to a unit getting attacked.

This particular Event uses these three Event Responses: (Attacked unit), (Attacking unit), (Triggering unit) <- same as attacked unit

Then from there you can gather more information like getting the position of the attacked unit or getting the owner of it.

Here are some more examples of Events and their corresponding Event Responses:

Event: A unit Dies
Event Response: (Dying unit), (Killing unit)

Event: A unit Spawns a summoned unit
Event Response: (Summoned unit), (Summoning unit)

These pairings of Events/Event Responses exist for every single Event. Note that (Triggering unit) is always the unit mentioned in the Event and (Triggering player) is always the player mentioned in the Event.

You also have the Pick Every Unit and Pick Every Player actions which take advantage of the (Picked unit) and (Picked player) functions. In addition to that you have (Matching unit) and (Matching player) which go along with the Matching function which is common in many places -> "Pick every unit in region matching...".

You must use the correct Event Responses and functions that correspond with what you're doing. Here's an updated version of your trigger:
  • Nature's Wrath
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacked unit) has buff Nature's Wrath ) Equal to True
      • ((Owner of (Attacked unit)) is an enemy of (Owner of Attacking unit)) Equal to True
    • Actions
      • Set NW_Point = (Position of (Attacking unit))
      • Unit - Create 1 dummy nature wrath for (Owner of (Attacked unit)) at NW_Point facing generic building facing degrees
      • Custom script: call RemoveLocation(udg_NW_Point)
      • Unit - Set level of Entangling roots dummy for (Last created unit) to (Level of Nature's Wrath for (Attacked unit))
      • Unit - Add a 2.00 second generic expiration timer to (Last created unit)
      • Unit - Order (Last created unit) to Night Elf Keeper of the Grove (Attacking unit)
Note how I removed the Point memory leak with my Custom Script (I think you forgot to do this) and simplified the trigger since it didn't really need an If Then Else statement. I also use a variable made exclusively for this trigger to avoid any possible issues.

One last important thing to note is that the "A unit is attacked" Event is generally avoided for effects like these since the Event fires regardless of whether the attack finishes or not. Although, in this case it may be fine since the opponent would be the only one who can abuse it which would be foolish on their part.

The solution to this issue is to use a Damage Engine, which is a system that detects when damage is taken, and since you're on an older version you would need to find one that's compatible with it.
 
Last edited:
Level 4
Joined
Jan 6, 2023
Messages
33
It worked, gotta admit I forgot to put the Custom Script to it. Also have to learn all the event responses because when it comes to passives and stuff i'm still in the dark :thumbs_down:


One last important thing to note is that the "A unit is attacked" Event is generally avoided for effects like these since the Event fires regardless of whether the attack finishes or not. Although, in this case it may be fine since the opponent would be the only one who can abuse it which would be foolish on their part.
Does that mean that if an enemy attacks my unit, then the effect occurs ONLY once per started fight? then it resets when enemies quit combat?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,549
It worked, gotta admit I forgot to put the Custom Script to it. Also have to learn all the event responses because when it comes to passives and stuff i'm still in the dark :thumbs_down:



Does that mean that if an enemy attacks my unit, then the effect occurs ONLY once per started fight? then it resets when enemies quit combat?
The Event works with every single attack the way you'd expect it to. It's just that the attacking player can abuse this by ordering their unit to attack, cancel said attack, and then re-order it again and continue this pattern in rapid succession. This will cause the Event to fire many more times than you'd want it to, however, in your case it's not really an issue because the opponent would only be hurting themselves by doing so.

The real issue is when the attacker is the one who inflicts the Entangling Roots, or Critical Strike, or whatever passive effect you may be triggering since the attacking player can make the trigger run far more often than it's supposed to.

Also, I see you're working with a Dummy unit and I have some suggestions that you may already be doing:
Base your Dummy unit on the Locust unit since it has most of the settings you're after. Then disable it's attack, model, shadow, and most importantly set it's Movement Type to None and Speed Base to 0. With these settings the Dummy unit can cast spells instantly without needing to turn to face it's target.
 
Last edited:
Level 4
Joined
Jan 6, 2023
Messages
33
The Event works with every single attack the way you'd expect it to. It's just that the attacking player can abuse this by ordering their unit to attack, cancel said attack, and then re-order it again and continue this pattern in rapid succession. This will cause the Event to fire many more times than you'd want it to, however, in your case it's not really an issue because the opponent would only be hurting themselves by doing so.

The real issue is when the attacker is the one who inflicts the Entangling Roots, or Critical Strike, or whatever passive effect you may be triggering since the attacking player can make the trigger run far more often than it's supposed to.

Also, I see you're working with a Dummy unit and I have some suggestions that you may already be doing:
Base your Dummy unit on the Locust unit since it has most of the settings you're after. Then disable it's attack, model, shadow, and most importantly set it's Movement Type to None and Speed Base to 0. With these settings the Dummy unit can cast spells instantly without needing to turn to face it's target.
Oooh alright. Yeah, it shouldnt be an issue since only attacking units get rooted.
Also I've set up my dummy this way already, so the spell now works without noticing any spawning dummy! Thank you for helping by the way!
 
Status
Not open for further replies.
Top