• 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] Map-Crashing Trigger

Status
Not open for further replies.
Level 3
Joined
Feb 25, 2007
Messages
22
So I have this trigger (below) that crashes my map when it runs. It's pretty long, and so I'm guessing that I just miscoded it somewhere, and it's not doing exactly what I want it to. Here's a synopsis of what its intended for:

The map has 8 players, and and at the beginning, each player is targeting another player. First a trigger will run setting each player's target to an integer equal to the player's number +4. Then I will run this trigger.

This trigger is intended to do the following: If player X (Player_Targeter_Integer) is actually playing, I will check to make sure that his target integer is not above 8 (and change it if it is), then I will make sure that player X's target is playing, and change player X's target if they aren't. Whenever I find that a player has a real target, I will add 1 to the integer that counts how many players have a real target. The integer X will cycle through the numbers 1-8 until every player in the game has a real target and then terminate.

So that's how the trigger's supposed to work. Unfortunately, its been crashing my game. Any help fixing this problem would be greatly appreciated.

  • Set Targets
    • Events
    • Conditions
      • Test_Mode_Enabled Equal to False
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Player_Targeter_Integer Greater than 8
        • Then - Actions
          • Set Player_Targeter_Integer = 1
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Player(Player_Targeter_Integer)) slot status) Equal to Is playing
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Player_Target[Player_Targeter_Integer] Greater than 8
            • Then - Actions
              • Set Player_Target[Player_Targeter_Integer] = (Player_Target[Player_Targeter_Integer] - 8)
            • Else - Actions
              • Do nothing
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player(Player_Target[Player_Targeter_Integer])) slot status) Not equal to Is playing
            • Then - Actions
              • Set Player_Target[Player_Targeter_Integer] = (Player_Target[Player_Targeter_Integer] + 1)
            • Else - Actions
              • Set Players_With_Real_Target = (Players_With_Real_Target + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Players_With_Real_Target Equal to Number_of_Players
            • Then - Actions
              • Trigger - Turn off (This trigger)
            • Else - Actions
              • Set Player_Targeter_Integer = (Player_Targeter_Integer + 1)
              • Trigger - Run (This trigger) (checking conditions)
        • Else - Actions
          • Set Player_Targeter_Integer = (Player_Targeter_Integer + 1)
          • Trigger - Run (This trigger) (checking conditions)
 
Level 3
Joined
Feb 25, 2007
Messages
22
Thanks for all the feedback. It's definitely helped. I've isolated (I think) the problem, but I can't figure out what's wrong or how to fix it.

To answer some comments: The trigger should not be running while its still running. It should only run after it's completed itself once. This trigger is the one causing the problem. It is run from another trigger, and when the condition catches, there is no crash. I made sure that Player_Targeter_Integer was never 0, but that didn't help it.

So finally I added debug messages:

  • Set Targets
    • Events
    • Conditions
      • Test_Mode_Enabled Equal to False
    • Actions
      • Game - Display to (All players) the text: debug1
      • Wait 2.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Player_Targeter_Integer Greater than 8
        • Then - Actions
          • Set Player_Targeter_Integer = 1
        • Else - Actions
      • Game - Display to (All players) the text: debug2
      • Wait 2.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • ((Player(Player_Targeter_Integer)) slot status) Equal to Is playing
              • Has_Real_Target[Player_Targeter_Integer] Equal to False
        • Then - Actions
          • Game - Display to (All players) the text: debug3
          • Wait 2.00 seconds
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Player_Target[Player_Targeter_Integer] Greater than 8
            • Then - Actions
              • Set Player_Target[Player_Targeter_Integer] = (Player_Target[Player_Targeter_Integer] - 8)
            • Else - Actions
          • Game - Display to (All players) the text: debug4
          • Wait 2.00 seconds
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player(Player_Target[Player_Targeter_Integer])) slot status) Not equal to Is playing
            • Then - Actions
              • Game - Display to (All players) the text: debug4.1
              • Wait 2.00 seconds
              • Set Player_Target[Player_Targeter_Integer] = (Player_Target[Player_Targeter_Integer] + 1)
            • Else - Actions
              • Game - Display to (All players) the text: debug4.2
              • Wait 2.00 seconds
              • Set Has_Real_Target[Player_Targeter_Integer] = True
              • Set Players_With_Real_Target = (Players_With_Real_Target + 1)
          • Game - Display to (All players) the text: debug5
          • Wait 2.00 seconds
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Players_With_Real_Target Equal to Number_of_Players
            • Then - Actions
              • Trigger - Turn off (This trigger)
            • Else - Actions
              • Set Player_Targeter_Integer = (Player_Targeter_Integer + 1)
              • Wait 2.00 seconds
              • Trigger - Run (This trigger) (checking conditions)
          • Game - Display to (All players) the text: debug6
          • Wait 2.00 seconds
        • Else - Actions
          • Set Player_Targeter_Integer = (Player_Targeter_Integer + 1)
          • Wait 2.00 seconds
          • Trigger - Run (This trigger) (checking conditions)
The wait commands allow me to see whats actually happening. The trigger will run past debug4, and then the game will crash after the wait action is completed. I added debugs 4.1 and 4.2 to isolate the problem further, but the game crashes before either of them go off.

So yea, I know where at least part of my problem is. Any suggestions?
 
Level 3
Joined
Feb 25, 2007
Messages
22
Ahhh thanks a ton man! That was indeed the problem. Player_Target values of players who were not in the game were set to 0 in the previous trigger. Thanks for the help!
 
Status
Not open for further replies.
Top