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

Screwy Spell!!

Status
Not open for further replies.
Level 3
Joined
Nov 17, 2009
Messages
30
For some reason every other time I cast my custom ability it doesn't works. Then it works when I cast it again. This keeps going on endlessly!!!
Plz help me!
Triggers
  • Thunder Orb
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Thunder Orb
    • Actions
      • Set TOI_C = (TOI_C + 1)
      • Set TOI_M = (TOI_M + 1)
      • Unit - Create 1 Thunder Orb (Dummy) for (Owner of (Casting unit)) at (Position of (Casting unit)) facing Default building facing degrees
      • Set TOI_Target[TOI_C] = (Target unit of ability being cast)
      • Set TOI_Orb[TOI_C] = (Last created unit)
      • Trigger - Turn on Thunder Orb Loop <gen>
  • Thunder Orb Loop
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer TOI_C) from 1 to TOI_M, do (Actions)
        • Loop - Actions
          • Unit - Order TOI_Orb[TOI_C] to Neutral Naga Sea Witch - Forked Lightning TOI_Target[TOI_C]
 
Last edited:
  • Set TOI_M = (TOI_M + 1)
You need to remove that line. You increase TOI_M along with TOI_C. TOI_C is your main indexing variable, while TOI_M is the subordinate variable.

TOI_M will receive the value of TOI_C, upon the indexing loop (For each (Integer TOI_C) from 1 to TOI_M).

Finally, you have an error; seemingly, your main indexing variable is TOI_C (you add it in the indexing of the rest variables, e.g. TOI_Orb[TOI_C] = (Last created unit)), but, in the "loading" trigger, the "Thunder Orb Loop", you render it the subordinate variable.
So, your loop in the second variable should be:
  • For each (Integer TOI_M) from 1 to TOI_C, do (Actions)
If you make the change I described above, make sure you remove the Set TOI_M = (TOI_M + 1) action too.
 
Level 9
Joined
Jun 25, 2009
Messages
427
For some reason every other time I cast my custom ability it doesn't works. Then it works when I cast it again. This keeps going on endlessly!!!
Plz help me!
Triggers
  • Thunder Orb
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Thunder Orb
    • Actions
      • Set TOI_C = (TOI_C + 1)
      • Set TOI_M = (TOI_M + 1)
      • Unit - Create 1 Thunder Orb (Dummy) for (Owner of (Casting unit)) at (Position of (Casting unit)) facing Default building facing degrees
      • Set TOI_Target[TOI_C] = (Target unit of ability being cast)
      • Set TOI_Orb[TOI_C] = (Last created unit)
      • Trigger - Turn on Thunder Orb Loop <gen>
  • Thunder Orb Loop
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer TOI_C) from 1 to TOI_M, do (Actions)
        • Loop - Actions
          • Unit - Order TOI_Orb[TOI_C] to Neutral Naga Sea Witch - Forked Lightning TOI_Target[TOI_C]

And by the way your position leaks. :)

Set Caster=(Position of (Triggering Unit))

And by the way, while using triggers as these please refer to Triggering Unit because it reduces memory usage.
 
Status
Not open for further replies.
Top