• 🏆 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] Help with Chain spell.

Status
Not open for further replies.
Level 2
Joined
Jan 9, 2008
Messages
19
Hi!
I have tried to get Stonebludgeon's "Chain spell template" (Chain Spell Template) triggers to be able to handle all of future chain spells.

For me it works except from the variable "MaximumNumberHits" where the trigger doesn't seam to find it. (MaxnumberHits = how many times a specific unit can be "bounced")

I don't know if I've missed something (with my tired eyes). Maybe someone has a pair of fresh eyes that can spot the problem?

Original trigger:
Code:
Chain Storm Bolt Cast

    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Chain Storm Bolt
    Actions
        -------- Setup Variables --------
        -------- ----------------------------------------------------------------------------------------------------EDIT UNDER [Missile Speed, Bounce Range, Number of Bounces and how many times the same unit may be hit during one chain.] --------
        Set SpellBounceRange = 400.00
        Set SpellBounceSpeed = 800.00
        Set SpellNumberBounces = (2 + (2 x (Level of Chain Storm Bolt for (Casting unit))))
        Set SpellMaximumNumberHits = 1
        -------- ----------------------------------------------------------------------------------------------------EDIT ABOVE [Missile Speed, Bounce Range, Number of Bounces and how many times the same unit may be hit during one chain.] --------
        -------- Spell Effect Create Dummy Unit With Model --------
        Set TemporaryPoint[1] = (Position of (Casting unit))
        Set TemporaryPoint[2] = (Position of (Target unit of ability being cast))
        -------- ----------------------------------------------------------------------------------------------------EDIT UNDER [The Missile Type, which is a unit.] --------
        Unit - Create 1 Storm Bolt Missile for (Owner of (Casting unit)) at TemporaryPoint[1] facing TemporaryPoint[2]
        -------- ----------------------------------------------------------------------------------------------------EDIT ABOVE [The Missile Type, which is a unit.] --------
        -------- ----------------------------------------------------------------------------------------------------EDIT UNDER [Select the right Loop Trigger.] --------
        If ((PowerChainGroup is empty) Equal to True) then do (Trigger - Turn on Chain Storm Bolt Loop <gen>) else do (Do nothing)
        -------- ----------------------------------------------------------------------------------------------------EDIT ABOVE [Select the right Loop Trigger.] --------
        Unit Group - Add (Last created unit) to PowerChainGroup
        -------- Save Variables --------
        Hashtable - Save SpellBounceRange as 0 of (Key (Last created unit)) in PowerChainHash
        Hashtable - Save SpellBounceSpeed as 1 of (Key (Last created unit)) in PowerChainHash
        Hashtable - Save SpellNumberBounces as 2 of (Key (Last created unit)) in PowerChainHash
        Hashtable - Save Handle Of(Target unit of ability being cast) as 3 of (Key (Last created unit)) in PowerChainHash
        Hashtable - Save (Level of Chain Storm Bolt for (Casting unit)) as 4 of (Key (Last created unit)) in PowerChainHash
        Hashtable - Save SpellMaximumNumberHits as 5 of (Key (Last created unit)) in PowerChainHash
        Hashtable - Save (Key (Last created unit)) as 6 of (Key (Last created unit)) in PowerChainHash
        -------- Clean up --------
        Custom script: call RemoveLocation (udg_TemporaryPoint[2])
        Custom script: call RemoveLocation (udg_TemporaryPoint[1])

