sentrywiz
S
sentrywiz
My map crashes every minute or so when I play it because there might be an infinite loop in my triggers that I can't find it.
Triggers are for an AI:
My money is on the capture trigger that is issued a run being called a bazillion times at one point.
It does run smoothly until the AI captures 4 buildings. Usually when the capture lab trigger is supposed to run,
this is where a crash occurs. But there is no error or anything, just WC3 exiting.
There are two other triggers, 1 for capturing labs other for capturing palaces but it doesn't matter,
both of them are copies of the CPU CAPTURE PUMP trigger with changed vars.
+REP and smart points for solution.
EDIT
+rep to IcemanBo for pointing me in the right direction. It was an infinite loop connected not to the first trigger but to the second since distance was always greater than 2000 and it run endless number of times.
Thread can be closed.
Triggers are for an AI:
-
CPU HQ
-
Events
- Time - Every 0.50 seconds of game time
- Conditions
-
Actions
- Game - Display to (All players) for 0.50 seconds the text: |cffcccccc<order lo...
- Set CPU_MainUnitGroup = (Units owned by Player 2 (Blue) matching (((Matching unit) is A structure) Not equal to True))
- If ((Number of units in CPU_MainUnitGroup) Less than or equal to 9) then do (Trigger - Run CPU BUILD <gen> (ignoring conditions)) else do (Do nothing)
-
Unit Group - Pick every unit in CPU_MainUnitGroup and do (Actions)
-
Loop - Actions
- Trigger - Run CPU UNIT HEALED <gen> (ignoring conditions)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Percentage life of (Picked unit)) Less than or equal to 50.00
-
Or - Any (Conditions) are true
-
Conditions
- (Custom value of (Picked unit)) Equal to 0
- (Custom value of (Picked unit)) Equal to 2
- (Custom value of (Picked unit)) Equal to 3
- (Custom value of (Picked unit)) Equal to 4
-
Conditions
-
Then - Actions
- Game - Display to (All players) the text: heal
- Unit - Set the custom value of (Picked unit) to 1
- Trigger - Run CPU ESCAPE <gen> (ignoring conditions)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Unit-type of (Picked unit)) Equal to Engineer
- (Custom value of (Picked unit)) Not equal to 2
-
Or - Any (Conditions) are true
-
Conditions
- (CPU CAPTURE PUMP <gen> is on) Equal to True
- (CPU CAPTURE LAB <gen> is on) Equal to True
- (CPU CAPTURE PALACE <gen> is on) Equal to True
-
Conditions
-
Then - Actions
- Game - Display to (All players) the text: capture n
- Trigger - Run CPU CAPTURE N <gen> (ignoring conditions)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Unit-type of (Picked unit)) Equal to Centurion
-
Then - Actions
- Game - Display to (All players) the text: centurion def
- Unit - Set the custom value of (Picked unit) to 4
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Unit-type of (Picked unit)) Equal to Raider
-
Then - Actions
- Game - Display to (All players) the text: raider go
- Unit - Set the custom value of (Picked unit) to 2
- Trigger - Run CPU CAPTURE E <gen> (ignoring conditions)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Unit-type of (Picked unit)) Equal to Disruptor
-
Then - Actions
- Game - Display to (All players) the text: disruptor go
- Unit - Set the custom value of (Picked unit) to 4
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Loop - Actions
- Custom script: call DestroyGroup ( udg_CPU_MainUnitGroup )
-
Events
-
CPU CAPTURE N
- Events
- Conditions
-
Actions
- Set CPU_Pumps = (Units owned by Player 2 (Blue) of type Pump Station)
- Set CPU_Labs = (Units owned by Player 2 (Blue) of type Research Lab)
- Set CPU_Palaces = (Units owned by Player 2 (Blue) of type Goblin Palace)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of units in CPU_Pumps) Less than 4
- (Custom value of (Picked unit)) Not equal to 1
- (Custom value of (Picked unit)) Not equal to 2
-
Then - Actions
- If ((CPU CAPTURE PUMP <gen> is on) Not equal to True) then do (Trigger - Turn on CPU CAPTURE PUMP <gen>) else do (Do nothing)
- Unit - Set the custom value of (Picked unit) to 2
- Trigger - Run CPU CAPTURE PUMP <gen> (ignoring conditions)
- Unit - Order (Picked unit) to Human Dragonhawk Rider - Aerial Shackles CPU_CaptureUnit
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of units in CPU_Labs) Less than 1
- (Custom value of (Picked unit)) Not equal to 1
- (Custom value of (Picked unit)) Not equal to 2
-
Then - Actions
- If ((CPU CAPTURE PUMP <gen> is on) Equal to True) then do (Trigger - Turn off CPU CAPTURE PUMP <gen>) else do (Do nothing)
- If ((CPU CAPTURE LAB <gen> is on) Not equal to True) then do (Trigger - Turn on CPU CAPTURE LAB <gen>) else do (Do nothing)
- Unit - Set the custom value of (Picked unit) to 2
- Trigger - Run CPU CAPTURE LAB <gen> (ignoring conditions)
- Unit - Order (Picked unit) to Human Dragonhawk Rider - Aerial Shackles CPU_CaptureUnit
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of units in CPU_Palaces) Less than 1
- (Custom value of (Picked unit)) Not equal to 1
- (Custom value of (Picked unit)) Not equal to 2
-
Then - Actions
- If ((CPU CAPTURE PUMP <gen> is on) Equal to True) then do (Trigger - Turn off CPU CAPTURE PUMP <gen>) else do (Do nothing)
- If ((CPU CAPTURE PALACE <gen> is on) Equal to True) then do (Trigger - Turn off CPU CAPTURE LAB <gen>) else do (Do nothing)
- If ((CPU CAPTURE PALACE <gen> is on) Not equal to True) then do (Trigger - Turn on CPU CAPTURE PALACE <gen>) else do (Do nothing)
- Unit - Set the custom value of (Picked unit) to 2
- Trigger - Run CPU CAPTURE PALACE <gen> (ignoring conditions)
- Unit - Order (Picked unit) to Human Dragonhawk Rider - Aerial Shackles CPU_CaptureUnit
-
Else - Actions
- If ((CPU CAPTURE PUMP <gen> is on) Equal to True) then do (Trigger - Turn off CPU CAPTURE PUMP <gen>) else do (Do nothing)
- If ((CPU CAPTURE PALACE <gen> is on) Equal to True) then do (Trigger - Turn off CPU CAPTURE LAB <gen>) else do (Do nothing)
- If ((CPU CAPTURE PALACE <gen> is on) Equal to True) then do (Trigger - Turn on CPU CAPTURE PALACE <gen>) else do (Do nothing)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Custom script: call DestroyGroup ( udg_CPU_Pumps )
- Custom script: call DestroyGroup ( udg_CPU_Labs )
- Custom script: call DestroyGroup ( udg_CPU_Palaces )
-
CPU CAPTURE PUMP
- Events
- Conditions
-
Actions
- Set CPU_Loc3 = (Position of (Picked unit))
- Set CPU_EngineerGroup = (Units owned by Neutral Passive matching ((Unit-type of (Matching unit)) Equal to Pump Station))
- Set CPU_RandomCapture = (Random unit from CPU_EngineerGroup)
- Set CPU_Loc4 = (Position of CPU_RandomCapture)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Distance between CPU_Loc3 and CPU_Loc4) Greater than 1000.00
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Distance between CPU_Loc3 and CPU_Loc4) Greater than 2000.00
-
Then - Actions
- Trigger - Run (This trigger) (ignoring conditions)
-
Else - Actions
- Set CPU_CaptureUnit = CPU_RandomCapture
- Trigger - Turn off (This trigger)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Else - Actions
- Set CPU_CaptureUnit = CPU_RandomCapture
-
If - Conditions
- Custom script: call DestroyGroup ( udg_CPU_EngineerGroup )
- Custom script: call RemoveLocation ( udg_CPU_Loc4 )
- Custom script: call RemoveLocation ( udg_CPU_Loc3 )
My money is on the capture trigger that is issued a run being called a bazillion times at one point.
It does run smoothly until the AI captures 4 buildings. Usually when the capture lab trigger is supposed to run,
this is where a crash occurs. But there is no error or anything, just WC3 exiting.
There are two other triggers, 1 for capturing labs other for capturing palaces but it doesn't matter,
both of them are copies of the CPU CAPTURE PUMP trigger with changed vars.
+REP and smart points for solution.
EDIT
+rep to IcemanBo for pointing me in the right direction. It was an infinite loop connected not to the first trigger but to the second since distance was always greater than 2000 and it run endless number of times.
Thread can be closed.
Last edited by a moderator: