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

Spell in Progress [GUI] - "Turn Back the Boats"

Status
Not open for further replies.
Level 5
Joined
May 13, 2012
Messages
66
Hey I'm trying to learn spell triggering so I decided to go with the easiest using plain indexing. For some reason the spell is not MUI where multiple unit cast results in this: the first cast resolves fine. But the 2nd cast freezes.
But once the first cast resolves, subsequent casts are fine. So what's causing this to screw up? I may have made a fundamental mistake.
:goblin_wtf:
  • TBB Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set TBB_speed[1] = 12.00
      • Set TBB_speed[2] = 24.00
      • Set TBB_speed[3] = 36.00
      • Set TBB_detection[1] = 300.00
      • Set TBB_detection[2] = 300.00
      • Set TBB_detection[3] = 300.00
      • Set TBB_refugees[1] = 1
      • Set TBB_refugees[2] = 3
      • Set TBB_refugees[3] = 5
  • TBB Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Turn Back the Boats
    • Actions
      • Set TBB_CasterLoc = (Position of (Triggering unit))
      • Set TBB_TargetLoc = (Target point of ability being cast)
      • Set TBB_Index = (TBB_Index + 1)
      • Set TBB_Caster[TBB_Index] = (Triggering unit)
      • -------- Creating Boat Dummy --------
      • Set TBB_Angle[TBB_Index] = (Angle from TBB_CasterLoc to TBB_TargetLoc)
      • Unit - Create 1 Human Transport Ship for (Triggering player) at TBB_CasterLoc facing TBB_Angle[TBB_Index] degrees
      • Set TBB_Dummy[TBB_Index] = (Last created unit)
      • Unit - Set level of AOE damage upon death (boat) for TBB_Dummy[TBB_Index] to (Level of Turn Back the Boats for TBB_Caster[TBB_Index])
      • Set TBB_distance[TBB_Index] = 0.00
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TBB_Index Equal to 1
        • Then - Actions
          • Trigger - Turn on TBB Loop <gen>
        • Else - Actions
      • Custom script: call RemoveLocation(udg_TBB_CasterLoc)
      • Custom script: call RemoveLocation(udg_TBB_TargetLoc)


  • TBB Loop
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer TBB_Loop) from 1 to TBB_Index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TBB_distance[TBB_Loop] Greater than or equal to (400.00 + (400.00 x (Real((Level of Turn Back the Boats for TBB_Caster[TBB_Loop])))))
            • Then - Actions
              • Set TBB_TempPoint[TBB_Loop] = (Position of TBB_Dummy[TBB_Loop])
              • Unit Group - Pick every unit in TBB_Group[TBB_Loop] and do (Actions)
                • Loop - Actions
                  • Unit - Move (Picked unit) instantly to TBB_TempPoint[TBB_Loop]
                  • Unit - Unhide (Picked unit)
              • Unit - Add a 0.00 second Generic expiration timer to TBB_Dummy[TBB_Loop]
              • Custom script: call RemoveLocation(udg_TBB_TempPoint[udg_TBB_Loop])
              • Custom script: call DestroyGroup(udg_TBB_Group[udg_TBB_Loop])
              • -------- Recycling Indexes --------
              • Set TBB_Index = (TBB_Index - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TBB_Index Equal to 0
                • Then - Actions
                  • -------- Nulling Variables --------
                  • Set TBB_Angle[TBB_Loop] = 0.00
                  • Set TBB_distance[TBB_Loop] = 0.00
                  • Set TBB_Caster[TBB_Loop] = No unit
                  • Set TBB_Dummy[TBB_Loop] = No unit
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
              • -------- Moving the Boat --------
              • Set TBB_TempPoint[TBB_Loop] = (Position of TBB_Dummy[TBB_Loop])
              • Set TBB_TempPoint[TBB_Loop] = (TBB_TempPoint[TBB_Loop] offset by TBB_speed[(Level of Turn Back the Boats for TBB_Caster[TBB_Loop])] towards TBB_Angle[TBB_Loop] degrees)
              • Set TBB_distance[TBB_Loop] = (TBB_distance[TBB_Loop] + TBB_speed[(Level of Turn Back the Boats for TBB_Caster[TBB_Loop])])
              • Unit - Move TBB_Dummy[TBB_Loop] instantly to TBB_TempPoint[TBB_Loop]
              • -------- Picking Units within Boat Detection Range --------
              • Set TBB_Group[TBB_Loop] = (Units within TBB_detection[(Level of Turn Back the Boats for TBB_Caster[TBB_Loop])] of TBB_TempPoint[TBB_Loop] matching ((((Matching unit) belongs to an enemy of (Owner of TBB_Caster[TBB_Loop])) Equal to True) and ((((Matching unit) is alive) Equal to True)
              • Custom script: call RemoveLocation(udg_TBB_TempPoint[udg_TBB_Loop])
              • -------- To make sure loading event occurs only once per index. --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (TBB_Group[TBB_Loop] is empty) Equal to True
                • Then - Actions
                  • Set TBB_TempPoint[TBB_Loop] = (Position of TBB_Dummy[TBB_Loop])
                  • -------- Setting a cap on number of units (refugees) loaded to 1/3/5 based on level of ability --------
                  • Set TBB_Group[TBB_Loop] = (Random TBB_refugees[(Level of Turn Back the Boats for TBB_Caster[TBB_Loop])] units from TBB_Group[TBB_Loop])
                  • Unit Group - Pick every unit in TBB_Group[TBB_Loop] and do (Actions)
                    • Loop - Actions
                      • Floating Text - Create floating text that reads Refugee intercepted... above (Picked unit) with Z offset 100.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
                      • Floating Text - Change (Last created floating text): Disable permanence
                      • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
                      • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
                      • Unit - Hide (Picked unit)
                • Else - Actions
              • Custom script: call RemoveLocation(udg_TBB_TempPoint[udg_TBB_Loop])
 

Attachments

  • turn back the boats.w3x
    22.3 KB · Views: 48
Level 19
Joined
Jul 14, 2011
Messages
875
When deindexing:
  • Set TBB_Angle[TBB_Loop] = TBB_Angle[TBB_Index]
  • Set TBB_distance[TBB_Loop] = TBB_distance[TBB_Index]
  • Set TBB_Caster[TBB_Loop] = TBB_Caster[TBB_Index]
  • Set TBB_Dummy[TBB_Loop] = TBB_Dummy[TBB_Index]
  • Set TBB_Angle[TBB_Index] = 0.00
  • Set TBB_distance[TBB_Index] = 0.00
  • Set TBB_Caster[TBB_Index] = No unit
  • Set TBB_Dummy[TBB_Index] = No unit
  • Set TBB_Index = (TBB_Index - 1)
  • Set TBB_Loop = (TBB_Loop - 1)
Remove the points inside the loops.
EDIT:Also, shouldnt this be in Triggers and Scripts?
 
Status
Not open for further replies.
Top