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

Conflicting Loops = Error

Status
Not open for further replies.
Level 12
Joined
Jun 28, 2008
Messages
688
Well arighty, here I am again trusting my beloved Hive for help. =P
Here we go, the spell goes like this:
It shoots out a missile which is linked to another missile shortly behind it. After the two missiles travel a bit, the front missile stops and the back missile "orbits" around it. Then they both explode when the back missile reaches a 180 degree rotation. If the front missile collides with an enemy, it will explode and the back missile will do the rotation. If the back missile collides with an enemy while rotating, both missiles explode.

Really a beautiful spell, if I do say so myself. The problem is this:
The spell uses two loop triggers (1 for the missile movement, another for the rotation) which somehow makes the whole thing not MUI. When the rotation is occuring and another missile is fired, the recently fired missile will stop and rotate as well, and at the end of the older missile's rotation a critical error occurs and WC3 is shut down. I know why that happens, what I don't know is why having these two loops makes it non-MUI.

Any help at all in solving this issue is greatly appreciated.

Initializes upon cast -
  • Phantom Bolt Init
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Phantom Bolt
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • pb_index1 Equal to 0
        • Then - Actions
          • Trigger - Turn on Phantom Bolt Per <gen>
        • Else - Actions
      • Set pb_index1 = (pb_index1 + 1)
      • Set pb_index2 = (pb_index2 + 1)
      • Set pb_loopon[pb_index2] = True
      • Set pb_caster[pb_index2] = (Triggering unit)
      • Set pb_caster_loc[pb_index2] = (Position of pb_caster[pb_index2])
      • Set pb_target_loc[pb_index2] = (Target point of ability being cast)
      • Set pb_angle[pb_index2] = (Angle from pb_caster_loc[pb_index2] to pb_target_loc[pb_index2])
      • Set pb_segment_1[pb_index2] = (pb_caster_loc[pb_index2] offset by 200.00 towards pb_angle[pb_index2] degrees)
      • Set pb_segment_2[pb_index2] = (pb_caster_loc[pb_index2] offset by 75.00 towards pb_angle[pb_index2] degrees)
      • Unit - Create 1 effect Phantom (Greater) for (Owner of pb_caster[pb_index2]) at pb_segment_1[pb_index2] facing pb_angle[pb_index2] degrees
      • Set pb_effect_1[pb_index2] = (Last created unit)
      • Unit - Create 1 effect Phantom for (Owner of pb_caster[pb_index2]) at pb_segment_2[pb_index2] facing pb_angle[pb_index2] degrees
      • Set pb_effect_2[pb_index2] = (Last created unit)
      • Lightning - Create a Finger of Death lightning effect from source pb_segment_1[pb_index2] to target pb_segment_2[pb_index2]
      • Set pb_light[pb_index2] = (Last created lightning effect)
      • Lightning - Change color of pb_light[pb_index2] to (0.75 0.00 1.00) with 1.00 alpha
Moves the missiles and detects collision -
  • Phantom Bolt Per
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer pb_index3) from 1 to pb_index2, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • pb_loopon[pb_index3] Equal to True
            • Then - Actions
              • Set pb_counter[pb_index3] = (pb_counter[pb_index3] + 0.03)
              • Set pb_segment_1[pb_index3] = (pb_segment_1[pb_index3] offset by 35.00 towards pb_angle[pb_index3] degrees)
              • Set pb_segment_2[pb_index3] = (pb_segment_2[pb_index3] offset by 30.00 towards pb_angle[pb_index3] degrees)
              • Unit - Move pb_effect_1[pb_index3] instantly to pb_segment_1[pb_index3]
              • Unit - Move pb_effect_2[pb_index3] instantly to pb_segment_2[pb_index3]
              • Lightning - Move pb_light[pb_index3] to source pb_segment_1[pb_index3] and target pb_segment_2[pb_index3]
              • Custom script: set bj_wantDestroyGroup = true
              • Unit Group - Pick every unit in (Units within 115.00 of pb_segment_1[pb_index3] matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is A structure) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of pb_caster[pb_index3])) Equal to True)))) and do (Actions)
                • Loop - Actions
                  • Unit - Cause pb_caster[pb_index3] to damage (Picked unit), dealing 11.00 damage of attack type Spells and damage type Normal
                  • Unit - Add a 0.01 second Generic expiration timer to pb_effect_1[pb_index3]
                  • Special Effect - Create a special effect at pb_segment_1[pb_index3] using Abilities\Spells\Human\Feedback\ArcaneTowerAttack.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Special Effect - Create a special effect at pb_segment_1[pb_index3] using Abilities\Spells\Human\ManaFlare\ManaFlareBoltImpact.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Set pb_distance[pb_index3] = (Distance between pb_segment_1[pb_index3] and pb_segment_2[pb_index3])
                  • Set pb_counter[pb_index3] = 0.00
                  • Custom script: call RemoveLocation(udg_pb_caster_loc[udg_pb_index3])
                  • Custom script: call RemoveLocation(udg_pb_target_loc[udg_pb_index3])
                  • Trigger - Turn on Phantom Bolt Per 2 <gen>
                  • Trigger - Turn off (This trigger)
                  • Skip remaining actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • pb_counter[pb_index3] Greater than or equal to 1.10
                • Then - Actions
                  • Animation - Change pb_effect_1[pb_index3]'s vertex coloring to (50.00%, 50.00%, 50.00%) with 0.00% transparency
                  • Animation - Change pb_effect_1[pb_index3]'s size to (175.00%, 175.00%, 175.00%) of its original size
                  • Set pb_distance[pb_index3] = (Distance between pb_segment_1[pb_index3] and pb_segment_2[pb_index3])
                  • Set pb_counter[pb_index3] = 0.00
                  • Custom script: call RemoveLocation(udg_pb_caster_loc[udg_pb_index3])
                  • Custom script: call RemoveLocation(udg_pb_target_loc[udg_pb_index3])
                  • Trigger - Turn on Phantom Bolt Per 2 <gen>
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
Rotates the missile and detects collision -
  • Phantom Bolt Per 2
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer pb_index3) from 1 to pb_index2, do (Actions)
        • Loop - Actions
          • Set pb_counter[pb_index3] = (pb_counter[pb_index3] + 0.03)
          • Set pb_angle[pb_index3] = (pb_angle[pb_index3] + 5.10)
          • Set pb_segment_2[pb_index3] = (pb_segment_1[pb_index3] offset by pb_distance[pb_index3] towards (pb_angle[pb_index3] + 180.00) degrees)
          • Unit - Move pb_effect_2[pb_index3] instantly to pb_segment_2[pb_index3]
          • Lightning - Move pb_light[pb_index3] to source pb_segment_1[pb_index3] and target pb_segment_2[pb_index3]
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within 75.00 of pb_segment_2[pb_index3] matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is A structure) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of pb_caster[pb_index3])) Equal to True)))) and do (Actions)
            • Loop - Actions
              • Unit - Cause pb_caster[pb_index3] to damage (Picked unit), dealing 5.00 damage of attack type Spells and damage type Normal
              • Unit - Add a 0.01 second Generic expiration timer to pb_effect_2[pb_index3]
              • Lightning - Destroy pb_light[pb_index3]
              • Special Effect - Create a special effect at pb_segment_2[pb_index3] using Abilities\Spells\Human\Feedback\ArcaneTowerAttack.mdl
              • Special Effect - Destroy (Last created special effect)
              • Special Effect - Create a special effect at pb_segment_2[pb_index3] using Abilities\Spells\Human\ManaFlare\ManaFlareBoltImpact.mdl
              • Special Effect - Destroy (Last created special effect)
              • Custom script: call RemoveLocation(udg_pb_segment_1[udg_pb_index3])
              • Custom script: call RemoveLocation(udg_pb_segment_2[udg_pb_index3])
              • Set pb_counter[pb_index3] = 0.00
              • Set pb_loopon[pb_index3] = False
              • Set pb_index1 = (pb_index1 - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • pb_index1 Equal to 0
                • Then - Actions
                  • Set pb_index2 = 0
                  • Trigger - Turn off (This trigger)
                • Else - Actions
              • Skip remaining actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • pb_counter[pb_index3] Greater than or equal to 1.00
            • Then - Actions
              • Unit - Add a 0.01 second Generic expiration timer to pb_effect_1[pb_index3]
              • Unit - Add a 0.01 second Generic expiration timer to pb_effect_2[pb_index3]
              • Lightning - Destroy pb_light[pb_index3]
              • Special Effect - Create a special effect at pb_segment_1[pb_index3] using Abilities\Spells\Human\Feedback\ArcaneTowerAttack.mdl
              • Special Effect - Destroy (Last created special effect)
              • Special Effect - Create a special effect at pb_segment_2[pb_index3] using Abilities\Spells\Human\Feedback\ArcaneTowerAttack.mdl
              • Special Effect - Destroy (Last created special effect)
              • Special Effect - Create a special effect at pb_segment_1[pb_index3] using Abilities\Spells\Human\ManaFlare\ManaFlareBoltImpact.mdl
              • Special Effect - Destroy (Last created special effect)
              • Special Effect - Create a special effect at pb_segment_2[pb_index3] using Abilities\Spells\Human\ManaFlare\ManaFlareBoltImpact.mdl
              • Special Effect - Destroy (Last created special effect)
              • Custom script: call RemoveLocation(udg_pb_segment_1[udg_pb_index3])
              • Custom script: call RemoveLocation(udg_pb_segment_2[udg_pb_index3])
              • Set pb_counter[pb_index3] = 0.00
              • Set pb_loopon[pb_index3] = False
              • Set pb_index1 = (pb_index1 - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • pb_index1 Equal to 0
                • Then - Actions
                  • Set pb_index2 = 0
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
 
Level 17
Joined
Mar 17, 2009
Messages
1,349
Thus would bug MUI'ness the way you do it. You'll have to index the already indexed looping trigger. So imo, just simply converge trigger two and trigger three into one.

Make a boolean upon which you determine which part of the trigger runs :)

Yet, maybe you'd like to wait to see if anyone has a better idea, I'm very sleepy so I don't think my brain is functioning well now :p

EDIT:
The reason it's not MUI, it's cause your turning on and off the 2nd and 3rd trigger without any certain condition... so if a unit is still casting while another finishes, you turn off the 2nd trigger for all unit = bug.
 
Status
Not open for further replies.
Top