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

Help Build Custom Aoe Dmage Spell

Status
Not open for further replies.
Level 4
Joined
Dec 17, 2020
Messages
28
Hello everyone !

I'm creating an area damage spell with tiggers. The real spell has the damage to 0 so the damage is caused by the tigger with calculations based on the hero's statistics, but hey.
My problem is that I have used various methods so that it only damages enemies and not allies or itself to no satisfactory results.
Could you help me create a correct tigger please?


1642023894114.png
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,535
(Picked unit) only exists inside of the Loop - Actions section of that Pick Every Unit function. So when you do "matching (Owner of (Picked unit))" it doesn't know which unit you're referring to, because no unit has been (Picked) yet.

When you use the "matching" function you need to use the (Matching unit) Event Response to reference the unit that you want to compare.

But there's more than one way of going about this. Here's a popular method that most people find easier to work with:
  • Example
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set VariableSet SpellPoint = (Position of (Triggering unit))
      • Set VariableSet SpellGroup = (Units within 512.00 of SpellPoint.)
      • Unit Group - Pick every unit in SpellGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an enemy of (Owner of (Triggering unit)).) Equal to True
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) is A structure) Equal to False
            • Then - Actions
              • -------- do stuff to the (Picked unit) --------
            • Else - Actions
      • Custom script: call RemoveLocation(udg_SpellPoint)
      • Custom script: call DestroyGroup(udg_SpellGroup)

All of the Variables/Custom script stuff is used to clean up the memory leaks. In your trigger you're leaking a Point and a Unit Group. More on those later.

Here's the same thing but without the memory leak management. A bit easier to read:
  • Example
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units within 512.00 of (Position of (Triggering unit)).) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an enemy of (Owner of (Triggering unit)).) Equal to True
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) is A structure) Equal to False
            • Then - Actions
              • -------- do stuff to the (Picked unit) --------
            • Else - Actions

Both triggers will work just fine, it's just that the first trigger doesn't leak and second one does. If you're still learning the ways of the trigger editor it may be wise not to worry about memory leaks just yet and stick to my 2nd trigger. It's not a map breaking issue, you can read more about it in the link in my signature.

Lastly, if you need help fixing a trigger, please post it in Triggers & Scripts. Thanks!
Note that I moved the thread already so it's now in the correct forum.
 
Last edited:
Level 12
Joined
Mar 13, 2020
Messages
421
Why you trigger such simple spells.. you could just use any aoe ability and set a Real Levelfield trigger to use the stats you want as damage...

I would only recommend the old way for people under 1.32 patch or for much more complicated spells... but an simple aoe based on attack damage...

His Picture tells me he has patch 1.32...

Just use Flamestrike and change all values you want set the damage to 0

Then find out by pressing ctrl + D
What the Fourcc Name of the Damage Data for Flamestrike is something like Htb1 for Stormbolt

Then open your trigger editor

Event
Unit starts effect of Ability

Condition
Ability equal CustomFlamestrike

Action
Ability - set Ability Real Levelfield of CustomFlamestrike of Triggering Unit ( Level of Ability - 1 ) (Htb1 to Base Damage of Triggering Unit)

Unit - Incrase Level of Ability Custom Flamestrike

Unit - Decrase Level of Ability Custom Flamestrike


———————-

(Htb1 I used as example it’s Not the FourCC Data of Flamestrike because I’m on Phone and don’t remember
Level of Ability - 1 because we want the index of the level and indexes starts by 0 not by 1 so - 1 will get the index of the current level...
Maybe this helps you)

Edit: I’m not saying this way is better then the other one... I mean it’s simpler to understand...
But for me you should understand and know both ways
Uncle showed you the old way before the new natives and it’s still recommend if you use for example silence as aoe and want it to deal damage to too have a spell with an effect...
But as you said you set the damage to 0 that told me you use a simple aoe that deals normally damage...
 
Last edited:
Level 4
Joined
Dec 17, 2020
Messages
28
I am very grateful :ogre_hurrhurr:for the examples and recommendations you received, they helped me a lot and I have used those examples to work other spells on the map I am working on.
Here I leave you pics of the tiggers (without optimizing) that work

Divine Storm: (Physical damage skill)
Unleashes a whirl of divine energy, dealing (25% of Hero Base damage) + 25 (per level) Holy damage to all nearby enemies.

1642220002950.png


Divine Light:
A divine light that can heal a living ally for 500 health or deal half damage to an undead enemies.
Nearby units take 20% of the target's healing or damage.

Damage nearby target undead enemies
1642220357221.png


And Heal nearby target allies
1642220455187.png
 
Last edited:
Status
Not open for further replies.
Top