1. Are you planning to upload your awesome map to Hive? Please review the rules here.
    Dismiss Notice
  2. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  3. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  4. From the gates of hell, the 5th Special Effect Contest Results have emerged.
    Dismiss Notice
  5. Rubbed the right way, the genie is out of its lamp! The 12th Concept Art Contest Results have been announced.
    Dismiss Notice
  6. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  7. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Do you have good ideas for new contests? If so, please open new threads in the Contest Submission sub-forum to discuss them.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Trigger Viewer

Barrens TD 6.86.w3x
Variables
Variables
Start
init
createPeasantChooseDialog
createVersusModeDialog
createDifficultyDialog
setVersus
setDifficulty
versusModeClicked
createPeasantClicked
difficultyButtonClicked
setUnitTypeArray
preloadUnits
TimedStart
start0
start5
start10
Commands
sellAll
sellN
eatAll
eatN
vFarCam
farCam
midCam
cam
xp
setLevel
Building
buildPaladin
buildPanda
buildDemolisher
buildHealer
buildTower
buildWoodSucker
buildGoldSucker
woodSuckerDeath
goldSuckerDeath
buildLumberMill
buildFarmStart
buildFarmTrainChick
buildBonfire
Training
autoTrainLumber
autoTrainFarm1
autoTrainFarm2
autoTrainFarm3
autoTrainMill
woodTrained
chickTrained
Upgrades
upgradeWood
upgradeGold
upgradeToMill
upgradeBuildings
upgradeMaxFood
importWood
upgradeAnimals
upgradeArcher
upgradeEnemies
upgradeSkilledArcher
upgradePlayer
Multiboard
updateMultiboard
initialiseMultiboard
updateRounds
ManaManagement
deactivateDefencePaladin
deactivateAttackPanda
deactivateDemolisher
activateDefencePaladin
activateAttackPanda
activateDemolisher
priestAI
priestAILong
manaWellAI
reduceManaDemolisher
reduceManaDefencePaladin
reduceManaDemolisherAttackPanda
Cleanup
cleanupEffects
cleanupLumber
cleanupItems
cleanupLeaver
cleanupEnemies
cleanupCrashedPlayer
Tips
Item Recipies
rogueArmor
wizardArmor
holyShield
arcaneBook
dragonArmor
druidClaws
maskOfTheKodo
Timers
wave30Timer
wave20Timer
wave10Timer
recoverTimer
startGameTimer
normalNightTimer
normalDayTimer
Misc
killRabbits
createBonfire
createFarms
createLumberMills
eatChickenMessage
spawnInfernos
globalTicker
reduceFarmCounter
stackItem
setEnemyCount
startBossWave
stopBossWave
runSpawn
spawnUnits
removeBuilding
relocateCamp
weatherSettings
disableFires
createMerchant
removeMerchant
day
night
deathGood
deathEnemy0
deathEnemy1
deathEnemy2
deathEnemy3
spawnGoldReward
createTrees
createCritters
rabbitDeath
stagDeath
eatChickenGroup
levelUp
sellChickenGroup
castEat
castSell
hunger
winEffects
winGame
closeGame
Enter map-specific custom script code below. This text will be included in the map script after variables are declared and before any trigger code.

		
Name Type Is Array Initial Value
activeItem item No
ahnksSpawned integer No
allPlayers force No
animalChanceValues integer Yes 0
animalTypes unitcode Yes
animalTypesHash hashtable No
ArcherButton button No
attackPoint location No
badPlayers force No
baseCode integer No 0
blackMask fogmodifier Yes
chanceValue integer No
chickensToForceEat integer No
chooseUnit dialog No
CleanedItem item Yes
closeGameTimer timer No
commonDropTable itemcode Yes
createdMerchant boolean No
daySpeed real No 1.00
dayTimer timer No
defeatedPlayers boolean Yes
difficultyButton button Yes
difficultyDialog dialog No
difficultyIndex integer No
difficultyStrings string Yes
difficultyVotes integer Yes 0
eatGroup group No
eatGroupCount integer No
eatGroups group Yes
effectCounter integer No
effectDestroyTimer timer No
effects effect Yes
enemyPlayers player Yes
enemySize integer Yes
extraXp integer No
farmCount integer Yes
foodValues integer Yes
gameSpeed real No 320.00
gameTimer timer No
goldLevel integer Yes 100
goldSucker integer Yes 0
goldValue integer No
goldValues integer Yes
goodGroup group No
hungerPlayer integer No 1
infernalGroup group No
itemA itemcode No
itemB itemcode No
itemC itemcode No
ItemCleanupFlag boolean No
ItemCleanupTimer timer No
ItemsToClean integer No
lastUnitCounter integer No
level integer No 1
Loop integervar No
lumberGroup group No
LumberjackButton button No
lumberLevel integer Yes 30
lumberTimer timer No
maxFood integer Yes 50
maxPlayers integer No 8
maxUnits integer No 40
merchant unit No
multiboard multiboard No
multiboardEnabled boolean No
newRequiredXP integer No
nightMode boolean No
nightSpeed real No 1.00
nightTimer timer No
peasantCurrent integer Yes
peasantLevel integer No
peasantNames string Yes
peasantRequired integer Yes
peasants unit Yes
playerCount integer No
players force No
playlist string No
printEat boolean No
rareDropTable itemcode Yes
roundsDialog dialog No
roundsDialogButtons button Yes
roundsDialogText string Yes
roundsResult integer No
roundsVoting integer Yes
sellGroup group No
sellGroupCount integer No
spawningEnabled boolean No
spawnPoint location No
spawnRegions rect Yes
spawnSide integer No
spawnTimer timer No
tempEffect effect Yes
tempGroup group No
tempGroup2 group No
tempInt integer No
tempInt2 integer No
tempItem item No
tempItemType itemcode No
tempPlayer player No
tempPlayerNumber integer No
tempPlayers force No
tempPoint location No
tempPoint2 location No
tempRegion rect No
tempType unitcode No
tempUnit unit No
tempUnitType unitcode No
tempWeather weathereffect No
tick integer No 1
tickTimer timer No
timeRatio real No 1.00
TimeRemaining real No
totalRounds integer No 30
unitCode integer No
unitCodes integer Yes
unitCount integer No
unitIndex integer No
unitTypes unitcode Yes
upgradeAnimalPlayer integer No 1
upgradeGroup group No
upgradeLevel integer No
upgradeLevelMajor integer No
versusDialog dialog No
versusDialogButton button Yes
versusIndex integer No
versusMode boolean No
versusVotes integer Yes
visibility fogmodifier Yes
weather weathereffect No
weatherSet boolean No
woodSucker integer Yes 0
x real No
xpValue integer No
xpValues integer Yes
y real No
init
  Events
    Map initialization
  Conditions
  Actions
    Destructible - Pick every destructible in invarea1 <gen> and do (Actions)
      Loop - Actions
        Destructible - Make (Picked destructible) Invulnerable
    Destructible - Pick every destructible in invarea2 <gen> and do (Actions)
      Loop - Actions
        Destructible - Make (Picked destructible) Invulnerable
    Destructible - Pick every destructible in invarea3 <gen> and do (Actions)
      Loop - Actions
        Destructible - Make (Picked destructible) Invulnerable
    Destructible - Pick every destructible in invarea4 <gen> and do (Actions)
      Loop - Actions
        Destructible - Make (Picked destructible) Invulnerable
    Set VariableSet totalRounds = 30
    Set VariableSet gameSpeed = 265.00
    Trigger - Run setUnitTypeArray <gen> (checking conditions)
    Set VariableSet playlist = Sound\Music\mp3Music\Orc1.mp3;Sound\Music\mp3Music\Orc2.mp3;Sound\Music\mp3Music\Orc3.mp3;Sound\Music\mp3Music\OrcX1.mp3;Sound\Music\mp3Music\War3XMainScreen.mp3;Sound\Music\mp3Music\Mainscreen.mp3
    Set VariableSet peasantNames[0] = The Incredible Farmer
    Set VariableSet peasantNames[1] = Four Hundred and Twenty Year old Farmer
    Set VariableSet peasantNames[2] = Old Coot
    Set VariableSet peasantNames[3] = Elite MLG Farmer Bro
    Set VariableSet peasantNames[4] = Wheat Bae
    Set VariableSet peasantNames[5] = Piggles the Pig Lover
    Set VariableSet peasantNames[6] = The Sheep Shagger
    Set VariableSet peasantNames[7] = Tobbaco Mac
    Set VariableSet peasantNames[8] = Cucumber Carl
    Set VariableSet peasantNames[9] = Herb Man
    Set VariableSet peasantNames[10] = Fred the Cuck
    Set VariableSet peasantNames[11] = Charlie the Chicken Shit Flicker
    Set VariableSet peasantNames[12] = Kaden The Cow Crap Collecter
    Set VariableSet rareDropTable[0] = Greater Damage Bonus
    Set VariableSet rareDropTable[1] = Advanced Armor
    Set VariableSet rareDropTable[2] = Greater Attack Speed Bonus
    Set VariableSet rareDropTable[3] = Legendary Armor
    Set VariableSet rareDropTable[4] = Flame Blade
    Set VariableSet rareDropTable[5] = Greater Mana Bonus
    Set VariableSet commonDropTable[0] = Broken Armor
    Set VariableSet commonDropTable[1] = Damage Bonus
    Set VariableSet commonDropTable[2] = Mana Bonus
    Set VariableSet commonDropTable[3] = Life Ring
    Set VariableSet commonDropTable[4] = Attack Speed Bonus
    Set VariableSet commonDropTable[5] = Shield
    Set VariableSet animalTypes[0] = Chick
    Set VariableSet animalTypes[1] = Chicken (1)
    Set VariableSet animalTypes[2] = Fat Chicken
    Set VariableSet animalTypes[3] = Obese Chicken
    Set VariableSet animalTypes[4] = Lamb
    Set VariableSet animalTypes[5] = Sheep
    Set VariableSet animalTypes[6] = Fat Sheep
    Set VariableSet animalTypes[7] = Obese Sheep
    Set VariableSet animalTypes[8] = Free Range Chicken
    Custom script: set udg_baseCode = udg_animalTypes[2]
    For each (Integer A) from 0 to 8, do (Actions)
      Loop - Actions
        Custom script: set udg_tempInt = udg_animalTypes[GetForLoopIndexA()] - udg_baseCode
        Set VariableSet unitCodes[tempInt] = (Integer A)
    Set VariableSet foodValues[0] = 5
    Set VariableSet foodValues[1] = 10
    Set VariableSet foodValues[2] = 25
    Set VariableSet foodValues[3] = 50
    Set VariableSet foodValues[4] = 25
    Set VariableSet foodValues[5] = 50
    Set VariableSet foodValues[6] = 100
    Set VariableSet foodValues[7] = 250
    Set VariableSet foodValues[8] = 125
    Set VariableSet goldValues[0] = 2
    Set VariableSet goldValues[1] = 5
    Set VariableSet goldValues[2] = 10
    Set VariableSet goldValues[3] = 25
    Set VariableSet goldValues[4] = 25
    Set VariableSet goldValues[5] = 50
    Set VariableSet goldValues[6] = 100
    Set VariableSet goldValues[7] = 250
    Set VariableSet goldValues[8] = 75
    Set VariableSet animalChanceValues[0] = 15
    Set VariableSet animalChanceValues[1] = 30
    Set VariableSet animalChanceValues[2] = 40
    Set VariableSet animalChanceValues[4] = 40
    Set VariableSet animalChanceValues[5] = 60
    Set VariableSet animalChanceValues[6] = 80
    For each (Integer A) from 0 to 9, do (Actions)
      Loop - Actions
        Set VariableSet xpValues[(Integer A)] = (5 x ((Integer A) + 1))
    For each (Integer A) from 10 to 19, do (Actions)
      Loop - Actions
        Set VariableSet xpValues[(Integer A)] = (50 x ((Integer A) + 1))
    For each (Integer A) from 20 to 29, do (Actions)
      Loop - Actions
        Set VariableSet xpValues[(Integer A)] = (100 x ((Integer A) + 1))
    For each (Integer A) from 30 to 99, do (Actions)
      Loop - Actions
        Set VariableSet xpValues[(Integer A)] = (250 x ((Integer A) + 1))
    Quest - Create a Optional quest titled Peasant Points with the description Peasant Points Gained for each animal:- Chick: 5- Chicken: 10- Fat Chicken: 25- Obese Chicken: 50- Free Range Chicken: 125- Lamb: 25- Sheep: 50- Fat Sheep: 100- Obese Sheep: 250, using icon path ReplaceableTextures\CommandButtons\BTNCritterChicken.blp
    Quest - Create a Optional quest titled Gold with the description Gold gained for each animal:- Chick: 2- Chicken: 5- Fat Chicken: 10- Obese Chicken: 25- Free Range Chicken: 75- Lamb: 25- Sheep: 50- Fat Sheep: 100- Obese Sheep: 250, using icon path ReplaceableTextures\CommandButtons\BTNChestOfGold.blp
    Quest - Create a Required quest titled Tips with the description - Enemies come at night time and leave at day.- Enemies spawn from the sides of the map.- There are 30 waves, every 10th wave is a difficult wave, but gives you a long time to rebuild.- Build Lumber Mills and Lumber upgrades to get wood, or import wood from the tent.- Kill units with your peasant and towers to get gold and items. or sell chickens.- The chance to to drop wood, gold and items can be increased with upgrades- Eat chickens/sheep to gain peasant points to level up your peasant- Some advanced units require mana to function, using icon path ReplaceableTextures\CommandButtons\BTNTownHall.blp
    Quest - Create a Required quest titled Commands with the description Adjust Camera: -mid, -far, -vfarAdjust Specific Camera: -cam 1000-4000Eat all chickens/sheep: -eatCheck Peasant XP: -xpEat specific number of chickens/sheep: -eat 1-99Sell all your animals for gold: -sellSell specific number of chickens/sheep: -sell 1-99, using icon path ReplaceableTextures\WorldEditUI\StartingLocation.blp
    Set VariableSet spawnRegions[0] = bot <gen>
    Set VariableSet spawnRegions[1] = top <gen>
    Set VariableSet spawnRegions[2] = left <gen>
    Set VariableSet spawnRegions[3] = right <gen>
    Set VariableSet enemyPlayers[0] = Player 21 (Coal)
    Set VariableSet enemyPlayers[1] = Player 22 (Snow)
    Set VariableSet enemyPlayers[2] = Player 23 (Emerald)
    Set VariableSet enemyPlayers[3] = Player 24 (Peanut)
    Player Group - Add Player 21 (Coal) to badPlayers
    Player Group - Add Player 22 (Snow) to badPlayers
    Player Group - Add Player 23 (Emerald) to badPlayers
    Player Group - Add Player 24 (Peanut) to badPlayers
    Player - Change color of Player 24 (Peanut) to Black, Changing color of existing units
    Player - Change color of Player 23 (Emerald) to Black, Changing color of existing units
    Player - Change color of Player 22 (Snow) to Black, Changing color of existing units
    Player - Change color of Player 21 (Coal) to Black, Changing color of existing units
    Player - Set name of Player 21 (Coal) to Baddies
    Player - Set name of Player 22 (Snow) to Baddies
    Player - Set name of Player 23 (Emerald) to Baddies
    Player - Set name of Player 24 (Peanut) to Baddies
    Player Group - Pick every player in badPlayers and do (Actions)
      Loop - Actions
        Player - Make Neutral Hostile treat (Picked player) as an Ally with shared vision
        Player - Make (Picked player) treat Neutral Hostile as an Ally with shared vision
    Set VariableSet players = (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) controller) Equal to User)).)
    Set VariableSet allPlayers = (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) controller) Equal to User)).)
    Set VariableSet playerCount = (Number of players in players)
    Trigger - Run setEnemyCount <gen> (checking conditions)
    Trigger - Add to setLevel <gen> the event (Player 1 (Red) types a chat message containing -setlevel (stringnoformat) as A substring)
    Player Group - Pick every player in players and do (Actions)
      Loop - Actions
        Player - Set (Picked player).Food max to maxFood[(Player number of (Picked player))]
        Trigger - Add to cleanupLeaver <gen> the event ((Picked player) leaves the game)
        Trigger - Add to xp <gen> the event ((Picked player) types a chat message containing -xp (stringnoformat) as An exact match)
        Trigger - Add to midCam <gen> the event ((Picked player) types a chat message containing -mid (stringnoformat) as An exact match)
        Trigger - Add to farCam <gen> the event ((Picked player) types a chat message containing -far (stringnoformat) as An exact match)
        Trigger - Add to vFarCam <gen> the event ((Picked player) types a chat message containing -vfar (stringnoformat) as An exact match)
        Trigger - Add to eatAll <gen> the event ((Picked player) types a chat message containing -eat (stringnoformat) as An exact match)
        Trigger - Add to sellAll <gen> the event ((Picked player) types a chat message containing -sell (stringnoformat) as An exact match)
        Trigger - Add to eatN <gen> the event ((Picked player) types a chat message containing -eat (stringnoformat) as A substring)
        Trigger - Add to sellN <gen> the event ((Picked player) types a chat message containing -sell (stringnoformat) as A substring)
        Trigger - Add to cam <gen> the event ((Picked player) types a chat message containing -cam (stringnoformat) as A substring)
        Visibility - Create an initially Enabled visibility modifier for (Picked player) emitting Visibility across (Playable map area)
        Set VariableSet visibility[(Player number of (Picked player))] = (Last created visibility modifier)
        Visibility - Create an initially Disabled visibility modifier for (Picked player) emitting Black mask across (Playable map area)
        Set VariableSet blackMask[(Player number of (Picked player))] = (Last created visibility modifier)
        Set VariableSet tempInt = (Player number of (Picked player))
        Set VariableSet peasantCurrent[tempInt] = 0
        Set VariableSet peasantRequired[tempInt] = 10
        Player - Set the current research level of Robf (techcode) to 1 for (Picked player)
        Player - Limit training of Pack Horse to 1 for (Picked player)
        Player - Limit training of Peasant to 1 for (Picked player)
        Player - Limit training of Camp to 1 for (Picked player)
        Player - Limit training of Smart Machine (lumberjack) to 1 for (Picked player)
        Player - Limit training of Smart Machine (hunter) to 1 for (Picked player)
        Player - Limit training of Bonfire to 1 for (Picked player)
        Player - Make Farm (2) Unavailable for training/construction by (Picked player)
        Player - Make Farm (3) Unavailable for training/construction by (Picked player)
    Trigger - Run createCritters <gen> (checking conditions)
    Trigger - Run createTrees <gen> (checking conditions)
    Trigger - Run upgradeEnemies <gen> (checking conditions)
    Trigger - Run preloadUnits <gen> (checking conditions)
    Custom script: call DestroyTrigger( GetTriggeringTrigger() )
