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

[Solved] Spell - Based on Tornado

Status
Not open for further replies.
Level 4
Joined
Sep 25, 2018
Messages
81
I have been trying to create a spell which is based off a neutral hero's, Naga Sea Witch, ultimate, Tornado.

What I am trying to do is have the damage triggered, because I want the damage to be stats based.

The problem I am having is trying to put together a trigger which detects whether a unit/group of units are within a certain range of the "tornado". The "tornado" acts exactly the same as normal, so the hero is able to control it if they want to. Therefore, the region, which does damage, must move with the "tornado".

I just can't seem to work out how to trigger it so that it detects whether a unit has entered or left the area around the "tornado". The area being the DoT area.

Sorry if I come across as if I'm labouring the point.

Please help :)
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
You shouldn't do this with a region to damage units. Instead you'll save the tornado unit into a variable and with a periodic trigger pick all the units around it and deal damage.

  • Events
    • Unit - A unit spawns a summoned unit
  • Conditions
    • (Unit type of (Summoned Unit)) equal to TORNADO
  • Actions
    • Set TornadoVar = (Summoned Unit)
    • Set TornadoDmg = ((Intelligence of (Triggering Unit) (include bonuses)) x TornadoStatFactor) + TornadoBaseDamage
    • Set TornadoDmg = TornadoDmg*TORNADO_PERIOD
    • Trigger - Turn on Tornado Periodic Trigger <gen>
  • Events
    • Time - Every TORNDO_PERIOD seconds of game-time
  • Conditions
  • Actions
    • If (All conditions are true) then do (Then actions) else do (Else actions)
      • If - Conditions
        • (Current life of TornadoVar) less than or equal to 0.405
      • Then - Actions
        • Trigger - Turn off (This trigger)
        • Skip remaining actions
      • Else - Actions
    • Set TornadoPoint = Position of TornadoVar
    • Custom script: set bj_wantDestroyGroup = true //cleans a group leak in the next line
    • Unit Group - Pick every unit in (Units within TORNADO_RANGE of TornadoPoint matching (((Matching Unit) belongs to an enemy of (Owner of TornadoVar)) and ((Matching Unit) is alive equal to true) and ((Matching Unit) is Spell Immune equal to false))) and do (Actions)
    • Loop - Actions
      • Unit - Cause TornadoVar to damage (Picked Unit) for TornadoDmg of attack type Magic and damage type Normal
    • Custom script: call RemoveLocation(udg_TornadoPoint) //keep the udg_ prefix but make sure the name here matches the name of your point variable
Now this only works for 1 cast of this tornado spell at a time. If you need more than one simultaneous cast you'll have to modify this format. This tutorial should help you understand how to do so: Visualize: Dynamic Indexing
 
Level 13
Joined
Jul 15, 2007
Messages
763
You can make Pyrogasm's solution MUI without resorting to dynamic indexing. When you summon a Tornado, add it to a unit group, and periodically pick every Tornado in that group and deal its area damage by picking units around it. If you need to recall large amounts of information (spell level, caster, talents etc.) then it will be cleanest to store that info in variables using dynamic indexing, or a hashtable.
 
Level 4
Joined
Sep 25, 2018
Messages
81
You shouldn't do this with a region to damage units. Instead you'll save the tornado unit into a variable and with a periodic trigger pick all the units around it and deal damage.

  • Events
    • Unit - A unit spawns a summoned unit
  • Conditions
    • (Unit type of (Summoned Unit)) equal to TORNADO
  • Actions
    • Set TornadoVar = (Summoned Unit)
    • Set TornadoDmg = ((Intelligence of (Triggering Unit) (include bonuses)) x TornadoStatFactor) + TornadoBaseDamage
    • Set TornadoDmg = TornadoDmg*TORNADO_PERIOD
    • Trigger - Turn on Tornado Periodic Trigger <gen>
  • Events
    • Time - Every TORNDO_PERIOD seconds of game-time
  • Conditions
  • Actions
    • If (All conditions are true) then do (Then actions) else do (Else actions)
      • If - Conditions
        • (Current life of TornadoVar) less than or equal to 0.405
      • Then - Actions
        • Trigger - Turn off (This trigger)
        • Skip remaining actions
      • Else - Actions
    • Set TornadoPoint = Position of TornadoVar
    • Custom script: set bj_wantDestroyGroup = true //cleans a group leak in the next line
    • Unit Group - Pick every unit in (Units within TORNADO_RANGE of TornadoPoint matching (((Matching Unit) belongs to an enemy of (Owner of TornadoVar)) and ((Matching Unit) is alive equal to true) and ((Matching Unit) is Spell Immune equal to false))) and do (Actions)
    • Loop - Actions
      • Unit - Cause TornadoVar to damage (Picked Unit) for TornadoDmg of attack type Magic and damage type Normal
    • Custom script: call RemoveLocation(udg_TornadoPoint) //keep the udg_ prefix but make sure the name here matches the name of your point variable
Now this only works for 1 cast of this tornado spell at a time. If you need more than one simultaneous cast you'll have to modify this format. This tutorial should help you understand how to do so: Visualize: Dynamic Indexing

This worked perfectly. Exactly the effect I was looking for.

Thanks for the help!
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
When you summon a Tornado, add it to a unit group, and periodically pick every Tornado in that group and deal its area damage by picking units around it.
If you want to go this route, the 3 ways to know how much damage to deal are:
  • Store the damage or the casting unit's stat in the unit's Custom Value (can only be an integer). And hope CV isn't being used by something like a unit indexer.
  • Make the tornado a hero and set it's stats to match the caster's.
  • Save this information in a hashtable entry for each tornado.
You will also need a dummy level ability on the tornado to know what level the spell was cast at, or different unit groups for each level, or different tornado units for each level.
 
Level 4
Joined
Sep 25, 2018
Messages
81
If you want to go this route, the 3 ways to know how much damage to deal are:
  • Store the damage or the casting unit's stat in the unit's Custom Value (can only be an integer). And hope CV isn't being used by something like a unit indexer.
  • Make the tornado a hero and set it's stats to match the caster's.
  • Save this information in a hashtable entry for each tornado.
You will also need a dummy level ability on the tornado to know what level the spell was cast at, or different unit groups for each level, or different tornado units for each level.
Just out of interest, would it be possible to activate the damage while a unit has a buff (which is linked to the tornado), as appose to dealing the damage when standing near the tornado.

At the moment I have a buff which is purely visual that the tornado gives off to units nearby. But as you know with buffs, there is a delay before they are removed from a unit (like an aura). Just wondering if I can link the damage to the aura so it does the damage only to the units with the buff.
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
You can check for the buff with a trigger. I believe under boolean comparison is "unit has buff".
  • Conditions
    • ((Picked Unit) has buff TORNADO_BUFF) equal to true
I guess you're envisioning periodically picking every unit on the map and checking if they have the buff, then dealing damage if they do? 2 problems with this:
  1. Picking all units on a map with a high frequency is really not recommended, especially if you map is large. You will start to notice performance issues with many units on the map because the GUI functions are inherently inefficient.
  2. There's no way to make the damage based on an attribute then because you can't get the source of a buff. There's no function to do that.
But as you know with buffs, there is a delay before they are removed from a unit (like an aura).
Buffs get removed on time every time if they were supplied by a timed ability. Aura update lag only affects, well, auras... and the default tornado ability Tornado Slow Aura is, yep, an aura.
 
Status
Not open for further replies.
Top