[Solved] Game-crashing Trigger!! Help Please
EDIT: Ok guys well after some intense analytical hours, I found that one of the triggers would try to run itself infinitely. It only did so starting the Medieval Age, its the one where A Unit Enters Region. This trigger is meant to auto-upgrade newly settled villages from Chieftain's huts to the next-age town center: Landlords Dwellings(instead of massing If/Then/Elses in the initial Settling trigger). I found the reason it did so was because when a Chieftain's Hut was replaced, the new Landlords Dwelling was now entering the region. And since under the Or conditions it has Landlord Dwellings as a viable triggering unit, that unit will run the trigger. Obviously it can only be replaced with a Landlords Dwelling(pointlessly), since thats the age at which the player is. Now this newly replaced Landlords Dwelling will run the trigger again, get replaced, run the trigger again, and so on infinitely. So, essentially, the game crashes.
Just thought I'd share that learning experience. Anyway I fixed it, but thank you all for your concern
P.S It does not happen after the 2 or 3rd time the trigger runs, so its not a leaking-over-time issue. It crashes on the first instance!
Here is another related trigger.
EDIT: Ok guys well after some intense analytical hours, I found that one of the triggers would try to run itself infinitely. It only did so starting the Medieval Age, its the one where A Unit Enters Region. This trigger is meant to auto-upgrade newly settled villages from Chieftain's huts to the next-age town center: Landlords Dwellings(instead of massing If/Then/Elses in the initial Settling trigger). I found the reason it did so was because when a Chieftain's Hut was replaced, the new Landlords Dwelling was now entering the region. And since under the Or conditions it has Landlord Dwellings as a viable triggering unit, that unit will run the trigger. Obviously it can only be replaced with a Landlords Dwelling(pointlessly), since thats the age at which the player is. Now this newly replaced Landlords Dwelling will run the trigger again, get replaced, run the trigger again, and so on infinitely. So, essentially, the game crashes.
Just thought I'd share that learning experience. Anyway I fixed it, but thank you all for your concern
-
advance to the medieval age
-
Events
- Unit - A unit Finishes research
-
Conditions
- (Researched tech-type) Equal to Advance to the Medieval Age (Ancient)
-
Actions
- Set agerace[1] = (agerace[1] + 1)
-
Unit Group - Pick every unit in (Units owned by (Owner of (Researching unit)) of type Chieftain's Hut) and do (Actions)
-
Loop - Actions
- Unit - Replace (Picked unit) with a Landlord's Dwelling using The new unit's max life and mana
-
Loop - Actions
-
Unit Group - Pick every unit in (Units owned by (Owner of (Researching unit)) of type Village Forum) and do (Actions)
-
Loop - Actions
- Unit - Replace (Picked unit) with a Marketplace using The new unit's max life and mana
-
Loop - Actions
-
Unit Group - Pick every unit in (Units owned by (Owner of (Researching unit)) of type Ancient Villager) and do (Actions)
-
Loop - Actions
- Unit - Replace (Picked unit) with a Medieval Villager using The old unit's relative life and mana
-
Loop - Actions
-
Unit Group - Pick every unit in (Units owned by (Owner of (Researching unit)) of type Ancient Settler) and do (Actions)
-
Loop - Actions
- Unit - Replace (Picked unit) with a Medieval Settler using The old unit's relative life and mana
-
Loop - Actions
-
Unit Group - Pick every unit in (Units owned by (Owner of (Researching unit)) of type Ancient Barracks) and do (Actions)
-
Loop - Actions
- Unit - Replace (Picked unit) with a Medieval Barracks using The old unit's relative life and mana
-
Loop - Actions
-
Unit Group - Pick every unit in (Units owned by (Owner of (Researching unit)) of type Fishing Net) and do (Actions)
-
Loop - Actions
- Unit - Replace (Picked unit) with a Improved Fishing Net using The old unit's relative life and mana
- Unit - Order (Last replaced unit) to Human Sorceress - Invisibility (Last replaced unit)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- agerace[1] Equal to 1
-
Then - Actions
- Game - Display to (All players) the text: ((Name of (Owner of (Researching unit))) + was the first civilization to reach the Medieval Age! (+25 Happiness all villages))
-
For each (Integer A) from 1 to 102, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (village[(Integer A)] is alive) Equal to True
- (Owner of village[(Integer A)]) Equal to (Owner of (Researching unit))
-
Then - Actions
- Set villagehappiness[(Integer A)] = (villagehappiness[(Integer A)] + 25)
-
Else - Actions
- Do nothing
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
- Trigger - Turn on Autoupgrade Settled Village <gen>
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- agerace[1] Equal to (Number of players in playingplayers)
-
Then - Actions
- Game - Display to (All players) the text: ((Name of (Owner of (Researching unit))) + was the last civilization to reach the Medieval Age! (-25 Happiness all villages))
-
For each (Integer A) from 1 to 102, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (village[(Integer A)] is alive) Equal to True
- (Owner of village[(Integer A)]) Equal to (Owner of (Researching unit))
-
Then - Actions
- Set villagehappiness[(Integer A)] = (villagehappiness[(Integer A)] - 25)
-
Else - Actions
- Do nothing
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
Else - Actions
- Game - Display to (All players) the text: ((Name of (Owner of (Researching unit))) + has reached the Medieval Age!)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Trigger - Run count civ happiness <gen> (ignoring conditions)
-
Events
P.S It does not happen after the 2 or 3rd time the trigger runs, so its not a leaking-over-time issue. It crashes on the first instance!
Here is another related trigger.
-
medieval unlocked
-
Events
- Unit - A unit Finishes research
-
Conditions
- (Researched tech-type) Equal to Advance to the Medieval Age (Ancient)
-
Actions
- Set medieval[(Player number of (Owner of (Researching unit)))] = 1
-
Events
-
Autoupgrade Settled Village
-
Events
- Unit - A unit enters (Playable map area)
-
Conditions
-
Or - Any (Conditions) are true
-
Conditions
- (Unit-type of (Entering unit)) Equal to Chieftain's Hut
- (Unit-type of (Entering unit)) Equal to Landlord's Dwelling
- (Unit-type of (Entering unit)) Equal to Royal Palace
- (Unit-type of (Entering unit)) Equal to Imperial Capital
-
Conditions
-
Or - Any (Conditions) are true
-
Actions
- Set cities[(Player number of (Owner of (Triggering unit)))] = (cities[(Player number of (Owner of (Triggering unit)))] + 1)
- Trigger - Run count civ happiness <gen> (ignoring conditions)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- imperial[(Player number of (Owner of (Triggering unit)))] Equal to 1
-
Then - Actions
- Unit - Replace (Triggering unit) with a Imperial Capital using The new unit's max life and mana
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- hasReconnoiter[(Player number of (Owner of (Triggering unit)))] Equal to True
-
Then - Actions
- Unit - Add Reconnoiter to (Last replaced unit)
-
Else - Actions
- Do nothing
-
If - Conditions
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- renaissance[(Player number of (Owner of (Triggering unit)))] Equal to 1
-
Then - Actions
- Unit - Replace (Entering unit) with a Royal Palace using The new unit's max life and mana
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- medieval[(Player number of (Owner of (Entering unit)))] Equal to 1
-
Then - Actions
- Unit - Replace (Entering unit) with a Landlord's Dwelling using The new unit's max life and mana
-
Else - Actions
- Unit - Set life of (Triggering unit) to 100.00%
-
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
-
Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) of type Royal Palace) and do (Actions)
-
Loop - Actions
- Unit Group - Add (Picked unit) to TempGroup
-
Loop - Actions
-
Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) of type Landlord's Dwelling) and do (Actions)
-
Loop - Actions
- Unit Group - Add (Picked unit) to TempGroup
-
Loop - Actions
-
Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) of type Imperial Capital) and do (Actions)
-
Loop - Actions
- Unit Group - Add (Picked unit) to TempGroup
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- tax[(Player number of (Owner of (Triggering unit)))] Equal to 1
- TaxonCD[(Player number of (Owner of (Triggering unit)))] Equal to False
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Taxing[(Player number of (Owner of (Triggering unit)))] Equal to 1
-
Then - Actions
-
Unit Group - Pick every unit in TempGroup and do (Actions)
-
Loop - Actions
- Unit - Add Increase taxes by 1 Gold (From Light Tax) to (Triggering unit)
-
Loop - Actions
-
Unit Group - Pick every unit in TempGroup and do (Actions)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Taxing[(Player number of (Owner of (Triggering unit)))] Equal to 0
-
Then - Actions
-
Unit Group - Pick every unit in TempGroup and do (Actions)
-
Loop - Actions
- Unit - Add Increase taxes by 1 Gold (From Medium Tax) to (Triggering unit)
- Unit - Add Decrease Tax by 1 Gold (From Medium) to (Triggering unit)
-
Loop - Actions
-
Unit Group - Pick every unit in TempGroup and do (Actions)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Taxing[(Player number of (Owner of (Triggering unit)))] Equal to -1
-
Then - Actions
-
Unit Group - Pick every unit in TempGroup and do (Actions)
-
Loop - Actions
- Unit - Add Decrease Tax by 1 Gold (From Heavy) to (Triggering unit)
-
Loop - Actions
-
Unit Group - Pick every unit in TempGroup and do (Actions)
-
Else - Actions
- 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
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Else - Actions
- Do nothing
-
If - Conditions
- Custom script: call DestroyGroup(udg_TempGroup)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- HasGovernment[(Player number of (Owner of (Triggering unit)))] Equal to True
-
Then - Actions
- Unit - Remove Communism from (Triggering unit)
- Unit - Remove Liberalism from (Triggering unit)
- Unit - Remove Republic from (Triggering unit)
-
Else - Actions
- Do nothing
-
If - Conditions
-
Events
Last edited: