• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • It's time for the first HD Modeling Contest of 2025. Join the theme discussion for Hive's HD Modeling Contest #7! Click here to post your idea!

Help with chain hex

Status
Not open for further replies.
Level 4
Joined
Nov 18, 2021
Messages
41
Can some1 tell me the issue with my trigger? Sometimes it hexes nothing besides the main target, other times it jumps several times but not to all. It's so random I don't get it.
1638727659235.png


1638727233492.png

1638727415671.png

2 times once it hexes everything, 2nd 1 is left for some reason
 
Last edited:
Level 25
Joined
Feb 9, 2009
Messages
1,798
My nit pick is the group conditions, there's a much easier way to filter, this short and sweet tutorial goes over it.
Can some1 tell me the issue with my trigger? Sometimes it hexes nothing besides the main target, other times it jumps several times but not to all. It's so random I don't get it.
2 times once it hexes everything, 2nd 1 is left for some reason
From what I can see you are selecting the units in the group and telling the dummy to pick one of them and cast it on them.
Lastly (triggering unit) is lost in loops so be sure to tag it with a variable.

Also "Able to attack ground units" condition might be apart of that issue, maybe?
But as @Cheshire says, this won't be a "Chain" visual.

edit: also you need location variables or leaks will bog down your game with nasty memory junk!
  • Example
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Animate Dead
    • Actions
      • Set VariableSet Unit[0] = (Triggering unit)
      • Set VariableSet Point[0] = (Position of (Target unit of ability being cast))
      • Set VariableSet Group = (Units within 1000.00 of Point[0].)
      • Unit - Create 1 Footman for (Owner of Unit[0]) at Point[0] facing Default building facing degrees
      • Set VariableSet Unit[1] = (Last created unit)
      • Unit - Add Hex to (Last created unit)
      • Unit Group - Pick every unit in Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) has buff Hex) Equal to False
              • ((Picked unit) is Magic Immune) Equal to False
              • ((Picked unit) is visible to (Owner of Unit[0]).) Equal to True
            • Then - Actions
              • Unit - Order Unit[1] to Orc Shadow Hunter - Hex (Picked unit)
            • Else - Actions
      • Unit - Add a 0.10 second Generic expiration timer to Unit[1]
      • Unit Group - Remove all units from Group.
      • Custom script: call RemoveLocation(udg_Point[0])
 
Level 4
Joined
Nov 18, 2021
Messages
41
My nit pick is the group conditions, there's a much easier way to filter, this short and sweet tutorial goes over it.

From what I can see you are selecting the units in the group and telling the dummy to pick one of them and cast it on them.
Lastly (triggering unit) is lost in loops so be sure to tag it with a variable.

Also "Able to attack ground units" condition might be apart of that issue, maybe?
But as @Cheshire says, this won't be a "Chain" visual.

edit: also you need location variables or leaks will bog down your game with nasty memory junk!
  • Example
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Animate Dead
    • Actions
      • Set VariableSet Unit[0] = (Triggering unit)
      • Set VariableSet Point[0] = (Position of (Target unit of ability being cast))
      • Set VariableSet Group = (Units within 1000.00 of Point[0].)
      • Unit - Create 1 Footman for (Owner of Unit[0]) at Point[0] facing Default building facing degrees
      • Set VariableSet Unit[1] = (Last created unit)
      • Unit - Add Hex to (Last created unit)
      • Unit Group - Pick every unit in Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) has buff Hex) Equal to False
              • ((Picked unit) is Magic Immune) Equal to False
              • ((Picked unit) is visible to (Owner of Unit[0]).) Equal to True
            • Then - Actions
              • Unit - Order Unit[1] to Orc Shadow Hunter - Hex (Picked unit)
            • Else - Actions
      • Unit - Add a 0.10 second Generic expiration timer to Unit[1]
      • Unit Group - Remove all units from Group.
      • Custom script: call RemoveLocation(udg_Point[0])
this is aoe not chain hex. I plan to limit it to 5 jumps with each jump per 0.25 seconds (by adding casting time to dummy target) and it will jump to a random target within small radius from previous target every time. Just to test it I expanded the range to 1000 and removed limiter in op-pic
As for triggering unit it is not lost and theoretically working as intended. First it is the casting hero, then it is a dummy target
 
Level 25
Joined
Mar 29, 2020
Messages
1,465
I kind of liked the idea of making a chain spell recursively without needing to use unit indexing etc. I was lazy and didn't remove leaks. basically this just uses a unique type of dummy who's expiration timer provides the "wait" between chain jumps:

  • createDummy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Chain Hex
    • Actions
      • Set VariableSet tempoint = (Position of (Target unit of ability being cast))
      • Set VariableSet TempPlayer = (Owner of (Triggering unit))
      • Unit - Create 1 dying dummy for TempPlayer at tempoint facing Default building facing degrees
      • Unit - Add a 0.10 second Generic expiration timer to (Last created unit)
  • fire hex
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to dying dummy
    • Actions
      • Game - Display to (All players) the text: unit died
      • Set VariableSet tempoint = (Position of (Dying unit))
      • Set VariableSet AllInRange = (Units within 500.00 of tempoint.)
      • Unit Group - Remove all units from HexTargets.
      • Unit Group - Pick every unit in AllInRange and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) belongs to an enemy of (Owner of (Dying unit)).) Equal to True
              • (Unit-type of (Picked unit)) Not equal to dummy
              • (Unit-type of (Picked unit)) Not equal to dying dummy
              • ((Picked unit) has buff Hex) Equal to False
            • Then - Actions
              • Unit Group - Add (Picked unit) to HexTargets
            • Else - Actions
      • Set VariableSet TempUnit = (Random unit from HexTargets)
      • Unit - Create 1 dummy for (Owner of (Triggering unit)) at tempoint facing Default building facing degrees
      • Set VariableSet DummyCaster = (Last created unit)
      • Unit - Add a 1.00 second Generic expiration timer to DummyCaster
      • Unit - Add Chain Hex to DummyCaster
      • Unit - Set level of Chain Hex for DummyCaster to (Level of Chain Hex for (Triggering unit))
      • Unit - Order DummyCaster to Orc Shadow Hunter - Hex TempUnit
 
Level 4
Joined
Nov 18, 2021
Messages
41
I kind of liked the idea of making a chain spell recursively without needing to use unit indexing etc. I was lazy and didn't remove leaks. basically this just uses a unique type of dummy who's expiration timer provides the "wait" between chain jumps:

  • createDummy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Chain Hex
    • Actions
      • Set VariableSet tempoint = (Position of (Target unit of ability being cast))
      • Set VariableSet TempPlayer = (Owner of (Triggering unit))
      • Unit - Create 1 dying dummy for TempPlayer at tempoint facing Default building facing degrees
      • Unit - Add a 0.10 second Generic expiration timer to (Last created unit)
  • fire hex
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to dying dummy
    • Actions
      • Game - Display to (All players) the text: unit died
      • Set VariableSet tempoint = (Position of (Dying unit))
      • Set VariableSet AllInRange = (Units within 500.00 of tempoint.)
      • Unit Group - Remove all units from HexTargets.
      • Unit Group - Pick every unit in AllInRange and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) belongs to an enemy of (Owner of (Dying unit)).) Equal to True
              • (Unit-type of (Picked unit)) Not equal to dummy
              • (Unit-type of (Picked unit)) Not equal to dying dummy
              • ((Picked unit) has buff Hex) Equal to False
            • Then - Actions
              • Unit Group - Add (Picked unit) to HexTargets
            • Else - Actions
      • Set VariableSet TempUnit = (Random unit from HexTargets)
      • Unit - Create 1 dummy for (Owner of (Triggering unit)) at tempoint facing Default building facing degrees
      • Set VariableSet DummyCaster = (Last created unit)
      • Unit - Add a 1.00 second Generic expiration timer to DummyCaster
      • Unit - Add Chain Hex to DummyCaster
      • Unit - Set level of Chain Hex for DummyCaster to (Level of Chain Hex for (Triggering unit))
      • Unit - Order DummyCaster to Orc Shadow Hunter - Hex TempUnit
you forgot to remove wards, invisible, fogged and buildings from hex targets
 

Uncle

