• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

trigger doesnt stop

Status
Not open for further replies.
Level 5
Joined
Sep 27, 2011
Messages
141
Hi everyone I have a problem with my trigger where the trigger never turns off and therefore does not stop producing trees also in the first one the gold mines are not produced can someone please help.
  • Resource Mode
    • Events
      • Player - Player 1 (Red) types a chat message containing - as A substring
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Entered chat string) Equal to -lr
        • Then - Actions
          • Set Terrain_Count = 26
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Entered chat string) Equal to -nr
        • Then - Actions
          • Set Terrain_Count = 50
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Entered chat string) Equal to -hr
        • Then - Actions
          • Set Terrain_Count = 100
        • Else - Actions
      • For each (Integer Temp_Int2) from 1 to (Terrain_Count / 2), do (Actions)
        • Loop - Actions
          • Custom script: loop
          • Set Temp_Loc = (Random point in Region 000 <gen>)
          • Set Temp_Group = (Units within 800.00 of Temp_Loc matching (((Matching unit) is alive) Equal to True))
          • Set Temp_Int = (Number of units in Temp_Group)
          • Custom script: call DestroyGroup(udg_Temp_Group)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Temp_Int Greater than or equal to 1
            • Then - Actions
              • Custom script: call RemoveLocation(udg_Temp_Loc)
            • Else - Actions
          • Custom script: exitwhen(udg_Temp_Int == 0 )
          • Custom script: endloop
          • Unit - Create 1 Gold Mine for Neutral Passive at Temp_Loc facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_Temp_Loc)
      • Set Terrain_Count_Max = Terrain_Count
      • Set Terrain_Count = 0
      • Trigger - Turn on Generate Resources <gen>
      • Trigger - Turn off (This trigger)
  • Generate Resources
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set Temp_Int2 = 0
      • Custom script: loop
      • Set Temp_Int2 = (Temp_Int2 + 1)
      • Custom script: loop
      • Set Temp_Loc = (Random point in Region 000 <gen>)
      • Set Temp_Group = (Units within 600.00 of Temp_Loc matching ((((Matching unit) is alive) Equal to True) and (((Owner of (Matching unit)) controller) Equal to User)))
      • Set Temp_Int = (Number of units in Temp_Group)
      • Custom script: call DestroyGroup(udg_Temp_Group)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Temp_Int Greater than or equal to 1
        • Then - Actions
          • Custom script: call RemoveLocation(udg_Temp_Loc)
        • Else - Actions
      • Custom script: exitwhen(udg_Temp_Int == 0 )
      • Custom script: endloop
      • Destructible - Create a Summer Tree Wall at Temp_Loc facing (Random angle) with scale (Random real number between 0.80 and 1.20) and variation 0
      • Custom script: call RemoveLocation(udg_Temp_Loc)
      • Custom script: exitwhen(udg_Temp_Int2 == 40 )
      • Custom script: endloop
      • Set Terrain_Count = (Terrain_Count + 1)
      • Cinematic - Clear the screen of text messages for (All players)
      • Game - Display to (All players) the text: (Loading Resources: + ((String((Integer((((Real(Terrain_Count)) / (Real(Terrain_Count_Max))) x 100.00))))) + %))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Terrain_Count Greater than or equal to Terrain_Count_Max
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
Thanks everyone.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
first i believe the bottom one never stops running because the first one stops it never sets the Terrain_Count_Max variable and as to fix it try this for the event for the top one

  • Events
    • Player - Player 1 (Red) types a chat message containing -lr as An exact match
    • Player - Player 1 (Red) types a chat message containing -hr as An exact match
    • Player - Player 1 (Red) types a chat message containing -nr as An exact match
also the 2 if blocks w the call RemoveLocation script under the then doesnt make sense to do it tht way
edit: when a unit is killed it is still in unit group u have to remove the unit by urself this could be making it run forever also sry i just noticed u had a loop in there u know u can do a For each integer action which is the gui equivalent of the custom script loop u r using
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
thanks for rep and ya the custom script works better because it uses its own integer rather than the integer A which is slow but if u use ur own integer like this it is a little faster and doesnt bug up like the for each integer A does try this one

  • For each (Integer my_integer) from 1 to 10, do (Actions)
    • Loop - Actions
u problably noticed my_integer is a variable i have made in the variable editor it wont bug up like the for each integer a does
 
Status
Not open for further replies.
Top