Copied the first two campaign missions and the helper script into share/hedgewars/Data/
authorbelphegorr <szabibibi@gmail.com>
Mon, 25 Jun 2012 11:16:24 +0300
changeset 7203 37661b2a7b64
parent 7201 dc17ffdf0702
child 7205 cdc38e49a276
Copied the first two campaign missions and the helper script into share/hedgewars/Data/
share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/campaign.ini
share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/first_blood.lua
share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/shadow.lua
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/campaign.ini	Mon Jun 25 11:16:24 2012 +0300
@@ -0,0 +1,14 @@
+MissionNum=3
+ResetRetry=1
+
+[Mission 1]
+Name=First Blood
+Script=first_blood.lua
+
+[Mission 2]
+Name=The Shadow Falls
+Script=shadow.lua
+
+[Mission 3]
+Name=The Journey Back
+Script=journey.lua
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/first_blood.lua	Mon Jun 25 11:16:24 2012 +0300
@@ -0,0 +1,684 @@
+loadfile(GetDataPath() .. "Scripts/Animate.lua")()
+
+-----------------------------Variables---------------------------------
+startDialogue = {}
+damageAnim = {}
+onShroomAnim = {}
+onFlowerAnim = {}
+tookParaAnim = {}
+tookPunchAnim = {}
+onMoleHeadAnim = {}
+tookRope2Anim = {}
+challengeAnim = {}
+challengeFailedAnim = {}
+challengeCompletedAnim = {}
+beforeKillAnim = {}
+closeCannim = {}
+cannKilledAnim = {}
+cannKilledEarlyAnim = {}
+princessDamagedAnim = {}
+elderDamagedAnim = {}
+pastMoleHeadAnim = {}
+
+
+targets = {}
+crates = {}
+targXdif2 = {2755, 2638, 2921, 2664, 2973, 3162, 3268, 3067, 3588, 3759, 3062, 1300}
+targYdif2 = {1197, 1537, 1646, 1852, 1857, 1804, 1538, 1173, 984, 1290, 1167, 1183}
+targXdif1 = {2749, 2909, 2770, 2892, 2836, 3296, 3567, 3066, 1558, 1305}
+targYdif1 = {1179, 1313, 1734, 1603, 1441, 1522, 982, 1190, 1152, 1259}
+targetPosX = {{821, 866, 789}, {614, 656, 638}, {1238, 1237, 1200}, {1558, 1596, 1631}, {2190, 2396, 2457}}
+targetPosY = {{1342, 1347, 1326}, {1112, 1121, 1061}, {1152, 1111, 1111}, {1132, 1136, 1280}, {1291, 1379, 1317}}
+crateNum = {10, 12}
+
+
+stage = 1
+cratesCollected = 0
+chalTries = 0
+targetsDestroyed = 0
+targsWave = 1
+tTime = -1
+difficulty = 0
+
+cannibalVisible = false
+cannibalKilles = false
+youngdamaged = false
+youngKilled = false
+elderDamaged = false
+princessDamaged = false
+elderKilled = false
+princessKilled = false
+rope1Taken = false
+paraTaken = false
+rope2Taken = false
+punchTaken = false
+canKilled = false
+desertTaken = false
+challengeFailed = false
+difficultyChoice = false
+
+goals = {
+  [startDialogue] = {"First Blood", "First Steps", "Press [Left] or [Right] to move around, [Enter] to jump", 1, 4000},
+  [onShroomAnim] = {"First Blood", "A leap in a leap", "Go on top of the flower", 1, 4000},
+  [onFlowerAnim] = {"First Blood", "Hightime", "Collect the crate on the right.|Hint: Select the rope, [Up] or [Down] to aim, [Space] to fire, directional keys to move.|Ropes can be fired again in the air!", 1, 7000},
+  [tookParaAnim] = {"First Blood", "Omnivore", "Get on the head of the mole", 1, 4000},
+  [onMoleHeadAnim] = {"First Blood", "The Leap of Faith", "Use the parachute ([Space] while in air) to get the next crate", 1, 4000},
+  [tookRope2Anim] = {"First Blood", "The Rising", "Do the deed", 1, 4000},
+  [tookPunchAnim] = {"First Blood", "The Slaughter", "Destroy the targets!|Hint: Select the Shoryuken and hit [Space]|P.S. You can use it mid-air.", 1, 5000},
+  [challengeAnim] = {"First Blood", "The Crate Frenzy", "Collect the crates within the time limit!|If you fail, you'll have to try again.", 1, 5000},
+  [challengeFailedAnim] = {"First Blood", "The Crate Frenzy", "Collect the crates within the time limit!|If you fail, you'll have to try again.", 1, 5000},
+  [challengeCompletedAnim] = {"First Blood", "The Ultimate Weapon", "Destroy the targets!|Hint: [Up], [Down] to aim, [Space] to shoot", 1, 5000},
+  [beforeKillAnim] = {"First Blood", "The First Blood", "Kill the cannibal!", 1, 5000},
+  [closeCannim] = {"First Blood", "The First Blood", "KILL IT!", 1, 5000}
+}
+-----------------------------Animations--------------------------------
+function Skipanim(anim)
+  AnimSwitchHog(youngh)
+  if goals[anim] ~= nil then
+    ShowMission(unpack(goals[anim]))
+  end
+end
+
+function SkipDamageAnim(anim)
+  SwitchHog(youngh)
+  SetInputMask(0xFFFFFFFF)
+end
+
+function SkipOnShroom()
+  Skipanim(onShroomAnim)
+  SetGearPosition(elderh, 2700, 1278)
+end
+
+function AnimationSetup()
+  AddSkipFunction(damageAnim, SkipDamageAnim, {damageAnim})
+  table.insert(damageAnim, {func = AnimWait, args = {youngh, 500}, skipFunc = Skipanim, skipArgs = damageAnim})
+  table.insert(damageAnim, {func = AnimSay, args = {elderh, "Watch your steps, young one!", SAY_SAY, 2000}})
+  table.insert(damageAnim, {func = AnimGearWait, args = {youngh, 500}})
+
+  AddSkipFunction(princessDamagedAnim, SkipDamageAnim, {princessDamagedAnim})
+  table.insert(princessDamagedAnim, {func = AnimWait, args = {princess, 500}, skipFunc = Skipanim, skipArgs = princessDamagedAnim})
+  table.insert(princessDamagedAnim, {func = AnimSay, args = {princess, "Why do men keep hurting me?", SAY_THINK, 3000}})
+  table.insert(princessDamagedAnim, {func = AnimGearWait, args = {youngh, 500}})
+
+  AddSkipFunction(elderDamagedAnim, SkipDamageAnim, {elderDamagedAnim})
+  table.insert(elderDamagedAnim, {func = AnimWait, args = {elderh, 500}, skipFunc = Skipanim, skipArgs = elderDamagedAnim})
+  table.insert(elderDamagedAnim, {func = AnimSay, args = {elderh, "Violence is not the answer to your problems!", SAY_SAY, 3000}})
+  table.insert(elderDamagedAnim, {func = AnimGearWait, args = {youngh, 500}})
+  
+  AddSkipFunction(startDialogue, Skipanim, {startDialogue})
+  table.insert(startDialogue, {func = AnimWait, args = {youngh, 3500}, skipFunc = Skipanim, skipArgs = startDialogue})
+  table.insert(startDialogue, {func = AnimCaption, args = {youngh, "Once upon a time, on an island with great natural resources, lived two tribes in heated conflict...",  5000}})
+  table.insert(startDialogue, {func = AnimCaption, args = {youngh, "One tribe was peaceful, spending their time hunting and training, enjoying the small pleasures of life...", 5000}})
+  table.insert(startDialogue, {func = AnimCaption, args = {youngh, "The other one were all cannibals, spending their time eating the organs of fellow hedgehogs...", 5000}})
+  table.insert(startDialogue, {func = AnimCaption, args = {youngh, "And so it began...", 1000}})
+  table.insert(startDialogue, {func = AnimSay, args = {elderh, "What are you doing at a distance so great, young one?", SAY_SHOUT, 4000}})
+  table.insert(startDialogue, {func = AnimSay, args = {elderh, "Come closer, so that your training may continue!", SAY_SHOUT, 6000}})
+  table.insert(startDialogue, {func = AnimSay, args = {youngh, "This is it! It's time to make Fell From Heaven fall for me...", SAY_THINK, 6000}})
+  table.insert(startDialogue, {func = AnimJump, args = {youngh, "long"}})
+  table.insert(startDialogue, {func = AnimTurn, args = {princess, "Right"}})
+  table.insert(startDialogue, {func = AnimSwitchHog, args = {youngh}})
+  table.insert(startDialogue, {func = AnimShowMission, args = {youngh, "First Blood", "First Steps", "Press [Left] or [Right] to move around, [Enter] to jump", 1, 4000}}) 
+
+  AddSkipFunction(onShroomAnim, SkipOnShroom, {onShroomAnim})
+  table.insert(onShroomAnim, {func = AnimSay, args = {elderh, "I can see you have been training diligently.", SAY_SAY, 4000}, skipFunc = Skipanim, skipArgs = onShroomAnim})
+  table.insert(onShroomAnim, {func = AnimSay, args = {elderh, "The wind whispers that you are ready to become familiar with tools, now...", SAY_SAY, 4000}})
+  table.insert(onShroomAnim, {func = AnimSay, args = {elderh, "Open that crate and we will continue!", SAY_SAY, 5000}})
+  table.insert(onShroomAnim, {func = AnimMove, args = {elderh, "right", 2700, 0}})
+  table.insert(onShroomAnim, {func = AnimTurn, args = {elderh, "Left"}})
+  table.insert(onShroomAnim, {func = AnimSay, args = {princess, "He moves like an eagle in the sky.", SAY_THINK, 4000}})
+  table.insert(onShroomAnim, {func = AnimSwitchHog, args = {youngh}})
+  table.insert(onShroomAnim, {func = AnimShowMission, args = {youngh, "First Blood", "A leap in a leap", "Go on top of the flower", 1, 4000}}) 
+
+  AddSkipFunction(onFlowerAnim, Skipanim, {onFlowerAnim})
+  table.insert(onFlowerAnim, {func = AnimTurn, args = {elderh, "Right"}, skipFunc = Skipanim, skipArgs = onFlowerAnim})
+  table.insert(onFlowerAnim, {func = AnimSay, args = {elderh, "See that crate farther on the right?", SAY_SAY, 4000}})
+  table.insert(onFlowerAnim, {func = AnimSay, args = {elderh, "Swing, Leaks A Lot, on the wings of the wind!", SAY_SAY, 6000}})
+  table.insert(onFlowerAnim, {func = AnimSay, args = {princess, "His arms are so strong!", SAY_THINK, 4000}})
+  table.insert(onFlowerAnim, {func = AnimSwitchHog, args = {youngh}})
+  table.insert(onFlowerAnim, {func = AnimShowMission, args = {youngh, "First Blood", "Hightime", "Collect the crate on the right.|Hint: Select the rope, [Up] or [Down] to aim, [Space] to fire, directional keys to move.|Ropes can be fired again in the air!", 1, 7000}}) 
+  
+  AddSkipFunction(tookParaAnim, Skipanim, {tookParaAnim})
+  table.insert(tookParaAnim, {func = AnimGearWait, args = {youngh, 1000}, skipFunc = Skipanim, skipArgs = tookParaAnim})
+  table.insert(tookParaAnim, {func = AnimSay, args = {elderh, "Use the rope to get on the head of the mole, young one!", SAY_SHOUT, 4000}})
+  table.insert(tookParaAnim, {func = AnimSay, args = {elderh, "Worry not, for it is a peaceful animal! There is no reason to be afraid...", SAY_SHOUT, 5000}})
+  table.insert(tookParaAnim, {func = AnimSay, args = {elderh, "We all know what happens when you get frightened...", SAY_SAY, 4000}})
+  table.insert(tookParaAnim, {func = AnimSay, args = {youngh, "So humiliating...", SAY_SAY, 4000}})
+  table.insert(tookParaAnim, {func = AnimShowMission, args = {youngh, "First Blood", "Omnivore", "Get on the head of the mole", 1, 4000}}) 
+  table.insert(tookParaAnim, {func = AnimSwitchHog, args = {youngh}})
+
+  AddSkipFunction(onMoleHeadAnim, Skipanim, {onMoleHeadAnim})
+  table.insert(onMoleHeadAnim, {func = AnimSay, args = {elderh, "Perfect! Now try to get the next crate without hurting yourself!", SAY_SAY, 4000}, skipFunc = Skipanim, skipArgs = onMoleHeadAnim})
+  table.insert(onMoleHeadAnim, {func = AnimSay, args = {elderh, "The giant umbrella from the last crate should help break the fall.", SAY_SAY, 4000}})
+  table.insert(onMoleHeadAnim, {func = AnimSay, args = {princess, "He's so brave...", SAY_THINK, 4000}})
+  table.insert(onMoleHeadAnim, {func = AnimShowMission, args = {youngh, "First Blood", "The Leap of Faith", "Use the parachute ([Space] while in air) to get the next crate", 1, 4000}}) 
+  table.insert(onMoleHeadAnim, {func = AnimSwitchHog, args = {youngh}})
+
+  AddSkipFunction(pastMoleHeadAnim, Skipanim, {pastMoleHeadAnim})
+  table.insert(pastMoleHeadAnim, {func = AnimSay, args = {elderh, "I see you have already taken the leap of faith.", SAY_SAY, 4000}, skipFunc = Skipanim, skipArgs = pastMoleHeadAnim})
+  table.insert(pastMoleHeadAnim, {func = AnimSay, args = {elderh, "Get that crate!", SAY_SAY, 4000}})
+  table.insert(pastMoleHeadAnim, {func = AnimSwitchHog, args = {youngh}})
+
+  AddSkipFunction(tookRope2Anim, Skipanim, {tookRope2Anim})
+  table.insert(tookRope2Anim, {func = AnimSay, args = {elderh, "Impressive...you are still dry as the corpse of a hawk after a week in the desert...", SAY_SAY, 5000}, skipFunc = Skipanim, skipArgs = tookRope2Anim})
+  table.insert(tookRope2Anim, {func = AnimSay, args = {elderh, "You probably know what to do next...", SAY_SAY, 4000}})
+  table.insert(tookRope2Anim, {func = AnimShowMission, args = {youngh, "First Blood", "The Rising", "Do the deed", 1, 4000}}) 
+  table.insert(tookRope2Anim, {func = AnimSwitchHog, args = {youngh}})
+
+  AddSkipFunction(tookPunchAnim, Skipanim, {tookPunchAnim})
+  table.insert(tookPunchAnim, {func = AnimTurn, args = {elderh, "Left"}, skipFunc = Skipanim, skipArgs = tookPunchAnim})
+  table.insert(tookPunchAnim, {func = AnimSay, args = {elderh, "It is time to practice your fighting skills.", SAY_SAY, 4000}})
+  table.insert(tookPunchAnim, {func = AnimSay, args = {elderh, "Imagine those targets are the wolves that killed your parents! Take your anger out on them!", SAY_SAY, 5000}})
+  table.insert(tookPunchAnim, {func = AnimShowMission, args = {youngh, "First Blood", "The Slaughter", "Destroy the targets!|Hint: Select the Shoryuken and hit [Space]|P.S. You can use it mid-air.", 1, 5000}}) 
+  table.insert(tookPunchAnim, {func = AnimSwitchHog, args = {youngh}})
+
+  AddSkipFunction(challengeAnim, Skipanim, {challengeAnim})
+  table.insert(challengeAnim, {func = AnimSay, args = {elderh, "I hope you are prepared for a small challenge, young one.", SAY_SAY, 4000}, skipFunc = Skipanim, skipArgs = challengeAnim})
+  table.insert(challengeAnim, {func = AnimSay, args = {elderh, "Your movement skills will be evaluated now.", SAY_SAY, 4000}})
+  table.insert(challengeAnim, {func = AnimSay, args = {elderh, "Collect all the crates, but remember, our time in this life is limited!", SAY_SAY, 4000}})
+  table.insert(challengeAnim, {func = AnimSay, args = {elderh, "How difficult would you like it to be?"}})
+  table.insert(challengeAnim, {func = AnimSwitchHog, args = {youngh}})
+  table.insert(challengeAnim, {func = AnimWait, args = {youngh, 500}})
+
+  AddSkipFunction(challengeFailedAnim, Skipanim, {challengeFailedAnim})
+  table.insert(challengeFailedAnim, {func = AnimSay, args = {elderh, "Hmmm...perhaps a little more time will help.", SAY_SAY, 4000}, skipFunc = Skipanim, skipArgs = challengeFailedAnim})
+  table.insert(challengeFailedAnim, {func = AnimShowMission, args = {youngh, "First Blood", "The Crate Frenzy", "Collect the crates within the time limit!|If you fail, you'll have to try again.", 1, 5000}}) 
+  table.insert(challengeFailedAnim, {func = AnimSwitchHog, args = {youngh}})
+
+  AddSkipFunction(challengeCompletedAnim, Skipanim, {challengeCompletedAnim})
+  table.insert(challengeCompletedAnim, {func = AnimSay, args = {elderh, "The spirits of the ancerstors are surely pleased, Leaks A Lot.", SAY_SAY, 4000}, skipFunc = Skipanim, skipArgs = challengeCompletedAnim})
+  table.insert(challengeCompletedAnim, {func = AnimSay, args = {elderh, "You have proven yourself worthy to see our most ancient secret!", SAY_SAY, 4000}})
+  table.insert(challengeCompletedAnim, {func = AnimSay, args = {elderh, "The weapon in that last crate was bestowed upon us by the ancients!", SAY_SAY, 4000}})
+  table.insert(challengeCompletedAnim, {func = AnimSay, args = {elderh, "Use it with precaution!", SAY_SAY, 4000}})
+  table.insert(challengeCompletedAnim, {func = AnimShowMission, args = {youngh, "First Blood", "The Ultimate Weapon", "Destroy the targets!|Hint: [Up], [Down] to aim, [Space] to shoot", 1, 5000}}) 
+  table.insert(challengeCompletedAnim, {func = AnimSwitchHog, args = {youngh}})
+
+  AddSkipFunction(beforeKillAnim, Skipanim, {beforeKillAnim})
+  table.insert(beforeKillAnim, {func = AnimSay, args = {elderh, "What do my faulty eyes observe? A spy!", SAY_SHOUT, 4000}, skipFunc = Skipanim, skipArgs = beforeKillAnim})
+  table.insert(beforeKillAnim, {func = AnimFollowGear, args = {cannibal}})
+  table.insert(beforeKillAnim, {func = AnimWait, args = {cannibal, 1000}})
+  table.insert(beforeKillAnim, {func = AnimSay, args = {elderh, "Destroy him, Leaks A Lot! He is responsible for the deaths of many of us!", SAY_SHOUT, 4000}})
+  table.insert(beforeKillAnim, {func = AnimSay, args = {cannibal, "Oh, my!", SAY_THINK, 4000}})
+  table.insert(beforeKillAnim, {func = AnimShowMission, args = {youngh, "First Blood", "The First Blood", "Kill the cannibal!", 1, 5000}}) 
+  table.insert(beforeKillAnim, {func = AnimSwitchHog, args = {youngh}})
+  
+  AddSkipFunction(closeCannim, Skipanim, {closeCannim})
+  table.insert(closeCannim, {func = AnimSay, args = {elderh, "I see you would like his punishment to be more...personal...", SAY_SAY, 4000}, skipFunc = Skipanim, skipArgs = closeCannim})
+  table.insert(closeCannim, {func = AnimSay, args = {cannibal, "I'm certain that this is a misunderstanding, fellow hedgehogs!", SAY_SAY, 4000}})
+  table.insert(closeCannim, {func = AnimSay, args = {cannibal, "If only I were given a chance to explain my being here...", SAY_SAY, 4000}})
+  table.insert(closeCannim, {func = AnimSay, args = {elderh, "Do not let his words fool you, young one! He will stab you in the back as soon as you turn away!", SAY_SAY, 6000}})
+  table.insert(closeCannim, {func = AnimSay, args = {elderh, "Here...pick your weapon!", SAY_SAY, 5000}})
+  table.insert(closeCannim, {func = AnimShowMission, args = {youngh, "First Blood", "The First Blood", "KILL IT!", 1, 5000}}) 
+  table.insert(closeCannim, {func = AnimSwitchHog, args = {youngh}})
+
+  table.insert(cannKilledAnim, {func = AnimSay, args = {elderh, "Yes, yeees! You are now ready to enter the real world!", SAY_SHOUT, 6000}})
+
+  table.insert(cannKilledEarlyAnim, {func = AnimSay, args = {elderh, "What?! A cannibal? Here? There is no time to waste! Come, you are prepared.", SAY_SHOUT, 4000}})
+end
+-----------------------------Events------------------------------------
+
+function CheckDamage()
+  return youngdamaged and StoppedGear(youngh) 
+end
+
+function DoOnDamage()
+  AddAnim(damageAnim)
+  youngdamaged = false
+  AddFunction({func = ResetTurnTime, args = {}})
+end
+
+function CheckDeath()
+  return youngKilled
+end
+
+function DoDeath()
+  RemoveEventFunc(CheckKilledOthers)
+  RemoveEventFunc(CheckDamage)
+  RemoveEventFunc(CheckDamagedOthers)
+  FinishThem()
+  ShowMission("First Blood", "The wasted youth", "Leaks A Lot gave his life for his tribe! He should have survived!", 2, 4000)
+end
+
+function CheckDamagedOthers()
+  return (princessDamaged and StoppedGear(princess)) or (elderDamaged and StoppedGear(elderh))
+end
+
+function CheckKilledOthers()
+  return princessKilled or elderKilled
+end
+
+function DoOnDamagedOthers()
+  if princessDamaged then
+    AddAnim(princessDamagedAnim)
+  end
+  if elderDamaged then
+    AddAnim(elderDamagedAnim)
+  end
+  elderDamaged = false
+  princessDamaged = false
+  AddFunction({func = ResetTurnTime, args = {}})
+end
+
+function DoKilledOthers()
+  AddCaption("After Leaks A Lot betrayed his tribe, he joined the cannibals...")
+  FinishThem()
+end
+
+function CheckMovedUntilJump()
+   return GetX(youngh) >= 2343
+end
+
+function DoMovedUntilJump()
+  ShowMission("First Blood", "Step By Step", "Hint: Double Jump - Press [Backspace] twice", -amSkip, 0)
+  AddEvent(CheckOnShroom, {}, DoOnShroom, {}, 0)
+end
+
+function CheckOnShroom()
+  return GetX(youngh) >= 2461
+end
+
+function DoOnShroom()
+  ropeCrate1 = SpawnUtilityCrate(2751, 1194, amRope)
+  AddAnim(onShroomAnim)
+  AddEvent(CheckOnFlower, {}, DoOnFlower, {}, 0)
+end
+
+function CheckOnFlower()
+  return rope1Taken
+end
+
+function DoOnFlower()
+  AddAmmo(youngh, amRope, 100)
+  paraCrate = SpawnUtilityCrate(3245, 1758, amParachute)
+  AddAnim(onFlowerAnim)
+  AddEvent(CheckTookParaCrate, {}, DoTookParaCrate, {}, 0)
+end
+
+function CheckTookParaCrate()
+  return paraTaken and StoppedGear(youngh)
+end
+
+function DoTookParaCrate()
+  AddAmmo(youngh, amParachute, 100)
+  AddAnim(tookParaAnim)
+  AddEvent(CheckOnMoleHead, {}, DoOnMoleHead, {}, 0)
+  AddEvent(CheckPastMoleHead, {}, DoPastMoleHead, {}, 0)
+end
+
+function CheckOnMoleHead()
+  x = GetX(youngh)
+  return x >= 3005 and x <= 3126 and StoppedGear(youngh)
+end
+
+function CheckPastMoleHead()
+  x = GetX(youngh)
+  y = GetY(youngh)
+  return x < 3005 and y > StoppedGear(youngh) 
+end
+
+function DoPastMoleHead()
+  RemoveEventFunc(CheckOnMoleHead)
+  ropeCrate2 = SpawnUtilityCrate(2782, 1720, amRope)
+  AddAmmo(youngh, amRope, 0)
+  AddAnim(pastMoleHeadAnim)
+  AddEvent(CheckTookRope2, {}, DoTookRope2, {}, 0)
+end
+
+function DoOnMoleHead()
+  RemoveEventFunc(CheckPastMoleHead)
+  ropeCrate2 = SpawnUtilityCrate(2782, 1720, amRope)
+  AddAmmo(youngh, amRope, 0)
+  AddAnim(onMoleHeadAnim)
+  AddEvent(CheckTookRope2, {}, DoTookRope2, {}, 0)
+end
+
+function CheckTookRope2()
+  return rope2Taken and StoppedGear(youngh)
+end
+
+function DoTookRope2()
+  AddAmmo(youngh, amRope, 100)
+  AddAnim(tookRope2Anim)
+  punchCrate = SpawnAmmoCrate(2460, 1321, amFirePunch)
+  AddEvent(CheckTookPunch, {}, DoTookPunch, {})
+end
+
+function CheckTookPunch()
+  return punchTaken and StoppedGear(youngh)
+end
+
+function DoTookPunch()
+  AddAmmo(youngh, amFirePunch, 100)
+  AddAmmo(youngh, amRope, 0)
+  AddAnim(tookPunchAnim)
+  targets[1] = AddGear(1594, 1185, gtTarget, 0, 0, 0, 0)
+  targets[2] = AddGear(2188, 1314, gtTarget, 0, 0, 0, 0)
+  targets[3] = AddGear(1961, 1318, gtTarget, 0, 0, 0, 0)
+  targets[4] = AddGear(1961, 1200, gtTarget, 0, 0, 0, 0)
+  targets[5] = AddGear(1961, 1100, gtTarget, 0, 0, 0, 0)
+  AddEvent(CheckTargDestroyed, {}, DoTargDestroyed, {}, 0)
+end
+
+function CheckTargDestroyed()
+  return targetsDestroyed == 5 and StoppedGear(youngh)
+end
+
+function DoTargDestroyed()
+  AddAnim(challengeAnim)
+  targetsDestroyed = 0
+  AddFunction({func = SetChoice, args = {}})
+  ropeCrate3 = SpawnAmmoCrate(2000, 1200, amRope)
+  AddEvent(CheckTookRope3, {}, AddAmmo, {youngh, amRope, 100}, 0)
+  AddEvent(CheckCratesColled, {}, DoCratesColled, {}, 0)
+  AddEvent(CheckChallengeWon, {}, DoChallengeWon, {}, 0)
+  AddEvent(CheckTimesUp, {}, DoTimesUp, {}, 1)
+end
+
+function CheckChoice()
+  return difficulty ~= 0
+end
+
+function DoChoice()
+  difficultyChoice = false
+  SetInputMask(0xFFFFFFFF)
+  StartChallenge(120000 + chalTries * 20000)
+end
+
+function CheckCratesColled()
+  return cratesCollected == crateNum[difficulty]
+end
+
+function DoCratesColled()
+  RemoveEventFunc(CheckTimesUp)
+  TurnTimeLeft = -1
+  AddCaption("As the challenge was completed, Leaks A Lot set foot on the ground...")
+end
+
+function CheckChallengeWon()
+  return cratesCollected == crateNum[difficulty] and StoppedGear(youngh)
+end
+
+function DoChallengeWon()
+  desertCrate = SpawnAmmoCrate(1240, 1212, amDEagle)
+  AddAnim(challengeCompletedAnim)
+  AddEvent(CheckDesertColled, {}, DoDesertColled, {}, 0)
+end
+
+function CheckTookRope3()
+  return rope3Taken
+end
+
+function CheckTimesUp()
+  return TurnTimeLeft == 100
+end
+
+function DoTimesUp()
+  challengeFailed = true
+  DeleteGear(crates[1])
+  TurnTimeLeft = -1
+  AddCaption("And so happenned that Leaks A Lot failed to complete the challenge! He landed, pressured by shame...")
+  AddEvent(CheckChallengeFailed, {}, DoChallengeFailed, {}, 0)
+end
+
+function CheckChallengeFailed()
+  return challengeFailed and StoppedGear(youngh)
+end
+
+function DoChallengeFailed()
+  challengeFailed = false
+  AddAnim(challengeFailedAnim)
+  chalTries = chalTries + 1
+  difficulty = 0
+  AddFunction({func = SetChoice, args = {}})
+end
+
+function CheckDesertColled()
+  return desertTaken and StoppedGear(youngh)
+end
+
+function DoDesertColled()
+  AddAmmo(youngh, amDEagle, 100)
+  PutTargets(1)
+  AddEvent(CheckTargetsKilled, {}, DoTargetsKilled, {}, 1)
+  AddEvent(CheckCannibalKilled, {}, DoCannibalKilledEarly, {}, 0)
+  ShowMission("First Blood", "The Bull's Eye", "[Up], [Down] to aim, [Space] to shoot!", 1, 5000)
+end
+
+function CheckTargetsKilled()
+  return targetsDestroyed == 3 and StoppedGear(youngh)
+end
+
+function DoTargetsKilled()
+  targetsDestroyed = 0
+  targsWave = targsWave + 1
+  if targsWave > 5 then
+    RemoveEventFunc(CheckTargetsKilled)
+    SetState(cannibal, gstVisible)
+    cannibalVisible = true
+    AddAnim(beforeKillAnim)
+    AddEvent(CheckCloseToCannibal, {}, DoCloseToCannibal, {}, 0)
+    AddEvent(CheckCannibalKilled, {}, DoCannibalKilled, {}, 0)
+  else
+    PutTargets(targsWave)
+  end
+end
+
+function CheckCloseToCannibal()
+  if CheckCannibalKilled() then
+    return false
+  end
+  return math.abs(GetX(cannibal) - GetX(youngh)) <= 400 and StoppedGear(youngh)
+end
+
+function DoCloseToCannibal()
+  AddAnim(closeCannim)
+  AddFunction({func = SpawnAmmoCrate, args = {targetPosX[1][1], targetPosY[1][1], amWhip}})
+  AddFunction({func = SpawnAmmoCrate, args = {targetPosX[1][2], targetPosY[1][2], amBaseballBat}})
+  AddFunction({func = SpawnAmmoCrate, args = {targetPosX[1][3], targetPosY[1][3], amHammer}})
+end
+
+function CheckCannibalKilled()
+  return cannibalKilled and StoppedGear(youngh)
+end
+
+function DoCannibalKilled()
+  AddAnim(cannKilledAnim)
+  SaveCampaignVar("Progress", "1")
+end
+
+function DoCannibalKilledEarly()
+  AddAnim(cannKilledEarlyAnim)
+  DoCannibalKilled()
+end
+
+-----------------------------Misc--------------------------------------
+function StartChallenge(time)
+  cratesCollected = 0
+  PutCrate(1)
+  TurnTimeLeft = time
+  ShowMission("First Blood", "The Crate Frenzy", "Collect the crates within the time limit!|If you fail, you'll have to try again.", 1, 5000) 
+end
+
+function SetChoice()
+  SetInputMask(band(0xFFFFFFFF, bnot(gmAnimate+gmAttack+gmDown+gmHJump+gmLJump+gmSlot+gmSwitch+gmTimer+gmUp+gmWeapon)))
+  difficultyChoice = true
+  ShowMission("First Blood", "The Torment", "Select difficulty: [Left] - easier or [Right] - harder", 0, 4000)
+  AddEvent(CheckChoice, {}, DoChoice, {}, 0) 
+end
+
+function SetTime(time)
+  TurnTimeLeft = time
+end
+
+function ResetTurnTime()
+  TurnTimeLeft = tTime
+  tTime = -1
+end
+
+function PutCrate(i)
+  if i > crateNum[difficulty] then
+    return
+  end
+  if difficulty == 1 then
+    crates[1] = SpawnAmmoCrate(targXdif1[i], targYdif1[i], amRope)
+  else
+    crates[1] = SpawnAmmoCrate(targXdif2[i], targYdif2[i], amRope)
+  end
+end
+
+function PutTargets(i)
+  targets[1] = AddGear(targetPosX[i][1], targetPosY[i][1], gtTarget, 0, 0, 0, 0)
+  targets[2] = AddGear(targetPosX[i][2], targetPosY[i][2], gtTarget, 0, 0, 0, 0)
+  targets[3] = AddGear(targetPosX[i][3], targetPosY[i][3], gtTarget, 0, 0, 0, 0)
+end
+
+function FinishThem()
+  SetHealth(elderh, 0)
+  SetHealth(youngh, 0)
+  SetHealth(princess, 0)
+end
+-----------------------------Main Functions----------------------------
+
+function onGameInit()
+	Seed = 69 
+	GameFlags = gfInfAttack + gfSolidLand + gfDisableWind 
+	TurnTime = 100000 
+	CaseFreq = 0
+	MinesNum = 0
+	MinesTime = 3000
+	Explosives = 0
+	Delay = 10 
+	MapGen = 0
+	Theme = "Nature"
+
+
+	AddTeam("Natives", 1117585, "Bone", "Island", "HillBilly", "cm_birdy")
+	youngh = AddHog("Leaks A Lot", 0, 100, "Rambo")
+  elderh = AddHog("White Raven", 0, 99, "IndianChief")
+  princess = AddHog("Fell From Heaven", 0, 300, "tiara")
+  SetGearPosition(princess, 1911, 1361)
+  HogTurnLeft(princess, true)
+  SetGearPosition(elderh, 2667, 1208)
+  HogTurnLeft(elderh, true)
+  SetGearPosition(youngh, 1862, 1362)
+  HogTurnLeft(youngh, false)
+
+  AddTeam("Cannibals", 14483456, "Skull", "Island", "Pirate","cm_vampire")
+  cannibal = AddHog("Brainiac", 0, 5, "Zombi")
+  SetGearPosition(cannibal, 525, 1256)
+  HogTurnLeft(cannibal, false)
+  
+  AnimInit()
+  AnimationSetup()
+end
+
+function onGameStart()
+  TurnTimeLeft = -1
+  FollowGear(youngh)
+	ShowMission("A Classic Fairytale", "First Blood", "Finish your training|Hint: Animations can be skipped with the [Precise] key.", -amSkip, 0)
+  SetState(cannibal, gstInvisible)
+
+  AddAnim(startDialogue)
+  AddEvent(CheckDamage, {}, DoOnDamage, {}, 1)
+  AddEvent(CheckDeath, {}, DoDeath, {}, 0)
+  AddEvent(CheckDamagedOthers, {}, DoOnDamagedOthers, {}, 1)
+  AddEvent(CheckKilledOthers, {}, DoKilledOthers, {}, 0)
+  AddEvent(CheckMovedUntilJump, {}, DoMovedUntilJump, {}, 0)
+end
+
+function onGameTick()
+  AnimUnWait()
+  if ShowAnimation() == false then
+    return
+  end
+  ExecuteAfterAnimations()
+  CheckEvents()
+end
+
+function onGearDelete(gear)
+  if gear == ropeCrate1 then
+    rope1Taken = true
+  elseif gear == paraCrate then
+    paraTaken = true
+  elseif gear == ropeCrate2 then
+    rope2Taken = true
+  elseif gear == ropeCrate3 then
+    rope3Taken = true
+  elseif gear == crates[1] and challengeFailed == false then
+    crates[1] = nil
+    cratesCollected = cratesCollected + 1
+    PutCrate(cratesCollected + 1)
+  elseif gear == punchCrate then
+    punchTaken = true
+  elseif gear == desertCrate then
+    desertTaken = true
+  elseif GetGearType(gear) == gtTarget then
+    i = 1
+    while targets[i] ~= gear do
+      i = i + 1
+    end
+    targets[i] = nil
+    targetsDestroyed = targetsDestroyed + 1 
+  elseif gear == cannibal then
+    cannibalKilled = true
+  elseif gear == princess then
+    princessKilled = true
+  elseif gear == elderh then
+    elderKilled = true
+  elseif gear == youngh then
+    youngKilled = true
+  end
+end
+
+function onGearAdd(gear)
+end
+
+function onAmmoStoreInit()
+  SetAmmo(amWhip, 0, 0, 0, 8)
+  SetAmmo(amBaseballBat, 0, 0, 0, 8)
+  SetAmmo(amHammer, 0, 0, 0, 8)
+end
+
+function onNewTurn()
+  if CurrentHedgehog == cannibal and cannibalVisible == false then
+    SetState(cannibal, gstInvisible)
+  end
+  SwitchHog(youngh)
+  FollowGear(youngh)
+  TurnTimeLeft = -1
+end
+
+function onGearDamage(gear, damage)
+  if gear == youngh then
+    youngdamaged = true
+    tTime = TurnTimeLeft
+  elseif gear == princess then
+    princessDamaged = true
+    tTime = TurnTimeLeft
+  elseif gear == elderh then
+    elderDamaged = true
+    tTime = TurnTimeLeft
+  elseif gear == cannibal then
+    cannibalVisible = true
+    cannibalDamaged = true
+    SetState(cannibal, 0)
+  end
+end
+
+function onPrecise()
+  if GameTime > 2000 then
+    SetAnimSkip(true)
+  end
+end
+
+function onLeft()
+  if difficultyChoice == true then
+    difficulty = 1
+  end
+end
+
+function onRight()
+  if difficultyChoice == true then
+    difficulty = 2
+  end
+end
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/shadow.lua	Mon Jun 25 11:16:24 2012 +0300
@@ -0,0 +1,891 @@
+loadfile(GetDataPath() .. "Scripts/Animate.lua")()
+
+-----------------------------Constants---------------------------------
+startStage = 0
+spyStage = 1
+wave1Stage = 2
+wave2Stage = 3
+cyborgStage = 4
+ramonStage = 5
+aloneStage = 6
+duoStage = 7
+interSpyStage = 8
+interWeakStage = 9
+acceptedReturnStage = 10
+refusedReturnStage = 11
+attackedReturnStage = 12
+loseStage = 13
+
+ourTeam = 0
+weakTeam = 1
+strongTeam = 2
+cyborgTeam = 3
+
+leaksNr = 0
+denseNr = 1
+
+choiceAccept = 1
+choiceRefuse = 2
+choiceAttack = 3
+
+HogNames = {"Brainiac", "Corpsemonger", "Femur Lover", "Glark", "Bonely", "Rot Molester", "Bloodrocutor", "Muscle Dissolver", "Bloodsucker"}
+
+---POSITIONS---
+
+cannibalPos = {{3108, 1127}, 
+               {2559, 1080}, {3598, 1270}, {3293, 1177}, {2623, 1336}, 
+               {3418, 1336}, {3447, 1335}, {3481, 1340}, {3507, 1324}} 
+densePos = {2776, 1177}
+leaksPos = {2941, 1172}
+cyborgPos = {1113, 1818}
+
+---Animations
+
+startDialogue = {}
+weaklingsAnim = {}
+stronglingsAnim = {}
+acceptedAnim = {}
+acceptedSurvivedFinalAnim = {}
+acceptedDiedFinalAnim = {}
+refusedAnim = {}
+refusedFinalAnim = {}
+attackedAnim = {}
+attackedFinalAnim = {}
+
+-----------------------------Variables---------------------------------
+lastHogTeam = ourTeam
+lastOurHog = leaksNr
+lastEnemyHog = 0
+stage = 0
+choice = 0
+
+brainiacDead = false
+cyborgHidden = false
+leaksHidden = false
+denseHidden = false
+cyborgAttacked = false
+retryReturn = false
+shotgunTaken = false
+grenadeTaken = false
+spikyDead = false
+ramonDead = false
+denseDead = false
+leaksDead = false
+ramonHidden = false
+spikyHidden = false
+
+
+hogNr = {}
+cannibalDead = {}
+isHidden = {}
+
+
+--------------------------Anim skip functions--------------------------
+function AfterRefusedAnim()
+  SpawnUtilityCrate(2045, 1575, amSwitch)
+  SpawnUtilityCrate(2365, 1495, amShotgun)
+  SpawnUtilityCrate(2495, 1519, amGrenade)
+  SpawnUtilityCrate(2620, 1524, amRope)
+  ShowMission("The Shadow Falls", "The Showdown", "Save Leaks A Lot!|Hint: The Switch utility might be of help to you.", 1, 6000)
+  RemoveEventFunc(CheckDenseDead)
+  AddEvent(CheckStronglingsDead, {}, DoStronglingsDeadRefused, {}, 0)
+  AddAmmo(cannibals[6], amGrenade, 5)
+  stage = ramonStage
+  SwitchHog(cannibals[9])
+  FollowGear(ramon)
+  TurnTimeLeft = 0
+  SetGearMessage(ramon, 0)
+  HideHog(cyborg)
+  cyborgHidden = true
+  SetGearMessage(leaks, 0)
+end
+
+function SkipRefusedAnim()
+  RefusedStart()
+  SetGearPosition(dense, 2645, 1146)
+  SetGearPosition(ramon, 2218, 1675)
+  SetGearPosition(spiky, 2400, 1675)
+end
+
+function AfterStartDialogue()
+  stage = spyStage
+  ShowMission("The Shadow Falls", "Play with me!", "Defend yourself!|Hint: You can get tips on using weapons by moving your mouse over them in the weapon selection menu", 1, 6000)
+  TurnTimeLeft = TurnTime
+end
+
+
+function StartSkipFunc()
+  SetState(cannibals[1], 0)
+  AnimTurn(leaks, "Right")
+  AnimSwitchHog(leaks)
+  SetInputMask(0xFFFFFFFF)
+end
+
+function AfterWeaklingsAnim()
+  AddAmmo(cannibals[2], amShotgun, 4)
+  AddAmmo(cannibals[2], amGrenade, 3)
+  AddAmmo(leaks, amSkip, 4)
+  AddEvent(CheckWeaklingsKilled, {}, DoWeaklingsKilled, {}, 0)
+  SetHealth(SpawnHealthCrate(2757, 1030), 50)
+  SetHealth(SpawnHealthCrate(2899, 1009), 50)
+  stage = wave1Stage
+  SwitchHog(dense)
+  SetGearMessage(dense, 0)
+  SetGearMessage(leaks, 0)
+  TurnTimeLeft = TurnTime
+  ShowMission("The Shadow Falls", "Why do you not like me?", "Obliterate them!|Hint: You might want to take cover...", 1, 6000)
+end
+
+function SkipWeaklingsAnim()
+  for i = 2, 5 do
+    if isHidden[cannibals[i]] == true then
+      RestoreHog(cannibals[i])
+      isHidden[cannibals[i]] = false
+    end
+    SetGearPosition(cannibals[i], unpack(cannibalPos[i]))
+    SetState(cannibals[i], 0)
+  end
+  SetInputMask(0xFFFFFFFF)
+end
+
+function AfterStronglingsAnim()
+  stage = cyborgStage
+  TurnTimeLeft = 0
+  ShowMission("The Shadow Falls", "The Dilemma", "Choose your side! If you want to join the strange man, walk up to him.|Otherwise, walk away from him. If you decide to att...nevermind...", 1, 8000)
+  AddEvent(CheckChoice, {}, DoChoice, {}, 0)
+  AddEvent(CheckRefuse, {}, DoRefuse, {}, 0)
+  AddEvent(CheckAccept, {}, DoAccept, {}, 0)
+  AddEvent(CheckConfront, {}, DoConfront, {}, 0)
+  AddAmmo(dense, amSwitch, 0)
+  AddAmmo(dense, amSkip, 0)
+  SetHealth(SpawnHealthCrate(2557, 1030), 50)
+  SetHealth(SpawnHealthCrate(3599, 1009), 50)
+end
+
+function SkipStronglingsAnim()
+  for i = 6, 9 do
+    if isHidden[cannibals[i]] == true then
+      RestoreHog(cannibals[i])
+      isHidden[cannibals[i]] = false
+    end
+    SetGearPosition(cannibals[i], unpack(cannibalPos[i]))
+    SetState(cannibals[i], 0)
+  end
+  if cyborgHidden == true then
+    RestoreHog(cyborg)
+    cyborgHidden = false
+  end
+  SetState(cyborg, 0)
+  SetState(dense, 0)
+  SetGearPosition(dense, 1350, 1310)
+  FollowGear(dense)
+  HogTurnLeft(dense, true)
+  SetGearPosition(cyborg, 1250, 1310)
+  SwitchHog(dense)
+  SetInputMask(0xFFFFFFFF)
+end
+
+function RestartReturnAccepted()
+  retryReturn = false
+  SetGearPosition(dense, 1350, 1310)
+  AddAmmo(dense, amGirder, 2)
+  AddAmmo(dense, amParachute, 2)
+  ShowMission("The Shadow Falls", "The walk of Fame", "Return to Leaks A Lot! If you get stuck, press [Precise] to try again!", 1, 6000)
+  RemoveEventFunc(CheckNeedGirder)
+  RemoveEventFunc(CheckNeedWeapons)
+  AddEvent(CheckNeedGirder, {}, DoNeedGirder, {}, 0)
+  AddEvent(CheckNeedWeapons, {}, DoNeedWeapons, {}, 0)
+end
+
+
+function AfterAcceptedAnim()
+  stage = acceptedReturnStage
+  SpawnAmmoCrate(1300, 810, amGirder)
+  SpawnAmmoCrate(1300, 810 - 60, amParachute)
+  ShowMission("The Shadow Falls", "The walk of Fame", "Return to Leaks A Lot! If you get stuck, press [Precise] to try again!", 1, 6000)
+  HideHog(cyborg)
+  AddEvent(CheckTookWeapons, {}, DoTookWeapons, {}, 0)
+  AddEvent(CheckNeedGirder, {}, DoNeedGirder, {}, 0)
+  AddEvent(CheckNeedWeapons, {}, DoNeedWeapons, {}, 0)
+  AddEvent(CheckRestartReturnAccepted, {}, RestartReturnAccepted, {}, 1)
+  RemoveEventFunc(CheckDenseDead)
+end
+
+function SkipAcceptedAnim()
+  SetGearPosition(cyborg, unpack(cyborgPos))
+  SetState(cyborg, gstInvisible)
+  AnimSwitchHog(dense)
+  SetInputMask(0xFFFFFFFF)
+end
+
+function AfterAttackedAnim()
+  stage = aloneStage
+  HideHog(cyborg)
+  ShowMission("The Shadow Falls", "The Individualist", "Defeat the cannibals!|Grenade hint: set the timer with [1-5], aim with [Up]/[Down] and hold [Space] to set power", 1, 8000)
+  SpawnAmmoCrate(2551, 994, amGrenade)
+  SpawnAmmoCrate(3551, 994, amGrenade)
+  SpawnAmmoCrate(3392, 1101, amShotgun)
+  SpawnAmmoCrate(3192, 1101, amShotgun)
+  AddAmmo(cannibals[6], amGrenade, 5)
+  SetGearMessage(leaks, 0)
+  TurnTimeLeft = TurnTime
+  AddEvent(CheckStronglingsDead, {}, DoStronglingsDeadAttacked, {}, 0)
+end
+
+function SkipAttackedAnim()
+  if denseDead == false then
+    SetHealth(dense)
+  end
+  SetGearPosition(cyborg, unpack(cyborgPos))
+  SetState(cyborg, gstInvisible)
+  AnimSwitchHog(leaks)
+  SetInputMask(0xFFFFFFFF)
+end
+
+  
+-----------------------------Animations--------------------------------
+
+function EmitDenseClouds(anim, dir)
+  local dif
+  if dir == "left" then 
+    dif = 10
+  else
+    dif = -10
+  end
+  AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + dif, GetY(dense) + dif, vgtSteam, 0, true}, swh = false})
+  AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + dif, GetY(dense) + dif, vgtSteam, 0, true}, swh = false})
+  AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + dif, GetY(dense) + dif, vgtSteam, 0, true}, swh = false})
+  AnimInsertStepNext({func = AnimWait, args = {dense, 800}})
+  AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + dif, GetY(dense) + dif, vgtSteam, 0, true}, swh = false})
+  AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + dif, GetY(dense) + dif, vgtSteam, 0, true}, swh = false})
+  AnimInsertStepNext({func = AnimWait, args = {dense, 800}})
+  AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + dif, GetY(dense) + dif, vgtSteam, 0, true}, swh = false})
+end
+
+function BlowDenseCloud()
+  AnimInsertStepNext({func = DeleteGear, args = {dense}, swh = false}) 
+  AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense), GetY(dense), vgtBigExplosion, 0, true}, swh = false})
+  AnimInsertStepNext({func = AnimWait, args = {dense, 1200}})
+  AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + 20, GetY(dense), vgtExplosion, 0, true}, swh = false})
+  AnimInsertStepNext({func = AnimWait, args = {dense, 100}})
+  AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + 10, GetY(dense), vgtExplosion, 0, true}, swh = false})
+  AnimInsertStepNext({func = AnimWait, args = {dense, 100}})
+  AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) - 10, GetY(dense), vgtExplosion, 0, true}, swh = false})
+  AnimInsertStepNext({func = AnimWait, args = {dense, 100}})
+  AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) - 20, GetY(dense), vgtExplosion, 0, true}, swh = false})
+end
+
+function AnimationSetup()
+  table.insert(startDialogue, {func = AnimWait, args = {dense, 4000}})
+  table.insert(startDialogue, {func = AnimCaption, args = {leaks, "After the shock caused by the enemy spy, Leaks A Lot and Dense Cloud went hunting to relax.", 6000}})
+  table.insert(startDialogue, {func = AnimCaption, args = {leaks, "Little did they know that this hunt will mark them forever...", 4000}})
+  table.insert(startDialogue, {func = AnimSay, args = {leaks, "I have no idea where that mole disappeared...Can you see it?", SAY_SAY, 9000}})
+  table.insert(startDialogue, {func = AnimSay, args = {dense, "Nope. It was one fast mole, that's for sure.", SAY_SAY, 5000}}) 
+  table.insert(startDialogue, {func = AnimCustomFunction, args = {dense, EmitDenseClouds, {startDialogue, "right"}}})
+  table.insert(startDialogue, {func = AnimWait, args = {dense, 2000}})
+  table.insert(startDialogue, {func = AnimSay, args = {leaks, "Please, stop releasing your \"smoke signals\"!", SAY_SAY, 5000}})
+  table.insert(startDialogue, {func = AnimSay, args = {leaks, "You're terrorizing the forest...We won't catch anything like this!", SAY_SAY, 6000}})
+  table.insert(startDialogue, {func = AnimSay, args = {leaks, "...", SAY_THINK, 1000}})
+  table.insert(startDialogue, {func = AnimGiveState, args = {cannibals[1], 0}, swh = false})
+  table.insert(startDialogue, {func = AnimOutOfNowhere, args = {cannibals[1], unpack(cannibalPos[1])}, swh = false})
+  table.insert(startDialogue, {func = AnimTurn, args = {leaks, "Right"}})
+  table.insert(startDialogue, {func = AnimTurn, args = {cannibals[1], "Right"}})
+  table.insert(startDialogue, {func = AnimWait, args = {cannibals[1], 1000}})
+  table.insert(startDialogue, {func = AnimTurn, args = {cannibals[1], "Left"}})
+  table.insert(startDialogue, {func = AnimWait, args = {cannibals[1], 1000}})
+  table.insert(startDialogue, {func = AnimTurn, args = {cannibals[1], "Right"}})
+  table.insert(startDialogue, {func = AnimSay, args = {cannibals[1], "I can't believe it worked!", SAY_THINK, 3500}})
+  table.insert(startDialogue, {func = AnimSay, args = {cannibals[1], "That shaman sure knows what he/she's doing!", SAY_THINK, 6000}})
+  table.insert(startDialogue, {func = AnimSay, args = {leaks, "It wants our brains!", SAY_SHOUT, 3000}})
+  table.insert(startDialogue, {func = AnimTurn, args = {cannibals[1], "Left"}})
+  table.insert(startDialogue, {func = AnimSay, args = {cannibals[1], "Not you again! My head still hurts from last time!", SAY_SHOUT, 6000}})
+  table.insert(startDialogue, {func = AnimSwitchHog, args = {leaks}})
+  AddSkipFunction(startDialogue, StartSkipFunc, {})
+
+  table.insert(weaklingsAnim, {func = AnimGearWait, args = {leaks, 1000}})
+  table.insert(weaklingsAnim, {func = AnimCustomFunction, args = {leaks, UnHideWeaklings, {}}})
+  table.insert(weaklingsAnim, {func = AnimCustomFunction, args = {leaks, CondNeedToTurn, {leaks, dense}}})
+  table.insert(weaklingsAnim, {func = AnimSay, args = {leaks, "Did you see him coming?", SAY_SAY, 3500}})
+  table.insert(weaklingsAnim, {func = AnimSay, args = {dense, "No. Where did he come from?", SAY_SAY, 3500}})
+  table.insert(weaklingsAnim, {func = AnimOutOfNowhere, args = {cannibals[2], unpack(cannibalPos[2])}})
+  table.insert(weaklingsAnim, {func = AnimGiveState, args = {cannibals[2], 0}})
+  table.insert(weaklingsAnim, {func = AnimWait, args = {leaks, 400}})
+  table.insert(weaklingsAnim, {func = AnimGiveState, args = {cannibals[3], 0}})
+  table.insert(weaklingsAnim, {func = AnimOutOfNowhere, args = {cannibals[3], unpack(cannibalPos[3])}})
+  table.insert(weaklingsAnim, {func = AnimWait, args = {leaks, 400}})
+  table.insert(weaklingsAnim, {func = AnimGiveState, args = {cannibals[4], 0}})
+  table.insert(weaklingsAnim, {func = AnimOutOfNowhere, args = {cannibals[4], unpack(cannibalPos[4])}})
+  table.insert(weaklingsAnim, {func = AnimWait, args = {leaks, 400}})
+  table.insert(weaklingsAnim, {func = AnimGiveState, args = {cannibals[5], 0}})
+  table.insert(weaklingsAnim, {func = AnimOutOfNowhere, args = {cannibals[5], unpack(cannibalPos[5])}})
+  table.insert(weaklingsAnim, {func = AnimWait, args = {leaks, 400}})
+  table.insert(weaklingsAnim, {func = AnimSay, args = {cannibals[3], "Are we there yet?", SAY_SAY, 4000}}) 
+  table.insert(weaklingsAnim, {func = AnimSay, args = {dense, "This must be some kind of sorcery!", SAY_SHOUT, 3500}})
+  table.insert(weaklingsAnim, {func = AnimSwitchHog, args = {leaks}})
+  AddSkipFunction(weaklingsAnim, SkipWeaklingsAnim, {})
+
+  table.insert(stronglingsAnim, {func = AnimGearWait, args = {leaks, 1000}})
+  table.insert(stronglingsAnim, {func = AnimCustomFunction, args = {leaks, UnHideStronglings, {}}})
+  table.insert(stronglingsAnim, {func = AnimCustomFunction, args = {leaks, CondNeedToTurn, {leaks, dense}}})
+  table.insert(stronglingsAnim, {func = AnimGiveState, args = {leaks, 0}})
+  table.insert(stronglingsAnim, {func = AnimGiveState, args = {dense, 0}})
+  table.insert(stronglingsAnim, {func = AnimSay, args = {leaks, "I thought their shaman died when he tried our medicine!", SAY_SAY, 7000}})
+  table.insert(stronglingsAnim, {func = AnimSay, args = {dense, "I saw it with my own eyes!", SAY_SAY, 4000}})
+  table.insert(stronglingsAnim, {func = AnimSay, args = {leaks, "Then how do they keep appearing?", SAY_SAY, 4000}})
+  table.insert(stronglingsAnim, {func = AnimSay, args = {leaks, "It's impossible to communicate with the spirits without a shaman.", SAY_SAY, 7000}})
+  table.insert(stronglingsAnim, {func = AnimSay, args = {dense, "We need to warn the village.", SAY_SAY, 3500}})
+  table.insert(stronglingsAnim, {func = AnimGiveState, args = {cannibals[6], 0}})
+  table.insert(stronglingsAnim, {func = AnimOutOfNowhere, args = {cannibals[6], unpack(cannibalPos[6])}})
+  table.insert(stronglingsAnim, {func = AnimWait, args = {leaks, 400}})
+  table.insert(stronglingsAnim, {func = AnimGiveState, args = {cannibals[7], 0}})
+  table.insert(stronglingsAnim, {func = AnimOutOfNowhere, args = {cannibals[7], unpack(cannibalPos[7])}})
+  table.insert(stronglingsAnim, {func = AnimWait, args = {leaks, 400}})
+  table.insert(stronglingsAnim, {func = AnimGiveState, args = {cannibals[8], 0}})
+  table.insert(stronglingsAnim, {func = AnimOutOfNowhere, args = {cannibals[8], unpack(cannibalPos[8])}})
+  table.insert(stronglingsAnim, {func = AnimWait, args = {leaks, 400}})
+  table.insert(stronglingsAnim, {func = AnimGiveState, args = {cannibals[9], 0}})
+  table.insert(stronglingsAnim, {func = AnimOutOfNowhere, args = {cannibals[9], unpack(cannibalPos[9])}})
+  table.insert(stronglingsAnim, {func = AnimWait, args = {leaks, 400}})
+  table.insert(stronglingsAnim, {func = AnimSay, args = {cannibals[7], "What a ride!", SAY_SHOUT, 2000}})
+  table.insert(stronglingsAnim, {func = AnimTurn, args = {leaks, "Right"}})
+  table.insert(stronglingsAnim, {func = AnimWait, args = {leaks, 700}})
+  table.insert(stronglingsAnim, {func = AnimTurn, args = {leaks, "Left"}})
+  table.insert(stronglingsAnim, {func = AnimSay, args = {leaks, "We can't defeat them!", SAY_THINK, 3000}})
+  table.insert(stronglingsAnim, {func = AnimSay, args = {leaks, "I'll hold them up while you return to the village!", SAY_SAY, 6000}})
+  table.insert(stronglingsAnim, {func = AnimFollowGear, args = {cyborg}, swh = false})
+  table.insert(stronglingsAnim, {func = AnimWait, args = {cyborg, 1000}})
+  table.insert(stronglingsAnim, {func = AnimSetGearPosition, args = {dense, 1420, 1315}})
+  table.insert(stronglingsAnim, {func = AnimMove, args = {dense, "left", 1400, 0}})
+  table.insert(stronglingsAnim, {func = AnimCustomFunction, args = {dense, EmitDenseClouds, {stronglingsAnim, "left"}}})
+  table.insert(stronglingsAnim, {func = AnimMove, args = {dense, "left", 1350, 0}})
+  table.insert(stronglingsAnim, {func = AnimOutOfNowhere, args = {cyborg, 1250, 1320}})
+  table.insert(stronglingsAnim, {func = AnimRemoveState, args = {cyborg, gstInvisible}})
+  table.insert(stronglingsAnim, {func = AnimGearWait, args = {cyborg, 2000}})
+  table.insert(stronglingsAnim, {func = AnimSay, args = {cyborg, "Greetings, cloudy one!", SAY_SAY, 3000}})
+  table.insert(stronglingsAnim, {func = AnimSay, args = {cyborg, "I have come to make you an offering...", SAY_SAY, 6000}})
+  table.insert(stronglingsAnim, {func = AnimSay, args = {cyborg, "You are given the chance to turn your life around...", SAY_SAY, 6000}})
+  table.insert(stronglingsAnim, {func = AnimSay, args = {cyborg, "If you agree to provide the information we need, you will be spared!", SAY_SAY, 7000}})
+  table.insert(stronglingsAnim, {func = AnimSay, args = {cyborg, "Have no illusions, your tribe is dead, indifferent of your choice.", SAY_SAY, 7000}})
+  table.insert(stronglingsAnim, {func = AnimSay, args = {cyborg, "If you decide to help us, though, we will no longer need to find a new governor for the island.", SAY_SAY, 8000}})
+  table.insert(stronglingsAnim, {func = AnimSay, args = {cyborg, "If you know what I mean...", SAY_SAY, 3000}})
+  table.insert(stronglingsAnim, {func = AnimSay, args = {cyborg, "So? What will it be?", SAY_SAY, 3000}})
+  table.insert(stronglingsAnim, {func = AnimSwitchHog, args = {dense}})
+  AddSkipFunction(stronglingsAnim, SkipStronglingsAnim, {})
+
+  table.insert(acceptedAnim, {func = AnimSay, args = {cyborg, "Great choice, Steve! Mind if I call you that?", SAY_SAY, 7000}})
+  table.insert(acceptedAnim, {func = AnimSay, args = {dense, "Whatever floats your boat...", SAY_SAY, 4500}})
+  table.insert(acceptedAnim, {func = AnimSay, args = {cyborg, "Great! You will be contacted soon for assistance.", SAY_SAY, 6000}})
+  table.insert(acceptedAnim, {func = AnimSay, args = {cyborg, "In the meantime, take these and return to your \"friend\"!", SAY_SAY, 6000}})
+  table.insert(acceptedAnim, {func = AnimGiveState, args = {cyborg, gstInvisible}})
+  table.insert(acceptedAnim, {func = AnimDisappear, args = {cyborg, unpack(cyborgPos)}})
+  table.insert(acceptedAnim, {func = AnimSwitchHog, args = {dense}})
+  AddSkipFunction(acceptedAnim, SkipAcceptedAnim, {}) 
+
+  table.insert(acceptedSurvivedFinalAnim, {func = AnimCustomFunction, args = {dense, CondNeedToTurn, {leaks, dense}}})
+  table.insert(acceptedSurvivedFinalAnim, {func = AnimSay, args = {leaks, "Pfew! That was close!", SAY_SAY, 3000}})
+  table.insert(acceptedSurvivedFinalAnim, {func = AnimSay, args = {leaks, "Where did you get the exploding apples and the magic bow that shoots many arrows?", SAY_SAY, 9000}})
+  table.insert(acceptedSurvivedFinalAnim, {func = AnimSay, args = {dense, "Uhm...I met one of them and took his weapons.", SAY_SAY, 5000}})
+  table.insert(acceptedSurvivedFinalAnim, {func = AnimSay, args = {dense, "We should head back to the village now.", SAY_SAY, 5000}})
+
+  table.insert(acceptedDiedFinalAnim, {func = AnimSay, args = {leaks, "Pfew! That was close!", SAY_THINK, 3000}})
+  table.insert(acceptedDiedFinalAnim, {func = AnimSay, args = {leaks, "Your death will not be in vain, Dense Cloud!", SAY_THINK, 5000}})
+  table.insert(acceptedDiedFinalAnim, {func = AnimSay, args = {dense, "You will be avenged!", SAY_SAY, 3000}})
+
+  table.insert(refusedAnim, {func = AnimSay, args = {cyborg, "I see...", SAY_SAY, 2000}})
+  table.insert(refusedAnim, {func = AnimSay, args = {cyborg, "Remember this, pathetic animal: when the day comes, you will regret your blind loyalty!", SAY_SAY, 8000}})
+  table.insert(refusedAnim, {func = AnimSay, args = {cyborg, "You just committed suicide...", SAY_SAY, 5000}})
+  table.insert(refusedAnim, {func = AnimDisappear, args = {cyborg, unpack(cyborgPos)}})
+  table.insert(refusedAnim, {func = AnimGiveState, args = {cyborg, gstInvisible}})
+  table.insert(refusedAnim, {func = AnimSay, args = {dense, "If you say so...", SAY_THINK, 3000}})
+  table.insert(refusedAnim, {func = AnimFollowGear, args = {cyborg}, swh = false})
+  table.insert(refusedAnim, {func = AnimWait, args = {cyborg, 700}})
+  table.insert(refusedAnim, {func = AnimCustomFunction, args = {dense, RefusedStart, {}}})
+  table.insert(refusedAnim, {func = AnimOutOfNowhere, args = {dense, 2645, 1146}})
+  table.insert(refusedAnim, {func = AnimOutOfNowhere, args = {ramon, 2218, 1675}})
+  table.insert(refusedAnim, {func = AnimOutOfNowhere, args = {spiky, 2400, 1675}})
+  table.insert(refusedAnim, {func = AnimTurn, args = {spiky, "left"}})
+  table.insert(refusedAnim, {func = AnimWait, args = {cyborg, 1700}})
+  table.insert(refusedAnim, {func = AnimTurn, args = {spiky, "right"}})
+  table.insert(refusedAnim, {func = AnimWait, args = {cyborg, 1700}})
+  table.insert(refusedAnim, {func = AnimTurn, args = {spiky, "left"}})
+  table.insert(refusedAnim, {func = AnimSay, args = {spiky, "Dude, we really need a new shaman...", SAY_SAY, 4000}})
+  AddSkipFunction(refusedAnim, SkipRefusedAnim, {})
+
+  table.insert(refusedFinalAnim, {func = AnimSay, args = {leaks, "It's over...", SAY_SAY, 2000}})
+  table.insert(refusedFinalAnim, {func = AnimSay, args = {leaks, "Let's head back to the village!", SAY_SAY, 4000}})
+
+  table.insert(attackedAnim, {func = AnimCustomFunction, args = {dense, CondNeedToTurn, {cyborg, dense}}})
+  table.insert(attackedAnim, {func = AnimCustomFunction, args = {cyborg, SetHealth, {cyborg, 200}}})
+  table.insert(attackedAnim, {func = AnimWait, args = {cyborg, 2000}})
+  table.insert(attackedAnim, {func = AnimSay, args = {cyborg, "Really?! You thought you could harm me with your little toys?", SAY_SAY, 7000}})
+  table.insert(attackedAnim, {func = AnimSay, args = {cyborg, "You're pathetic! You are not worthy of my attention...", SAY_SAY, 6000}})
+  table.insert(attackedAnim, {func = AnimSay, args = {cyborg, "Actually, you aren't worthy of life! Take this...", SAY_SAY, 5000}})
+  table.insert(attackedAnim, {func = AnimCustomFunction, args = {dense, BlowDenseCloud, {}}, swh = false})
+  table.insert(attackedAnim, {func = AnimWait, args = {cyborg, 2000}})
+  table.insert(attackedAnim, {func = AnimSay, args = {cyborg, "Incredible...", SAY_SAY, 3000}})
+  table.insert(attackedAnim, {func = AnimDisappear, args = {cyborg, unpack(cyborgPos)}})
+  table.insert(attackedAnim, {func = AnimGiveState, args = {cyborg, gstInvisible}})
+  table.insert(attackedAnim, {func = AnimSwitchHog, args = {leaks}})
+  table.insert(attackedAnim, {func = AnimSay, args = {leaks, "I wonder where Dense Cloud is...", SAY_THINK, 4000}})
+  table.insert(attackedAnim, {func = AnimSay, args = {leaks, "I can't wait any more, I have to save myself!", SAY_THINK, 5000}})
+  AddSkipFunction(attackedAnim, SkipAttackedAnim, {})
+  
+  table.insert(attackedFinalAnim, {func = AnimSay, args = {leaks, "I have to get back to the village!", SAY_THINK, 5000}})
+  table.insert(attackedFinalAnim, {func = AnimSay, args = {leaks, "Dense Cloud must have already told them everything...", SAY_THINK, 7000}})
+
+end
+
+
+-----------------------------Misc--------------------------------------
+
+
+function RefusedStart()
+  if ramonHidden == true then
+    RestoreHog(ramon)
+    ramonHidden = false
+  end
+  if spikyHidden == true then
+    RestoreHog(spiky)
+    spikyHidden = false
+  end
+  SetState(ramon, 0)
+  SetState(spiky, 0)
+  SetGearMessage(dense, 0)
+  SetGearMessage(ramon, 0)
+  SetGearMessage(spiky, 0)
+end
+
+function AddHogs()
+	AddTeam("Natives", 1117585, "Bone", "Island", "HillBilly", "cm_birdy")
+  ramon = AddHog("Ramon", 0, 100, "rasta")
+	leaks = AddHog("Leaks A Lot", 0, 100, "Rambo")
+  dense = AddHog("Dense Cloud", 0, 100, "RobinHood")
+  spiky = AddHog("Spiky Cheese", 0, 100, "hair_yellow")
+
+  AddTeam("Weaklings", 14483456, "Skull", "Island", "Pirate","cm_vampire")
+  cannibals = {}
+  cannibals[1] = AddHog("Brainiac", 5, 20, "Zombi")
+
+  for i = 2, 5 do
+    cannibals[i] = AddHog(HogNames[i], 1, 20, "Zombi")
+    hogNr[cannibals[i]] = i - 2
+  end
+
+  AddTeam("Stronglings", 14483456, "Skull", "Island", "Pirate","cm_vampire")
+
+  for i = 6, 9 do
+    cannibals[i] = AddHog(HogNames[i], 2, 30, "vampirichog")
+    hogNr[cannibals[i]] = i - 2
+  end
+
+  AddTeam("011101001", 14483456, "ring", "UFO", "Robot", "cm_star")
+  cyborg = AddHog("Y3K1337", 0, 200, "cyborg1")
+end
+
+function PlaceHogs()
+  HogTurnLeft(leaks, true)
+
+  for i = 2, 9 do
+    SetGearPosition(cannibals[i], unpack(cyborgPos))
+    AnimTurn(cannibals[i], "left")
+    cannibalDead[i] = false
+  end
+
+  SetGearPosition(cannibals[1], cannibalPos[1][1], cannibalPos[1][2])
+  AnimTurn(cannibals[1], "left")
+
+  SetGearPosition(cyborg, cyborgPos[1], cyborgPos[2])
+  SetGearPosition(ramon, 2218, 1675)
+  SetGearPosition(skiky, 2400, 1675)
+  SetGearPosition(dense, densePos[1], densePos[2])
+  SetGearPosition(leaks, leaksPos[1], leaksPos[2]) 
+end
+
+function VisiblizeHogs()
+  for i = 1, 9 do
+    SetState(cannibals[i], gstInvisible)
+  end
+  SetState(cyborg, gstInvisible)
+  SetState(ramon, gstInvisible)
+  SetState(spiky, gstInvisible)
+end
+
+function CondNeedToTurn(hog1, hog2)
+  xl, xd = GetX(hog1), GetX(hog2)
+  if xl > xd then
+    AnimInsertStepNext({func = AnimTurn, args = {hog1, "Left"}})
+    AnimInsertStepNext({func = AnimTurn, args = {hog2, "Right"}})
+  elseif xl < xd then
+    AnimInsertStepNext({func = AnimTurn, args = {hog2, "Left"}})
+    AnimInsertStepNext({func = AnimTurn, args = {hog1, "Right"}})
+  end
+end
+
+function HideHogs()
+  for i = 2, 9 do
+    HideHog(cannibals[i])
+    isHidden[cannibals[i]] = true
+  end
+  HideHog(cyborg)
+  cyborgHidden = true
+  HideHog(ramon)
+  HideHog(spiky)
+  ramonHidden = true
+  spikyHidden = true
+end
+
+function HideStronglings()
+  for i = 6, 9 do
+    HideHog(cannibals[i])
+    isHidden[cannibals[i]] = true
+  end
+end
+
+function UnHideWeaklings()
+  for i = 2, 5 do
+    RestoreHog(cannibals[i])
+    isHidden[cannibals[i]] = false
+    SetState(cannibals[i], gstInvisible)
+  end
+end
+
+function UnHideStronglings()
+  for i = 6, 9 do
+    RestoreHog(cannibals[i])
+    isHidden[cannibals[i]] = false
+    SetState(cannibals[i], gstInvisible)
+  end
+  RestoreHog(cyborg)
+  cyborgHidden = false
+  SetState(cyborg, gstInvisible)
+end
+
+function ChoiceTaken()
+  if choice == choiceAccept then
+    AddAnim(acceptedAnim)
+    AddFunction({func = AfterAcceptedAnim, args = {}})
+  elseif choice == choiceRefuse then
+    AddAnim(refusedAnim)
+    AddFunction({func = AfterRefusedAnim, args = {}})
+  else
+    AddAnim(attackedAnim)
+    AddFunction({func = AfterAttackedAnim, args = {}})
+  end
+end
+
+function KillCyborg()
+  RestoreHog(cyborg)
+  DeleteGear(cyborg)
+  TurnTimeLeft = 0
+end
+-----------------------------Events------------------------------------
+
+function CheckBrainiacDead()
+  return brainiacDead
+end
+
+function DoBrainiacDead()
+  TurnTimeLeft = 0
+  AddAnim(weaklingsAnim)
+  AddFunction({func = AfterWeaklingsAnim, args = {}})
+  stage = interSpyStage
+end
+  
+function CheckWeaklingsKilled()
+  for i = 2, 5 do
+    if cannibalDead[i] == false then
+      return false
+    end
+  end
+  return true
+end
+
+function DoWeaklingsKilled()
+  TurnTimeLeft = 0
+  AddAnim(stronglingsAnim)
+  AddFunction({func = AfterStronglingsAnim, args = {}})
+  stage = interWeakStage
+end
+
+function CheckRefuse()
+  return GetX(dense) > 1400 and StoppedGear(dense)
+end
+
+function DoRefuse()
+  choice = choiceRefuse
+end
+
+function CheckAccept()
+  return GetX(dense) < 1300 and StoppedGear(dense)
+end
+
+function DoAccept()
+  choice = choiceAccept
+end
+
+function CheckConfront()
+  return cyborgAttacked and StoppedGear(dense)
+end
+
+function DoConfront()
+  choice = choiceAttack
+end
+
+function CheckChoice()
+  return choice ~= 0
+end
+
+function DoChoice()
+  RemoveEventFunc(CheckConfront)
+  RemoveEventFunc(CheckAccept)
+  RemoveEventFunc(CheckRefuse)
+  ChoiceTaken()
+end
+
+function CheckNeedGirder()
+  return GetX(dense) > 1640 and StoppedGear(dense)
+end
+
+function DoNeedGirder()
+  ShowMission("The Shadow Falls", "Under Construction", "To place a girder, select it, use [Left] and [Right] to select angle and length, place with [Left Click]", 1, 6000)
+end
+
+function CheckNeedWeapons()
+  return GetX(dense) > 2522 and StoppedGear(dense)
+end
+
+function DoNeedWeapons()
+  grenadeCrate = SpawnAmmoCrate(2550, 600, amGrenade)
+  shotgunCrate = SpawnAmmoCrate(2550, 550, amShotgun)
+  AddCaption("A little gift from the cyborgs")
+end
+
+function CheckTookWeapons()
+  return shotgunTaken and grenadeTaken
+end
+
+function DoTookWeapons()
+  ShowMission("The Shadow Falls", "The guardian", "Protect yourselves!|Grenade hint: set the timer with [1-5], aim with [Up]/[Down] and hold [Space] to set power", 1, 8000)
+  AddAmmo(dense, amSkip, 100)
+  AddAmmo(dense, amSwitch, 100)
+  stage = duoStage
+  RemoveEventFunc(CheckNeedGirder)
+  RemoveEventFunc(CheckNeedWeapons)
+  RemoveEventFunc(CheckRestartReturnAccepted)
+  AddEvent(CheckStronglingsDead, {}, DoStronglingsDead, {}, 0)
+  AddAmmo(cannibals[6], amGrenade, 7)
+  AddAmmo(cannibals[6], amShotgun, 7)
+  SetGearMessage(leaks, 0)
+  SetGearMessage(dense, 0)
+  TurnTimeLeft = TurnTime
+end
+
+function DoStronglingsDead()
+  if denseDead == true then
+    AddAnim(acceptedDiedFinalAnim)
+    SaveCampaignVar("M2DenseDead", "1")
+  else
+    AddAnim(acceptedSurvivedFinalAnim)
+    SaveCampaignVar("M2DenseDead", "0")
+  end
+  SaveCampaignVar("M2RamonDead", "0")
+  SaveCampaignVar("M2SpikyDead", "0")
+  AddFunction({func = KillCyborg, args = {}})
+  SaveCampaignVar("Progress", "2")
+  SaveCampaignVar("M2Choice", "" .. choice)
+end
+
+function DoStronglingsDeadRefused()
+  if denseDead == true then
+    SaveCampaignVar("M2DenseDead", "1")
+  else
+    SaveCampaignVar("M2DenseDead", "0")
+  end
+  if ramonDead == true then
+    SaveCampaignVar("M2RamonDead", "1")
+  else
+    SaveCampaignVar("M2RamonDead", "0")
+  end
+  if spikyDead == true then
+    SaveCampaignVar("M2SpikyDead", "1")
+  else
+    SaveCampaignVar("M2SpikyDead", "0")
+  end
+  AddAnim(refusedFinalAnim)
+  AddFunction({func = KillCyborg, args = {}})
+  SaveCampaignVar("Progress", "2")
+  SaveCampaignVar("M2Choice", "" .. choice)
+end
+
+function DoStronglingsDeadAttacked()
+  SaveCampaignVar("M2DenseDead", "1")
+  SaveCampaignVar("M2RamonDead", "0")
+  SaveCampaignVar("M2SpikyDead", "0")
+  AddAnim(attackedFinalAnim)
+  AddFunction({func = KillCyborg, args = {}})
+  SaveCampaignVar("Progress", "2")
+  SaveCampaignVar("M2Choice", "" .. choice)
+end
+
+function CheckStronglingsDead()
+  if leaksDead == true then
+    return false
+  end
+  for i = 6, 9 do
+    if cannibalDead[i] == false then
+      return false
+    end
+  end
+  return true
+end
+
+function CheckLeaksDead()
+  return leaksDead
+end
+
+function DoDead()
+  AddCaption("...and so the cyborgs took over the world...")
+  stage = loseStage
+  if ramonHidden then
+    RestoreHog(ramon)
+  end
+  if spikyHidden then
+    RestoreHog(spiky)
+  end
+  SetHealth(dense, 0)
+  SetHealth(leaks, 0)
+  SetHealth(ramon, 0)
+  SetHealth(spiky, 0)
+  TurnTimeLeft = 0
+end
+
+function CheckDenseDead()
+  return denseDead and choice ~= choiceAttack 
+end
+
+function CheckRestartReturnAccepted()
+  return retryReturn
+end
+
+-----------------------------Main Functions----------------------------
+
+function onGameInit()
+	Seed = 334 
+  TemplateFilter = 3
+	GameFlags = gfSolidLand + gfDisableWind
+	TurnTime = 50000 
+	CaseFreq = 0
+	MinesNum = 0
+	MinesTime = 3000
+	Explosives = 0
+	Delay = 10 
+	MapGen = 0
+	Theme = "Nature"
+  SuddenDeathTurns = 3000
+
+  AddHogs()
+  PlaceHogs()
+  VisiblizeHogs()
+  
+  AnimInit()
+  AnimationSetup()
+end
+
+function onGameStart()
+  HideHogs()
+  AddAmmo(leaks, amSwitch, 100)
+  AddEvent(CheckLeaksDead, {}, DoDead, {}, 0)
+  AddEvent(CheckDenseDead, {}, DoDead, {}, 0)
+  AddAnim(startDialogue)
+  AddFunction({func = AfterStartDialogue, args = {}})
+  AddEvent(CheckBrainiacDead, {}, DoBrainiacDead, {}, 0)
+  ShowMission("The Shadow Falls", "The First Encounter", "Survive!|Hint: Cinematics can be skipped with the [Precise] key.", 1, 0)
+end
+
+function onGameTick()
+  AnimUnWait()
+  if ShowAnimation() == false then
+    return
+  end
+  ExecuteAfterAnimations()
+  CheckEvents()
+end
+
+function onGearDelete(gear)
+  if gear == cannibals[1] then
+    brainiacDead = true
+  elseif gear == grenadeCrate then
+    grenadeTaken = true
+  elseif gear == shotgunCrate then
+    shotgunTaken = true
+  elseif gear == dense then
+    denseDead = true
+  elseif gear == leaks then
+    leaksDead = true
+  elseif gear == ramon then
+    ramonDead = true
+  elseif gear == spiky then
+    spikyDead = true
+  else
+    for i = 2, 9 do
+      if gear == cannibals[i] then
+        cannibalDead[i] = true
+      end
+    end
+  end
+end
+
+function onGearAdd(gear)
+end
+
+function onAmmoStoreInit()
+  SetAmmo(amDEagle, 9, 0, 0, 0)
+  SetAmmo(amSniperRifle, 9, 0, 0, 0)
+  SetAmmo(amFirePunch, 9, 0, 0, 0)
+  SetAmmo(amWhip, 9, 0, 0, 0)
+  SetAmmo(amBaseballBat, 9, 0, 0, 0)
+  SetAmmo(amHammer, 9, 0, 0, 0)
+  SetAmmo(amLandGun, 9, 0, 0, 0)
+  SetAmmo(amSnowball, 9, 0, 0, 0)
+  SetAmmo(amGirder, 0, 0, 0, 2)
+  SetAmmo(amParachute, 0, 0, 0, 2)
+  SetAmmo(amGrenade, 0, 0, 0, 8)
+  SetAmmo(amShotgun, 0, 0, 0, 8)
+  SetAmmo(amSwitch, 0, 0, 0, 8)
+  SetAmmo(amRope, 0, 0, 0, 6)
+end
+
+function onNewTurn()
+  if AnimInProgress() then
+    TurnTimeLeft = -1
+--  elseif stage == interSpyStage and GetHogTeamName(CurrentHedgehog) ~= "Natives" then
+--    TurnTimeLeft = 0
+--    SetState(CurrentHedgehog, gstInvisible)
+  elseif stage == cyborgStage then
+    if CurrentHedgehog ~= dense then
+      TurnTimeLeft = 0
+    else
+      TurnTimeLeft = -1
+    end
+  elseif stage == acceptedReturnStage then
+    SwitchHog(dense)
+    FollowGear(dense)
+    TurnTimeLeft = -1
+  end
+end
+
+function onGearDamage(gear, damage)
+  if gear == cyborg and stage == cyborgStage then
+    cyborgAttacked = true
+  end
+end
+
+function onPrecise()
+  if GameTime > 2500 then
+    SetAnimSkip(true)
+  end
+  if stage == acceptedReturnStage then
+    retryReturn = true
+  end
+end
+