createPeasantChooseDialog
  Events
    Time - Elapsed game time is 0.00 seconds
  Conditions
  Actions
    Dialog - Change the title of chooseUnit to Select Your Peasant
    Dialog - Create a dialog button for chooseUnit labelled Hunter
    Set VariableSet ArcherButton = (Last created dialog Button)
    Dialog - Create a dialog button for chooseUnit labelled Lumberjack
    Set VariableSet LumberjackButton = (Last created dialog Button)
    Custom script: call DestroyTrigger( GetTriggeringTrigger() )
createVersusModeDialog
  Events
    Time - Elapsed game time is 0.00 seconds
  Conditions
  Actions
    Dialog - Change the title of versusDialog to Game Mode
    Dialog - Create a dialog button for versusDialog labelled Cooperative
    Set VariableSet versusDialogButton[0] = (Last created dialog Button)
    Dialog - Create a dialog button for versusDialog labelled Versus
    Set VariableSet versusDialogButton[1] = (Last created dialog Button)
    Player Group - Pick every player in players and do (Actions)
      Loop - Actions
        Dialog - Show versusDialog for (Picked player)
    Custom script: call DestroyTrigger( GetTriggeringTrigger() )
createDifficultyDialog
  Events
    Time - Elapsed game time is 0.00 seconds
  Conditions
  Actions
    Dialog - Change the title of difficultyDialog to Select Difficulty
    Set VariableSet difficultyStrings[0] = |c00C0FFC0Weak Scum|r
    Set VariableSet difficultyStrings[1] = |c00A0FFA0Gutter Trash|r
    Set VariableSet difficultyStrings[2] = |c0080FF80Barrens Idiot|r
    Set VariableSet difficultyStrings[3] = |c008080FFAverage Joe|r
    Set VariableSet difficultyStrings[4] = |c00B5A0E0Mildly Competent|r
    Set VariableSet difficultyStrings[5] = |c00C8808FTalented Chicken Muncher|r
    Set VariableSet difficultyStrings[6] = |c00640000Farming God|r
    For each (Integer A) from 0 to 6, do (Actions)
      Loop - Actions
        Dialog - Create a dialog button for difficultyDialog labelled difficultyStrings[(Integer A)]
        Set VariableSet difficultyButton[(Integer A)] = (Last created dialog Button)
    Custom script: call DestroyTrigger( GetTriggeringTrigger() )
setVersus
  Events
    Time - Elapsed game time is 10.00 seconds
  Conditions
  Actions
    Set VariableSet tempInt = 0
    For each (Integer A) from 0 to 1, do (Actions)
      Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            versusVotes[(Integer A)] Greater than tempInt
          Then - Actions
            Set VariableSet tempInt = versusVotes[(Integer A)]
            Set VariableSet versusIndex = (Integer A)
          Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        versusIndex Equal to 0
      Then - Actions
        Sound - Play PeasantWarcry1 <gen>
        Set VariableSet versusMode = False
        Game - Display to players the text: Cooperative Mode Activated!
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        versusIndex Equal to 1
      Then - Actions
        Sound - Play FootmanYesAttack1 <gen>
        Set VariableSet versusMode = True
        Game - Display to players the text: Versus Mode Activated!
        Player Group - Pick every player in players and do (Actions)
          Loop - Actions
            Set VariableSet tempPlayer = (Picked player)
            For each (Integer A) from 1 to (maxPlayers + 1), do (Actions)
              Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  If - Conditions
                    tempPlayer Not equal to (Player((Integer A)))
                  Then - Actions
                    Player - Make (Picked player) treat (Player((Integer A))) as an Enemy
                    Player - Make tempPlayer treat (Player((Integer A))) as an Enemy
                  Else - Actions
      Else - Actions
    Custom script: call DestroyTrigger( GetTriggeringTrigger() )
setDifficulty
  Events
    Time - Elapsed game time is 15.00 seconds
  Conditions
  Actions
    Set VariableSet tempInt = 0
    For each (Integer A) from 0 to 6, do (Actions)
      Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            difficultyVotes[(Integer A)] Greater than tempInt
          Then - Actions
            Set VariableSet tempInt = difficultyVotes[(Integer A)]
            Set VariableSet difficultyIndex = (Integer A)
          Else - Actions
    Player Group - Pick every player in badPlayers and do (Actions)
      Loop - Actions
        Player - Set (Picked player) handicap to (50.00 + (Real((difficultyIndex x 20))))%
    Player - Set Neutral Hostile handicap to (50.00 + (Real((difficultyIndex x 20))))%
    Game - Display to players the text: ( + (Difficulty Selected: + difficultyStrings[difficultyIndex]))
    Sound - Play SecretFound <gen>
    Trigger - Run startGameTimer <gen> (checking conditions)
    Player Group - Pick every player in players and do (Actions)
      Loop - Actions
        Player - Add (100 x (7 - difficultyIndex)) to (Picked player).Current lumber
        Player - Set the current research level of R003 (techcode) to (7 - difficultyIndex) for (Picked player)
    For each (Integer A) from 0 to 9, do (Actions)
      Loop - Actions
        Set VariableSet xpValues[(Integer A)] = (xpValues[(Integer A)] + (difficultyIndex x 5))
    For each (Integer A) from 10 to 19, do (Actions)
      Loop - Actions
        Set VariableSet xpValues[(Integer A)] = (xpValues[(Integer A)] + (difficultyIndex x 10))
    For each (Integer A) from 20 to 29, do (Actions)
      Loop - Actions
        Set VariableSet xpValues[(Integer A)] = (xpValues[(Integer A)] + (difficultyIndex x 15))
    For each (Integer A) from 30 to 99, do (Actions)
      Loop - Actions
        Set VariableSet xpValues[(Integer A)] = (xpValues[(Integer A)] + (difficultyIndex x 30))
    Custom script: call DestroyTrigger( GetTriggeringTrigger() )
versusModeClicked
  Events
    Dialog - A dialog button is clicked for versusDialog
  Conditions
  Actions
    For each (Integer A) from 0 to 1, do (Actions)
      Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Clicked dialog button) Equal to versusDialogButton[(Integer A)]
          Then - Actions
            Set VariableSet versusVotes[(Integer A)] = (versusVotes[(Integer A)] + 1)
          Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Clicked dialog button) Equal to versusDialogButton[(Integer A)]
            (Triggering player) Equal to Player 1 (Red)
          Then - Actions
            Set VariableSet versusVotes[(Integer A)] = (versusVotes[(Integer A)] + 2)
          Else - Actions
    Dialog - Show difficultyDialog for (Triggering player)
createPeasantClicked
  Events
    Dialog - A dialog button is clicked for chooseUnit
  Conditions
  Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Clicked dialog button) Equal to ArcherButton
      Then - Actions
        Set VariableSet tempPoint = (Random point in center <gen>)
        Unit - Create 1.Hunter Peasant for (Triggering player) at tempPoint facing Default building facing degrees
        Unit - Set Name of (Last created unit) to peasantNames[(Random integer number between 0 and 12)]
        Set VariableSet peasants[(Player number of (Triggering player))] = (Last created unit)
        Hero - Create Ankh of Reincarnation and give it to (Last created unit)
        Hero - Create Scroll of Speed and give it to (Last created unit)
        Item - Set charges remaining in (Last created item) to 3
        Hero - Create Junk Tower and give it to (Last created unit)
        Item - Set charges remaining in (Last created item) to 3
        Hero - Create Scrappy Wall and give it to (Last created unit)
        Item - Set charges remaining in (Last created item) to 15
        Trigger - Add to deathGood <gen> the event ((Last created unit) Dies)
        Unit Group - Add (Last created unit) to goodGroup
        Selection - Select (Last created unit) for (Triggering player)
        Camera - Pan camera for (Triggering player) to tempPoint over 1.00 seconds
        Custom script: call RemoveLocation(udg_tempPoint)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Clicked dialog button) Equal to LumberjackButton
      Then - Actions
        Set VariableSet tempPoint = (Random point in center <gen>)
        Unit - Create 1.Lumberjack Peasant for (Triggering player) at tempPoint facing Default building facing degrees
        Unit - Set Name of (Last created unit) to peasantNames[(Random integer number between 0 and 12)]
        Set VariableSet peasants[(Player number of (Triggering player))] = (Last created unit)
        Hero - Create Ankh of Reincarnation and give it to (Last created unit)
        Hero - Create Scroll of Speed and give it to (Last created unit)
        Item - Set charges remaining in (Last created item) to 3
        Hero - Create Junk Tower and give it to (Last created unit)
        Item - Set charges remaining in (Last created item) to 3
        Hero - Create Scrappy Wall and give it to (Last created unit)
        Item - Set charges remaining in (Last created item) to 15
        Trigger - Add to deathGood <gen> the event ((Last created unit) Dies)
        Unit Group - Add (Last created unit) to goodGroup
        Selection - Select (Last created unit) for (Triggering player)
        Camera - Pan camera for (Triggering player) to tempPoint over 1.00 seconds
        Custom script: call RemoveLocation(udg_tempPoint)
      Else - Actions
difficultyButtonClicked
  Events
    Dialog - A dialog button is clicked for difficultyDialog
  Conditions
  Actions
    For each (Integer A) from 0 to 6, do (Actions)
      Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Clicked dialog button) Equal to difficultyButton[(Integer A)]
          Then - Actions
            Set VariableSet difficultyVotes[(Integer A)] = (difficultyVotes[(Integer A)] + 1)
          Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Clicked dialog button) Equal to difficultyButton[(Integer A)]
            (Triggering player) Equal to Player 1 (Red)
          Then - Actions
            Set VariableSet difficultyVotes[(Integer A)] = (difficultyVotes[(Integer A)] + 2)
          Else - Actions
    Dialog - Show chooseUnit for (Triggering player)
function Trig_setArray_Actions takes nothing returns nothing
    set udg_unitTypes[0] = 'n000'
    set udg_unitTypes[1] = 'n001'
    set udg_unitTypes[2] = 'n002'
    set udg_unitTypes[3] = 'n003'
    set udg_unitTypes[4] = 'n004'
    set udg_unitTypes[5] = 'n005'
    set udg_unitTypes[6] = 'n006'
    set udg_unitTypes[7] = 'n007'
    set udg_unitTypes[8] = 'n008'
    set udg_unitTypes[9] = 'n009'
    set udg_unitTypes[10] = 'n00A'
    set udg_unitTypes[11] = 'n00B'
    set udg_unitTypes[12] = 'n00C'
    set udg_unitTypes[13] = 'n00D'
    set udg_unitTypes[14] = 'n00E'
    set udg_unitTypes[15] = 'n00F'
    set udg_unitTypes[16] = 'n00G'
    set udg_unitTypes[17] = 'n00H'
    set udg_unitTypes[18] = 'n00I'
    set udg_unitTypes[19] = 'n00J'
    set udg_unitTypes[20] = 'n00K'
    set udg_unitTypes[21] = 'n00L'
    set udg_unitTypes[22] = 'n00M'
    set udg_unitTypes[23] = 'n00N'
    set udg_unitTypes[24] = 'n00O'
    set udg_unitTypes[25] = 'n00P'
    set udg_unitTypes[26] = 'n00Q'
    set udg_unitTypes[27] = 'n00R'
    set udg_unitTypes[28] = 'n00S'
    set udg_unitTypes[29] = 'n00T'
    set udg_unitTypes[30] = 'n00U'
    set udg_unitTypes[31] = 'n00V'
    set udg_unitTypes[32] = 'n00W'
    set udg_unitTypes[33] = 'n00X'
    set udg_unitTypes[34] = 'n00Y'
    set udg_unitTypes[35] = 'n00Z'
    set udg_unitTypes[36] = 'n010'
    set udg_unitTypes[37] = 'n011'
    set udg_unitTypes[38] = 'n012'
    set udg_unitTypes[39] = 'n013'
    set udg_unitTypes[40] = 'n014'
    set udg_unitTypes[41] = 'n015'
    set udg_unitTypes[42] = 'n016'
    set udg_unitTypes[43] = 'n017'
    set udg_unitTypes[44] = 'n018'
    set udg_unitTypes[45] = 'n019'
    set udg_unitTypes[46] = 'n01A'
    set udg_unitTypes[47] = 'n01B'
    set udg_unitTypes[48] = 'n01C'
    set udg_unitTypes[49] = 'n01D'
endfunction

