1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Solved] Spell - Based on Tornado

Discussion in 'Triggers & Scripts' started by rkemsley, Oct 15, 2018.

  1. rkemsley

    rkemsley

    Joined:
    Sep 25, 2018
    Messages:
    21
    Resources:
    0
    Resources:
    0
    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 :)
     
  2. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    2,901
    Resources:
    1
    Spells:
    1
    Resources:
    1
    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
     
  3. pick-a-chew

    pick-a-chew

    Joined:
    Jul 15, 2007
    Messages:
    691
    Resources:
    4
    Icons:
    2
    Maps:
    2
    Resources:
    4
    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.
     
  4. rkemsley

    rkemsley

    Joined:
    Sep 25, 2018
    Messages:
    21
    Resources:
    0
    Resources:
    0
    This worked perfectly. Exactly the effect I was looking for.

    Thanks for the help!
     
  5. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    2,901
    Resources:
    1
    Spells:
    1
    Resources:
    1
    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.
     
  6. rkemsley

    rkemsley

    Joined:
    Sep 25, 2018
    Messages:
    21
    Resources:
    0
    Resources:
    0
    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.
     
  7. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    2,901
    Resources:
    1
    Spells:
    1
    Resources:
    1
    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.
    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.