Warcraft Moderator
Level 71
Joined
Aug 10, 2018
Messages
7,530
Here's my take :D

  • Cast Chain Hex
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Chain Hex
    • Actions
      • Set VariableSet CH_Index = (CH_Index + 1)
      • Set VariableSet CH_Duration[CH_Index] = 0
      • Set VariableSet CH_Bounces[CH_Index] = 0
      • Set VariableSet CH_Target[CH_Index] = (Target unit of ability being cast)
      • -------- --------
      • -------- Create the Unit Group that keeps track of units already hexed by this instance of the spell: --------
      • Custom script: set udg_CH_WasHit[udg_CH_Index] = CreateGroup()
      • -------- --------
      • -------- Create the Dummy that will cast Hex: --------
      • Set VariableSet CH_PointA = (Position of CH_Target[CH_Index])
      • Unit - Create 1 Dummy for (Triggering player) at CH_PointA facing Default building facing degrees
      • Custom script: call RemoveLocation (udg_CH_PointA)
      • Set VariableSet CH_Dummy[CH_Index] = (Last created unit)
      • Unit - Add Hex (Dummy) to CH_Dummy[CH_Index]
      • Unit - Order CH_Dummy[CH_Index] to Orc Shadow Hunter - Hex CH_Target[CH_Index]
      • Unit Group - Add CH_Target[CH_Index] to CH_WasHit[CH_Index]
      • -------- --------
      • -------- Start the timer if it's not already on: --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CH_Index Equal to 1
        • Then - Actions
          • Countdown Timer - Start CH_Timer as a Repeating timer that will expire in 0.05 seconds
        • Else - Actions
  • Chain Hex Loop
    • Events
      • Time - CH_Timer expires
    • Conditions
    • Actions
      • For each (Integer CH_Loop) from 1 to CH_Index, do (Actions)
        • Loop - Actions
          • Set VariableSet CH_Duration[CH_Loop] = (CH_Duration[CH_Loop] + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CH_Duration[CH_Loop] Equal to 5
            • Then - Actions
              • Set VariableSet CH_Duration[CH_Loop] = 0
              • Set VariableSet CH_Bounces[CH_Loop] = (CH_Bounces[CH_Loop] + 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CH_Bounces[CH_Loop] Less than or equal to 5
                • Then - Actions
                  • -------- Bounce --------
                  • Set VariableSet CH_PointA = (Position of CH_Target[CH_Loop])
                  • Set VariableSet CH_Group = (Units within 500.00 of CH_PointA.)
                  • Custom script: call RemoveLocation (udg_CH_PointA)
                  • Set VariableSet CH_Target[CH_Loop] = No unit
                  • Unit Group - Pick every unit in CH_Group and do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Picked unit) belongs to an enemy of (Owner of CH_Dummy[CH_Loop]).) Equal to True
                          • ((Picked unit) is alive) Equal to True
                          • ((Picked unit) is A structure) Equal to False
                          • ((Picked unit) is in CH_WasHit[CH_Loop].) Equal to False
                        • Then - Actions
                          • Set VariableSet CH_Target[CH_Loop] = (Picked unit)
                        • Else - Actions
                  • Custom script: call DestroyGroup(udg_CH_Group)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • CH_Target[CH_Loop] Not equal to No unit
                    • Then - Actions
                      • Unit - Order CH_Dummy[CH_Loop] to Orc Shadow Hunter - Hex CH_Target[CH_Loop]
                      • Unit Group - Add CH_Target[CH_Loop] to CH_WasHit[CH_Loop]
                    • Else - Actions
                      • -------- End (no target) --------
                      • Custom script: call DestroyGroup(udg_CH_WasHit[udg_CH_Loop])
                      • Unit - Remove CH_Dummy[CH_Loop] from the game
                      • Set VariableSet CH_Dummy[CH_Loop] = CH_Dummy[CH_Index]
                      • Set VariableSet CH_Duration[CH_Loop] = CH_Duration[CH_Index]
                      • Set VariableSet CH_Bounces[CH_Loop] = CH_Bounces[CH_Index]
                      • Set VariableSet CH_WasHit[CH_Loop] = CH_WasHit[CH_Index]
                      • Set VariableSet CH_Loop = (CH_Loop - 1)
                      • Set VariableSet CH_Index = (CH_Index - 1)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • CH_Index Equal to 0
                        • Then - Actions
                          • Countdown Timer - Pause CH_Timer
                        • Else - Actions
                • Else - Actions
                  • -------- End (out of bounces) --------
                  • Custom script: call DestroyGroup(udg_CH_WasHit[udg_CH_Loop])
                  • Unit - Remove CH_Dummy[CH_Loop] from the game
                  • Set VariableSet CH_Dummy[CH_Loop] = CH_Dummy[CH_Index]
                  • Set VariableSet CH_Duration[CH_Loop] = CH_Duration[CH_Index]
                  • Set VariableSet CH_Bounces[CH_Loop] = CH_Bounces[CH_Index]
                  • Set VariableSet CH_WasHit[CH_Loop] = CH_WasHit[CH_Index]
                  • Set VariableSet CH_Loop = (CH_Loop - 1)
                  • Set VariableSet CH_Index = (CH_Index - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • CH_Index Equal to 0
                    • Then - Actions
                      • Countdown Timer - Pause CH_Timer
                    • Else - Actions
            • Else - Actions
There's probably some Conditions missing for filtering units in the Unit Group but that stuff is up to the user anyways.

I also made a version that will always bounce to the closest unit possible.
 

Attachments

  • Chain Hex.w3m
    22.7 KB · Views: 10
Last edited:
Status
Not open for further replies.
Top