//===========================================================================
function InitTrig_setUnitTypeArray takes nothing returns nothing
    set gg_trg_setUnitTypeArray = CreateTrigger(  )
    call TriggerAddAction( gg_trg_setUnitTypeArray, function Trig_setArray_Actions )
    call DestroyTrigger( GetTriggeringTrigger() )
endfunction

 
preloadUnits
  Events
  Conditions
  Actions
    Set VariableSet tempPoint = (Random point in center <gen>)
    Unit - Create 1.Lumberjack Peasant for Neutral Passive at tempPoint facing Default building facing degrees
    Unit - Remove (Last created unit) from the game
    Set VariableSet tempPoint = (Random point in center <gen>)
    Unit - Create 1.Hunter Peasant for Neutral Passive at tempPoint facing Default building facing degrees
    Unit - Remove (Last created unit) from the game
    For each (Integer A) from 0 to 49, do (Actions)
      Loop - Actions
        Set VariableSet tempPoint = (Random point in center <gen>)
        Unit - Create 1.unitTypes[(Integer A)] for Neutral Passive at tempPoint facing Default building facing degrees
        Unit - Remove (Last created unit) from the game
    Custom script: call RemoveLocation(udg_tempPoint)
    Custom script: call DestroyTrigger( GetTriggeringTrigger() )
start0
  Events
    Time - Elapsed game time is 0.00 seconds
  Conditions
  Actions
    Sound - Stop music Immediately
    Countdown Timer - Start tickTimer as a Repeating timer that will expire in 1.00 seconds
    Cinematic - Fade in over 7.00 seconds using texture Black Mask and color (0%, 0%, 0%) with 0% transparency
    Game - Set the time of day to 9.00
    Game - Turn the day/night cycle Off
    Trigger - Run startGameTimer <gen> (checking conditions)
    Quest - Flash the quest dialog button
    Player Group - Pick every player in players and do (Actions)
      Loop - Actions
        Set VariableSet tempPoint = (Random point in center <gen>)
        Camera - Pan camera for (Picked player) to tempPoint over 0 seconds
        Custom script: call RemoveLocation(udg_tempPoint)
        Camera - Set (Picked player)'s camera Distance to target to 2250.00 over 0.00 seconds
    Custom script: call DestroyTrigger( GetTriggeringTrigger() )
start5
  Events
    Time - Elapsed game time is 5.00 seconds
  Conditions
  Actions
    Sound - Play BattleNetWooshStereo1 <gen>
    Custom script: call DestroyTrigger( GetTriggeringTrigger() )
start10
  Events
    Time - Elapsed game time is 5 seconds
  Conditions
  Actions
    Sound - Clear the music list
    Custom script: call SetMapMusic(udg_playlist, true, 0)
    Custom script: call PlayMusic(udg_playlist)
    Custom script: call DestroyTrigger( GetTriggeringTrigger() )
sellAll
  Events
  Conditions
  Actions
    Set VariableSet sellGroup = (Units owned by (Triggering player) matching (((Unit-type of (Matching unit)) Equal to Chick) or (((Unit-type of (Matching unit)) Equal to Chicken (1)) or (((Unit-type of (Matching unit)) Equal to Fat Chicken) or (((Unit-type of (Matching unit)) Equal to Obese Chicken) or (((Unit-type of (Matching unit)) Equal to Fat Sheep) or (((Unit-type of (Matching unit)) Equal to Lamb) or (((Unit-type of (Matching unit)) Equal to Obese Sheep) or ((Unit-type of (Matching unit)) Equal to Sheep)))))))).)
    Trigger - Run sellChickenGroup <gen> (checking conditions)
    Custom script: call DestroyGroup(udg_sellGroup)
    Set VariableSet tempPoint = (Position of peasants[(Player number of (Triggering player))])
    Sound - Play ReceiveGold <gen> at 100% volume, located at tempPoint with Z offset 0
    Custom script: call RemoveLocation(udg_tempPoint)
sellN
  Events
  Conditions
  Actions
    Set VariableSet tempInt = (Integer((Substring((Entered chat string), 6, 8))))
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        tempInt Greater than 0
        tempInt Less than 100
      Then - Actions
        Set VariableSet tempGroup = (Units owned by (Triggering player) matching (((Unit-type of (Matching unit)) Equal to Chick) or (((Unit-type of (Matching unit)) Equal to Chicken (1)) or (((Unit-type of (Matching unit)) Equal to Fat Chicken) or (((Unit-type of (Matching unit)) Equal to Obese Chicken) or (((Unit-type of (Matching unit)) Equal to Fat Sheep) or (((Unit-type of (Matching unit)) Equal to Lamb) or (((Unit-type of (Matching unit)) Equal to Obese Sheep) or ((Unit-type of (Matching unit)) Equal to Sheep)))))))).)
        Set VariableSet sellGroup = (Random (Min(tempInt, (Number of units in tempGroup))) units from tempGroup)
        Custom script: call DestroyGroup(udg_tempGroup)
        Trigger - Run sellChickenGroup <gen> (checking conditions)
        Custom script: call DestroyGroup(udg_sellGroup)
        Set VariableSet tempPoint = (Position of peasants[(Player number of (Triggering player))])
        Sound - Play ReceiveGold <gen> at 100% volume, located at tempPoint with Z offset 0
        Custom script: call RemoveLocation(udg_tempPoint)
      Else - Actions
eatAll
  Events
  Conditions
  Actions
    Set VariableSet eatGroup = (Units owned by (Triggering player) matching (((Unit-type of (Matching unit)) Equal to Chick) or (((Unit-type of (Matching unit)) Equal to Chicken (1)) or (((Unit-type of (Matching unit)) Equal to Fat Chicken) or (((Unit-type of (Matching unit)) Equal to Obese Chicken) or (((Unit-type of (Matching unit)) Equal to Fat Sheep) or (((Unit-type of (Matching unit)) Equal to Lamb) or (((Unit-type of (Matching unit)) Equal to Obese Sheep) or ((Unit-type of (Matching unit)) Equal to Sheep)))))))).)
    Trigger - Run eatChickenGroup <gen> (checking conditions)
    Custom script: call DestroyGroup(udg_eatGroup)
eatN
  Events
  Conditions
  Actions
    Set VariableSet tempInt = (Integer((Substring((Entered chat string), 5, 7))))
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        tempInt Greater than 0
        tempInt Less than 100
      Then - Actions
        Set VariableSet tempGroup = (Units owned by (Triggering player) matching (((Unit-type of (Matching unit)) Equal to Chick) or (((Unit-type of (Matching unit)) Equal to Chicken (1)) or (((Unit-type of (Matching unit)) Equal to Fat Chicken) or (((Unit-type of (Matching unit)) Equal to Obese Chicken) or (((Unit-type of (Matching unit)) Equal to Fat Sheep) or (((Unit-type of (Matching unit)) Equal to Lamb) or (((Unit-type of (Matching unit)) Equal to Obese Sheep) or ((Unit-type of (Matching unit)) Equal to Sheep)))))))).)
        Set VariableSet eatGroup = (Random (Min(tempInt, (Number of units in tempGroup))) units from tempGroup)
        Custom script: call DestroyGroup(udg_tempGroup)
        Trigger - Run eatChickenGroup <gen> (checking conditions)
        Custom script: call DestroyGroup(udg_eatGroup)
      Else - Actions
vFarCam
  Events
  Conditions
  Actions
    Camera - Set (Triggering player)'s camera Distance to target to 2500.00 over 0 seconds
farCam
  Events
  Conditions
  Actions
    Camera - Set (Triggering player)'s camera Distance to target to 2150.00 over 0 seconds
midCam
  Events
  Conditions
  Actions
    Camera - Set (Triggering player)'s camera Distance to target to 1550.00 over 0 seconds
cam
  Events
  Conditions
  Actions
    Set VariableSet tempInt = (Integer((Substring((Entered chat string), 5, 10))))
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        tempInt Less than 1000
      Then - Actions
        Set VariableSet tempInt = 1000
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        tempInt Greater than 4000
      Then - Actions
        Set VariableSet tempInt = 4000
      Else - Actions
    Camera - Set (Triggering player)'s camera Distance to target to (Real(tempInt)) over 0 seconds
xp
  Events
  Conditions
  Actions
    Set VariableSet tempInt = peasantCurrent[(Player number of (Triggering player))]
    Set VariableSet tempInt2 = peasantRequired[(Player number of (Triggering player))]
    Set VariableSet tempPlayers = (Player group((Triggering player)))
    Game - Display to tempPlayers for 5.00 seconds the text: (Level: + (String((Current research level of R006 (techcode) for (Triggering player)))))
    Game - Display to tempPlayers for 5.00 seconds the text: (Experience: + ((String(tempInt)) + (/ + (String(tempInt2)))))
    Custom script: call DestroyForce(udg_tempPlayers)
setLevel
  Events
  Conditions
    playerCount Equal to 1
    Or - Any (Conditions) are true
      Conditions
        (Name of (Triggering player)) Equal to worldedit
        (Name of (Triggering player)) Equal to opiemonster
  Actions
    Set VariableSet tempInt = (Integer((Substring((Entered chat string), 11, 12))))
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        tempInt Greater than 0
        tempInt Less than 32
      Then - Actions
        Set VariableSet level = tempInt
        Multiboard - Set the text for multiboard item in column 2, row 1 to ((String(level)) + (/ + 30))
      Else - Actions
buildPaladin
  Events
    Unit - A unit Finishes construction
  Conditions
    (Unit-type of (Triggering unit)) Equal to Defence Paladin
  Actions
    Unit - Set level of Defence for (Triggering unit) to (Current research level of R00C (techcode) for (Owner of (Triggering unit)))
buildPanda
  Events
    Unit - A unit Finishes construction
  Conditions
    (Unit-type of (Triggering unit)) Equal to Attack Panda
  Actions
    Unit - Set level of Damage Aura for (Triggering unit) to (Current research level of R00D (techcode) for (Owner of (Triggering unit)))
buildDemolisher
  Events
    Unit - A unit Finishes construction
  Conditions
    (Unit-type of (Triggering unit)) Equal to Demolisher
  Actions
    Unit - Set level of Burning Oil for (Triggering unit) to (Current research level of Robf (techcode) for (Owner of (Triggering unit)))
buildHealer
  Events
    Unit - A unit Finishes construction
  Conditions
    (Unit-type of (Triggering unit)) Equal to Healer
  Actions
    Unit - Set level of Heal (tower) for (Triggering unit) to (Current research level of R00B (techcode) for (Owner of (Triggering unit)))
buildTower
  Events
    Unit - A unit Finishes construction
  Conditions
    Or - Any (Conditions) are true
      Conditions
        (Unit-type of (Triggering unit)) Equal to Archer
        (Unit-type of (Triggering unit)) Equal to Knight
        (Unit-type of (Triggering unit)) Equal to Soldier
        (Unit-type of (Triggering unit)) Equal to Demolisher
  Actions
    Unit - Set level of Gold Chance for (Triggering unit) to (Current research level of R007 (techcode) for (Owner of (Triggering unit)))
buildWoodSucker
  Events
    Unit - A unit Finishes construction
  Conditions
    (Unit-type of (Triggering unit)) Equal to Wood Sucker
  Actions
    Set VariableSet tempInt = (Player number of (Owner of (Triggering unit)))
    Set VariableSet woodSucker[tempInt] = (woodSucker[tempInt] + 1)
buildGoldSucker
  Events
    Unit - A unit Finishes construction
  Conditions
    (Unit-type of (Triggering unit)) Equal to Gold Sucker
  Actions
    Set VariableSet tempInt = (Player number of (Owner of (Triggering unit)))
    Set VariableSet goldSucker[tempInt] = (goldSucker[tempInt] + 1)
woodSuckerDeath
  Events
    Unit - A unit Dies
  Conditions
    (Unit-type of (Dying unit)) Equal to Wood Sucker
  Actions
    Set VariableSet tempInt = (Player number of (Owner of (Dying unit)))
    Set VariableSet woodSucker[tempInt] = (woodSucker[tempInt] - 1)
goldSuckerDeath
  Events
    Unit - A unit Dies
  Conditions
    (Unit-type of (Dying unit)) Equal to Gold Sucker
  Actions
    Set VariableSet tempInt = (Player number of (Owner of (Dying unit)))
    Set VariableSet goldSucker[tempInt] = (goldSucker[tempInt] - 1)
buildLumberMill
  Events
    Unit - A unit Finishes construction
  Conditions
    (Unit-type of (Triggering unit)) Equal to Lumber Mill
  Actions
    Unit - Set level of Lumber Chance for (Triggering unit) to (Current research level of R008 (techcode) for (Owner of (Triggering unit)))
    Unit - Order (Triggering unit) to train/upgrade to a Harvest Wood
buildFarmStart
  Events
    Unit - A unit Begins construction
  Conditions
    Or - Any (Conditions) are true
      Conditions
        (Unit-type of (Triggering unit)) Equal to Farm
        (Unit-type of (Triggering unit)) Equal to Farm (2)
        (Unit-type of (Triggering unit)) Equal to Farm (3)
  Actions
    Set VariableSet farmCount[(Player number of (Owner of (Triggering unit)))] = (farmCount[(Player number of (Owner of (Triggering unit)))] + 1)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        farmCount[(Player number of (Owner of (Triggering unit)))] Equal to 5
      Then - Actions
        Player - Make Farm Unavailable for training/construction by (Owner of (Triggering unit))
        Player - Make Farm (2) Available for training/construction by (Owner of (Triggering unit))
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        farmCount[(Player number of (Owner of (Triggering unit)))] Equal to 10
      Then - Actions
        Player - Make Farm (2) Unavailable for training/construction by (Owner of (Triggering unit))
        Player - Make Farm (3) Available for training/construction by (Owner of (Triggering unit))
      Else - Actions
buildFarmTrainChick
  Events
    Unit - A unit Finishes construction
  Conditions
    Or - Any (Conditions) are true
      Conditions
        (Unit-type of (Triggering unit)) Equal to Farm
        (Unit-type of (Triggering unit)) Equal to Farm (2)
        (Unit-type of (Triggering unit)) Equal to Farm (3)
  Actions
    Unit - Order (Triggering unit) to train/upgrade to a Chick
buildBonfire
  Events
    Unit - A unit Finishes construction
  Conditions
    (Unit-type of (Triggering unit)) Equal to Bonfire
  Actions
    Player - Set the current research level of R00G (techcode) to 1 for (Owner of (Triggering unit))
autoTrainLumber
  Events
  Conditions
  Actions
    Set VariableSet tempGroup = (Units of type Lumber Mill)
    Unit Group - Pick every unit in tempGroup and do (Actions)
      Loop - Actions
        Unit - Order (Picked unit) to train/upgrade to a Harvest Wood
    Custom script: call DestroyGroup(udg_tempGroup)
autoTrainFarm1
  Events
  Conditions
  Actions
    Set VariableSet tempGroup = (Units of type Farm)
    Unit Group - Pick every unit in tempGroup and do (Actions)
      Loop - Actions
        Unit - Order (Picked unit) to train/upgrade to a Chick
    Custom script: call DestroyGroup(udg_tempGroup)
autoTrainFarm2
  Events
  Conditions
  Actions
    Set VariableSet tempGroup = (Units of type Farm (2))
    Unit Group - Pick every unit in tempGroup and do (Actions)
      Loop - Actions
        Unit - Order (Picked unit) to train/upgrade to a Chick
    Custom script: call DestroyGroup(udg_tempGroup)
autoTrainFarm3
  Events
  Conditions
  Actions
    Set VariableSet tempGroup = (Units of type Farm (3))
    Unit Group - Pick every unit in tempGroup and do (Actions)
      Loop - Actions
        Unit - Order (Picked unit) to train/upgrade to a Chick
    Custom script: call DestroyGroup(udg_tempGroup)
