• 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.

[Trigger] Custom spell of mine malfunctioning, need help

Status
Not open for further replies.
Level 2
Joined
Apr 4, 2010
Messages
8
Recently, I've been working on a spell which works by making a river which travels back to the point it was cast from. My idea was to record the path the first unit in the river takes with hashtables and that way have an actual flowing river. This is not working. What i have tried to do is have 2 sets of indexing going, so that when the spell is cast an index is created, which will manage each individual piece of the river in a seperate index, with the lead unit recording it's path as it goes. I know its not exactly a small piece of code, and it is'nt documented at all, but i would appreciate your help a lot. Anywho, i've got the trigger documentation and tooltip set up below. Obviously the spell isn't close to finished, incase you're wondering if you're reading the tooltip. Thanks for your help.

Releases his rage into a stream of water that travels from the target point to where the caster was standing at the time. Units hit by the stream will be sent down the stream to where the caster was standing when he cast the ability. Damages and stuns when units hit the end, and automatically curves to hit heroes. Damage is pure. |n|n|cffffcc00Level 1|r - 600 cast range, 1 second stun, 100 damage.|n|cffffcc00Level 2|r - 800 cast range, 1.15 second stun, 130 damage.|n|cffffcc00Level 3|r - 1000 cast range, 1.3 second stun, 160 damage.|n|cffffcc00Level 4|r - 1200 cast range, 1.4 second stun, 190 damage.


  • TF Init
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Tidal Fury
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TFBOOLEANHASHTABLECHECK Equal to False
        • Then - Actions
          • Hashtable - Create a hashtable
          • Set TF_Hashtable = (Last created hashtable)
          • Set TFBOOLEANHASHTABLECHECK = True
        • Else - Actions
      • Set TFAL1_Integers[1] = (TFAL1_Integers[1] + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TFAL1_Integers[1] Equal to 1
        • Then - Actions
          • Trigger - Turn on TF Loop 1 <gen>
        • Else - Actions
      • Set TFAL1_Integers[2] = (TFAL1_Integers[2] + 1)
      • Set TFAL1_Caster[TFAL1_Integers[2]] = (Casting unit)
      • Set TFAL1_TargetPoint[TFAL1_Integers[2]] = (Target point of ability being cast)
      • Set TFAL1_OriginalPoint[TFAL1_Integers[2]] = (Position of TFAL1_Caster[TFAL1_Integers[2]])
      • Set TFAL1_FirstUnit[TFAL1_Integers[2]] = True
      • Set TFAL1_CurrentCount[TFAL1_Integers[2]] = 0
      • Unit - Create 1 DummyCaster for (Owner of TFAL1_Caster[TFAL1_Integers[2]]) at TFAL1_OriginalPoint[TFAL1_Integers[2]] facing Default building facing degrees
      • Set TFAL1_DummyCaster[TFAL1_Integers[2]] = (Last created unit)
      • Unit Group - Add TFAL1_DummyCaster[TFAL1_Integers[2]] to TF_ConstantGroup
  • TF Loop 1
    • Events
      • Time - Every 0.06 seconds of game time
    • Conditions
    • Actions
      • For each (Integer TFAL1_Integers[3]) from 1 to TFAL1_Integers[2], do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TFAL1_FirstUnit[TFAL1_Integers[3]] Equal to True
            • Then - Actions
              • Set TFAL1_FirstUnit[TFAL1_Integers[3]] = False
              • Set TFAL2_Integers[1] = (TFAL2_Integers[1] + 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TFAL2_Integers[1] Equal to 1
                • Then - Actions
                  • Trigger - Turn on TF Loop 2 <gen>
                • Else - Actions
              • Set TFAL2_Integers[2] = (TFAL2_Integers[2] + 1)
              • Unit - Create 1 SFX_TidalFury River Particle for (Owner of TFAL1_Caster[TFAL1_Integers[3]]) at TFAL1_TargetPoint[TFAL1_Integers[3]] facing (Angle from TFAL1_OriginalPoint[TFAL1_Integers[3]] to TFAL1_TargetPoint[TFAL1_Integers[3]]) degrees
              • Set TFAL2_Dummy[TFAL2_Integers[2]] = (Last created unit)
              • Set TFAL2_LeadDummy[TFAL2_Integers[2]] = True
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Real(TFAL1_CurrentCount[TFAL1_Integers[3]])) / 4.00) Equal to (Real((TFAL1_CurrentCount[TFAL1_Integers[3]] / 4)))
                • Then - Actions
                  • Set TFAL2_MovesunitsBoo[TFAL2_Integers[2]] = True
                • Else - Actions
              • Set TFAL2_Caster[TFAL2_Integers[2]] = TFAL1_Caster[TFAL1_Integers[3]]
              • Set TFAL2_PointCounter[TFAL2_Integers[2]] = 0
              • Set TFAL2_OriginalPoint[TFAL2_Integers[2]] = TFAL1_OriginalPoint[TFAL1_Integers[3]]
              • Set TFAL2_Targetunit[TFAL2_Integers[2]] = No unit
              • Set TFAL2_DummyCaster[TFAL2_Integers[2]] = TFAL1_DummyCaster[TFAL1_Integers[3]]
            • Else - Actions
              • Set TFAL2_Integers[1] = (TFAL2_Integers[1] + 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TFAL2_Integers[1] Equal to 1
                • Then - Actions
                  • Trigger - Turn on TF Loop 2 <gen>
                • Else - Actions
              • Set TFAL2_Integers[2] = (TFAL2_Integers[2] + 1)
              • Unit - Create 1 SFX_TidalFury River Particle for (Owner of TFAL1_Caster[TFAL1_Integers[3]]) at TFAL1_TargetPoint[TFAL1_Integers[3]] facing (Angle from TFAL1_OriginalPoint[TFAL1_Integers[3]] to TFAL1_TargetPoint[TFAL1_Integers[3]]) degrees
              • Set TFAL2_Dummy[TFAL2_Integers[2]] = (Last created unit)
              • Set TFAL1_CurrentCount[TFAL1_Integers[3]] = (TFAL1_CurrentCount[TFAL1_Integers[3]] + 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Real(TFAL1_CurrentCount[TFAL1_Integers[3]])) / 4.00) Equal to (Real((TFAL1_CurrentCount[TFAL1_Integers[3]] / 4)))
                • Then - Actions
                  • Set TFAL2_MovesunitsBoo[TFAL2_Integers[2]] = True
                • Else - Actions
              • Set TFAL2_Caster[TFAL2_Integers[2]] = TFAL1_Caster[TFAL1_Integers[3]]
              • Set TFAL2_PointCounter[TFAL2_Integers[2]] = 0
              • Set TFAL2_DummyCaster[TFAL2_Integers[2]] = TFAL1_DummyCaster[TFAL1_Integers[3]]
  • TF Loop 2
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • For each (Integer TFAL2_Integers[3]) from 1 to TFAL2_Integers[2], do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TFAL2_LeadDummy[TFAL2_Integers[3]] Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TFAL2_Targetunit[TFAL2_Integers[3]] Equal to No unit
                • Then - Actions
                  • Set TFA_Point1[TFAL2_Integers[3]] = TFAL2_OriginalPoint[TFAL2_Integers[3]]
                  • Set TFA_Point2[TFAL2_Integers[3]] = (Position of TFAL2_Dummy[TFAL2_Integers[3]])
                  • Set TFAL2_Distance[TFAL2_Integers[3]] = ((Distance between TFA_Point1[TFAL1_Integers[3]] and TFA_Point2[TFAL2_Integers[3]]) / 2.00)
                  • Set TFA_Point3[TFAL2_Integers[3]] = (TFA_Point1[TFAL2_Integers[3]] offset by (TFAL2_Distance[TFAL2_Integers[3]] / 1.00) towards (Angle from TFA_Point1[TFAL2_Integers[3]] to TFA_Point2[TFAL2_Integers[3]]) degrees)
                  • Set TFAL2_TempBoolean[TFAL2_Integers[3]] = False
                  • For each (Integer TFAL2_Integers[4]) from 1 to 20, do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • TFAL2_TempBoolean[TFAL2_Integers[3]] Equal to False
                        • Then - Actions
                          • Set TFAL2_TempUnitGroup[TFAL2_Integers[3]] = (Units within ((TFAL2_Distance[TFAL2_Integers[3]] / 20.00) x (Real(TFAL2_Integers[4]))) of TFA_Point3[TFAL2_Integers[3]] matching ((((Matching unit) is A Hero) Equal to True) and ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) is Me
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Number of units in TFAL2_TempUnitGroup[TFAL2_Integers[3]]) Greater than or equal to 1
                            • Then - Actions
                              • Set TFAL2_TempBoolean[TFAL2_Integers[3]] = True
                              • Set TFAL2_Targetunit[TFAL2_Integers[3]] = (Random unit from TFAL2_TempUnitGroup[TFAL2_Integers[3]])
                              • Custom script: call DestroyGroup (udg_TFAL2_TempUnitGroup[udg_TFAL2_Integers[3]])
                            • Else - Actions
                              • Set TFAL2_Targetunit[TFAL2_Integers[3]] = No unit
                              • Custom script: call DestroyGroup (udg_TFAL2_TempUnitGroup[udg_TFAL2_Integers[3]])
                        • Else - Actions
                  • Custom script: call RemoveLocation (udg_TFA_Point1[udg_TFAL2_Integers[3]])
                  • Custom script: call RemoveLocation (udg_TFA_Point2[udg_TFAL2_Integers[3]])
                  • Custom script: call RemoveLocation (udg_TFA_Point3[udg_TFAL2_Integers[3]])
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • TFAL2_Targetunit[TFAL2_Integers[3]] Equal to No unit
                    • Then - Actions
                      • Set TFA_Point1[TFAL2_Integers[3]] = TFAL2_OriginalPoint[TFAL2_Integers[3]]
                      • Set TFA_Point2[TFAL2_Integers[3]] = (Position of TFAL2_Dummy[TFAL2_Integers[3]])
                      • Set TFA_Point3[TFAL2_Integers[3]] = (TFA_Point2[TFAL2_Integers[3]] offset by 40.00 towards (Angle from TFA_Point1[TFAL2_Integers[3]] to TFA_Point2[TFAL2_Integers[3]]) degrees)
                      • Unit - Make TFAL2_Dummy[TFAL2_Integers[3]] face TFA_Point3[TFAL2_Integers[3]] over 0.00 seconds
                      • Unit - Move TFAL2_Dummy[TFAL2_Integers[3]] instantly to TFA_Point3[TFAL2_Integers[3]]
                      • Unit Group - Pick every unit in TF_ConstantGroup and do (Actions)
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Picked unit) Equal to TFAL2_DummyCaster[TFAL2_Integers[3]]
                            • Then - Actions
                              • Hashtable - Save Handle OfTFA_Point3[TFAL2_Integers[3]] as TFAL2_PointCounter[TFAL2_Integers[3]] of (Key (Picked unit)) in TF_Hashtable
                            • Else - Actions
                      • Set TFAL2_PointCounter[TFAL2_Integers[3]] = (TFAL2_PointCounter[TFAL2_Integers[3]] + 1)
                      • Custom script: call RemoveLocation (udg_TFA_Point1[udg_TFAL2_Integers[3]])
                      • Custom script: call RemoveLocation (udg_TFA_Point2[udg_TFAL2_Integers[3]])
                      • Custom script: call RemoveLocation (udg_TFA_Point3[udg_TFAL2_Integers[3]])
                    • Else - Actions
                      • Set TFA_Point1[TFAL2_Integers[3]] = (Position of TFAL2_Targetunit[TFAL2_Integers[3]])
                      • Set TFA_Point2[TFAL2_Integers[3]] = (Position of TFAL2_Dummy[TFAL2_Integers[3]])
                      • Set TFA_Point3[TFAL2_Integers[3]] = (TFA_Point1[TFAL2_Integers[3]] offset by 40.00 towards (Angle from TFA_Point1[TFAL2_Integers[3]] to TFA_Point2[TFAL2_Integers[3]]) degrees)
                      • Unit - Make TFAL2_Dummy[TFAL2_Integers[3]] face TFA_Point3[TFAL2_Integers[3]] over 0.00 seconds
                      • Unit - Move TFAL2_Dummy[TFAL2_Integers[3]] instantly to TFA_Point3[TFAL2_Integers[3]]
                      • Unit Group - Pick every unit in TF_ConstantGroup and do (Actions)
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Picked unit) Equal to TFAL2_DummyCaster[TFAL2_Integers[3]]
                            • Then - Actions
                              • Hashtable - Save Handle OfTFA_Point3[TFAL2_Integers[3]] as TFAL2_PointCounter[TFAL2_Integers[3]] of (Key (Picked unit)) in TF_Hashtable
                            • Else - Actions
                      • Set TFAL2_PointCounter[TFAL2_Integers[3]] = (TFAL2_PointCounter[TFAL2_Integers[3]] + 1)
                      • Custom script: call RemoveLocation (udg_TFA_Point1[udg_TFAL2_Integers[3]])
                      • Custom script: call RemoveLocation (udg_TFA_Point2[udg_TFAL2_Integers[3]])
                      • Custom script: call RemoveLocation (udg_TFA_Point3[udg_TFAL2_Integers[3]])
                • Else - Actions
                  • Set TFA_Point1[TFAL2_Integers[3]] = (Position of TFAL2_Targetunit[TFAL2_Integers[3]])
                  • Set TFA_Point2[TFAL2_Integers[3]] = (Position of TFAL2_Dummy[TFAL2_Integers[3]])
                  • Set TFA_Point3[TFAL2_Integers[3]] = (TFA_Point1[TFAL2_Integers[3]] offset by 40.00 towards (Angle from TFA_Point1[TFAL2_Integers[3]] to TFA_Point2[TFAL2_Integers[3]]) degrees)
                  • Unit - Make TFAL2_Dummy[TFAL2_Integers[3]] face TFA_Point3[TFAL2_Integers[3]] over 0.00 seconds
                  • Unit - Move TFAL2_Dummy[TFAL2_Integers[3]] instantly to TFA_Point3[TFAL2_Integers[3]]
                  • Unit Group - Pick every unit in TF_ConstantGroup and do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Picked unit) Equal to TFAL2_DummyCaster[TFAL2_Integers[3]]
                        • Then - Actions
                          • Hashtable - Save Handle OfTFA_Point3[TFAL2_Integers[3]] as TFAL2_PointCounter[TFAL2_Integers[3]] of (Key (Picked unit)) in TF_Hashtable
                        • Else - Actions
                  • Set TFAL2_PointCounter[TFAL2_Integers[3]] = (TFAL2_PointCounter[TFAL2_Integers[3]] + 1)
                  • Custom script: call RemoveLocation (udg_TFA_Point1[udg_TFAL2_Integers[3]])
                  • Custom script: call RemoveLocation (udg_TFA_Point2[udg_TFAL2_Integers[3]])
                  • Custom script: call RemoveLocation (udg_TFA_Point3[udg_TFAL2_Integers[3]])
            • Else - Actions
              • Unit Group - Pick every unit in TF_ConstantGroup and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Picked unit) Equal to TFAL2_DummyCaster[TFAL2_Integers[3]]
                    • Then - Actions
                      • Set TFA_Point1[TFAL2_Integers[3]] = (Load TFAL2_PointCounter[TFAL2_Integers[3]] of (Key (Picked unit)) in TF_Hashtable)
                      • Set TFAL2_PointCounter[TFAL2_Integers[3]] = (TFAL2_PointCounter[TFAL2_Integers[3]] + 1)
                      • Unit - Make TFAL2_Dummy[TFAL2_Integers[3]] face TFA_Point1[TFAL2_Integers[3]] over 0.00 seconds
                      • Unit - Move TFAL2_Dummy[TFAL2_Integers[3]] instantly to TFA_Point1[TFAL2_Integers[3]]
                      • Custom script: call RemoveLocation (udg_TFA_Point1[udg_TFAL2_Integers[3]])
                    • Else - Actions
 