Code:
Chain Storm Bolt Loop

    Events
        Time - Every 0.03 seconds of game time
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in PowerChainGroup) Greater than 0
            Then - Actions
                Unit Group - Pick every unit in PowerChainGroup and do (Actions)
                    Loop - Actions
                        -------- Load Variables --------
                        Set SpellBounceSpeed = (Load 1 of (Key (Picked unit)) from PowerChainHash)
                        Set SpellNumberBounces = (Load 2 of (Key (Picked unit)) from PowerChainHash)
                        Set TemporaryTarget = (Load 3 of (Key (Picked unit)) in PowerChainHash)
                        Set TemporaryKeyTarget = (Load 3 of (Key (Picked unit)) in PowerChainHash)
                        Set TemporaryKeySpell = (Load 6 of (Key (Picked unit)) from PowerChainHash)
                        -------- Spell Effect Move Bouncing Missile --------
                        Set TemporaryPoint[1] = (Position of (Picked unit))
                        Set TemporaryPoint[2] = (Position of TemporaryTarget)
                        Set TemporaryPoint[3] = (TemporaryPoint[1] offset by (0.02 x SpellBounceSpeed) towards (Angle from TemporaryPoint[1] to TemporaryPoint[2]) degrees)
                        Unit - Move (Picked unit) instantly to TemporaryPoint[3], facing TemporaryPoint[2]
                        Custom script: call RemoveLocation (udg_TemporaryPoint[3])
                        Custom script: call RemoveLocation (udg_TemporaryPoint[1])
                        Set TemporaryPoint[1] = (Position of (Picked unit))
                        -------- Collision Of Unit And Bouncing Missile --------
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Distance between TemporaryPoint[1] and TemporaryPoint[2]) Less than or equal to (SpellBounceSpeed / 70.00)
                            Then - Actions
                                Custom script: call RemoveLocation (udg_TemporaryPoint[1])
                                Custom script: call RemoveLocation (udg_TemporaryPoint[2])
                                -------- Spell Hit --------
                                Set TemporaryPoint[1] = (Position of TemporaryTarget)
                                Unit - Create 1 Caster for (Owner of (Picked unit)) at TemporaryPoint[1] facing TemporaryPoint[1]
                                Unit - Add Storm Bolt (Dummy Spell) to (Last created unit)
                                -------- ----------------------------------------------------------------------------------------------------EDIT UNDER [Ability casted against every unit in the chain, and the right cast order.] --------
                                Unit - Set level of Storm Bolt (Dummy Spell) for (Last created unit) to (Load 4 of (Key (Picked unit)) from PowerChainHash)
                                Unit - Order (Last created unit) to Neutral - Firebolt TemporaryTarget
                                -------- ----------------------------------------------------------------------------------------------------EDIT ABOVE [Ability casted against every unit in the chain, and the right cast order.] --------
                                Unit - Add a 0.10 second Generic expiration timer to (Last created unit)
                                Custom script: call RemoveLocation (udg_TemporaryPoint[1])
                                -------- Save Variables On Target Unit --------
                                Hashtable - Save ((Load TemporaryKeySpell of (Key TemporaryKeyTarget) from PowerChainHash) + 1) as TemporaryKeySpell of (Key TemporaryKeyTarget) in PowerChainHash
                                -------- Decrease Bounces --------
                                Set SpellNumberBounces = (SpellNumberBounces - 1)
                                -------- Bounce On When More Units Can Be Hit --------
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        SpellNumberBounces Greater than 0
                                    Then - Actions
                                        -------- Load Variables --------
                                        Set SpellMaximumNumberHits = (Load 5 of (Key (Picked unit)) from PowerChainHash)
                                        Set SpellBounceRange = (Load 0 of (Key (Picked unit)) from PowerChainHash)
                                        -------- Spell Effect --------
                                        -------- ----------------------------------------------------------------------------------------------------EDIT UNDER [The conditions that a unit must meet to be aquired as the next target] --------
                                        Set TemporaryGroup[1] = (Units within SpellBounceRange of (Position of (Picked unit)) matching (((((Matching unit) is alive) Equal to True) and ((((Matching unit) is A structure) Equal to False) and (SpellMaximumNumberHits Greater than (Load TemporaryKeySpell of (Key (Matching unit)
                                        -------- ----------------------------------------------------------------------------------------------------EDIT ABOVE [The conditions that a unit must meet to be aquired as the next target] --------
                                        Set TemporaryGroup[2] = (Random 1 units from TemporaryGroup[1])
                                        -------- New Unit To Bounce To Found --------
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                (Number of units in TemporaryGroup[2]) Greater than 0
                                            Then - Actions
                                                -------- Make This Unit The New Target --------
                                                Unit Group - Pick every unit in TemporaryGroup[2] and do (Actions)
                                                    Loop - Actions
                                                        Set TemporaryTarget = (Picked unit)
                                                Custom script: call DestroyGroup (udg_TemporaryGroup[2])
                                                Custom script: call DestroyGroup (udg_TemporaryGroup[1])
                                                Set TemporaryPoint[1] = (Position of (Picked unit))
                                                Set TemporaryPoint[2] = (Position of TemporaryTarget)
                                                -------- New Dummy Unit --------
                                                -------- ----------------------------------------------------------------------------------------------------EDIT UNDER [The Missile Type, which is a unit.] --------
                                                Unit - Create 1 Storm Bolt Missile for (Owner of (Picked unit)) at TemporaryPoint[1] facing TemporaryPoint[2]
                                                -------- ----------------------------------------------------------------------------------------------------EDIT ABOVE [The Missile Type, which is a unit.] --------
                                                Unit Group - Add (Last created unit) to PowerChainGroup
                                                -------- Save Variables --------
                                                Hashtable - Save SpellBounceRange as 0 of (Key (Last created unit)) in PowerChainHash
                                                Hashtable - Save SpellBounceSpeed as 1 of (Key (Last created unit)) in PowerChainHash
                                                Hashtable - Save SpellNumberBounces as 2 of (Key (Last created unit)) in PowerChainHash
                                                Hashtable - Save Handle OfTemporaryTarget as 3 of (Key (Last created unit)) in PowerChainHash
                                                Hashtable - Save (Load 4 of (Key (Picked unit)) from PowerChainHash) as 4 of (Key (Last created unit)) in PowerChainHash
                                                Hashtable - Save SpellMaximumNumberHits as 5 of (Key (Last created unit)) in PowerChainHash
                                                Hashtable - Save (Load 6 of (Key (Picked unit)) from PowerChainHash) as 6 of (Key (Last created unit)) in PowerChainHash
                                                -------- Clean up --------
                                                Custom script: call RemoveLocation (udg_TemporaryPoint[2])
                                                Custom script: call RemoveLocation (udg_TemporaryPoint[1])
                                            Else - Actions
                                                Custom script: call DestroyGroup (udg_TemporaryGroup[2])
                                                Custom script: call DestroyGroup (udg_TemporaryGroup[1])
                                                -------- Clean Up Units That Were Hit --------
                                                Set TemporaryGroup[1] = (Units in (Playable map area) matching ((Load TemporaryKeySpell of (Key (Matching unit)) from PowerChainHash) Not equal to 0))
                                                Unit Group - Pick every unit in TemporaryGroup[1] and do (Actions)
                                                    Loop - Actions
                                                        Hashtable - Save 0 as TemporaryKeySpell of (Key (Picked unit)) in PowerChainHash
                                                Custom script: call DestroyGroup (udg_TemporaryGroup[1])
                                    Else - Actions
                                        -------- Clean Up Units That Were Hit --------
                                        Set TemporaryGroup[1] = (Units in (Playable map area) matching ((Load TemporaryKeySpell of (Key (Matching unit)) from PowerChainHash) Not equal to 0))
                                        Unit Group - Pick every unit in TemporaryGroup[1] and do (Actions)
                                            Loop - Actions
                                                Hashtable - Save 0 as TemporaryKeySpell of (Key (Picked unit)) in PowerChainHash
                                        Custom script: call DestroyGroup (udg_TemporaryGroup[1])
                                -------- Remove Old Dummy Unit --------
                                Unit - Kill (Picked unit)
                                Unit Group - Remove (Picked unit) from PowerChainGroup
                                Hashtable - Clear all child hashtables of child (Key (Picked unit)) in PowerChainHash
                            Else - Actions
                                Custom script: call RemoveLocation (udg_TemporaryPoint[1])
                                Custom script: call RemoveLocation (udg_TemporaryPoint[2])
            Else - Actions
                Trigger - Turn off (This trigger)

My code:
Code:
Chain Spells
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Ability being cast) Equal to Storm Bolt Chain
            Then - Actions
                -------- Setup Variables --------
                Set ChainSpellBounceRange = 400.00
                Set ChainSpellBounceSpeed = 800.00
                Set ChainSpellNumberBounces = (2 + (2 x (Level of Storm Bolt Chain  for (Casting unit))))
                Set ChainSpellMaxNumberHits = 1
                Set ChainSpellTemporaryPoint[1] = (Position of (Casting unit))
                Set ChainSpellTemporaryPoint[2] = (Position of (Target unit of ability being cast))
                -------- Unit --------
                Unit - Create 1 Stormbolt Dummy for (Owner of (Casting unit)) at ChainSpellTemporaryPoint[1] facing ChainSpellTemporaryPoint[2]
                If ((ChainSpellGroup is empty) Equal to True) then do (Trigger - Turn on Chain Spells Loop <gen>) else do (Do nothing)
                Unit Group - Add (Last created unit) to ChainSpellGroup
                -------- Save Variables --------
                Hashtable - Save ChainSpellBounceRange as 0 of (Key (Last created unit)) in ChainSpellHash
                Hashtable - Save ChainSpellBounceSpeed as 1 of (Key (Last created unit)) in ChainSpellHash
                Hashtable - Save ChainSpellNumberBounces as 2 of (Key (Last created unit)) in ChainSpellHash
                Hashtable - Save Handle Of(Target unit of ability being cast) as 3 of (Key (Last created unit)) in ChainSpellHash
                Hashtable - Save (Level of Storm Bolt Chain  for (Casting unit)) as 4 of (Key (Last created unit)) in ChainSpellHash
                Hashtable - Save ChainSpellMaxNumberHits as 5 of (Key (Last created unit)) in ChainSpellHash
                Hashtable - Save (Key (Last created unit)) as 6 of (Key (Last created unit)) in ChainSpellHash
                Hashtable - Save Handle Of(Last created unit) as 7 of (Key (Last created unit)) in ChainSpellHash
                -------- Clean up --------
                Custom script:   call RemoveLocation (udg_ChainSpellTemporaryPoint[1])
                Custom script:   call RemoveLocation (udg_ChainSpellTemporaryPoint[2])
            Else - Actions

Code:
Chain Spells Loop
    Events
        Time - Every 0.03 seconds of game time
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in ChainSpellGroup) Greater than 0
            Then - Actions
                Unit Group - Pick every unit in ChainSpellGroup and do (Actions)
                    Loop - Actions
                        -------- Load Variables --------
                        Set ChainSpellBounceSpeed = (Load 1 of (Key (Picked unit)) from ChainSpellHash)
                        Set ChainSpellNumberBounces = (Load 2 of (Key (Picked unit)) from ChainSpellHash)
                        Set ChainSpellTemporaryTarget = (Load 3 of (Key (Picked unit)) in ChainSpellHash)
                        Set ChainSpellTemporaryKeyTarget = (Load 3 of (Key (Picked unit)) in ChainSpellHash)
                        Set ChainSpellTemporaryKeySpell = (Load 6 of (Key (Picked unit)) from ChainSpellHash)
                        -------- Special effect Move --------
                        Set ChainSpellTemporaryPoint[1] = (Position of (Picked unit))
                        Set ChainSpellTemporaryPoint[2] = (Position of ChainSpellTemporaryTarget)
                        Set ChainSpellTemporaryPoint[3] = (ChainSpellTemporaryPoint[1] offset by (0.02 x ChainSpellBounceSpeed) towards (Angle from ChainSpellTemporaryPoint[1] to ChainSpellTemporaryPoint[2]) degrees)
                        Unit - Move (Picked unit) instantly to ChainSpellTemporaryPoint[3], facing ChainSpellTemporaryPoint[2]
                        Custom script:   call RemoveLocation (udg_ChainSpellTemporaryPoint[3])
                        Custom script:   call RemoveLocation (udg_ChainSpellTemporaryPoint[1])
                        Set ChainSpellTemporaryPoint[1] = (Position of (Picked unit))
                        -------- Collision of Unit and Bounceing Missile --------
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Distance between ChainSpellTemporaryPoint[1] and ChainSpellTemporaryPoint[2]) Less than or equal to (ChainSpellBounceSpeed / 70.00)
                            Then - Actions
                                Custom script:   call RemoveLocation (udg_ChainSpellTemporaryPoint[1])
                                Custom script:   call RemoveLocation (udg_ChainSpellTemporaryPoint[2])
                                -------- Spell hit --------
                                Set ChainSpellTemporaryPoint[1] = (Position of ChainSpellTemporaryTarget)
                                Unit - Create 1 Dummy for (Owner of (Picked unit)) at ChainSpellTemporaryPoint[1] facing Default building facing degrees
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        (Unit-type of (Load 7 of (Key (Picked unit)) in ChainSpellHash)) Equal to Stormbolt Dummy
                                    Then - Actions
                                        Unit - Add Storm Bolt - tauren  to (Last created unit)
                                        Unit - Set level of Storm Bolt - tauren  for (Last created unit) to (Load 4 of (Key (Picked unit)) from ChainSpellHash)
                                        Unit - Order (Last created unit) to Human Mountain King - Storm Bolt ChainSpellTemporaryTarget
                                    Else - Actions
                                Unit - Add a 0.10 second Generic expiration timer to (Last created unit)
                                Custom script:   call RemoveLocation (udg_ChainSpellTemporaryPoint[1])
                                -------- Save Varables on target unit --------
                                Hashtable - Save ((Load ChainSpellTemporaryKeySpell of (Key ChainSpellTemporaryKeyTarget) from ChainSpellHash) + 1) as ChainSpellTemporaryKeySpell of (Key ChainSpellTemporaryKeyTarget) in ChainSpellHash
                                Set ChainSpellNumberBounces = (ChainSpellNumberBounces - 1)
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        ChainSpellNumberBounces Greater than 0
                                    Then - Actions
                                        -------- Load Varables --------
                                        Set ChainSpellMaxNumberHits = (Load 5 of (Key (Picked unit)) from ChainSpellHash)
                                        Set ChainSpellBounceRange = (Load 0 of (Key (Picked unit)) from ChainSpellHash)
                                        -------- SPELLEFFECT --------
                                        Set ChainSpellTemporaryGroup[1] = (Units within ChainSpellBounceRange of (Position of (Picked unit)) matching (((((Matching unit) is alive) Equal to True) and ((((Matching unit) is A structure) Equal to False) and (ChainSpellMaxNumberHits Greater than (Load ChainSpellTemporaryKeySpell of (Key
                                        Set ChainSpellTemporaryGroup[2] = (Random 1 units from ChainSpellTemporaryGroup[1])
                                        -------- New Unit to bounce to Found --------
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                (Number of units in ChainSpellTemporaryGroup[2]) Greater than 0
                                            Then - Actions
                                                -------- Make this unit the new target --------
                                                Unit Group - Pick every unit in ChainSpellTemporaryGroup[2] and do (Actions)
                                                    Loop - Actions
                                                        Set ChainSpellTemporaryTarget = (Picked unit)
                                                Custom script:   call DestroyGroup (udg_ChainSpellTemporaryGroup[2])
                                                Custom script:   call DestroyGroup (udg_ChainSpellTemporaryGroup[1])
                                                Set ChainSpellTemporaryPoint[1] = (Position of (Picked unit))
                                                Set ChainSpellTemporaryPoint[2] = (Position of ChainSpellTemporaryTarget)
                                                -------- New Dummy Unit ( Edit The Missile Type, which is a unit.) --------
                                                Unit - Create 1 (Unit-type of (Load 7 of (Key (Picked unit)) in ChainSpellHash)) for (Owner of (Picked unit)) at ChainSpellTemporaryPoint[1] facing ChainSpellTemporaryPoint[2]
                                                Unit Group - Add (Last created unit) to ChainSpellGroup
                                                -------- Save Variables --------
                                                Hashtable - Save ChainSpellBounceRange as 0 of (Key (Last created unit)) in ChainSpellHash
                                                Hashtable - Save ChainSpellBounceSpeed as 1 of (Key (Last created unit)) in ChainSpellHash
                                                Hashtable - Save ChainSpellNumberBounces as 2 of (Key (Last created unit)) in ChainSpellHash
                                                Hashtable - Save Handle OfChainSpellTemporaryTarget as 3 of (Key (Last created unit)) in ChainSpellHash
                                                Hashtable - Save (Load 4 of (Key (Picked unit)) from ChainSpellHash) as 4 of (Key (Last created unit)) in ChainSpellHash
                                                Hashtable - Save ChainSpellMaxNumberHits as 5 of (Key (Last created unit)) in ChainSpellHash
                                                Hashtable - Save (Load 6 of (Key (Picked unit)) from ChainSpellHash) as 6 of (Key (Last created unit)) in ChainSpellHash
                                                Hashtable - Save Handle Of(Load 7 of (Key (Picked unit)) in ChainSpellHash) as 7 of (Key (Last created unit)) in ChainSpellHash
                                                -------- Clean up --------
                                                Custom script:   call RemoveLocation (udg_ChainSpellTemporaryPoint[2])
                                                Custom script:   call RemoveLocation (udg_ChainSpellTemporaryPoint[1])
                                            Else - Actions
                                                Custom script:   call RemoveLocation (udg_ChainSpellTemporaryPoint[2])
                                                Custom script:   call RemoveLocation (udg_ChainSpellTemporaryPoint[1])
                                                -------- Clean up Units that were hit --------
                                                Set ChainSpellTemporaryGroup[1] = (Units in (Playable map area) matching ((Load ChainSpellTemporaryKeySpell of (Key (Matching unit)) from ChainSpellHash) Not equal to 0))
                                                Unit Group - Pick every unit in ChainSpellTemporaryGroup[1] and do (Actions)
                                                    Loop - Actions
                                                        Hashtable - Save 0 as ChainSpellTemporaryKeySpell of (Key (Picked unit)) in ChainSpellHash
                                                Custom script:   call DestroyGroup (udg_ChainSpellTemporaryGroup[1])
                                    Else - Actions
                                        -------- Clean up Units that were hit --------
                                        Set ChainSpellTemporaryGroup[1] = (Units in (Playable map area) matching ((Load ChainSpellTemporaryKeySpell of (Key (Matching unit)) from ChainSpellHash) Not equal to 0))
                                        Unit Group - Pick every unit in ChainSpellTemporaryGroup[1] and do (Actions)
                                            Loop - Actions
                                                Hashtable - Save 0 as ChainSpellTemporaryKeySpell of (Key (Picked unit)) in ChainSpellHash
                                        Custom script:   call DestroyGroup (udg_ChainSpellTemporaryGroup[1])
                                -------- Remove old Dummy --------
                                Unit - Kill (Picked unit)
                                Unit Group - Remove (Picked unit) from ChainSpellGroup
                                Hashtable - Clear all child hashtables of child (Key (Picked unit)) in ChainSpellHash
                            Else - Actions
                                Custom script:   call RemoveLocation (udg_ChainSpellTemporaryPoint[1])
                                Custom script:   call RemoveLocation (udg_ChainSpellTemporaryPoint[2])
            Else - Actions
                Trigger - Turn off (This trigger)

Thanks for your time.
 
Level 24
Joined
Feb 9, 2009
Messages
1,787
How To Post Your Trigger

Also might have better result posting the trigger in the original test map along with the working one.

Original Cast
  • Chain Storm Bolt Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Chain Storm Bolt
    • Actions
      • -------- Setup Variables --------
      • -------- ----------------------------------------------------------------------------------------------------EDIT UNDER [Missile Speed, Bounce Range, Number of Bounces and how many times the same unit may be hit during one chain.] --------
      • Set SpellBounceRange = 400.00
      • Set SpellBounceSpeed = 800.00
      • Set SpellNumberBounces = (2 + (2 x (Level of Chain Storm Bolt for (Casting unit))))
      • Set SpellMaximumNumberHits = 1
      • -------- ----------------------------------------------------------------------------------------------------EDIT ABOVE [Missile Speed, Bounce Range, Number of Bounces and how many times the same unit may be hit during one chain.] --------
      • -------- Spell Effect Create Dummy Unit With Model --------
      • Set TemporaryPoint[1] = (Position of (Casting unit))
      • Set TemporaryPoint[2] = (Position of (Target unit of ability being cast))
      • -------- ----------------------------------------------------------------------------------------------------EDIT UNDER [The Missile Type, which is a unit.] --------
      • Unit - Create 1 Storm Bolt Missile for (Owner of (Casting unit)) at TemporaryPoint[1] facing TemporaryPoint[2]
      • -------- ----------------------------------------------------------------------------------------------------EDIT ABOVE [The Missile Type, which is a unit.] --------
      • -------- ----------------------------------------------------------------------------------------------------EDIT UNDER [Select the right Loop Trigger.] --------
      • If ((PowerChainGroup is empty) Equal to True) then do (Trigger - Turn on Chain Storm Bolt Loop <gen>) else do (Do nothing)
      • -------- ----------------------------------------------------------------------------------------------------EDIT ABOVE [Select the right Loop Trigger.] --------
      • Unit Group - Add (Last created unit) to PowerChainGroup
      • -------- Save Variables --------
      • Hashtable - Save SpellBounceRange as 0 of (Key (Last created unit)) in PowerChainHash
      • Hashtable - Save SpellBounceSpeed as 1 of (Key (Last created unit)) in PowerChainHash
      • Hashtable - Save SpellNumberBounces as 2 of (Key (Last created unit)) in PowerChainHash
      • Hashtable - Save Handle Of(Target unit of ability being cast) as 3 of (Key (Last created unit)) in PowerChainHash
      • Hashtable - Save (Level of Chain Storm Bolt for (Casting unit)) as 4 of (Key (Last created unit)) in PowerChainHash
      • Hashtable - Save SpellMaximumNumberHits as 5 of (Key (Last created unit)) in PowerChainHash
      • Hashtable - Save (Key (Last created unit)) as 6 of (Key (Last created unit)) in PowerChainHash
      • -------- Clean up --------
      • Custom script: call RemoveLocation (udg_TemporaryPoint[2])
      • Custom script: call RemoveLocation (udg_TemporaryPoint[1])

Original Periodic
  • Chain Storm Bolt Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in PowerChainGroup) Greater than 0
        • Then - Actions
          • Unit Group - Pick every unit in PowerChainGroup and do (Actions)
            • Loop - Actions
              • -------- Load Variables --------
              • Set SpellBounceSpeed = (Load 1 of (Key (Picked unit)) from PowerChainHash)
              • Set SpellNumberBounces = (Load 2 of (Key (Picked unit)) from PowerChainHash)
              • Set TemporaryTarget = (Load 3 of (Key (Picked unit)) in PowerChainHash)
              • Set TemporaryKeyTarget = (Load 3 of (Key (Picked unit)) in PowerChainHash)
              • Set TemporaryKeySpell = (Load 6 of (Key (Picked unit)) from PowerChainHash)
              • -------- Spell Effect Move Bouncing Missile --------
              • Set TemporaryPoint[1] = (Position of (Picked unit))
              • Set TemporaryPoint[2] = (Position of TemporaryTarget)
              • Set TemporaryPoint[3] = (TemporaryPoint[1] offset by (0.02 x SpellBounceSpeed) towards (Angle from TemporaryPoint[1] to TemporaryPoint[2]) degrees)
              • Unit - Move (Picked unit) instantly to TemporaryPoint[3], facing TemporaryPoint[2]
              • Custom script: call RemoveLocation (udg_TemporaryPoint[3])
              • Custom script: call RemoveLocation (udg_TemporaryPoint[1])
              • Set TemporaryPoint[1] = (Position of (Picked unit))
              • -------- Collision Of Unit And Bouncing Missile --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Distance between TemporaryPoint[1] and TemporaryPoint[2]) Less than or equal to (SpellBounceSpeed / 70.00)
                • Then - Actions
                  • Custom script: call RemoveLocation (udg_TemporaryPoint[1])
                  • Custom script: call RemoveLocation (udg_TemporaryPoint[2])
                  • -------- Spell Hit --------
                  • Set TemporaryPoint[1] = (Position of TemporaryTarget)
                  • Unit - Create 1 Caster for (Owner of (Picked unit)) at TemporaryPoint[1] facing TemporaryPoint[1]
                  • Unit - Add Storm Bolt (Dummy Spell) to (Last created unit)
                  • -------- ----------------------------------------------------------------------------------------------------EDIT UNDER [Ability casted against every unit in the chain, and the right cast order.] --------
                  • Unit - Set level of Storm Bolt (Dummy Spell) for (Last created unit) to (Load 4 of (Key (Picked unit)) from PowerChainHash)
                  • Unit - Order (Last created unit) to Neutral - Firebolt TemporaryTarget
                  • -------- ----------------------------------------------------------------------------------------------------EDIT ABOVE [Ability casted against every unit in the chain, and the right cast order.] --------
                  • Unit - Add a 0.10 second Generic expiration timer to (Last created unit)
                  • Custom script: call RemoveLocation (udg_TemporaryPoint[1])
                  • -------- Save Variables On Target Unit --------
                  • Hashtable - Save ((Load TemporaryKeySpell of (Key TemporaryKeyTarget) from PowerChainHash) + 1) as TemporaryKeySpell of (Key TemporaryKeyTarget) in PowerChainHash
                  • -------- Decrease Bounces --------
                  • Set SpellNumberBounces = (SpellNumberBounces - 1)
                  • -------- Bounce On When More Units Can Be Hit --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • SpellNumberBounces Greater than 0
                    • Then - Actions
                      • -------- Load Variables --------
                      • Set SpellMaximumNumberHits = (Load 5 of (Key (Picked unit)) from PowerChainHash)
                      • Set SpellBounceRange = (Load 0 of (Key (Picked unit)) from PowerChainHash)
                      • -------- Spell Effect --------
                      • -------- ----------------------------------------------------------------------------------------------------EDIT UNDER [The conditions that a unit must meet to be aquired as the next target] --------
                      • Set TemporaryGroup[1] = (Units within SpellBounceRange of (Position of (Picked unit)) matching (((((Matching unit) is alive) Equal to True) and ((((Matching unit) is A structure) Equal to False) and (SpellMaximumNumberHits Greater than (Load TemporaryKeySpell of (Key (Matching unit)
                      • -------- ----------------------------------------------------------------------------------------------------EDIT ABOVE [The conditions that a unit must meet to be aquired as the next target] --------
                      • Set TemporaryGroup[2] = (Random 1 units from TemporaryGroup[1])
                      • -------- New Unit To Bounce To Found --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in TemporaryGroup[2]) Greater than 0
                        • Then - Actions
                          • -------- Make This Unit The New Target --------
                          • Unit Group - Pick every unit in TemporaryGroup[2] and do (Actions)
                            • Loop - Actions
                              • Set TemporaryTarget = (Picked unit)
                          • Custom script: call DestroyGroup (udg_TemporaryGroup[2])
                          • Custom script: call DestroyGroup (udg_TemporaryGroup[1])
                          • Set TemporaryPoint[1] = (Position of (Picked unit))
                          • Set TemporaryPoint[2] = (Position of TemporaryTarget)
                          • -------- New Dummy Unit --------
                          • -------- ----------------------------------------------------------------------------------------------------EDIT UNDER [The Missile Type, which is a unit.] --------
                          • Unit - Create 1 Storm Bolt Missile for (Owner of (Picked unit)) at TemporaryPoint[1] facing TemporaryPoint[2]
                          • -------- ----------------------------------------------------------------------------------------------------EDIT ABOVE [The Missile Type, which is a unit.] --------
                          • Unit Group - Add (Last created unit) to PowerChainGroup
                          • -------- Save Variables --------
                          • Hashtable - Save SpellBounceRange as 0 of (Key (Last created unit)) in PowerChainHash
                          • Hashtable - Save SpellBounceSpeed as 1 of (Key (Last created unit)) in PowerChainHash
                          • Hashtable - Save SpellNumberBounces as 2 of (Key (Last created unit)) in PowerChainHash
                          • Hashtable - Save Handle OfTemporaryTarget as 3 of (Key (Last created unit)) in PowerChainHash
                          • Hashtable - Save (Load 4 of (Key (Picked unit)) from PowerChainHash) as 4 of (Key (Last created unit)) in PowerChainHash
                          • Hashtable - Save SpellMaximumNumberHits as 5 of (Key (Last created unit)) in PowerChainHash
                          • Hashtable - Save (Load 6 of (Key (Picked unit)) from PowerChainHash) as 6 of (Key (Last created unit)) in PowerChainHash
                          • -------- Clean up --------
                          • Custom script: call RemoveLocation (udg_TemporaryPoint[2])
                          • Custom script: call RemoveLocation (udg_TemporaryPoint[1])
                        • Else - Actions
                          • Custom script: call DestroyGroup (udg_TemporaryGroup[2])
                          • Custom script: call DestroyGroup (udg_TemporaryGroup[1])
                          • -------- Clean Up Units That Were Hit --------
                          • Set TemporaryGroup[1] = (Units in (Playable map area) matching ((Load TemporaryKeySpell of (Key (Matching unit)) from PowerChainHash) Not equal to 0))
                          • Unit Group - Pick every unit in TemporaryGroup[1] and do (Actions)
                            • Loop - Actions
                              • Hashtable - Save 0 as TemporaryKeySpell of (Key (Picked unit)) in PowerChainHash
                          • Custom script: call DestroyGroup (udg_TemporaryGroup[1])
                    • Else - Actions
                      • -------- Clean Up Units That Were Hit --------
                      • Set TemporaryGroup[1] = (Units in (Playable map area) matching ((Load TemporaryKeySpell of (Key (Matching unit)) from PowerChainHash) Not equal to 0))
                      • Unit Group - Pick every unit in TemporaryGroup[1] and do (Actions)
                        • Loop - Actions
                          • Hashtable - Save 0 as TemporaryKeySpell of (Key (Picked unit)) in PowerChainHash
                      • Custom script: call DestroyGroup (udg_TemporaryGroup[1])
                  • -------- Remove Old Dummy Unit --------
                  • Unit - Kill (Picked unit)
                  • Unit Group - Remove (Picked unit) from PowerChainGroup
                  • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in PowerChainHash
                • Else - Actions
                  • Custom script: call RemoveLocation (udg_TemporaryPoint[1])
                  • Custom script: call RemoveLocation (udg_TemporaryPoint[2])
        • Else - Actions
          • Trigger - Turn off (This trigger)

Smilis Cast
  • Chain Spells
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Storm Bolt Chain
        • Then - Actions
          • -------- Setup Variables --------
          • Set ChainSpellBounceRange = 400.00
          • Set ChainSpellBounceSpeed = 800.00
          • Set ChainSpellNumberBounces = (2 + (2 x (Level of Storm Bolt Chain for (Casting unit))))
          • Set ChainSpellMaxNumberHits = 1
          • Set ChainSpellTemporaryPoint[1] = (Position of (Casting unit))
          • Set ChainSpellTemporaryPoint[2] = (Position of (Target unit of ability being cast))
          • -------- Unit --------
          • Unit - Create 1 Stormbolt Dummy for (Owner of (Casting unit)) at ChainSpellTemporaryPoint[1] facing ChainSpellTemporaryPoint[2]
          • If ((ChainSpellGroup is empty) Equal to True) then do (Trigger - Turn on Chain Spells Loop <gen>) else do (Do nothing)
          • Unit Group - Add (Last created unit) to ChainSpellGroup
          • -------- Save Variables --------
          • Hashtable - Save ChainSpellBounceRange as 0 of (Key (Last created unit)) in ChainSpellHash
          • Hashtable - Save ChainSpellBounceSpeed as 1 of (Key (Last created unit)) in ChainSpellHash
          • Hashtable - Save ChainSpellNumberBounces as 2 of (Key (Last created unit)) in ChainSpellHash
          • Hashtable - Save Handle Of(Target unit of ability being cast) as 3 of (Key (Last created unit)) in ChainSpellHash
          • Hashtable - Save (Level of Storm Bolt Chain for (Casting unit)) as 4 of (Key (Last created unit)) in ChainSpellHash
          • Hashtable - Save ChainSpellMaxNumberHits as 5 of (Key (Last created unit)) in ChainSpellHash
          • Hashtable - Save (Key (Last created unit)) as 6 of (Key (Last created unit)) in ChainSpellHash
          • Hashtable - Save Handle Of(Last created unit) as 7 of (Key (Last created unit)) in ChainSpellHash
          • -------- Clean up --------
          • Custom script: call RemoveLocation (udg_ChainSpellTemporaryPoint[1])
          • Custom script: call RemoveLocation (udg_ChainSpellTemporaryPoint[2])
        • Else - Actions

Smilis Periodic
  • Chain Spells Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in ChainSpellGroup) Greater than 0
        • Then - Actions
          • Unit Group - Pick every unit in ChainSpellGroup and do (Actions)
            • Loop - Actions
              • -------- Load Variables --------
              • Set ChainSpellBounceSpeed = (Load 1 of (Key (Picked unit)) from ChainSpellHash)
              • Set ChainSpellNumberBounces = (Load 2 of (Key (Picked unit)) from ChainSpellHash)
              • Set ChainSpellTemporaryTarget = (Load 3 of (Key (Picked unit)) in ChainSpellHash)
              • Set ChainSpellTemporaryKeyTarget = (Load 3 of (Key (Picked unit)) in ChainSpellHash)
              • Set ChainSpellTemporaryKeySpell = (Load 6 of (Key (Picked unit)) from ChainSpellHash)
              • -------- Special effect Move --------
              • Set ChainSpellTemporaryPoint[1] = (Position of (Picked unit))
              • Set ChainSpellTemporaryPoint[2] = (Position of ChainSpellTemporaryTarget)
              • Set ChainSpellTemporaryPoint[3] = (ChainSpellTemporaryPoint[1] offset by (0.02 x ChainSpellBounceSpeed) towards (Angle from ChainSpellTemporaryPoint[1] to ChainSpellTemporaryPoint[2]) degrees)
              • Unit - Move (Picked unit) instantly to ChainSpellTemporaryPoint[3], facing ChainSpellTemporaryPoint[2]
              • Custom script: call RemoveLocation (udg_ChainSpellTemporaryPoint[3])
              • Custom script: call RemoveLocation (udg_ChainSpellTemporaryPoint[1])
              • Set ChainSpellTemporaryPoint[1] = (Position of (Picked unit))
              • -------- Collision of Unit and Bounceing Missile --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Distance between ChainSpellTemporaryPoint[1] and ChainSpellTemporaryPoint[2]) Less than or equal to (ChainSpellBounceSpeed / 70.00)
                • Then - Actions
                  • Custom script: call RemoveLocation (udg_ChainSpellTemporaryPoint[1])
                  • Custom script: call RemoveLocation (udg_ChainSpellTemporaryPoint[2])
                  • -------- Spell hit --------
                  • Set ChainSpellTemporaryPoint[1] = (Position of ChainSpellTemporaryTarget)
                  • Unit - Create 1 Dummy for (Owner of (Picked unit)) at ChainSpellTemporaryPoint[1] facing Default building facing degrees
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Load 7 of (Key (Picked unit)) in ChainSpellHash)) Equal to Stormbolt Dummy
                    • Then - Actions
                      • Unit - Add Storm Bolt - tauren to (Last created unit)
                      • Unit - Set level of Storm Bolt - tauren for (Last created unit) to (Load 4 of (Key (Picked unit)) from ChainSpellHash)
                      • Unit - Order (Last created unit) to Human Mountain King - Storm Bolt ChainSpellTemporaryTarget
                    • Else - Actions
                  • Unit - Add a 0.10 second Generic expiration timer to (Last created unit)
                  • Custom script: call RemoveLocation (udg_ChainSpellTemporaryPoint[1])
                  • -------- Save Varables on target unit --------
                  • Hashtable - Save ((Load ChainSpellTemporaryKeySpell of (Key ChainSpellTemporaryKeyTarget) from ChainSpellHash) + 1) as ChainSpellTemporaryKeySpell of (Key ChainSpellTemporaryKeyTarget) in ChainSpellHash
                  • Set ChainSpellNumberBounces = (ChainSpellNumberBounces - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ChainSpellNumberBounces Greater than 0
                    • Then - Actions
                      • -------- Load Varables --------
                      • Set ChainSpellMaxNumberHits = (Load 5 of (Key (Picked unit)) from ChainSpellHash)
                      • Set ChainSpellBounceRange = (Load 0 of (Key (Picked unit)) from ChainSpellHash)
                      • -------- SPELLEFFECT --------
                      • Set ChainSpellTemporaryGroup[1] = (Units within ChainSpellBounceRange of (Position of (Picked unit)) matching (((((Matching unit) is alive) Equal to True) and ((((Matching unit) is A structure) Equal to False) and (ChainSpellMaxNumberHits Greater than (Load ChainSpellTemporaryKeySpell of (Key
                      • Set ChainSpellTemporaryGroup[2] = (Random 1 units from ChainSpellTemporaryGroup[1])
                      • -------- New Unit to bounce to Found --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in ChainSpellTemporaryGroup[2]) Greater than 0
                        • Then - Actions
                          • -------- Make this unit the new target --------
                          • Unit Group - Pick every unit in ChainSpellTemporaryGroup[2] and do (Actions)
                            • Loop - Actions
                              • Set ChainSpellTemporaryTarget = (Picked unit)
                          • Custom script: call DestroyGroup (udg_ChainSpellTemporaryGroup[2])
                          • Custom script: call DestroyGroup (udg_ChainSpellTemporaryGroup[1])
                          • Set ChainSpellTemporaryPoint[1] = (Position of (Picked unit))
                          • Set ChainSpellTemporaryPoint[2] = (Position of ChainSpellTemporaryTarget)
                          • -------- New Dummy Unit ( Edit The Missile Type, which is a unit.) --------
                          • Unit - Create 1 (Unit-type of (Load 7 of (Key (Picked unit)) in ChainSpellHash)) for (Owner of (Picked unit)) at ChainSpellTemporaryPoint[1] facing ChainSpellTemporaryPoint[2]
                          • Unit Group - Add (Last created unit) to ChainSpellGroup
                          • -------- Save Variables --------
                          • Hashtable - Save ChainSpellBounceRange as 0 of (Key (Last created unit)) in ChainSpellHash
                          • Hashtable - Save ChainSpellBounceSpeed as 1 of (Key (Last created unit)) in ChainSpellHash
                          • Hashtable - Save ChainSpellNumberBounces as 2 of (Key (Last created unit)) in ChainSpellHash
                          • Hashtable - Save Handle OfChainSpellTemporaryTarget as 3 of (Key (Last created unit)) in ChainSpellHash
                          • Hashtable - Save (Load 4 of (Key (Picked unit)) from ChainSpellHash) as 4 of (Key (Last created unit)) in ChainSpellHash
                          • Hashtable - Save ChainSpellMaxNumberHits as 5 of (Key (Last created unit)) in ChainSpellHash
                          • Hashtable - Save (Load 6 of (Key (Picked unit)) from ChainSpellHash) as 6 of (Key (Last created unit)) in ChainSpellHash
                          • Hashtable - Save Handle Of(Load 7 of (Key (Picked unit)) in ChainSpellHash) as 7 of (Key (Last created unit)) in ChainSpellHash
                          • -------- Clean up --------
                          • Custom script: call RemoveLocation (udg_ChainSpellTemporaryPoint[2])
                          • Custom script: call RemoveLocation (udg_ChainSpellTemporaryPoint[1])
                        • Else - Actions
                          • Custom script: call RemoveLocation (udg_ChainSpellTemporaryPoint[2])
                          • Custom script: call RemoveLocation (udg_ChainSpellTemporaryPoint[1])
                          • -------- Clean up Units that were hit --------
                          • Set ChainSpellTemporaryGroup[1] = (Units in (Playable map area) matching ((Load ChainSpellTemporaryKeySpell of (Key (Matching unit)) from ChainSpellHash) Not equal to 0))
                          • Unit Group - Pick every unit in ChainSpellTemporaryGroup[1] and do (Actions)
                            • Loop - Actions
                              • Hashtable - Save 0 as ChainSpellTemporaryKeySpell of (Key (Picked unit)) in ChainSpellHash
                          • Custom script: call DestroyGroup (udg_ChainSpellTemporaryGroup[1])
                    • Else - Actions
                      • -------- Clean up Units that were hit --------
                      • Set ChainSpellTemporaryGroup[1] = (Units in (Playable map area) matching ((Load ChainSpellTemporaryKeySpell of (Key (Matching unit)) from ChainSpellHash) Not equal to 0))
                      • Unit Group - Pick every unit in ChainSpellTemporaryGroup[1] and do (Actions)
                        • Loop - Actions
                          • Hashtable - Save 0 as ChainSpellTemporaryKeySpell of (Key (Picked unit)) in ChainSpellHash
                      • Custom script: call DestroyGroup (udg_ChainSpellTemporaryGroup[1])
                  • -------- Remove old Dummy --------
                  • Unit - Kill (Picked unit)
                  • Unit Group - Remove (Picked unit) from ChainSpellGroup
                  • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in ChainSpellHash
                • Else - Actions
                  • Custom script: call RemoveLocation (udg_ChainSpellTemporaryPoint[1])
                  • Custom script: call RemoveLocation (udg_ChainSpellTemporaryPoint[2])
        • Else - Actions
          • Trigger - Turn off (This trigger)
 
Last edited:
Level 2
Joined
Jan 9, 2008
Messages
19
Ah! Sorry, didn't see the BB-code (bc unlogical to have them seperated from other codes).

Problem is that I've tried it in the original testmap, where it works, while in my custom map it dosn't.
I guess I've missed something, but I have read through the whole code more then ten times trying to find it. :(
 
Level 24
Joined
Feb 9, 2009
Messages
1,787
Is this a direct copy of your spell?
As this shows up in the first cast of your spell:

  • Hashtable - Save (Level of Unknown (A014) for (Casting unit)) as 4 of (Key (Last created unit)) in ChainSpellHash

Second in the periodic trigger the dummy's set level is attempting to set the level of the hero ability
  • Unit - Set level of HERO SPELL for (Last created unit) to (Load 4 of (Key (Picked unit)) from ChainSpellHash)
other than that I can it looks fine, this is really mind numbing!


AHA-HA-HA-HA!
  • Set ChainSpellTemporaryKeyTarget = (Load 3 of (Key (Picked unit)) in SMILIS)
THIS LITTLE DEVIL IS ACTUALLY:

Screenshot_16.png

WHEN IT SHOULD BE:
Screenshot_15.png


 
Last edited:
Status
Not open for further replies.
Top