1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Solved] Troubles with dummies, Only one out of 4 casts assigned spell.

Discussion in 'Triggers & Scripts' started by vlekje5, Feb 1, 2020.

  1. vlekje5

    vlekje5

    Joined:
    Dec 1, 2010
    Messages:
    255
    Resources:
    0
    Resources:
    0
    Basically i'm trying to make 4 dummies cast carrion swarm around my hero when i use war stomp.

    The problem is that somehow, only the first dummy actually casts the spell. The other 4 do nothing.
    If i change up the order and say kill the second dummy it works. However when i try to get all of them to cast it doesn't.

    Does anyone have any idea what causes this? (PS, i initially tried this using a loop, and will most likely make it a loop again once i know what's causing the problem)

    • Untitled Trigger 008
      • Events
        • Unit - A unit Begins channeling an ability
      • Conditions
        • (Ability being cast) Equal to War Stomp
      • Actions
        • Unit - Create 1 dumy for (Owner of (Casting unit)) at ((Position of (Casting unit)) offset by 256.00 towards 0.00 degrees.) facing (Position of (Casting unit))
        • Set VariableSet ShockwaveDummy[0] = (Last created unit)
        • Unit - Create 1 dumy for (Owner of (Casting unit)) at ((Position of (Casting unit)) offset by 256.00 towards 90.00 degrees.) facing (Position of (Casting unit))
        • Set VariableSet ShockwaveDummy[1] = (Last created unit)
        • Unit - Create 1 dumy for (Owner of (Casting unit)) at ((Position of (Casting unit)) offset by 256.00 towards 180.00 degrees.) facing (Position of (Casting unit))
        • Set VariableSet ShockwaveDummy[2] = (Last created unit)
        • Unit - Create 1 dumy for (Owner of (Casting unit)) at ((Position of (Casting unit)) offset by 256.00 towards 270.00 degrees.) facing (Position of (Casting unit))
        • Set VariableSet ShockwaveDummy[3] = (Last created unit)
        • Unit - Order ShockwaveDummy[0] to Undead Dreadlord - Carrion Swarm(Position of (Casting unit))
        • Unit - Order ShockwaveDummy[1] to Undead Dreadlord - Carrion Swarm(Position of (Casting unit))
        • Unit - Order ShockwaveDummy[2] to Undead Dreadlord - Carrion Swarm(Position of (Casting unit))
        • Unit - Order ShockwaveDummy[3] to Undead Dreadlord - Carrion Swarm(Position of (Casting unit))
     
  2. Warseeker

    Warseeker

    Joined:
    Feb 18, 2014
    Messages:
    3,154
    Resources:
    2
    Maps:
    2
    Resources:
    2
    I think that's because they are all casting the spell on the same direction. Anyway, this may solve your problem.
    • Shockwave
      • Events
        • Unit - A unit Begins channeling an ability
      • Conditions
        • (Ability being cast) Equal to War Stomp
      • Actions
        • Set Temp_Point = (Position of (Casting unit))
        • Unit - Create 1 DUMMY for (Owner of (Casting unit)) at Temp_Point facing 0.00 degrees
        • Set VariableSet ShockwaveDummy[0] = (Last created unit)
        • Unit - Add a 1.00 second Generic expiration timer to ShockwaveDummy[0]
        • Unit - Create 1 DUMMY for (Owner of (Casting unit)) at Temp_Point facing 90.00 degrees
        • Set VariableSet ShockwaveDummy[1] = (Last created unit)
        • Unit - Add a 1.00 second Generic expiration timer to ShockwaveDummy[1]
        • Unit - Create 1 DUMMY for (Owner of (Casting unit)) at Temp_Point facing 180.00 degrees
        • Set VariableSet ShockwaveDummy[2] = (Last created unit)
        • Unit - Add a 1.00 second Generic expiration timer to ShockwaveDummy[2]
        • Unit - Create 1 DUMMY for (Owner of (Casting unit)) at Temp_Point facing 270.00 degrees
        • Set VariableSet ShockwaveDummy[3] = (Last created unit)
        • Unit - Add a 1.00 second Generic expiration timer to ShockwaveDummy[3]
        • Unit - Order ShockwaveDummy[0] to Undead Dreadlord - Carrion Swarm (Temp_Point offset by 256.00 towards 0.00 degrees)
        • Unit - Order ShockwaveDummy[1] to Undead Dreadlord - Carrion Swarm (Temp_Point offset by 256.00 towards 90.00 degrees)
        • Unit - Order ShockwaveDummy[2] to Undead Dreadlord - Carrion Swarm (Temp_Point offset by 256.00 towards 180.00 degrees)
        • Unit - Order ShockwaveDummy[3] to Undead Dreadlord - Carrion Swarm (Temp_Point offset by 256.00 towards 270.00 degrees)
        • Custom script: call RemoveLocation (udg_Temp_Point)
     
  3. vlekje5

    vlekje5

    Joined:
    Dec 1, 2010
    Messages:
    255
    Resources:
    0
    Resources:
    0

    This seems to be it!

    By adding different angles it seems to work, However i still find it weird the first iteration didn't work. The dummies are basically all in a circle around the caster and were supposed to target the caster when casting. It's weird that they can't all target the same unit.

    However, i've put the degrees as an inverse of the angle they are placed at and imediately put it in a loop to make the code easier to edit.


    • Untitled Trigger 008 Copy
      • Events
        • Unit - A unit Begins channeling an ability
      • Conditions
        • (Ability being cast) Equal to War Stomp
      • Actions
        • For each (Integer A) from 0 to 11, do (Actions)
          • Loop - Actions
            • Unit - Create 1 dumy for (Owner of (Casting unit)) at ((Position of (Casting unit)) offset by 256.00 towards ((Real((Integer A))) x 30.00) degrees.) facing (Position of (Casting unit))
            • Set VariableSet ShockwaveDummy[(Integer A)] = (Last created unit)
            • Unit - Add a 1.00 second Generic expiration timer to ShockwaveDummy[(Integer A)]
        • For each (Integer B) from 0 to 11, do (Actions)
          • Loop - Actions
            • Unit - Order ShockwaveDummy[(Integer B)] to Undead Dreadlord - Carrion Swarm((Position of ShockwaveDummy[(Integer B)]) offset by 256.00 towards (180.00 + ((Real((Integer B))) x 30.00)) degrees.)


    So by using different angles as you said it is now working as intended. However like i've said before, i'm still curious why the original way of using the position of the center unit didn't work.

    One last thing, What is the custom script for?
     
    Last edited: Feb 1, 2020
  4. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    3,788
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Using points as you have done creates a memory leak, which can only be cleared with a custom script. This needs to be done for every point created once it is no longer needed, not just once as Warseeker wrote. This tutorial should explain it all: Things That Leak

    You don’t need to have two separate loops. All of the B loop actions can also just be done in the A loop (combine them).
     
  5. vlekje5

    vlekje5

    Joined:
    Dec 1, 2010
    Messages:
    255
    Resources:
    0
    Resources:
    0
    Ah, Okay if i plug in the custom script behind both loops i'm fine right?

    As for the two loops, i did it this way because i want to be sure that the units are all spawned before they cast. I'm not sure if there is any lagg on the script executing but i want them to be as in sync as possible.
     
  6. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    3,788
    Resources:
    1
    Spells:
    1
    Resources:
    1
    You will need to save and re-use Position of Casting Unit, so it will be cleaned after the loop. Inside the loop you will need to generate a new point each time for the unit to be created at, then clean it inside the loop.

    For all intents and purposes everything in a trigger happens instantly unless it explicitly takes time (like a camera pan). You do not ever need to worry in the way you have done above. A unit can literally cast a spell instantly on the line it was ordered if set up properly and can thus cast another spell on the exact next line.
     
  7. vlekje5

    vlekje5

    Joined:
    Dec 1, 2010
    Messages:
    255
    Resources:
    0
    Resources:
    0

    Okay so i've updated the trigger to look like this:

    • Untitled Trigger 008 Copy
      • Events
        • Unit - A unit Begins channeling an ability
      • Conditions
        • (Ability being cast) Equal to War Stomp
      • Actions
        • For each (Integer A) from 0 to 11, do (Actions)
          • Loop - Actions
            • Set VariableSet Temp_Point = (Position of (Casting unit))
            • Unit - Create 1 dumy for (Owner of (Casting unit)) at (Temp_Point offset by 256.00 towards ((Real((Integer A))) x 30.00) degrees.) facing Temp_Point
            • Set VariableSet ShockwaveDummy[(Integer A)] = (Last created unit)
            • Unit - Add a 1.00 second Generic expiration timer to ShockwaveDummy[(Integer A)]
            • Custom script: call RemoveLocation (udg_Temp_Point)
        • For each (Integer B) from 0 to 11, do (Actions)
          • Loop - Actions
            • Unit - Order ShockwaveDummy[(Integer B)] to Undead Dreadlord - Carrion Swarm((Position of ShockwaveDummy[(Integer B)]) offset by 256.00 towards (180.00 + ((Real((Integer B))) x 30.00)) degrees.)


    However, Should i following this logic also make a temp var for the position of the dummy in the Loop B part and clear that afterwards aswell?

    Also i've decided to stick with two loops since when i migrated the bottom function into the first loop it broke the spell again.

    The spell currently works as intended and looks like this:


    • Untitled Trigger 008 Copy
      • Events
        • Unit - A unit Begins channeling an ability
      • Conditions
        • (Ability being cast) Equal to War Stomp
      • Actions
        • For each (Integer A) from 0 to 11, do (Actions)
          • Loop - Actions
            • Set VariableSet Temp_Point = (Position of (Casting unit))
            • Unit - Create 1 dumy for (Owner of (Casting unit)) at (Temp_Point offset by 256.00 towards ((Real((Integer A))) x 30.00) degrees.) facing Temp_Point
            • Set VariableSet ShockwaveDummy[(Integer A)] = (Last created unit)
            • Unit - Add a 1.00 second Generic expiration timer to ShockwaveDummy[(Integer A)]
            • Custom script: call RemoveLocation (udg_Temp_Point)
        • For each (Integer B) from 0 to 11, do (Actions)
          • Loop - Actions
            • Set VariableSet TempDummy_Point = (Position of ShockwaveDummy[(Integer B)])
            • Unit - Order ShockwaveDummy[(Integer B)] to Undead Dreadlord - Carrion Swarm(TempDummy_Point offset by 256.00 towards (180.00 + ((Real((Integer B))) x 30.00)) degrees.)
            • Custom script: call RemoveLocation (udg_TempDummy_Point)



    Would this fix the problem with leaks?
     
  8. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    3,788
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Use starts effect of for all your ability triggers. That only fires after cd/mana cost have been applied and the spell cast cannot be interrupted. Use Triggering Unit whenever possible. You were still leaking multiple points; you can save yourself from having to clear leaks repeatedly by reusing some variables.

    • Untitled Trigger 008 Copy
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
        • (Ability being cast) Equal to War Stomp
      • Actions
        • Set VariableSet Temp_Point = (Position of (Triggering unit))
        • For each (Integer A) from 0 to 11, do (Actions)
          • Loop - Actions
            • Set VariableSet Temp_Point2 = (Temp_Point offset by 256.00 towards ((Real((Integer A))) x 30.00) degrees.)
            • Unit - Create 1 dumy for (Owner of (Triggering unit)) at Temp_Point2 facing Temp_Point
            • Set VariableSet ShockwaveDummy = (Last created unit)
            • Unit - Add a 1.00 second Generic expiration timer to ShockwaveDummy
            • -------- it would be best to have a generic dummy unit and just add the Carrion Swarm ability to it here instead of having it hardcoded in the OE ability list --------
            • Unit - Order ShockwaveDummy to Undead Dreadlord - Carrion Swarm Temp_Point
            • Custom script: call RemoveLocation(udg_Temp_Point2)
        • Custom script: call RemoveLocation (udg_Temp_Point)