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

Casual crash/freeze - I am clueless

Status
Not open for further replies.
Level 3
Joined
Mar 15, 2018
Messages
31
Hey Community,

I have a freeze happening on a regular basis at the same spot in a trigger BUT only sometimes. Most times as a matter of fact it passes the spot without an issue.

In the trigger the computer enemy makes its turn and gets the order to attack a specific unit with a spell. The trigger finds out which unit is to be attacked next as everything works in turns.

Here is the trigger: I cut out a bit of irrelevant actions before and marked with "HERE IT FREEZES.." where the crash happens. I put in a few debug strings as you can see. Hence I know where it stops.

  • P3Kb2b P3Kp16a Blackbeards Turn
    • Events
    • Conditions
    • Actions
      • IRRELEVANT ACTIONS
      • For each (Integer A) from 1 to P3_CountfCheckThese, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (P3_CheckTheseFood[P3_BBTarget] is dead) Equal to Falsch
              • (PiratebayArea 001 <gen> contains P3_CheckTheseFood[P3_BBTarget]) Equal to Falsch
            • Then - Actions
              • Game - Display to (All players) for 300.00 seconds the text: BB AK3 ------------1
              • Sound - Play Sound_BB_Attack[(Random integer number between 0 and 2)] at 100.00% volume, attached to P3_CurrentBB
              • Game - Display to (All players) for 300.00 seconds the text: BB AK3 ------------1
              • Unit - Order P3_CurrentBB to Night Elf Warden - Shadow Strike P3_CheckTheseFood[P3_BBTarget]
              • Game - Display to (All players) for 300.00 seconds the text: BB AK3 ------------1
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • P3_BBTarget Equal to 1
                • Then - Actions
                  • Game - Display to (All players) for 300.00 seconds the text: BB AK3 ------------...
                  • Set VariableSet P3_BBTarget = P3_CountfCheckThese
                • Else - Actions
                  • Game - Display to (All players) for 300.00 seconds the text: BB AK3 ------------...
                  • Set VariableSet P3_BBTarget = (P3_BBTarget - 1)
              • Game - Display to (All players) for 300.00 seconds the text: BB AK3 ------------1
              • HERE IT FREEZES (SOMETIMES!)
              • Skip remaining actions
            • Else - Actions
              • Game - Display to (All players) for 300.00 seconds the text: BB AK3 ------------2
              • Set VariableSet P3_CheckTheseFood[P3_BBTarget] = No unit
              • Game - Display to (All players) for 300.00 seconds the text: BB AK3 ------------2
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • P3_BBTarget Equal to 1
                • Then - Actions
                  • Set VariableSet P3_BBTarget = P3_CountfCheckThese
                  • Game - Display to (All players) for 300.00 seconds the text: BB AK3 ------------...
                • Else - Actions
                  • Set VariableSet P3_BBTarget = (P3_BBTarget - 1)
                  • Game - Display to (All players) for 300.00 seconds the text: BB AK3 ------------...
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • P3_Tot Equal to (P3_CountfCheckThese - 0)
            • Then - Actions
              • Game - Display to (All players) for 300.00 seconds the text: BB AK3 ------------...
              • Trigger - Run P35 FightEnd <gen> (checking conditions)
              • Skip remaining actions
            • Else - Actions
              • Game - Display to (All players) for 300.00 seconds the text: BB AK3 ------------...
        • Else - Actions
          • Game - Display to (All players) for 300.00 seconds the text: BB AK3 ------------...

First I had the suspicion, that it might be related to the trigger that fires with the spell, because before it crashes you can see the unit turn towards its target and then it freezes. Here it is and as you can see I put a debug string in at the very beginning. This though will not be displayed. Here is that trigger anyway:

  • P3Kb11 AttackHull BB VM
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to AttackHull
      • (Unit-type of (Triggering unit)) Equal to Blackbeard
    • Actions
      • Game - Display to (All players) the text: AttackHull gew...
      • Sound - Stop Canonball <gen> Immediately
      • Sound - Play Canonball <gen> at 60.00% volume, attached to (Casting unit)
      • Game - Display to (All players) the text: AttackHull gew...
      • For each (Integer A) from 0 to 4, 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 PlayerShip[(Integer A)]
            • Then - Actions
              • Game - Display to (All players) the text: (Es wird angegriffen: Player Ship + (String((Integer A))))
              • -------- Check mit wie vielen Würfeln wird angegriffen? --------
              • -------- Check wie viel bei einem Treffer abgezogen werden müsste --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Attr_Hull[((Integer A) + 5)] Not equal to 12
                • Then - Actions
                  • Set VariableSet P3_AttributeDecrease = 1
                • Else - Actions
                  • Set VariableSet P3_AttributeDecrease = 2
              • Game - Display to (All players) the text: (Es wird angegriffen: Player Ship + (String((Integer A))))
              • -------- Die HP werden dem anvisierten Schiffsbereich angepasst --------
              • For each (Integer B) from 0 to 4, 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 PlayerShip[(Integer B)]
                    • Then - Actions
                      • Game - Display to (All players) for 39.00 seconds the text: (String((Integer B)))
                      • Unit - Set Max HP of PlayerShip[(Integer B)] to P3_FightshipsInitRu[(Integer B)]
                      • Unit - Set Unit: PlayerShip[(Integer B)]'s Real Field: Hit Points ('uhpc') to Value: (Real(Attr_Hull[(Integer B)]))
                    • Else - Actions
              • Game - Display to (All players) for 30.00 seconds the text: (Blackbeard braucht für dieses Schiff nur noch + ((String(Attr_Hull[(Integer A)])) + Treffer!))
              • -------- Das Würfeln --------
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Triggering unit) Equal to P3_CurrentBB
        • Then - Actions
          • For each (Integer B) from 0 to 4, do (Actions)
            • Loop - Actions
              • Set VariableSet P3_Rolled[(Integer B)] = (Random integer number between 1 and 6)
              • Game - Display to (All players) for 30.00 seconds the text: ((String(((Integer B) + 1))) + (.Wurf: + (String(P3_Rolled[(Integer B)]))))
              • Game - Display to (All players) for 30.00 seconds the text: (Attr_Hull[ + ((String(((Player number of (Owner of (Target unit of ability being cast))) - 1))) + (|cff0000ff] = |r + (String(Attr_Hull[((Player number of (Owner of (Target unit of ability being cast))) - 1)])))))
              • -------- Getroffen Abfrage --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • P3_Rolled[(Integer B)] Greater than or equal to 5
                • Then - Actions
                  • -------- Für Spieler 1-4 --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Player number of (Owner of (Target unit of ability being cast))) Not equal to 6
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Attr_Hull[((Player number of (Owner of (Target unit of ability being cast))) - 1)] Not equal to 1
                        • Then - Actions
                          • Game - Display to (All players) the text: 1
                          • Unit - Set Armor of (Target unit of ability being cast) to ((Armor of (Target unit of ability being cast)) - (Real(P3_AttributeDecrease)))
                        • Else - Actions
                          • Game - Display to (All players) the text: 1a
                          • Unit - Set Armor of (Target unit of ability being cast) to 0.00
                      • Game - Display to (All players) the text: 2
                      • Set VariableSet Attr_Hull[((Player number of (Owner of (Target unit of ability being cast))) - 1)] = (Attr_Hull[((Player number of (Owner of (Target unit of ability being cast))) - 1)] - 1)
                      • Game - Display to (All players) the text: 3
                      • Set VariableSet Attr_Hull[(((Player number of (Owner of (Target unit of ability being cast))) - 1) + 5)] = (Integer((Armor of (Target unit of ability being cast))))
                      • Game - Display to (All players) the text: 4
                      • Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) - (Real(P3_AttributeDecrease)))
                      • Game - Display to (All players) the text: 5
                      • -------- Check wie viel bei einem Treffer abgezogen werden müsste --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Attr_Hull[((Integer A) + 5)] Not equal to 12
                        • Then - Actions
                          • Set VariableSet P3_AttributeDecrease = 1
                        • Else - Actions
                          • Set VariableSet P3_AttributeDecrease = 2
                    • Else - Actions
                      • -------- Für Spieler 6 --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Player number of (Owner of (Target unit of ability being cast))) Equal to 6
                        • Then - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • Attr_Hull[((Player number of (Owner of (Target unit of ability being cast))) - 2)] Not equal to 1
                            • Then - Actions
                              • Unit - Set Armor of (Target unit of ability being cast) to ((Armor of (Target unit of ability being cast)) - (Real(P3_AttributeDecrease)))
                            • Else - Actions
                              • Unit - Set Armor of (Target unit of ability being cast) to 0.00
                          • Set VariableSet Attr_Hull[((Player number of (Owner of (Target unit of ability being cast))) - 2)] = (Attr_Hull[((Player number of (Owner of (Target unit of ability being cast))) - 2)] - 1)
                          • Set VariableSet Attr_Hull[(((Player number of (Owner of (Target unit of ability being cast))) - 2) + 5)] = (Integer((Armor of (Target unit of ability being cast))))
                          • Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) - (Real(P3_AttributeDecrease)))
                          • -------- Check wie viel bei einem Treffer abgezogen werden müsste --------
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • Attr_Hull[((Integer A) + 5)] Not equal to 12
                            • Then - Actions
                              • Set VariableSet P3_AttributeDecrease = 1
                            • Else - Actions
                              • Set VariableSet P3_AttributeDecrease = 2
                        • Else - Actions
                • Else - Actions
              • Game - Display to (All players) the text: Würfel geworfen
              • -------- Wie viele Würfel? Abfrage --------
        • Else - Actions
      • Game - Display to (All players) for 300.00 seconds the text: ((Target unit of ability being cast) = + (String((Life of (Target unit of ability being cast)))))
      • Game - Display to (All players) for 300.00 seconds the text: ((Target unit of ability being cast) = + (String((Life of (Target unit of ability being cast)))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Life of (Target unit of ability being cast)) Less than 1.00
        • Then - Actions
          • Game - Display to (All players) for 300.00 seconds the text: ((Target unit of ability being cast) = + (String((Life of (Target unit of ability being cast)))))
          • Set VariableSet P3_Dead = (P3_Dead + 1)
          • Game - Display to (All players) for 300.00 seconds the text: (P3_Dead = P3_Dead + 1 = + (String(P3_Dead)))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • P3_CurrentCategory Equal to 2
        • Then - Actions
          • Game - Display to (All players) the text: EXIT1
          • Trigger - Run P34a P3Kb2a Whos turn next <gen> (checking conditions)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • P3_CurrentCategory Equal to 3
        • Then - Actions
          • Game - Display to (All players) the text: EXIT2
          • Trigger - Run P34 P3Kp2 Whosturnisit <gen> (checking conditions)
        • Else - Actions

Now I also thought about, if a object value of the ability could be the cause, but I can't figure out why this then would happen only at the same spot in the trigger and only sometimes. The spell is based on shadow strike. Here are the object values:

Bs7qCvQ.png

I starred at these triggers now for hours and I don't know where to look for the problem. Please can you help me find the culprit?

Thanks very much!

LG
old_edge
 
Level 12
Joined
Jan 30, 2020
Messages
875
@Uncle : would you have any idea about what causes these crashes? I wanted to help but I confess that decrypting long lines of GUI is something I haven't done for 16 years, so I can't keep a clear track of what is happening :'(
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,544
You can narrow it down by disabling the triggers.

For instance, test to see if it freezes after removing the order to cast Shadow Strike.

If it stops freezing then we know it's either the Shadow Strike trigger that's causing the problem OR a trigger that runs whenever you issue an Order Targeting an Object, as that could be the problem as well.

I've found that the only time my game freezes is when I create an infinite loop, example:
A unit is issued an order targeting an Object -> Order triggering unit to Attack target unit of issued order

Also, I don't think you need those Skip Remaining Actions.

You could instead use a Boolean that needs to be FALSE in order for any of the triggers in the Loop to run. Set this Boolean to TRUE in replacement of "Skip Remaining Actions", and set it to FALSE at the start of the trigger.

Like:

Set BREAK = False

For Each IntegerA from 1 to P3_CountfCheckThese do:
If BREAK = False then
-If Then Else
-If Then Else

The Loop will "stop" running once BREAK = True. I don't fully understand what you're trying to do in your trigger so my approach might not work without some modifications.

Anyway, I just don't like Skip Remaining Actions as I fear it's going to have weird interactions but it might be an irrational fear. It could be perfectly fine the way you're using it.
 
Last edited:
Status
Not open for further replies.
Top