Hashtable should be created once, not everytime the spell is cast:
  • Tr
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Hashtable - Create a hashtable
    • Set TF_Hashtable = (Last created hashtable)
• Use (Triggering unit) over (Casting unit); it procs slightly faster.

• You are not recycling your indexing system.

• Your indexing system condition
  • TFAL1_Integers[1] Equal to 1
should be Equal to 0, not 1.

• You are using the following line in both triggers:
  • Set TFAL2_Integers[1] = (TFAL2_Integers[1] + 1)
This won't be provide you with MUI enhancement.
 
Level 2
Joined
Apr 4, 2010
Messages
8
Thanks for the reply, sorry for how late mine is.
1) The hashtable is only created once, the first time the spell is cast. This is cause i made it for a friend and i wanted to minimize how many triggers he had to import.

2)Thanks, i didn't know that.

3)I haven't got around to finishing the spell at all, but once i finish the core of it i'll get round to it.

4)
  • Set TFAL1_Integers[1] = (TFAL1_Integers[1] + 1)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • TFAL1_Integers[1] Equal to 1
    • Then - Actions
      • Trigger - Turn on TF Loop 1 <gen>
    • Else - Actions
It adds one first, before it checks whether TF Loop 1 is on.

5)
  • Set TFAL1_Integers[1] = (TFAL1_Integers[1] + 1)
  • Set TFAL2_Integers[2] = (TFAL2_Integers[2] + 1)
They are different variables.

I think i should say what is wrong with the trigger. When cast it doesn't record the path of the first unit, and occasionally the first unit travels in the completely wrong direction.
 
Level 2
Joined
Apr 4, 2010
Messages
8
OK, i've solved why its not recording the path, i was clearing the points (facepalm). However there is still one small problem, the stream is traveling in the wrong direction...Any ideas why?
 
Status
Not open for further replies.
Top