autoTrainMill
  Events
  Conditions
  Actions
    Set VariableSet tempGroup = (Units of type Mill)
    Unit Group - Pick every unit in tempGroup and do (Actions)
      Loop - Actions
        Unit - Order (Picked unit) to train/upgrade to a Lamb
    Custom script: call DestroyGroup(udg_tempGroup)
woodTrained
  Events
    Unit - A unit Finishes training a unit
  Conditions
    (Unit-type of (Trained unit)) Equal to Harvest Wood
  Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Current research level of R008 (techcode) for (Owner of (Trained unit))) Less than or equal to 4
        (Random integer number between 0 and (150 + (difficultyIndex x 5))) Less than (lumberLevel[(Player number of (Owner of (Trained unit)))] + 1)
      Then - Actions
        Set VariableSet tempPoint = ((Position of (Trained unit)) offset by ((Random real number between 10.00 and 30.00), (Random real number between 10.00 and 30.00)))
        Item - Create Lesser Bundle of Lumber at tempPoint
        Custom script: call RemoveLocation(udg_tempPoint)
        Set VariableSet tempPoint = (Position of (Triggering unit))
        Floating Text - Create floating text that reads Success! at tempPoint with Z offset 0, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0% transparency
        Custom script: call RemoveLocation(udg_tempPoint)
        Floating Text - Change (Last created floating text): Disable permanence
        Floating Text - Set the velocity of (Last created floating text) to 30.00 towards 90 degrees
        Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
        Floating Text - Change the lifespan of (Last created floating text) to 4.00 seconds
      Else - Actions
        Set VariableSet tempPoint = (Position of (Triggering unit))
        Floating Text - Create floating text that reads Miss at tempPoint with Z offset 0, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0% transparency
        Custom script: call RemoveLocation(udg_tempPoint)
        Floating Text - Change (Last created floating text): Disable permanence
        Floating Text - Set the velocity of (Last created floating text) to 50.00 towards 90 degrees
        Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
        Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Current research level of R008 (techcode) for (Owner of (Trained unit))) Greater than 4
        (Random integer number between 0 and (460 + (difficultyIndex x 20))) Less than (lumberLevel[(Player number of (Owner of (Trained unit)))] + 1)
      Then - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            woodSucker[(Player number of (Owner of (Trained unit)))] Greater than 0
          Then - Actions
            Player - Set (Owner of (Trained unit)).Current lumber to (((Owner of (Trained unit)) Current lumber) + 100)
          Else - Actions
            Set VariableSet tempPoint = ((Position of (Trained unit)) offset by ((Random real number between 10.00 and 30.00), (Random real number between 10.00 and 30.00)))
            Item - Create Bundle of Lumber at tempPoint
            Custom script: call RemoveLocation(udg_tempPoint)
            Set VariableSet tempPoint = (Position of (Triggering unit))
            Floating Text - Create floating text that reads Success! at tempPoint with Z offset 0, using font size 10, color (0.00%, 100%, 0.00%), and 0% transparency
            Custom script: call RemoveLocation(udg_tempPoint)
            Floating Text - Change (Last created floating text): Disable permanence
            Floating Text - Set the velocity of (Last created floating text) to 30.00 towards 90 degrees
            Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
            Floating Text - Change the lifespan of (Last created floating text) to 4.00 seconds
      Else - Actions
        Set VariableSet tempPoint = (Position of (Triggering unit))
        Floating Text - Create floating text that reads Miss at tempPoint with Z offset 0, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0% transparency
        Custom script: call RemoveLocation(udg_tempPoint)
        Floating Text - Change (Last created floating text): Disable permanence
        Floating Text - Set the velocity of (Last created floating text) to 50.00 towards 90 degrees
        Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
        Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Current research level of R008 (techcode) for (Owner of (Trained unit))) Greater than 9
        (Random integer number between 0 and (14000 + (difficultyIndex x 1000))) Less than (lumberLevel[(Player number of (Owner of (Trained unit)))] + 1)
      Then - Actions
        Set VariableSet tempPoint = ((Position of (Trained unit)) offset by ((Random real number between 10.00 and 30.00), (Random real number between 10.00 and 30.00)))
        Item - Create Greater Bundle of Lumber at tempPoint
        Custom script: call RemoveLocation(udg_tempPoint)
        Set VariableSet tempPoint = (Position of (Triggering unit))
        Floating Text - Create floating text that reads Greater Lumber! at tempPoint with Z offset 0, using font size 15.00, color (100.00%, 0.00%, 100.00%), and 0% transparency
        Custom script: call RemoveLocation(udg_tempPoint)
        Floating Text - Change (Last created floating text): Disable permanence
        Floating Text - Set the velocity of (Last created floating text) to 25.00 towards 90 degrees
        Floating Text - Change the fading age of (Last created floating text) to 5.00 seconds
        Floating Text - Change the lifespan of (Last created floating text) to 6.00 seconds
      Else - Actions
    Unit - Remove (Trained unit) from the game
chickTrained
  Events
    Unit - A unit Finishes training a unit
  Conditions
    level Greater than or equal to 3
    (Unit-type of (Trained unit)) Equal to Chick
  Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Random integer number between 0 and 100) Less than or equal to (Current research level of R00E (techcode) for (Owner of (Trained unit)))
      Then - Actions
        Unit - Replace (Trained unit) with a Free Range Chicken using The old unit's relative life and mana
      Else - Actions
upgradeWood
  Events
    Unit - A unit Finishes research
  Conditions
    (Researched tech-type) Equal to R008 (techcode)
  Actions
    Set VariableSet lumberLevel[(Player number of (Owner of (Triggering unit)))] = (lumberLevel[(Player number of (Owner of (Triggering unit)))] + 20)
upgradeGold
  Events
    Unit - A unit Finishes research
  Conditions
    (Researched tech-type) Equal to R007 (techcode)
  Actions
    Set VariableSet goldLevel[(Player number of (Owner of (Triggering unit)))] = (goldLevel[(Player number of (Owner of (Triggering unit)))] + 100)
upgradeToMill
  Events
    Unit - A unit Finishes an upgrade
  Conditions
    (Unit-type of (Triggering unit)) Equal to Mill
  Actions
    Unit - Order (Triggering unit) to train/upgrade to a Lamb
upgradeBuildings
  Events
    Unit - A unit Finishes research
  Conditions
    (Researched tech-type) Equal to R00J (techcode)
  Actions
    Player - Set the current research level of R001 (techcode) to (Current research level of R00J (techcode) for (Owner of (Researching unit))) for (Owner of (Researching unit))
upgradeMaxFood
  Events
    Unit - A unit Finishes research
  Conditions
    (Researched tech-type) Equal to R00I (techcode)
  Actions
    Set VariableSet maxFood[(Player number of (Owner of (Triggering unit)))] = (maxFood[(Player number of (Owner of (Triggering unit)))] + 25)
    Player - Set (Owner of (Triggering unit)).Food max to maxFood[(Player number of (Owner of (Triggering unit)))]
importWood
  Events
    Unit - A unit Finishes research
  Conditions
    (Researched tech-type) Equal to R00F (techcode)
  Actions
    Player - Add 100 to (Owner of (Researching unit)).Current lumber
    Set VariableSet tempPoint = (Position of (Researching unit))
    Sound - Play BundleOfLumber <gen> at 100% volume, located at tempPoint with Z offset 0
    Floating Text - Create floating text that reads +100 Wood at tempPoint with Z offset 0, using font size 10.00, color (0.00%, 100.00%, 0.00%), and 0% transparency
    Floating Text - Change (Last created floating text): Disable permanence
    Floating Text - Set the velocity of (Last created floating text) to 50.00 towards 90 degrees
    Floating Text - Change the fading age of (Last created floating text) to 4.00 seconds
    Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
    Custom script: call RemoveLocation(udg_tempPoint)
upgradeAnimals
  Events
  Conditions
  Actions
    Set VariableSet tempPlayer = (Player((upgradeAnimalPlayer + 0)))
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (tempPlayer slot status) Equal to Is playing
      Then - Actions
        Set VariableSet tempGroup = (Units owned by tempPlayer matching (((Unit-type of (Matching unit)) Equal to Chick) or (((Unit-type of (Matching unit)) Equal to Chicken (1)) or (((Unit-type of (Matching unit)) Equal to Fat Chicken) or (((Unit-type of (Matching unit)) Equal to Fat Chicken) or (((Unit-type of (Matching unit)) Equal to Fat Sheep) or (((Unit-type of (Matching unit)) Equal to Lamb) or (((Unit-type of (Matching unit)) Equal to Fat Sheep) or ((Unit-type of (Matching unit)) Equal to Sheep)))))))).)
        Set VariableSet upgradeGroup = (Random (Min(35, (Number of units in tempGroup))) units from tempGroup)
        Custom script: call DestroyGroup(udg_tempGroup)
        Set VariableSet peasantLevel = (Current research level of R00E (techcode) for tempPlayer)
        Unit Group - Pick every unit in upgradeGroup and do (Actions)
          Loop - Actions
            Set VariableSet tempUnitType = (Unit-type of (Picked unit))
            Custom script: set udg_unitCode = udg_tempUnitType - udg_baseCode
            Set VariableSet unitIndex = unitCodes[unitCode]
            Set VariableSet chanceValue = animalChanceValues[unitIndex]
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                (Random integer number between 0 and chanceValue) Less than or equal to peasantLevel
              Then - Actions
                Unit - Replace (Picked unit) with a animalTypes[(unitIndex + 1)] using The old unit's relative life and mana
              Else - Actions
        Custom script: call DestroyGroup(udg_upgradeGroup)
      Else - Actions
    Set VariableSet upgradeAnimalPlayer = (upgradeAnimalPlayer + 1)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        upgradeAnimalPlayer Greater than maxPlayers
      Then - Actions
        Set VariableSet upgradeAnimalPlayer = 1
      Else - Actions
upgradeArcher
  Events
    Unit - A unit Dies
  Conditions
    (Unit-type of (Killing unit)) Equal to Archer
    (Random integer number between 1 and 1000) Less than or equal to 15
  Actions
    Unit - Replace (Killing unit) with a Skilled Archer using The old unit's relative life and mana
    Sound - Play ArcherReady1 <gen> at 100% volume, attached to (Last replaced unit)
    Special Effect - Create a special effect attached to the origin (attachpoint) of (Last replaced unit) using Abilities\Spells\Other\Levelup\LevelupCaster.mdl
    Set VariableSet effects[effectCounter] = (Last created special effect)
    Set VariableSet effectCounter = (effectCounter + 1)
    Countdown Timer - Start effectDestroyTimer as a One-shot timer that will expire in 3.00 seconds
upgradeEnemies
  Events
  Conditions
  Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        level Less than 10
      Then - Actions
        Set VariableSet upgradeLevel = (upgradeLevel + 1)
        Player Group - Pick every player in badPlayers and do (Actions)
          Loop - Actions
            Player - Set the current research level of R004 (techcode) to upgradeLevel for (Picked player)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        level Greater than or equal to 10
        level Less than 20
      Then - Actions
        Set VariableSet upgradeLevel = (upgradeLevel + 2)
        Player Group - Pick every player in badPlayers and do (Actions)
          Loop - Actions
            Player - Set the current research level of R004 (techcode) to upgradeLevel for (Picked player)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        level Greater than or equal to 20
      Then - Actions
        Set VariableSet upgradeLevel = (upgradeLevel + 6)
        Player Group - Pick every player in badPlayers and do (Actions)
          Loop - Actions
            Player - Set the current research level of R004 (techcode) to upgradeLevel for (Picked player)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        level Equal to 10
      Then - Actions
        Set VariableSet upgradeLevelMajor = (upgradeLevelMajor + 1)
        Player Group - Pick every player in badPlayers and do (Actions)
          Loop - Actions
            Player - Set the current research level of R005 (techcode) to upgradeLevelMajor for (Picked player)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        level Equal to 15
      Then - Actions
        Set VariableSet upgradeLevelMajor = (upgradeLevelMajor + 1)
        Player Group - Pick every player in badPlayers and do (Actions)
          Loop - Actions
            Player - Set the current research level of R005 (techcode) to upgradeLevelMajor for (Picked player)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        level Equal to 20
      Then - Actions
        Set VariableSet upgradeLevelMajor = (upgradeLevelMajor + 2)
        Player Group - Pick every player in badPlayers and do (Actions)
          Loop - Actions
            Player - Set the current research level of R005 (techcode) to upgradeLevelMajor for (Picked player)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        level Equal to 25
      Then - Actions
        Set VariableSet upgradeLevelMajor = (upgradeLevelMajor + 3)
        Player Group - Pick every player in badPlayers and do (Actions)
          Loop - Actions
            Player - Set the current research level of R005 (techcode) to upgradeLevelMajor for (Picked player)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        level Equal to 30
      Then - Actions
        Set VariableSet upgradeLevelMajor = (upgradeLevelMajor + (4 + difficultyIndex))
        Player Group - Pick every player in badPlayers and do (Actions)
          Loop - Actions
            Player - Set the current research level of R005 (techcode) to upgradeLevelMajor for (Picked player)
      Else - Actions
upgradeSkilledArcher
  Events
    Unit - A unit Dies
  Conditions
    (Unit-type of (Killing unit)) Equal to Skilled Archer
    (Random integer number between 1 and 1000) Less than or equal to 5
  Actions
    Unit - Replace (Killing unit) with a Master Archer using The old unit's relative life and mana
    Sound - Play ArcherWarcry1 <gen> at 100% volume, attached to (Last replaced unit)
    Special Effect - Create a special effect attached to the origin (attachpoint) of (Last replaced unit) using Abilities\Spells\Other\Levelup\LevelupCaster.mdl
    Set VariableSet effects[effectCounter] = (Last created special effect)
    Set VariableSet effectCounter = (effectCounter + 1)
    Countdown Timer - Start effectDestroyTimer as a One-shot timer that will expire in 3.00 seconds
upgradePlayer
  Events
  Conditions
  Actions
    Set VariableSet tempInt = (Current research level of R006 (techcode) for (Owner of tempUnit))
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Unit-type of tempUnit) Equal to Lumberjack Peasant
      Then - Actions
        Special Effect - Create a special effect attached to the origin (attachpoint) of tempUnit using Abilities\Spells\Other\Levelup\LevelupCaster.mdl
        Set VariableSet effects[effectCounter] = (Last created special effect)
        Set VariableSet effectCounter = (effectCounter + 1)
        Countdown Timer - Start effectDestroyTimer as a One-shot timer that will expire in 3.00 seconds
        Unit - Set Armor of tempUnit to ((Armor of tempUnit) + 0.20)
        Unit - Set Max HP of tempUnit to ((Max HP of tempUnit) + (50 + (5 x (7 - difficultyIndex))))
        Unit - Set life of tempUnit to ((Life of tempUnit) + (50.00 + (5.00 x (7.00 - (Real(difficultyIndex))))))
        Unit - Set level of Cleave for tempUnit to tempInt
        Unit - Set level of Overdrive for tempUnit to tempInt
        Unit - Set level of Heal (peasant) for tempUnit to tempInt
      Else - Actions
        Special Effect - Create a special effect attached to the origin (attachpoint) of tempUnit using Abilities\Spells\Other\Levelup\LevelupCaster.mdl
        Set VariableSet effects[effectCounter] = (Last created special effect)
        Set VariableSet effectCounter = (effectCounter + 1)
        Countdown Timer - Start effectDestroyTimer as a One-shot timer that will expire in 3.00 seconds
        Unit - Set Armor of tempUnit to ((Armor of tempUnit) + 0.05)
        Unit - Set Max HP of tempUnit to ((Max HP of tempUnit) + (20 + (4 x (7 - difficultyIndex))))
        Unit - Set life of tempUnit to ((Life of tempUnit) + (20.00 + (4.00 x (7.00 - (Real(difficultyIndex))))))
        Unit - Set level of Heal (peasant) for tempUnit to tempInt
