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

[Trigger] Game-crashing Trigger!! Help Please

Status
Not open for further replies.
Level 4
Joined
Jul 14, 2012
Messages
100
[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 :D

  • 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
      • 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
      • 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
      • 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
      • 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
      • 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)
      • 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
          • 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
            • Else - Actions
              • Game - Display to (All players) the text: ((Name of (Owner of (Researching unit))) + has reached the Medieval Age!)
      • Trigger - Run count civ happiness <gen> (ignoring conditions)
It basically makes the map unplayable :O Help please!! It would be greatly appreciated

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
EDIT: I followed ruler's advice to the above trigger but it still crashes. Also, this trigger will run consequently since the replaced Chieftain Huts into a Landlord's Dwelling is the Landlord Dwelling "entering" the map...

  • 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
    • 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
        • 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%
      • 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
      • 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
      • 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
      • 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)
            • 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)
                • 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)
                    • Else - Actions
                      • Do nothing
        • Else - Actions
          • Do nothing
      • 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
 
Last edited:
Level 4
Joined
Jul 14, 2012
Messages
100
Unit - Order (Picked unit) to Human Sorceress - Invisibility (Picked unit)
You should order (Last Replaced unit) also to target (Last replaced unit), since the picked unit you replaced no longer exists.

Also, remove that wait.


Okay I did that but it still crashes!

Also I added another trigger which runs consequent to the above(via the replaced unit entering the map)
 
Level 4
Joined
Jul 14, 2012
Messages
100
Trigger - Run count civ happiness <gen> (ignoring conditions)

Please post this trigger as well.

Umm sure

  • count civ happiness
    • Events
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 102, do (Actions)
        • Loop - Actions
          • Player Group - Pick every player in playingplayers and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Owner of village[(Integer A)]) Equal to (Picked player)
                  • (village[(Integer A)] is alive) Equal to True
                • Then - Actions
                  • Set stockhappiness[(Player number of (Picked player))] = ((stockhappiness[(Player number of (Picked player))] + villagehappiness[(Integer A)]) + 0)
                • Else - Actions
                  • Do nothing
              • Set civhappiness[(Player number of (Picked player))] = stockhappiness[(Player number of (Picked player))]
              • Multiboard - Set the text for (Last created multiboard) item in column 2, row (Player number of (Picked player)) to ((String(cities[(Player number of (Picked player))])) + Villages)
              • Multiboard - Set the text for (Last created multiboard) item in column 4, row (Player number of (Picked player)) to (String(civhappiness[(Player number of (Picked player))]))
      • For each (Integer A) from 1 to 16, do (Actions)
        • Loop - Actions
          • Set stockhappiness[(Integer A)] = 0
But I've already resolved it ^^ I edited my First post a while ago. I guess I should've edited my last too. Well anyway thanks for your concern though! :D and for your help on my other triggers. It really did help :)
 
Level 4
Joined
Jul 14, 2012
Messages
100
I didn't look at the whole code but from a first glance it seems that "Replace unit" will fire the "Unit enters map" event. Try disabling the trigger at the start of the trigger and then reenabling it at the end. That way, the triggers' code won't fire its own event.

Do it for each trigger concerned and see if it fixes the problem.

Yes I already noticed and I resolved this trigger already ^-^ Thanks though ! That actually was what the problem seemed to be after all.
 
Status
Not open for further replies.
Top