Add alternate dialogs in ACF mission 6 when killing cyborgs before collecting crates
authorWuzzy <almikes@aol.com>
Sun, 16 Apr 2017 08:19:33 +0200
changeset 12277 2c884bb73975
parent 12276 bb44fd4d8809
child 12278 1d2fe83709d1
Add alternate dialogs in ACF mission 6 when killing cyborgs before collecting crates
ChangeLog.txt
share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/dragon.lua
--- a/ChangeLog.txt	Sun Apr 16 06:08:24 2017 +0200
+++ b/ChangeLog.txt	Sun Apr 16 08:19:33 2017 +0200
@@ -168,6 +168,7 @@
  + New scenario: Big Armory
  + New training: Basic Flying Saucer Training
  + Rope-Knocking Challenge was improved (now awards score based on kills and time; taunts for knocking out hedgehogs)
+ + A Classic Fairytale, mission 6: Add alternate dialogues when killing cyborgs before collecting the crates
  + A few campaign missions now save your personal best successes (e.g. fastest finish in Hard Flying) which get shown after you finish them agin
  + A Space Adventure shows 2 flowers over fully completed planets (with side missions)
  + Rewrote some help texts in basic rope training
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/dragon.lua	Sun Apr 16 06:08:24 2017 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/dragon.lua	Sun Apr 16 08:19:33 2017 +0200
@@ -171,6 +171,10 @@
 crates = {}
 cratesNum = 0
 jetCrate = nil
+
+cyborgsKilledBeforeCrates = false
+cratesTaken = false
+doneCyborgsDead = false
 -----------------------------Animations--------------------------------
 function EmitDenseClouds(dir)
   local dif
@@ -258,12 +262,27 @@
   table.insert(killAnim, {func = AnimOutOfNowhere, args = {cyborg, unpack(cyborgPos)}})
   table.insert(killAnim, {func = AnimCustomFunction, args = {cyborg, CondNeedToTurn, {cyborg, native}}})
   table.insert(killAnim, {func = AnimSay, args = {cyborg, string.format(loc("You bear impressive skills, %s!"), nativeUnNames[m5DeployedNum]), SAY_SHOUT, 4000}})
-  table.insert(killAnim, {func = AnimSay, args = {cyborg, loc("However, my mates don't agree with me on letting you go..."), SAY_SHOUT, 7000}})
-  table.insert(killAnim, {func = AnimSay, args = {cyborg, loc("I guess you'll have to kill them."), SAY_SHOUT, 4000}})
+  if CheckCyborgsDead() then
+    table.insert(killAnim, {func = AnimSay, args = {cyborg, loc("I see you already took care of your enemies."), SAY_SHOUT, 7000}})
+    table.insert(killAnim, {func = AnimSay, args = {cyborg, loc("Those were scheduled for disposal anyway."), SAY_SHOUT, 4000}})
+    table.insert(killAnim, {func = AnimSay, args = {cyborg, loc("So you basically did the dirty work for us."), SAY_SHOUT, 4000}})
+    cyborgsKilledBeforeCrates = true
+  else
+    table.insert(killAnim, {func = AnimSay, args = {cyborg, loc("However, my mates don't agree with me on letting you go..."), SAY_SHOUT, 7000}})
+    table.insert(killAnim, {func = AnimSay, args = {cyborg, loc("I guess you'll have to kill them."), SAY_SHOUT, 4000}})
+  end
   table.insert(killAnim, {func = AnimDisappear, args = {cyborg, unpack(cyborgPos)}})
   table.insert(killAnim, {func = AnimSwitchHog, args = {native}})
   table.insert(killAnim, {func = AnimWait, args = {native, 1}})
   table.insert(killAnim, {func = AnimCustomFunction, args = {native, HideHedge, {cyborg}}})
+
+  local function checkCyborgsAgain()
+     if CheckCyborgsDead() then
+        DoCyborgsDead()
+     end
+  end
+  table.insert(killAnim, {func = AnimCustomFunction, args = {native, checkCyborgsAgain, {}}})
+
   AddSkipFunction(killAnim, SkipKillAnim, {})
 end
 
@@ -272,7 +291,9 @@
   table.insert(killedAnim, {func = AnimOutOfNowhere, args = {cyborg, unpack(secondPos[2])}})
   table.insert(killedAnim, {func = AnimOutOfNowhere, args = {native, unpack(secondPos[1])}})
   table.insert(killedAnim, {func = AnimCustomFunction, args = {cyborg, CondNeedToTurn, {cyborg, native}}})
-  table.insert(killedAnim, {func = AnimSay, args = {cyborg, string.format(loc("Nice work, %s!"), nativeUnNames[m5DeployedNum]), SAY_SHOUT, 4000}})
+  if not cyborgsKilledBeforeCrates then
+    table.insert(killedAnim, {func = AnimSay, args = {cyborg, string.format(loc("Nice work, %s!"), nativeUnNames[m5DeployedNum]), SAY_SHOUT, 4000}})
+  end
   table.insert(killedAnim, {func = AnimSay, args = {cyborg, loc("As a reward for your performance, here's some new technology!"), SAY_SHOUT, 8000}})
   table.insert(killedAnim, {func = AnimSay, args = {cyborg, loc("Use it wisely!"), SAY_SHOUT, 3000}})
   table.insert(killedAnim, {func = AnimDisappear, args = {cyborg, unpack(secondPos[2])}})
@@ -355,12 +376,15 @@
 end
 
 function DoCyborgsDead()
-  NullifyAmmo()
-  RestoreHedge(cyborg)
-  SetupKilledAnim()
-  SetGearMessage(CurrentHedgehog, 0)
-  AddAnim(killedAnim)
-  AddFunction({func = AfterKilledAnim, args = {}})
+  if cratesTaken and not doneCyborgsDead then
+    NullifyAmmo()
+    RestoreHedge(cyborg)
+    SetupKilledAnim()
+    SetGearMessage(CurrentHedgehog, 0)
+    AddAnim(killedAnim)
+    AddFunction({func = AfterKilledAnim, args = {}})
+    doneCyborgsDead = true
+  end
 end
 
 
@@ -373,6 +397,7 @@
 end
 
 function DoCratesTaken()
+  cratesTaken = true
   SetupKillAnim()
   SetGearMessage(CurrentHedgehog, 0)
   AddAnim(killAnim)
@@ -434,6 +459,9 @@
 function CyborgDeadReact()
   freshDead = nil
   if cyborgsLeft == 0 then
+    if not cratesTaken then
+       AnimSay(native, loc("I still have to collect the crates."), SAY_THINK, 8000)
+    end
     return
   end
   AnimSay(native, reactions[cyborgsLeft])