updateMultiboard
  Events
    Time - Every 1.00 seconds of game time
  Conditions
    multiboardEnabled Equal to True
  Actions
    Set VariableSet tempInt = 4
    Player Group - Pick every player in allPlayers and do (Actions)
      Loop - Actions
        Multiboard - Set the text for multiboard item in column 2, row tempInt to (String(((Picked player) Units Killed)))
        Multiboard - Set the text for multiboard item in column 3, row tempInt to (String(((Picked player) Current gold)))
        Multiboard - Set the text for multiboard item in column 4, row tempInt to (String(((Picked player) Current lumber)))
        Multiboard - Set the text for multiboard item in column 5, row tempInt to (String(((Current research level of R006 (techcode) for (Picked player)) + 0)))
        Set VariableSet tempInt = (tempInt + 1)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Remaining time for nightTimer) Greater than 0.00
      Then - Actions
        Multiboard - Set the text for multiboard item in column 2, row 2 to (String((Integer((Remaining time for nightTimer)))))
        Multiboard - Set the text for multiboard item in column 1, row 2 to Nightfall:
      Else - Actions
        Multiboard - Set the text for multiboard item in column 2, row 2 to (String((Integer((Remaining time for dayTimer)))))
        Multiboard - Set the text for multiboard item in column 1, row 2 to Daybreak:
initialiseMultiboard
  Events
    Time - Elapsed game time is 25.00 seconds
  Conditions
  Actions
    Multiboard - Create a multiboard with 5 columns and (3 + (Number of players in players)) rows, titled Barrens TD.
    Set VariableSet multiboard = (Last created multiboard)
    Multiboard - Set the display style for multiboard item in column 1, row 1 to Show text and Hide icons
    Multiboard - Set the display style for multiboard item in column 2, row 1 to Show text and Hide icons
    Multiboard - Set the display style for multiboard item in column 1, row 2 to Show text and Hide icons
    Multiboard - Set the display style for multiboard item in column 2, row 2 to Show text and Hide icons
    Multiboard - Set the display style for multiboard item in column 3, row 1 to Hide text and Hide icons
    Multiboard - Set the display style for multiboard item in column 4, row 1 to Hide text and Hide icons
    Multiboard - Set the display style for multiboard item in column 5, row 1 to Hide text and Hide icons
    Multiboard - Set the display style for multiboard item in column 3, row 2 to Hide text and Hide icons
    Multiboard - Set the display style for multiboard item in column 4, row 2 to Hide text and Hide icons
    Multiboard - Set the display style for multiboard item in column 5, row 2 to Hide text and Hide icons
    Multiboard - Set the text for multiboard item in column 1, row 1 to Round:
    Multiboard - Set the text for multiboard item in column 1, row 2 to Nightfall:
    Multiboard - Set the text for multiboard item in column 2, row 1 to ((String(level)) + (/ + 30))
    Multiboard - Set the text for multiboard item in column 2, row 2 to 0
    Multiboard - Set the width for multiboard item in column 1, row 1 to 8.00% of the total screen width
    Multiboard - Set the width for multiboard item in column 1, row 2 to 8.00% of the total screen width
    Multiboard - Set the width for multiboard item in column 1, row 3 to 8.00% of the total screen width
    Multiboard - Set the width for multiboard item in column 2, row 1 to 4.00% of the total screen width
    Multiboard - Set the width for multiboard item in column 2, row 2 to 4.00% of the total screen width
    Multiboard - Set the width for multiboard item in column 2, row 3 to 4.00% of the total screen width
    Multiboard - Set the width for multiboard item in column 3, row 3 to 4.00% of the total screen width
    Multiboard - Set the width for multiboard item in column 4, row 3 to 4.00% of the total screen width
    Multiboard - Set the width for multiboard item in column 5, row 3 to 4.00% of the total screen width
    Multiboard - Set the display style for multiboard item in column 1, row 3 to Hide text and Hide icons
    Multiboard - Set the display style for multiboard item in column 2, row 3 to Hide text and Show icons
    Multiboard - Set the display style for multiboard item in column 3, row 3 to Hide text and Show icons
    Multiboard - Set the display style for multiboard item in column 4, row 3 to Hide text and Show icons
    Multiboard - Set the display style for multiboard item in column 5, row 3 to Hide text and Show icons
    Multiboard - Set the icon for multiboard item in column 2, row 3 to ReplaceableTextures\CommandButtons\BTNSacrifice.blp
    Multiboard - Set the icon for multiboard item in column 3, row 3 to ReplaceableTextures\CommandButtons\BTNChestOfGold.blp
    Multiboard - Set the icon for multiboard item in column 4, row 3 to ReplaceableTextures\CommandButtons\BTNBundleOfLumber.blp
    Multiboard - Set the icon for multiboard item in column 5, row 3 to ReplaceableTextures\CommandButtons\BTNPeasant.blp
    Multiboard - Set the text for multiboard item in column 1, row 3 to Player
    Multiboard - Set the text for multiboard item in column 2, row 3 to Kills
    Multiboard - Set the text for multiboard item in column 3, row 3 to Gold
    Multiboard - Set the text for multiboard item in column 4, row 3 to Lumber
    Multiboard - Set the text for multiboard item in column 5, row 3 to Peasant Level
    Set VariableSet tempInt = 4
    Player Group - Pick every player in allPlayers and do (Actions)
      Loop - Actions
        Multiboard - Set the display style for multiboard item in column 1, row tempInt to Show text and Hide icons
        Multiboard - Set the display style for multiboard item in column 2, row tempInt to Show text and Hide icons
        Multiboard - Set the display style for multiboard item in column 3, row tempInt to Show text and Hide icons
        Multiboard - Set the display style for multiboard item in column 4, row tempInt to Show text and Hide icons
        Multiboard - Set the display style for multiboard item in column 5, row tempInt to Show text and Hide icons
        Multiboard - Set the width for multiboard item in column 1, row tempInt to 8.00% of the total screen width
        Multiboard - Set the width for multiboard item in column 2, row tempInt to 4.00% of the total screen width
        Multiboard - Set the width for multiboard item in column 3, row tempInt to 4.00% of the total screen width
        Multiboard - Set the width for multiboard item in column 4, row tempInt to 4.00% of the total screen width
        Multiboard - Set the width for multiboard item in column 5, row tempInt to 4.00% of the total screen width
        Multiboard - Set the text for multiboard item in column 1, row tempInt to (Substring((Name of (Picked player)), 1, 12))
        Multiboard - Set the text for multiboard item in column 2, row tempInt to 0
        Multiboard - Set the text for multiboard item in column 3, row tempInt to (String(((Picked player) Current gold)))
        Multiboard - Set the text for multiboard item in column 4, row tempInt to (String(((Picked player) Current lumber)))
        Multiboard - Set the text for multiboard item in column 5, row tempInt to 0
        Set VariableSet tempInt = (tempInt + 1)
    Multiboard - Show multiboard
    Set VariableSet multiboardEnabled = True
    Custom script: call DestroyTrigger( GetTriggeringTrigger() )
updateRounds
  Events
  Conditions
  Actions
    Multiboard - Set the text for multiboard item in column 2, row 1 to ((String(level)) + (/ + (String(totalRounds))))
deactivateDefencePaladin
  Events
  Conditions
  Actions
    Set VariableSet tempGroup = (Units of type Defence Paladin)
    Unit Group - Pick every unit in tempGroup and do (Actions)
      Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Integer((Mana of (Picked unit)))) Equal to 0
          Then - Actions
            Unit - Replace (Picked unit) with a Deactivated Defence Paladin using The old unit's relative life and mana
          Else - Actions
    Custom script: call DestroyGroup(udg_tempGroup)
deactivateAttackPanda
  Events
  Conditions
  Actions
    Set VariableSet tempGroup = (Units of type Attack Panda)
    Unit Group - Pick every unit in tempGroup and do (Actions)
      Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Integer((Mana of (Picked unit)))) Equal to 0
          Then - Actions
            Unit - Replace (Picked unit) with a Deactivated Attack Panda using The old unit's relative life and mana
          Else - Actions
    Custom script: call DestroyGroup(udg_tempGroup)
deactivateDemolisher
  Events
  Conditions
  Actions
    Set VariableSet tempGroup = (Units of type Demolisher)
    Unit Group - Pick every unit in tempGroup and do (Actions)
      Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Integer((Mana of (Picked unit)))) Equal to 0
          Then - Actions
            Unit - Replace (Picked unit) with a Deactivated Demolisher using The old unit's relative life and mana
          Else - Actions
    Custom script: call DestroyGroup(udg_tempGroup)
activateDefencePaladin
  Events
  Conditions
  Actions
    Set VariableSet tempGroup = (Units of type Deactivated Demolisher)
    Unit Group - Pick every unit in tempGroup and do (Actions)
      Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Integer((Mana of (Picked unit)))) Greater than 5
          Then - Actions
            Unit - Replace (Picked unit) with a Demolisher using The old unit's relative life and mana
          Else - Actions
    Custom script: call DestroyGroup(udg_tempGroup)
activateAttackPanda
  Events
  Conditions
  Actions
    Set VariableSet tempGroup = (Units of type Deactivated Defence Paladin)
    Unit Group - Pick every unit in tempGroup and do (Actions)
      Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Integer((Mana of (Picked unit)))) Greater than 5
          Then - Actions
            Unit - Replace (Picked unit) with a Defence Paladin using The old unit's relative life and mana
            Unit - Set level of Defence for (Last replaced unit) to (Current research level of R00C (techcode) for (Owner of (Picked unit)))
          Else - Actions
    Custom script: call DestroyGroup(udg_tempGroup)
activateDemolisher
  Events
  Conditions
  Actions
    Set VariableSet tempGroup = (Units of type Deactivated Attack Panda)
    Unit Group - Pick every unit in tempGroup and do (Actions)
      Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Integer((Mana of (Picked unit)))) Greater than 5
          Then - Actions
            Unit - Replace (Picked unit) with a Attack Panda using The old unit's relative life and mana
            Unit - Set level of Damage Aura for (Last replaced unit) to (Current research level of R00D (techcode) for (Owner of (Picked unit)))
          Else - Actions
    Custom script: call DestroyGroup(udg_tempGroup)
priestAI
  Events
  Conditions
  Actions
    -------- Healing --------
    Set VariableSet tempGroup = (Units of type Healer)
    Unit Group - Pick every unit in tempGroup and do (Actions)
      Loop - Actions
        Set VariableSet tempGroup2 = (Units within 800.00 of (Position of (Picked unit)) matching ((Integer((Percentage life of (Matching unit)))) Less than 80).)
        Unit - Order (Picked unit) to Orc Shadow Hunter - Healing Wave.(Random unit from tempGroup2)
        Custom script: call DestroyGroup(udg_tempGroup2)
    Custom script: call DestroyGroup(udg_tempGroup)
priestAILong
  Events
  Conditions
  Actions
    -------- Healing --------
    Set VariableSet tempGroup = (Units of type Healer)
    Unit Group - Pick every unit in tempGroup and do (Actions)
      Loop - Actions
        Set VariableSet tempGroup2 = (Units within 800.00 of (Position of (Picked unit)) matching ((Integer((Percentage life of (Matching unit)))) Less than 95).)
        Unit - Order (Picked unit) to Orc Shadow Hunter - Healing Wave.(Random unit from tempGroup2)
        Custom script: call DestroyGroup(udg_tempGroup2)
    Custom script: call DestroyGroup(udg_tempGroup)
manaWellAI
  Events
  Conditions
  Actions
    Set VariableSet tempGroup = (Units of type Mana Well)
    Unit Group - Pick every unit in tempGroup and do (Actions)
      Loop - Actions
        Unit - Order (Picked unit) to Night Elf Moon Well - Activate Replenish Mana And Life.
    Custom script: call DestroyGroup(udg_tempGroup)
reduceManaDemolisher
  Events
  Conditions
  Actions
    Set VariableSet tempGroup = (Units of type Demolisher)
    Unit Group - Pick every unit in tempGroup and do (Actions)
      Loop - Actions
        Unit - Set mana of (Picked unit) to (Max(0.00, ((Mana of (Picked unit)) - 1)))
    Custom script: call DestroyGroup(udg_tempGroup)
reduceManaDefencePaladin
  Events
  Conditions
  Actions
    Set VariableSet tempGroup = (Units of type Defence Paladin)
    Unit Group - Pick every unit in tempGroup and do (Actions)
      Loop - Actions
        Unit - Set mana of (Picked unit) to (Max(0.00, ((Mana of (Picked unit)) - 2.00)))
    Custom script: call DestroyGroup(udg_tempGroup)
reduceManaDemolisherAttackPanda
  Events
  Conditions
  Actions
    Set VariableSet tempGroup = (Units of type Attack Panda)
    Unit Group - Pick every unit in tempGroup and do (Actions)
      Loop - Actions
        Unit - Set mana of (Picked unit) to (Max(0.00, ((Mana of (Picked unit)) - 2.00)))
    Custom script: call DestroyGroup(udg_tempGroup)
cleanupEffects
  Events
    Time - effectDestroyTimer expires
  Conditions
  Actions
    For each (Integer A) from 0 to effectCounter, do (Actions)
      Loop - Actions
        Special Effect - Destroy effects[(Integer A)]
    Set VariableSet effectCounter = 0
cleanupLumber
  Events
  Conditions
  Actions
    Set VariableSet tempGroup = (Units of type Harvest Wood)
    Unit Group - Pick every unit in tempGroup and do (Actions)
      Loop - Actions
        Unit - Remove (Picked unit) from the game
    Custom script: call DestroyGroup(udg_tempGroup)
cleanupItems
  Events
  Conditions
  Actions
    Item - Pick every item in (Entire map) and do (Actions)
      Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Current life of (Picked item)) Less than or equal to 0.01
          Then - Actions
            Item - Remove (Picked item)
          Else - Actions
cleanupLeaver
  Events
  Conditions
    (peasants[(Player number of (Triggering player))] is alive) Equal to True
  Actions
    Unit - Kill peasants[(Player number of (Triggering player))]
cleanupEnemies
  Events
  Conditions
  Actions
    Trigger - Turn off deathEnemy0 <gen>
    Trigger - Turn off deathEnemy1 <gen>
    Trigger - Turn off deathEnemy2 <gen>
    Trigger - Turn off deathEnemy3 <gen>
    For each (Integer A) from 0 to 3, do (Actions)
      Loop - Actions
        Set VariableSet tempGroup = (Units in (Playable map area) owned by enemyPlayers[(Integer A)])
        Unit Group - Pick every unit in tempGroup and do (Actions)
          Loop - Actions
            Unit - Explode (Picked unit).
        Custom script: call DestroyGroup(udg_tempGroup)
    Set VariableSet enemySize[0] = 0
    Set VariableSet enemySize[1] = 0
    Set VariableSet enemySize[2] = 0
    Set VariableSet enemySize[3] = 0
    Trigger - Turn on deathEnemy0 <gen>
    Trigger - Turn on deathEnemy1 <gen>
    Trigger - Turn on deathEnemy2 <gen>
    Trigger - Turn on deathEnemy3 <gen>
