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

Special Effect And Damage Point

Status
Not open for further replies.
Level 3
Joined
Dec 30, 2015
Messages
33
Hello! I'm trying to create a trigger that creates a special effect, and 2-3 seconds later damages that area for 200-300 damage or so. The problem is, I cannot find a way to have the damage point be at the location of that special effect. Does anyone have a trigger that works to accomplish this? My current trigger is this:
Frost Nova
Events
Unit - |cffFF0303Hydross the Unstable 0089 <gen> Is attacked
Conditions
Actions
Special Effect - Create a special effect at (Random point in Frost Nova Region <gen>) using Abilities\Spells\NightElf\TrueshotAura\TrueshotAura.mdl
Wait 3.00 seconds
Special Effect - Destroy (Last created special effect)
Unit - Cause |cffFF0303Hydross the Unstable 0089 <gen> to damage circular area after 2.00 seconds of radius 200.00 at (Random point in Frost Nova Region <gen>), dealing 500.00 damage of attack type Spells and damage type Normal
Special Effect - Destroy (Last created special effect)
 

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,457
Here's an example of how you could do it.
  • Hydross Is Attacked v1
    • Events
      • Unit - Hydross 0000 <gen> Is attacked
    • Conditions
    • Actions
      • -------- Increase Nova Index 1 --------
      • Set VariableSet Nova_Index1 = (Nova_Index1 + 1)
      • -------- --------
      • -------- Set Nova Point --------
      • Set VariableSet Nova_Point[Nova_Index1] = (Random point in Hydross Region <gen>)
      • -------- --------
      • -------- Create Trueshot Sfx --------
      • Special Effect - Create a special effect at Nova_Point[Nova_Index1] using Abilities\Spells\NightElf\TrueshotAura\TrueshotAura.mdl
      • Set VariableSet Nova_Sfx[Nova_Index1] = (Last created special effect)
      • -------- --------
      • Wait 3.00 seconds
      • -------- --------
      • -------- Increase Nova Index 2 --------
      • Set VariableSet Nova_Index2 = (Nova_Index2 + 1)
      • -------- --------
      • -------- Deal Damage To Nearby Enemies --------
      • Set VariableSet TempGroup = (Units within 200.00 of Nova_Point[Nova_Index2].)
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) belongs to an enemy of (Owner of Hydross 0000 <gen>).) Equal to True
            • Then - Actions
              • Unit - Cause Hydross 0000 <gen> to damage (Picked unit), dealing 500.00 damage of attack type Spells and damage type Normal
            • Else - Actions
      • Custom script: call DestroyGroup (udg_TempGroup)
      • -------- --------
      • -------- Destroy Trueshot Sfx - If a special effect takes too long to disappear you can set it's flying height to something like -500 or 5000 to hide it --------
      • Special Effect - Set Height of Nova_Sfx[Nova_Index2] to: -500.00
      • Special Effect - Destroy Nova_Sfx[Nova_Index2]
      • -------- --------
      • -------- Create and Destroy Frost Nova Sfx --------
      • Special Effect - Create a special effect at Nova_Point[Nova_Index2] using Abilities\Spells\Undead\FrostNova\FrostNovaTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • -------- --------
      • -------- Remove The Point From The Game's Memory - This prevents memory leaks --------
      • Custom script: call RemoveLocation (udg_Nova_Point[udg_Nova_Index2])
      • -------- --------
      • -------- Reset The Index If Possible - This prevents these Integers from growing to huge numbers --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Nova_Index1 Equal to Nova_Index2
        • Then - Actions
          • Set VariableSet Nova_Index1 = 0
          • Set VariableSet Nova_Index2 = 0
        • Else - Actions
Attached a map below.

Note that "A unit is attacked" isn't a very safe to use Event as players can abuse this by spamming an attack/stop order targeting Hydross which makes the trigger fire A LOT of times.

In my map I added two extra versions.
v2 doesn't use a Region to spawn the Frost Novas and instead creates them at a random point offset from Hydross' position.
v3 uses a Damage Event which fires when Hydross takes damage from a normal attack. I'd recommend using this one over "Hydross is attacked".
---
How it works:
Variables with Arrays allow you to keep track of multiple things using a single variable. This is extremely useful and basically required in order to create effects like these.

So in this triggers case, we have an Integer called Nova_Index1. This is basically a counter that increases by 1 every time Hydross is attacked. We use this Integer as the Index -> [] for the rest of our variables in order to make each of them unique.

So when Hydross is attacked for the first time:
Index1 increases by 1 --------------- Increasing from 0 to 1
Nova_Point[Index1] is created ----- In other words, we create Nova_Point[1]
Nova_Sfx[Index1] is created ------- In other words, we create Nova_Sfx[1]

When Hydross is attacked for the second time:
Index1 increases by 1 --------------- Increasing from 1 to 2
Nova_Point[Index1] is created ----- In other words, we create Nova_Point[2]
Nova_Sfx[Index1] is created ------- In other words, we create Nova_Sfx[2]

^So as you can see, each Variable will be assigned it's own Index (The number in the []).

This allows us to differentiate between the different Points and Special Effects and allows us to keep track of everything even after the Wait. The rest of the trigger is fairly self-explanatory, steps are taken to remove memory leaks (check out my signature) and at the very end of the trigger we check to see if we can reset the Indices (Index1 and Index2) back to 0 (If they're equal to one another by the end of the trigger then that means that Hydross hasn't been attacked AGAIN in the last 3 seconds so it's safe to do so).

Edit: I was leaking a group. I fixed it and uploaded a new map.
 

Attachments

  • Hydross Attack Uncle 2.w3m
    20.7 KB · Views: 19
Last edited:
Status
Not open for further replies.
Top