Portal mission: Delay first speech until turn start
authorWuzzy <Wuzzy2@mail.ru>
Mon, 21 Jan 2019 19:56:43 +0100
changeset 14671 5931aff25837
parent 14670 e7b2542c4d28
child 14672 7dbf528ed6a0
Portal mission: Delay first speech until turn start
share/hedgewars/Data/Missions/Scenario/portal.lua
--- a/share/hedgewars/Data/Missions/Scenario/portal.lua	Mon Jan 21 19:49:38 2019 +0100
+++ b/share/hedgewars/Data/Missions/Scenario/portal.lua	Mon Jan 21 19:56:43 2019 +0100
@@ -3,7 +3,8 @@
 
 local MineArray = {}
 local player
-local adviceGiven = false
+local adviceGiven0 = false
+local adviceGiven1 = false
 local adviceGiven2 = false
 
 function onGameInit()
@@ -166,15 +167,20 @@
 		loc("In this mission you have infinite time.") .. "|" ..
 		loc("Mines time: 0 seconds"),
 		-amPortalGun, 5000)
-	HogSay(player, loc("I should get myself a portal device, maybe this crate has one."), SAY_THINK)
+end
 
+function onNewTurn()
+	if (adviceGiven0 == false) then
+		adviceGiven0 = true
+		HogSay(player, loc("I should get myself a portal device, maybe this crate has one."), SAY_THINK)
+	end
 end
 
 function onGameTick()
 
 	if (player ~= nil)  then
-		if (gearIsInBox(player, 1650, 1907, 200, 60) and (adviceGiven == false)) then
-			adviceGiven = true
+		if (gearIsInBox(player, 1650, 1907, 200, 60) and (adviceGiven1 == false)) then
+			adviceGiven1 = true
 			HogSay(player, loc("Hmmm, I’ll have to find some way of moving him off this anti-portal surface."), SAY_THINK)
 		elseif (gearIsInBox(player, 2960, 790, 200, 60) and (adviceGiven2 == false)) then
 			adviceGiven2 = true