cleanupCrashedPlayer
  Events
  Conditions
  Actions
    Player Group - Pick every player in allPlayers and do (Actions)
      Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            ((Picked player) slot status) Equal to Has left the game
            (peasants[(Player number of (Picked player))] is alive) Equal to True
          Then - Actions
            Unit - Kill peasants[(Player number of (Picked player))]
          Else - Actions
rogueArmor
  Events
    Unit - A unit Acquires an item
  Conditions
  Actions
    Set VariableSet itemA = Damage Bonus
    Set VariableSet itemB = Broken Armor
    Set VariableSet itemC = Rogue Armor
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        ((Item carried by (Triggering unit) of type itemA) is owned) Equal to True
        ((Item carried by (Triggering unit) of type itemB) is owned) Equal to True
      Then - Actions
        Item - Remove (Item carried by (Triggering unit) of type itemA)
        Item - Remove (Item carried by (Triggering unit) of type itemB)
        Hero - Create itemC and give it to (Triggering unit)
      Else - Actions
wizardArmor
  Events
    Unit - A unit Acquires an item
  Conditions
  Actions
    Set VariableSet itemA = Attack Speed Bonus
    Set VariableSet itemB = Mana Bonus
    Set VariableSet itemC = Wizard Staff
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        ((Item carried by (Triggering unit) of type itemA) is owned) Equal to True
        ((Item carried by (Triggering unit) of type itemB) is owned) Equal to True
      Then - Actions
        Item - Remove (Item carried by (Triggering unit) of type itemA)
        Item - Remove (Item carried by (Triggering unit) of type itemB)
        Hero - Create itemC and give it to (Triggering unit)
      Else - Actions
holyShield
  Events
    Unit - A unit Acquires an item
  Conditions
  Actions
    Set VariableSet itemA = Shield
    Set VariableSet itemB = Life Ring
    Set VariableSet itemC = Holy Shield
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        ((Item carried by (Triggering unit) of type itemA) is owned) Equal to True
        ((Item carried by (Triggering unit) of type itemB) is owned) Equal to True
      Then - Actions
        Item - Remove (Item carried by (Triggering unit) of type itemA)
        Item - Remove (Item carried by (Triggering unit) of type itemB)
        Hero - Create itemC and give it to (Triggering unit)
      Else - Actions
arcaneBook
  Events
    Unit - A unit Acquires an item
  Conditions
  Actions
    Set VariableSet itemA = Ring of Evasion
    Set VariableSet itemB = Greater Mana Bonus
    Set VariableSet itemC = Arcane Book
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        ((Item carried by (Triggering unit) of type itemA) is owned) Equal to True
        ((Item carried by (Triggering unit) of type itemB) is owned) Equal to True
      Then - Actions
        Item - Remove (Item carried by (Triggering unit) of type itemA)
        Item - Remove (Item carried by (Triggering unit) of type itemB)
        Hero - Create itemC and give it to (Triggering unit)
      Else - Actions
dragonArmor
  Events
    Unit - A unit Acquires an item
  Conditions
  Actions
    Set VariableSet itemA = Greater Damage Bonus
    Set VariableSet itemB = Advanced Armor
    Set VariableSet itemC = Dragon Armor
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        ((Item carried by (Triggering unit) of type itemA) is owned) Equal to True
        ((Item carried by (Triggering unit) of type itemB) is owned) Equal to True
      Then - Actions
        Item - Remove (Item carried by (Triggering unit) of type itemA)
        Item - Remove (Item carried by (Triggering unit) of type itemB)
        Hero - Create itemC and give it to (Triggering unit)
      Else - Actions
druidClaws
  Events
    Unit - A unit Acquires an item
  Conditions
  Actions
    Set VariableSet itemA = Greater Attack Speed Bonus
    Set VariableSet itemB = Lightning Claws
    Set VariableSet itemC = Dragon Armor
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        ((Item carried by (Triggering unit) of type itemA) is owned) Equal to True
        ((Item carried by (Triggering unit) of type itemB) is owned) Equal to True
      Then - Actions
        Item - Remove (Item carried by (Triggering unit) of type itemA)
        Item - Remove (Item carried by (Triggering unit) of type itemB)
        Hero - Create itemC and give it to (Triggering unit)
      Else - Actions
maskOfTheKodo
  Events
    Unit - A unit Acquires an item
  Conditions
  Actions
    Set VariableSet itemA = Flame Blade
    Set VariableSet itemB = Legendary Armor
    Set VariableSet itemC = Mask of the Kodo
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        ((Item carried by (Triggering unit) of type itemA) is owned) Equal to True
        ((Item carried by (Triggering unit) of type itemB) is owned) Equal to True
      Then - Actions
        Item - Remove (Item carried by (Triggering unit) of type itemA)
        Item - Remove (Item carried by (Triggering unit) of type itemB)
        Hero - Create itemC and give it to (Triggering unit)
      Else - Actions
wave30Timer
  Events
  Conditions
  Actions
    Set VariableSet timeRatio = (100.00 / (150.00 - (Real((difficultyIndex x 10)))))
    Set VariableSet TimeRemaining = (((24.00 - 17.00) + 8.00) x (20.00 x timeRatio))
    Countdown Timer - Start dayTimer as a One-shot timer that will expire in TimeRemaining seconds
wave20Timer
  Events
  Conditions
  Actions
    Set VariableSet timeRatio = (100.00 / (250.00 - (Real((difficultyIndex x 10)))))
    Set VariableSet TimeRemaining = (((24.00 - 17.00) + 8.00) x (20.00 x timeRatio))
    Countdown Timer - Start dayTimer as a One-shot timer that will expire in TimeRemaining seconds
wave10Timer
  Events
  Conditions
  Actions
    Set VariableSet timeRatio = (100.00 / (300.00 - (Real((difficultyIndex x 10)))))
    Set VariableSet TimeRemaining = (((24.00 - 17.00) + 8.00) x (20.00 x timeRatio))
    Countdown Timer - Start dayTimer as a One-shot timer that will expire in TimeRemaining seconds
recoverTimer
  Events
  Conditions
  Actions
    Set VariableSet timeRatio = (100.00 / (75.00 + (Real((difficultyIndex x 10)))))
    Set VariableSet TimeRemaining = ((17.00 - 9.00) x (20.00 x timeRatio))
    Countdown Timer - Start nightTimer as a One-shot timer that will expire in TimeRemaining seconds
startGameTimer
  Events
  Conditions
  Actions
    Set VariableSet timeRatio = (100.00 / (70.00 + ((Real(difficultyIndex)) x 5.00)))
    Set VariableSet TimeRemaining = ((17.00 - 9.00) x (20.00 x timeRatio))
    Countdown Timer - Start nightTimer as a One-shot timer that will expire in TimeRemaining seconds
normalNightTimer
  Events
  Conditions
  Actions
    Set VariableSet timeRatio = (100.00 / gameSpeed)
    Set VariableSet TimeRemaining = (((24.00 - 18.00) + 8.00) x (20.00 x timeRatio))
    Countdown Timer - Start dayTimer as a One-shot timer that will expire in TimeRemaining seconds
normalDayTimer
  Events
  Conditions
  Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        level Less than 15
      Then - Actions
        Set VariableSet timeRatio = (100.00 / gameSpeed)
        Set VariableSet TimeRemaining = ((19.00 - 9.00) x (20.00 x timeRatio))
        Countdown Timer - Start nightTimer as a One-shot timer that will expire in TimeRemaining seconds
      Else - Actions
        Set VariableSet timeRatio = (100.00 / gameSpeed)
        Set VariableSet TimeRemaining = ((17.00 - 9.00) x (20.00 x timeRatio))
        Countdown Timer - Start nightTimer as a One-shot timer that will expire in TimeRemaining seconds
killRabbits
  Events
    Time - Elapsed game time is 15.00 seconds
  Conditions
  Actions
    Game - Display to (All players) for 35.00 seconds the text: Kill rabbits for gold to create a camp.
    Sound - Play ChickenWhat1 <gen>
createBonfire
  Events
    Time - Elapsed game time is 60.00 seconds
  Conditions
  Actions
    Game - Display to (All players) for 35.00 seconds the text: Harvest wood to create a bonfire to heal and get vision at night.
    Sound - Play SheepWhat101 <gen>
createFarms
  Events
    Time - Elapsed game time is 100.00 seconds
  Conditions
  Actions
    Game - Display to (All players) for 35.00 seconds the text: Create farms to produce chickens for food.
    Sound - Play SheepWhat1 <gen>
createLumberMills
  Events
    Time - Elapsed game time is 140.00 seconds
  Conditions
  Actions
    Game - Display to (All players) for 35.00 seconds the text: Create lumber mills for a chance to produce lumber over time.
    Sound - Play SheepWhat2 <gen>
eatChickenMessage
  Events
    Time - Elapsed game time is 180.00 seconds
  Conditions
  Actions
    Game - Display to (All players) for 35.00 seconds the text: Type -eat to consume your chickens and level up!
    Sound - Play SheepDeath <gen>
spawnInfernos
  Events
    Time - Every 2.00 seconds of game time
  Conditions
  Actions
    Unit Group - Pick every unit in infernalGroup and do (Actions)
      Loop - Actions
        Set VariableSet tempPoint = (Random point in (Playable map area))
        Unit - Order (Picked unit) to Undead Dreadlord - Inferno.tempPoint
        Custom script: call RemoveLocation(udg_tempPoint)
globalTicker
  Events
    Time - tickTimer expires
  Conditions
  Actions
    Trigger - Run updateMultiboard <gen> (checking conditions)
    Trigger - Run reduceManaDefencePaladin <gen> (checking conditions)
    Trigger - Run reduceManaDemolisher <gen> (checking conditions)
    Trigger - Run reduceManaDemolisherAttackPanda <gen> (checking conditions)
    Trigger - Run runSpawn <gen> (checking conditions)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (tick mod 3) Equal to 0
      Then - Actions
        Trigger - Run deactivateDefencePaladin <gen> (checking conditions)
        Trigger - Run activateDefencePaladin <gen> (checking conditions)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        ((tick + 1) mod 3) Equal to 0
      Then - Actions
        Trigger - Run deactivateDemolisher <gen> (checking conditions)
        Trigger - Run activateDemolisher <gen> (checking conditions)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        ((tick + 2) mod 3) Equal to 0
      Then - Actions
        Trigger - Run deactivateAttackPanda <gen> (checking conditions)
        Trigger - Run activateAttackPanda <gen> (checking conditions)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        ((tick + 0) mod 2) Equal to 0
      Then - Actions
        Trigger - Run priestAI <gen> (checking conditions)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (tick mod 5) Equal to 0
      Then - Actions
        Trigger - Run manaWellAI <gen> (checking conditions)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (tick mod 7) Equal to 0
      Then - Actions
        Trigger - Run hunger <gen> (checking conditions)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (tick mod 10) Equal to 0
      Then - Actions
        Trigger - Run upgradeAnimals <gen> (checking conditions)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (tick mod 20) Equal to 0
      Then - Actions
        Trigger - Run priestAILong <gen> (checking conditions)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        tick Equal to 50
      Then - Actions
        Trigger - Run autoTrainLumber <gen> (checking conditions)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        tick Equal to 51
      Then - Actions
        Trigger - Run autoTrainFarm1 <gen> (checking conditions)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        tick Equal to 52
      Then - Actions
        Trigger - Run autoTrainFarm2 <gen> (checking conditions)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        tick Equal to 53
      Then - Actions
        Trigger - Run autoTrainFarm3 <gen> (checking conditions)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        tick Equal to 54
      Then - Actions
        Trigger - Run autoTrainMill <gen> (checking conditions)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        tick Equal to 55
      Then - Actions
        Trigger - Run cleanupLumber <gen> (checking conditions)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        tick Equal to 56
      Then - Actions
        Trigger - Run cleanupItems <gen> (checking conditions)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        tick Equal to 57
      Then - Actions
        Trigger - Run cleanupCrashedPlayer <gen> (checking conditions)
      Else - Actions
    Set VariableSet tick = (tick + 1)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        tick Equal to 60
      Then - Actions
        Set VariableSet tick = 1
      Else - Actions
reduceFarmCounter
  Events
    Unit - A unit Dies
  Conditions
    Or - Any (Conditions) are true
      Conditions
        (Unit-type of (Dying unit)) Equal to Farm
        (Unit-type of (Dying unit)) Equal to Farm (2)
        (Unit-type of (Dying unit)) Equal to Farm (3)
  Actions
    Set VariableSet farmCount[(Player number of (Owner of (Dying unit)))] = (farmCount[(Player number of (Owner of (Dying unit)))] - 1)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        farmCount[(Player number of (Owner of (Triggering unit)))] Equal to 4
      Then - Actions
        Player - Make Farm Available for training/construction by (Owner of (Dying unit))
        Player - Make Farm (2) Unavailable for training/construction by (Owner of (Dying unit))
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        farmCount[(Player number of (Owner of (Triggering unit)))] Equal to 9
      Then - Actions
        Player - Make Farm (2) Available for training/construction by (Owner of (Dying unit))
        Player - Make Farm (3) Unavailable for training/construction by (Owner of (Dying unit))
      Else - Actions
stackItem
  Events
    Unit - A unit Acquires an item
  Conditions
    (Item-class of (Item being manipulated)) Equal to Charged
  Actions
    Set VariableSet tempUnit = (Hero manipulating item)
    Set VariableSet tempItem = (Item being manipulated)
    Set VariableSet tempItemType = (Item-type of tempItem)
    Set VariableSet tempInt = (Charges remaining in tempItem)
    For each (Integer A) from 1 to 6, do (Actions)
      Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Item-type of tempItem) Equal to (Item-type of (Item carried by tempUnit in slot (Integer A)))
            tempItem Not equal to (Item carried by tempUnit in slot (Integer A))
          Then - Actions
            Set VariableSet tempInt = ((Charges remaining in (Item carried by tempUnit in slot (Integer A))) + tempInt)
            Set VariableSet activeItem = (Item carried by tempUnit in slot (Integer A))
            Item - Set charges remaining in activeItem to tempInt
            Item - Remove tempItem
            Set VariableSet tempItem = activeItem
          Else - Actions
setEnemyCount
  Events
  Conditions
  Actions
    Set VariableSet maxUnits = (0 + (7 x playerCount))
