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

[Trigger] TOTAL ERROR when casting a spell

Status
Not open for further replies.
Level 11
Joined
Jun 26, 2014
Messages
497
(I accidentally posted this on the Help Zone first, pls delete that thread)
Usually I get the total error after 20th or 30th cast (if the number of casting is even the problem here)
Spell desc.: Links the caster and the target, healing the target per second and draining the mana of the caster. Caster can link himself with multiple units.

  • Cell Link
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Cell Link
    • Actions
      • For each (Integer A) from 1 to SP_CL_mui, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Target unit of ability being cast) Equal to SP_CL_unit[(Integer A)]
            • Then - Actions
              • Player Group - Add (Owner of (Triggering unit)) to Player_Messages
              • Game - Display to Player_Messages for 5.00 seconds the text: |cffffcc00Unit is a...
              • Player Group - Remove (Owner of (Triggering unit)) from Player_Messages
              • Skip remaining actions
            • Else - Actions
      • Set SP_CL_index = (SP_CL_index + 1)
      • Set SP_CL_mui = (SP_CL_mui + 1)
      • Set SP_CL_caster[SP_CL_mui] = (Triggering unit)
      • Set SP_CL_unit[SP_CL_mui] = (Target unit of ability being cast)
      • Set SP_CL_data[SP_CL_mui] = ((Real((Level of Cell Link for (Triggering unit)))) x 1.00)
      • Set SP_CL_mana[SP_CL_mui] = ((Real((Level of Cell Link for (Triggering unit)))) x 0.10)
      • Set SP_CL_distance[SP_CL_mui] = (((Level of Cell Link for (Triggering unit)) x 75) + 675)
      • Set SP_CL_point1[SP_CL_mui] = (Position of (Triggering unit))
      • Set SP_CL_point2[SP_CL_mui] = (Position of (Target unit of ability being cast))
      • Lightning - Create a Healing Wave - Secondary lightning effect from source SP_CL_point1[SP_CL_mui] to target SP_CL_point2[SP_CL_mui]
      • Set SP_CL_link[SP_CL_mui] = (Last created lightning effect)
      • Trigger - Turn on Cell Link Loop <gen>
  • Cell Link Loop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to SP_CL_mui, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((SP_CL_caster[(Integer A)] is alive) Equal to True) and ((SP_CL_unit[(Integer A)] is alive) Equal to True)
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Distance between SP_CL_point1[(Integer A)] and SP_CL_point2[(Integer A)]) Less than or equal to (Real(SP_CL_distance[(Integer A)]))
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Percentage mana of SP_CL_caster[(Integer A)]) Greater than 5.00
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Percentage life of SP_CL_unit[(Integer A)]) Less than 100.00
                        • Then - Actions
                          • Set SP_CL_point1[(Integer A)] = (Position of SP_CL_caster[(Integer A)])
                          • Set SP_CL_point2[(Integer A)] = (Position of SP_CL_unit[(Integer A)])
                          • Lightning - Move SP_CL_link[(Integer A)] to source SP_CL_point1[(Integer A)] and target SP_CL_point2[(Integer A)]
                          • Unit - Set mana of SP_CL_caster[(Integer A)] to ((Mana of SP_CL_caster[(Integer A)]) - SP_CL_mana[(Integer A)])
                          • Unit - Set life of SP_CL_unit[(Integer A)] to ((Life of SP_CL_unit[(Integer A)]) + SP_CL_data[(Integer A)])
                          • Custom script: call RemoveLocation(udg_SP_CL_point1[bj_forLoopAIndex])
                          • Custom script: call RemoveLocation(udg_SP_CL_point2[bj_forLoopAIndex])
                        • Else - Actions
                          • Lightning - Destroy SP_CL_link[(Integer A)]
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • SP_CL_unit[(Integer A)] Not equal to No unit
                            • Then - Actions
                              • Set SP_CL_caster[(Integer A)] = No unit
                              • Set SP_CL_unit[(Integer A)] = No unit
                              • Set SP_CL_index = (SP_CL_index - 1)
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • SP_CL_index Less than or equal to 0
                                • Then - Actions
                                  • Set SP_CL_index = 0
                                  • Set SP_CL_mui = 0
                                  • Trigger - Turn off (This trigger)
                                • Else - Actions
                            • Else - Actions
                    • Else - Actions
                      • Lightning - Destroy SP_CL_link[(Integer A)]
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • SP_CL_unit[(Integer A)] Not equal to No unit
                        • Then - Actions
                          • Set SP_CL_caster[(Integer A)] = No unit
                          • Set SP_CL_unit[(Integer A)] = No unit
                          • Set SP_CL_index = (SP_CL_index - 1)
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • SP_CL_index Less than or equal to 0
                            • Then - Actions
                              • Set SP_CL_index = 0
                              • Set SP_CL_mui = 0
                              • Trigger - Turn off (This trigger)
                            • Else - Actions
                        • Else - Actions
                • Else - Actions
                  • Lightning - Destroy SP_CL_link[(Integer A)]
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • SP_CL_unit[(Integer A)] Not equal to No unit
                    • Then - Actions
                      • Set SP_CL_caster[(Integer A)] = No unit
                      • Set SP_CL_unit[(Integer A)] = No unit
                      • Set SP_CL_index = (SP_CL_index - 1)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • SP_CL_index Less than or equal to 0
                        • Then - Actions
                          • Set SP_CL_index = 0
                          • Set SP_CL_mui = 0
                          • Trigger - Turn off (This trigger)
                        • Else - Actions
                    • Else - Actions
            • Else - Actions
              • Lightning - Destroy SP_CL_link[(Integer A)]
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • SP_CL_unit[(Integer A)] Not equal to No unit
                • Then - Actions
                  • Set SP_CL_caster[(Integer A)] = No unit
                  • Set SP_CL_unit[(Integer A)] = No unit
                  • Set SP_CL_index = (SP_CL_index - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • SP_CL_index Less than or equal to 0
                    • Then - Actions
                      • Set SP_CL_index = 0
                      • Set SP_CL_mui = 0
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
Error as in crash or what type of error?

I have only glanced at the code, but I am assuming you're moving a destroyed lightning which causes a crash.

Your code within the loop is also less than optimal.
 
Level 11
Joined
Jun 26, 2014
Messages
497
Error as in crash or what type of error?

I have only glanced at the code, but I am assuming you're moving a destroyed lightning which causes a crash.

Your code within the loop is also less than optimal.

I tried moving the lightning destroy function to a better position, I hope it will fix it. I'll let you know if it continues to crash and I'll screenshot the error if it happens.
 
Status
Not open for further replies.
Top