startBossWave
  Events
  Conditions
  Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        level Equal to 10
      Then - Actions
        For each (Integer A) from 1 to 7, do (Actions)
          Loop - Actions
            Set VariableSet tempPoint = (Random point in (Playable map area))
            Unit - Create 1.DummyInferno1 for Neutral Hostile at tempPoint facing Default building facing degrees
            Custom script: call RemoveLocation(udg_tempPoint)
            Unit Group - Add (Last created unit) to infernalGroup
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        level Equal to 20
      Then - Actions
        For each (Integer A) from 1 to 8, do (Actions)
          Loop - Actions
            Set VariableSet tempPoint = (Random point in (Playable map area))
            Unit - Create 1.DummyInferno2 for Neutral Hostile at tempPoint facing Default building facing degrees
            Custom script: call RemoveLocation(udg_tempPoint)
            Unit Group - Add (Last created unit) to infernalGroup
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        level Equal to 30
      Then - Actions
        For each (Integer A) from 1 to 9, do (Actions)
          Loop - Actions
            Set VariableSet tempPoint = (Random point in (Playable map area))
            Unit - Create 1.DummyInferno3 for Neutral Hostile at tempPoint facing Default building facing degrees
            Custom script: call RemoveLocation(udg_tempPoint)
            Unit Group - Add (Last created unit) to infernalGroup
      Else - Actions
    Trigger - Turn on spawnInfernos <gen>
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        level Equal to 10
      Then - Actions
        Set VariableSet tempType = MEGA BADI 1
        Trigger - Run wave10Timer <gen> (checking conditions)
        Sound - Play PitLordYesAttack1 <gen>
        Player Group - Pick every player in players and do (Actions)
          Loop - Actions
            Environment - Create at (Playable map area) the weather effect Dungeon Green Fog (Heavy)
            Environment - Turn (Last created weather effect) On
            Set VariableSet tempWeather = (Last created weather effect)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        level Equal to 20
      Then - Actions
        Set VariableSet tempType = MEGA BADI 2
        Trigger - Run wave20Timer <gen> (checking conditions)
        Sound - Play PitLordYesAttack2 <gen>
        Player Group - Pick every player in players and do (Actions)
          Loop - Actions
            Environment - Create at (Playable map area) the weather effect Dungeon Blue Fog (Heavy)
            Environment - Turn (Last created weather effect) On
            Set VariableSet tempWeather = (Last created weather effect)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        level Equal to 30
      Then - Actions
        Set VariableSet tempType = MEGA BADI 3
        Trigger - Run wave30Timer <gen> (checking conditions)
        Sound - Play PitLordYesAttack3 <gen>
        Player Group - Pick every player in players and do (Actions)
          Loop - Actions
            Environment - Create at (Playable map area) the weather effect Dungeon Red Fog (Heavy)
            Environment - Turn (Last created weather effect) On
            Set VariableSet tempWeather = (Last created weather effect)
      Else - Actions
stopBossWave
  Events
  Conditions
  Actions
    Trigger - Turn off spawnInfernos <gen>
    Unit Group - Pick every unit in infernalGroup and do (Actions)
      Loop - Actions
        Unit - Explode (Picked unit).
        Unit Group - Remove (Picked unit) from infernalGroup.
    Sound - Clear the music list
    Custom script: call SetMapMusic(udg_playlist, true, 0)
    Custom script: call PlayMusic(udg_playlist)
    Environment - Turn tempWeather Off
    Environment - Remove tempWeather
    Trigger - Run recoverTimer <gen> (checking conditions)
    Player Group - Pick every player in players and do (Actions)
      Loop - Actions
        Camera - Stop swaying/shaking the camera for (Picked player).
        Cinematic - Hide filter
runSpawn
  Events
  Conditions
    spawningEnabled Equal to True
  Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        spawnSide Less than 4
      Then - Actions
        Set VariableSet attackPoint = (Position of (Random unit from goodGroup))
        Set VariableSet spawnPoint = (Random point in spawnRegions[spawnSide])
        Unit - Create 7.tempType for enemyPlayers[spawnSide] at spawnPoint facing Default building facing degrees
        Set VariableSet tempGroup = (Last created unit group)
        Unit Group - Pick every unit in tempGroup and do (Actions)
          Loop - Actions
            AI - Ignore (Picked unit)'s guard position
            Unit - Make (Picked unit) Explode on death
            Unit - Order (Picked unit) to Attack-Move To.attackPoint
        Custom script: call DestroyGroup(udg_tempGroup)
        Custom script: call RemoveLocation(udg_spawnPoint)
        Custom script: call RemoveLocation(udg_attackPoint)
        Set VariableSet spawnSide = (spawnSide + 1)
      Else - Actions
        Set VariableSet spawnSide = 0
function Trig_spawnUnits_Copy_Conditions takes nothing returns boolean
    if ( not ( udg_enemySize[udg_spawnSide] < udg_maxUnits ) ) then
        return false
    endif
    return true
endfunction

function Trig_spawnUnits_Copy_Func007C takes nothing returns boolean
    if ( not ( udg_level == 10 ) ) then
        return false
    endif
    return true
endfunction

function Trig_spawnUnits_Copy_Func008C takes nothing returns boolean
    if ( not ( udg_level == 20 ) ) then
        return false
    endif
    return true
endfunction

function Trig_spawnUnits_Copy_Func009C takes nothing returns boolean
    if ( not ( udg_level == 30 ) ) then
        return false
    endif
    return true
endfunction

function Trig_spawnUnits_Copy_Actions takes nothing returns nothing
    set udg_enemySize[udg_spawnSide] = ( udg_enemySize[udg_spawnSide] + 1 )
    call CreateNUnitsAtLoc( 1, udg_tempType, udg_enemyPlayers[udg_spawnSide], udg_spawnPoint, bj_UNIT_FACING )
    set udg_tempUnit = GetLastCreatedUnit()
    call SetUnitExplodedBJ( udg_tempUnit, true )
    if ( Trig_spawnUnits_Copy_Func007C() ) then
        call BlzSetUnitMaxHP( udg_tempUnit, R2I(( I2R(BlzGetUnitMaxHP(udg_tempUnit)) * 1.25 )) )
    else
    endif
    if ( Trig_spawnUnits_Copy_Func008C() ) then
        call BlzSetUnitMaxHP( udg_tempUnit, R2I(( I2R(BlzGetUnitMaxHP(udg_tempUnit)) * 1.50 )) )
    else
    endif
    if ( Trig_spawnUnits_Copy_Func009C() ) then
        call BlzSetUnitMaxHP( udg_tempUnit, R2I(( I2R(BlzGetUnitMaxHP(udg_tempUnit)) * 2.20 )) )
    else
    endif
    call SetUnitLifePercentBJ( udg_tempUnit, 100 )
    call IssuePointOrderLocBJ( udg_tempUnit, "attack", udg_attackPoint )
endfunction

//===========================================================================
function InitTrig_spawnUnits takes nothing returns nothing
    set gg_trg_spawnUnits = CreateTrigger(  )
    call TriggerAddCondition( gg_trg_spawnUnits, Condition( function Trig_spawnUnits_Copy_Conditions ) )
    call TriggerAddAction( gg_trg_spawnUnits, function Trig_spawnUnits_Copy_Actions )
endfunction
removeBuilding
  Events
    Unit - A unit Begins casting an ability
  Conditions
    (Ability being cast) Equal to Remove
  Actions
    Unit - Explode (Triggering unit).
relocateCamp
  Events
    Unit - A unit Begins casting an ability
  Conditions
    (Ability being cast) Equal to Relocate Camp
  Actions
    Unit - Remove (Triggering unit) from the game
    Player - Add 10 to (Owner of (Triggering unit)).Current gold
weatherSettings
  Events
  Conditions
  Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        weatherSet Equal to True
      Then - Actions
        Environment - Turn weather Off
        Environment - Remove weather
        Set VariableSet weatherSet = False
        Trigger - Turn off disableFires <gen>
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        And - All (Conditions) are true
          Conditions
            level Not equal to 8
            level Not equal to 9
            level Not equal to 10
            level Not equal to 18
            level Not equal to 19
            level Not equal to 20
            level Not equal to 28
            level Not equal to 29
            level Not equal to 30
            (Random integer number between 1 and 100) Less than 10
      Then - Actions
        Trigger - Turn on disableFires <gen>
        Set VariableSet weatherSet = True
        Environment - Create at (Entire map) the weather effect Ashenvale Rain (Heavy)
        Set VariableSet weather = (Last created weather effect)
        Environment - Turn weather On
      Else - Actions
disableFires
  Events
    Time - Every 2 seconds of game time
  Conditions
  Actions
    Set VariableSet tempGroup = (Units of type Bonfire)
    Unit Group - Pick every unit in tempGroup and do (Actions)
      Loop - Actions
        Unit - Replace (Picked unit) with a Extinguished Bonfire using The old unit's relative life and mana
    Custom script: call DestroyGroup(udg_tempGroup)
createMerchant
  Events
  Conditions
  Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        level Less than 25
        createdMerchant Equal to False
      Then - Actions
        Set VariableSet tempPoint = (Random point in gameArea <gen>)
        Unit - Create 1.Merchant (Male) for Neutral Passive at tempPoint facing Default building facing degrees
        Custom script: call RemoveLocation(udg_tempPoint)
        Set VariableSet merchant = (Last created unit)
        Set VariableSet createdMerchant = True
      Else - Actions
removeMerchant
  Events
  Conditions
  Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        createdMerchant Equal to True
      Then - Actions
        Unit - Remove merchant from the game
        Set VariableSet createdMerchant = False
      Else - Actions
day
  Events
    Time - dayTimer expires
  Conditions
    nightMode Equal to True
  Actions
    Set VariableSet nightMode = False
    Game - Set the time of day to 8.00
    -------- Previous Level --------
    Set VariableSet spawningEnabled = False
    Trigger - Run cleanupEnemies <gen> (checking conditions)
    Sound - Use the Barrens daytime ambient theme
    Trigger - Run weatherSettings <gen> (checking conditions)
    Player Group - Pick every player in players and do (Actions)
      Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            defeatedPlayers[(Player number of (Picked player))] Equal to False
          Then - Actions
            Visibility - Enable visibility[(Player number of (Picked player))]
            Visibility - Disable blackMask[(Player number of (Picked player))]
          Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        Or - Any (Conditions) are true
          Conditions
            level Equal to 10
            level Equal to 20
            level Equal to 30
      Then - Actions
        Trigger - Run stopBossWave <gen> (checking conditions)
      Else - Actions
        Trigger - Run normalDayTimer <gen> (checking conditions)
        Custom script: call PlayMusic(udg_playlist)
    -------- New Level --------
    Set VariableSet level = (level + 1)
    Trigger - Run winGame <gen> (checking conditions)
    Trigger - Run upgradeEnemies <gen> (checking conditions)
    Trigger - Run createCritters <gen> (checking conditions)
    Trigger - Run updateRounds <gen> (checking conditions)
    Trigger - Run createMerchant <gen> (checking conditions)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        level Equal to 8
      Then - Actions
        Game - Display to (All players) for 35.00 seconds the text: I smell the blood of demons. Prepare your defences!
        Sound - Play SheepDeathSwim1 <gen>
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        level Equal to 18
      Then - Actions
        Game - Display to (All players) for 35.00 seconds the text: Hell approaches, ready your defence!
        Sound - Play SheepDeathSwim1 <gen>
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        level Equal to 28
      Then - Actions
        Game - Display to (All players) for 35.00 seconds the text: The wrath of the barrens is coming. Ready your defence for the final force!
        Sound - Play SheepDeathSwim1 <gen>
      Else - Actions
night
  Events
    Time - nightTimer expires
  Conditions
    nightMode Equal to False
  Actions
    Set VariableSet nightMode = True
    Game - Set the time of day to 24.00
    Trigger - Run removeMerchant <gen> (checking conditions)
    Player Group - Pick every player in players and do (Actions)
      Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            defeatedPlayers[(Player number of (Picked player))] Equal to False
          Then - Actions
            Visibility - Disable visibility[(Player number of (Picked player))]
            Visibility - Enable blackMask[(Player number of (Picked player))]
          Else - Actions
    Sound - Stop music After fading
    Sound - Use the Barrens nighttime ambient theme
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        level Not equal to 10
        level Not equal to 20
        level Not equal to 30
      Then - Actions
        Set VariableSet tempType = unitTypes[(Random integer number between 0 and 49)]
        Trigger - Run normalNightTimer <gen> (checking conditions)
        Sound - Play CreepAggroWhat1 <gen>
      Else - Actions
        Trigger - Run startBossWave <gen> (checking conditions)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        Or - Any (Conditions) are true
          Conditions
            level Equal to 10
            level Equal to 20
            level Equal to 30
      Then - Actions
        Sound - Play PH1 <gen>
      Else - Actions
    Set VariableSet spawningEnabled = True
deathGood
  Events
  Conditions
  Actions
    Set VariableSet playerCount = (playerCount - 1)
    Sound - Play PeasantDeath <gen>
    Set VariableSet tempGroup = (Units owned by (Owner of (Dying unit)).)
    Unit Group - Remove (Dying unit) from goodGroup.
    Unit Group - Pick every unit in tempGroup and do (Actions)
      Loop - Actions
        Unit - Explode (Picked unit).
    Custom script: call DestroyGroup(udg_tempGroup)
    Game - Display to players for 10.00 seconds the text: ((Name of (Owner of (Dying unit))) + has died)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        playerCount Equal to 0
      Then - Actions
        Player Group - Pick every player in allPlayers and do (Actions)
          Loop - Actions
            Game - Defeat (Picked player) with the message: |cffff0000YOU LOOSE|r
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        versusMode Equal to True
      Then - Actions
        Visibility - Create an initially Enabled visibility modifier for (Owner of (Dying unit)) emitting Visibility across (Playable map area)
        Set VariableSet defeatedPlayers[(Player number of (Owner of (Dying unit)))] = True
      Else - Actions
    Trigger - Run setEnemyCount <gen> (checking conditions)
deathEnemy0
  Events
    Unit - A unit owned by Player 21 (Coal).Dies
  Conditions
  Actions
    Set VariableSet enemySize[0] = (enemySize[0] - 1)
    Trigger - Run spawnGoldReward <gen> (checking conditions)
deathEnemy1
  Events
    Unit - A unit owned by Player 22 (Snow).Dies
  Conditions
  Actions
    Set VariableSet enemySize[1] = (enemySize[1] - 1)
    Trigger - Run spawnGoldReward <gen> (checking conditions)
deathEnemy2
  Events
    Unit - A unit owned by Player 23 (Emerald).Dies
  Conditions
  Actions
    Set VariableSet enemySize[2] = (enemySize[2] - 1)
    Trigger - Run spawnGoldReward <gen> (checking conditions)
deathEnemy3
  Events
    Unit - A unit owned by Player 24 (Peanut).Dies
  Conditions
  Actions
    Set VariableSet enemySize[3] = (enemySize[3] - 1)
    Trigger - Run spawnGoldReward <gen> (checking conditions)
spawnGoldReward
  Events
  Conditions
  Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Random integer number between 0 and 4500) Less than (goldLevel[(Player number of (Owner of (Killing unit)))] + 0)
        (Current research level of R007 (techcode) for (Owner of (Killing unit))) Less than or equal to 4
      Then - Actions
        Set VariableSet tempPoint = (Position of (Dying unit))
        Item - Create Lesser Gold Coins at tempPoint
        Custom script: call RemoveLocation(udg_tempPoint)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Random integer number between 0 and 20000) Less than goldLevel[(Player number of (Owner of (Killing unit)))]
        (Current research level of R007 (techcode) for (Owner of (Killing unit))) Greater than 4
      Then - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            goldSucker[(Player number of (Owner of (Killing unit)))] Greater than 0
          Then - Actions
            Player - Set (Owner of (Killing unit)).Current gold to (((Owner of (Killing unit)) Current gold) + 100)
          Else - Actions
            Set VariableSet tempPoint = (Position of (Dying unit))
            Item - Create Gold Coins at tempPoint
            Custom script: call RemoveLocation(udg_tempPoint)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Current research level of R007 (techcode) for (Owner of (Killing unit))) Greater than 9
        (Random integer number between 0 and 200000) Less than goldLevel[(Player number of (Owner of (Killing unit)))]
      Then - Actions
        Set VariableSet tempPoint = (Position of (Dying unit))
        Item - Create Greater Gold Coins at tempPoint
        Floating Text - Create floating text that reads Greater Gold Coins! at tempPoint with Z offset 0, using font size 15.00, color (0.00%, 100.00%, 0.00%), and 0% transparency
        Floating Text - Change (Last created floating text): Disable permanence
        Floating Text - Set the velocity of (Last created floating text) to 25.00 towards 90 degrees
        Floating Text - Change the fading age of (Last created floating text) to 5.00 seconds
        Floating Text - Change the lifespan of (Last created floating text) to 6.00 seconds
        Custom script: call RemoveLocation(udg_tempPoint)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        level Less than 13
        (Random integer number between 0 and (200000 + (level x 10000))) Less than goldLevel[(Player number of (Owner of (Killing unit)))]
      Then - Actions
        Set VariableSet tempPoint = (Position of (Dying unit))
        Item - Create commonDropTable[(Random integer number between 0 and 5)] at tempPoint
        Floating Text - Create floating text that reads Item Drop! at tempPoint with Z offset 0, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0% transparency
        Floating Text - Change (Last created floating text): Disable permanence
        Floating Text - Set the velocity of (Last created floating text) to 35.00 towards 90 degrees
        Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
        Floating Text - Change the lifespan of (Last created floating text) to 4.00 seconds
        Custom script: call RemoveLocation(udg_tempPoint)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Random integer number between 0 and (800000 + ((level x 10000) + 1))) Less than goldLevel[(Player number of (Owner of (Killing unit)))]
        level Greater than 10
      Then - Actions
        Set VariableSet tempPoint = (Position of (Dying unit))
        Item - Create rareDropTable[(Random integer number between 0 and 5)] at tempPoint
        Floating Text - Create floating text that reads Rare Item! at tempPoint with Z offset 0, using font size 15.00, color (100.00%, 0.00%, 100.00%), and 0% transparency
        Floating Text - Change (Last created floating text): Disable permanence
        Floating Text - Set the velocity of (Last created floating text) to 25.00 towards 90 degrees
        Floating Text - Change the fading age of (Last created floating text) to 5.00 seconds
        Floating Text - Change the lifespan of (Last created floating text) to 6.00 seconds
        Custom script: call RemoveLocation(udg_tempPoint)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        level Less than 8
        (Random integer number between 0 and (50000 + (level x 8000))) Less than goldLevel[(Player number of (Owner of (Killing unit)))]
      Then - Actions
        Set VariableSet tempPoint = (Position of (Dying unit))
        Item - Create Potion of Healing at tempPoint
        Floating Text - Create floating text that reads Potion! at tempPoint with Z offset 0, using font size 15.00, color (0.00%, 100.00%, 0.00%), and 0% transparency
        Floating Text - Change (Last created floating text): Disable permanence
        Floating Text - Set the velocity of (Last created floating text) to 25.00 towards 90 degrees
        Floating Text - Change the fading age of (Last created floating text) to 5.00 seconds
        Floating Text - Change the lifespan of (Last created floating text) to 6.00 seconds
        Custom script: call RemoveLocation(udg_tempPoint)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        level Less than 8
        (Random integer number between 0 and (50000 + (level x 4000))) Less than goldLevel[(Player number of (Owner of (Killing unit)))]
      Then - Actions
        Set VariableSet tempPoint = (Position of (Dying unit))
        Item - Create Scroll of Speed at tempPoint
        Floating Text - Create floating text that reads Scroll of Speed! at tempPoint with Z offset 0, using font size 15.00, color (70.00%, 30.00%, 0.00%), and 0% transparency
        Floating Text - Change (Last created floating text): Disable permanence
        Floating Text - Set the velocity of (Last created floating text) to 25.00 towards 90 degrees
        Floating Text - Change the fading age of (Last created floating text) to 5.00 seconds
        Floating Text - Change the lifespan of (Last created floating text) to 6.00 seconds
        Custom script: call RemoveLocation(udg_tempPoint)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        level Less than 23
        level Greater than 10
        (Random integer number between 0 and (150000 + (level x 7000))) Less than goldLevel[(Player number of (Owner of (Killing unit)))]
      Then - Actions
        Set VariableSet tempPoint = (Position of (Dying unit))
        Item - Create Potion of Greater Healing at tempPoint
        Floating Text - Create floating text that reads Potion! at tempPoint with Z offset 0, using font size 15.00, color (0.00%, 100.00%, 0.00%), and 0% transparency
        Floating Text - Change (Last created floating text): Disable permanence
        Floating Text - Set the velocity of (Last created floating text) to 25.00 towards 90 degrees
        Floating Text - Change the fading age of (Last created floating text) to 5.00 seconds
        Floating Text - Change the lifespan of (Last created floating text) to 6.00 seconds
        Custom script: call RemoveLocation(udg_tempPoint)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Random integer number between 0 and ((100000 + (difficultyIndex x 10000)) + ((level x (10000 + (difficultyIndex x 1000))) + 0))) Less than goldLevel[(Player number of (Owner of (Killing unit)))]
        level Less than 25
        ahnksSpawned Less than (playerCount / 2)
      Then - Actions
        Set VariableSet ahnksSpawned = (ahnksSpawned + 1)
        Set VariableSet tempPoint = (Position of (Dying unit))
        Item - Create Ankh of Reincarnation at tempPoint
        Floating Text - Create floating text that reads Ahnk! at tempPoint with Z offset 0, using font size 15.00, color (80.00%, 80.00%, 0.00%), and 0% transparency
        Floating Text - Change (Last created floating text): Disable permanence
        Floating Text - Set the velocity of (Last created floating text) to 25.00 towards 90 degrees
        Floating Text - Change the fading age of (Last created floating text) to 5.00 seconds
        Floating Text - Change the lifespan of (Last created floating text) to 6.00 seconds
        Custom script: call RemoveLocation(udg_tempPoint)
      Else - Actions
createTrees
  Events
  Conditions
  Actions
    For each (Integer B) from 1 to (Random integer number between ((playerCount + 0) + 10) and ((playerCount x 3) + 15)), do (Actions)
      Loop - Actions
        Set VariableSet tempPoint = (Random point in gameArea <gen>)
        Set VariableSet tempRegion = (Region centered at tempPoint with size ((Random real number between 350.00 and 650.00), (Random real number between 350.00 and 650.00)))
        Custom script: call RemoveLocation(udg_tempPoint)
        For each (Integer A) from 1 to (Random integer number between 20 and 30), do (Actions)
          Loop - Actions
            Set VariableSet tempPoint = (Random point in tempRegion)
            Destructible - Create a BTtw (destructablecode) at tempPoint facing (Random angle) with scale (Random real number between 0.80 and 1.30) and variation (Random integer number between 0 and 10)
            Custom script: call RemoveLocation(udg_tempPoint)
    Custom script: call DestroyTrigger( GetTriggeringTrigger() )
    Destructible - Pick every destructible in center <gen> and do (Actions)
      Loop - Actions
        Destructible - Remove (Picked destructible)
createCritters
  Events
  Conditions
    level Less than or equal to 5
  Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        level Equal to 1
      Then - Actions
        For each (Integer A) from 1 to (playerCount x 5), do (Actions)
          Loop - Actions
            Set VariableSet tempPoint = (Random point in gameArea <gen>)
            Unit - Create 1.Rabbit for Neutral Hostile at tempPoint facing Default building facing degrees
            Custom script: call RemoveLocation(udg_tempPoint)
        Set VariableSet tempGroup = (Units in rabbitMoveRegion <gen> matching ((Unit-type of (Matching unit)) Equal to Rabbit))
        Unit Group - Pick every unit in tempGroup and do (Actions)
          Loop - Actions
            Set VariableSet tempPoint = (Random point in gameArea <gen>)
            Unit - Move (Picked unit) instantly to tempPoint
            Custom script: call RemoveLocation(udg_tempPoint)
        Custom script: call DestroyGroup(udg_tempGroup)
      Else - Actions
        For each (Integer A) from 1 to (3 x playerCount), do (Actions)
          Loop - Actions
            Set VariableSet tempPoint = (Random point in gameArea <gen>)
            Unit - Create 1.Rabbit for Neutral Hostile at tempPoint facing Default building facing degrees
            Custom script: call RemoveLocation(udg_tempPoint)
        For each (Integer A) from 1 to (1 x playerCount), do (Actions)
          Loop - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                (Random integer number between 1 and 100) Less than or equal to 10
              Then - Actions
                Set VariableSet tempPoint = (Random point in gameArea <gen>)
                Unit - Create 1.Stag for Neutral Hostile at tempPoint facing Default building facing degrees
                Custom script: call RemoveLocation(udg_tempPoint)
              Else - Actions
rabbitDeath
  Events
    Unit - A unit Dies
  Conditions
    (Unit-type of (Dying unit)) Equal to Rabbit
  Actions
    Set VariableSet tempPoint = (Position of (Dying unit))
    Item - Create Lesser Gold Coins at tempPoint
    Custom script: call RemoveLocation(udg_tempPoint)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Unit-type of (Killing unit)) Equal to Hunter Peasant
        (Random integer number between 0 and 100) Less than 40
      Then - Actions
        Set VariableSet tempPoint = (Position of (Dying unit))
        Item - Create Lesser Gold Coins at tempPoint
        Custom script: call RemoveLocation(udg_tempPoint)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Unit-type of (Killing unit)) Equal to Hunter Peasant
        (Random integer number between 0 and 100) Less than 10
      Then - Actions
        Set VariableSet tempPoint = (Position of (Dying unit))
        Item - Create commonDropTable[(Random integer number between 0 and 4)] at tempPoint
        Floating Text - Create floating text that reads Item Drop! at tempPoint with Z offset 0, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0% transparency
        Floating Text - Change (Last created floating text): Disable permanence
        Floating Text - Set the velocity of (Last created floating text) to 35.00 towards 90 degrees
        Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
        Floating Text - Change the lifespan of (Last created floating text) to 4.00 seconds
        Custom script: call RemoveLocation(udg_tempPoint)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Random integer number between 0 and 100) Less than 10
      Then - Actions
        Set VariableSet tempPoint = (Position of (Dying unit))
        Item - Create Potion of Healing at tempPoint
        Floating Text - Create floating text that reads Potion! at tempPoint with Z offset 0, using font size 15.00, color (0.00%, 100.00%, 0.00%), and 0% transparency
        Floating Text - Change (Last created floating text): Disable permanence
        Floating Text - Set the velocity of (Last created floating text) to 25.00 towards 90 degrees
        Floating Text - Change the fading age of (Last created floating text) to 5.00 seconds
        Floating Text - Change the lifespan of (Last created floating text) to 6.00 seconds
        Custom script: call RemoveLocation(udg_tempPoint)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        level Less than 10
        (Random integer number between 0 and 100) Less than 10
      Then - Actions
        Set VariableSet tempPoint = (Position of (Dying unit))
        Item - Create Scroll of Speed at tempPoint
        Floating Text - Create floating text that reads Scroll of Speed! at tempPoint with Z offset 0, using font size 15.00, color (70.00%, 30.00%, 0.00%), and 0% transparency
        Floating Text - Change (Last created floating text): Disable permanence
        Floating Text - Set the velocity of (Last created floating text) to 25.00 towards 90 degrees
        Floating Text - Change the fading age of (Last created floating text) to 5.00 seconds
        Floating Text - Change the lifespan of (Last created floating text) to 6.00 seconds
        Custom script: call RemoveLocation(udg_tempPoint)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        level Less than 6
        (Random integer number between 0 and 100) Less than 32
      Then - Actions
        Set VariableSet tempPoint = (Position of (Dying unit))
        Item - Create Scrappy Wall at tempPoint
        Custom script: call RemoveLocation(udg_tempPoint)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        level Less than 6
        (Random integer number between 0 and 100) Less than 8
      Then - Actions
        Set VariableSet tempPoint = (Position of (Dying unit))
        Item - Create Junk Tower at tempPoint
        Custom script: call RemoveLocation(udg_tempPoint)
      Else - Actions
stagDeath
  Events
    Unit - A unit Dies
  Conditions
    (Unit-type of (Dying unit)) Equal to Stag
  Actions
    Set VariableSet tempPoint = (Position of (Dying unit))
    Item - Create Lesser Gold Coins at tempPoint
    Custom script: call RemoveLocation(udg_tempPoint)
    Set VariableSet tempPoint = (Position of (Dying unit))
    Item - Create Lesser Gold Coins at tempPoint
    Custom script: call RemoveLocation(udg_tempPoint)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Random integer number between 0 and 100) Less than 50
        (Unit-type of (Killing unit)) Equal to Hunter Peasant
      Then - Actions
        Set VariableSet tempPoint = (Position of (Dying unit))
        Item - Create Lesser Gold Coins at tempPoint
        Custom script: call RemoveLocation(udg_tempPoint)
        Set VariableSet tempPoint = (Position of (Dying unit))
        Item - Create Lesser Gold Coins at tempPoint
        Custom script: call RemoveLocation(udg_tempPoint)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Random integer number between 0 and 100) Less than 30
      Then - Actions
        Set VariableSet tempPoint = (Position of (Dying unit))
        Item - Create commonDropTable[(Random integer number between 0 and 6)] at tempPoint
        Floating Text - Create floating text that reads Item Drop! at tempPoint with Z offset 0, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0% transparency
        Floating Text - Change (Last created floating text): Disable permanence
        Floating Text - Set the velocity of (Last created floating text) to 35.00 towards 90 degrees
        Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
        Floating Text - Change the lifespan of (Last created floating text) to 4.00 seconds
        Custom script: call RemoveLocation(udg_tempPoint)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Random integer number between 0 and 100) Less than 50
      Then - Actions
        Set VariableSet tempPoint = (Position of (Dying unit))
        Item - Create Potion of Healing at tempPoint
        Floating Text - Create floating text that reads Potion! at tempPoint with Z offset 0, using font size 15.00, color (0.00%, 100.00%, 0.00%), and 0% transparency
        Floating Text - Change (Last created floating text): Disable permanence
        Floating Text - Set the velocity of (Last created floating text) to 25.00 towards 90 degrees
        Floating Text - Change the fading age of (Last created floating text) to 5.00 seconds
        Floating Text - Change the lifespan of (Last created floating text) to 6.00 seconds
        Custom script: call RemoveLocation(udg_tempPoint)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Random integer number between 0 and 100) Less than 50
      Then - Actions
        Set VariableSet tempPoint = (Position of (Dying unit))
        Item - Create Potion of Healing at tempPoint
        Floating Text - Create floating text that reads Potion! at tempPoint with Z offset 0, using font size 15.00, color (0.00%, 100.00%, 0.00%), and 0% transparency
        Floating Text - Change (Last created floating text): Disable permanence
        Floating Text - Set the velocity of (Last created floating text) to 25.00 towards 90 degrees
        Floating Text - Change the fading age of (Last created floating text) to 5.00 seconds
        Floating Text - Change the lifespan of (Last created floating text) to 6.00 seconds
        Custom script: call RemoveLocation(udg_tempPoint)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        level Less than 10
        (Random integer number between 0 and 200) Less than 50
      Then - Actions
        Set VariableSet tempPoint = (Position of (Dying unit))
        Item - Create Scroll of Speed at tempPoint
        Floating Text - Create floating text that reads Scroll of Speed! at tempPoint with Z offset 0, using font size 15.00, color (70.00%, 30.00%, 0.00%), and 0% transparency
        Floating Text - Change (Last created floating text): Disable permanence
        Floating Text - Set the velocity of (Last created floating text) to 25.00 towards 90 degrees
        Floating Text - Change the fading age of (Last created floating text) to 5.00 seconds
        Floating Text - Change the lifespan of (Last created floating text) to 6.00 seconds
        Custom script: call RemoveLocation(udg_tempPoint)
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        level Less than 10
        (Random integer number between 0 and 200) Less than 50
      Then - Actions
        Set VariableSet tempPoint = (Position of (Dying unit))
        Item - Create Scroll of Speed at tempPoint
        Floating Text - Create floating text that reads Scroll of Speed! at tempPoint with Z offset 0, using font size 15.00, color (70.00%, 30.00%, 0.00%), and 0% transparency
        Floating Text - Change (Last created floating text): Disable permanence