Fix team name bugs in RC Plane Challenge and Dangerous Ducklings
authorWuzzy <Wuzzy2@mail.ru>
Fri, 21 Dec 2018 17:43:04 +0100
changeset 14499 cc358e997e32
parent 14498 e78c44ae94da
child 14500 ff2c1f25fc03
Fix team name bugs in RC Plane Challenge and Dangerous Ducklings
share/hedgewars/Data/Missions/Challenge/User_Mission_-_RCPlane_Challenge.lua
share/hedgewars/Data/Missions/Scenario/User_Mission_-_Dangerous_Ducklings.lua
--- a/share/hedgewars/Data/Missions/Challenge/User_Mission_-_RCPlane_Challenge.lua	Fri Dec 21 16:55:34 2018 +0100
+++ b/share/hedgewars/Data/Missions/Challenge/User_Mission_-_RCPlane_Challenge.lua	Fri Dec 21 17:43:04 2018 +0100
@@ -3,6 +3,7 @@
 HedgewarsScriptLoad("/Scripts/Achievements.lua")
 
 local player = nil
+local playerTeamName = nil
 local RCGear = nil
 local planesUsed = 0
 local planeTimer = 0
@@ -35,7 +36,7 @@
 	MinesNum = 0
 	Explosives = 0
 
-	AddMissionTeam(-1)
+	playerTeamName = AddMissionTeam(-1)
 	player = AddMissionHog(80)
 	SetGearPosition(player, 1380, 1500)
 
@@ -56,7 +57,7 @@
                                 loc("Compete to use as few planes as possible!") .. "|" ..
                                 recordInfo, -amRCPlane, 4000
                                 )
-	SetTeamLabel(loc("Wannabe Flyboys"), "0")
+	SetTeamLabel(playerTeamName, "0")
 
 	PlaceGirder(2192, 508, 6)
 	PlaceGirder(2192, 670, 6)
@@ -289,7 +290,7 @@
 	if GetGearType(gear) == gtRCPlane then
 		RCGear = gear
 		planesUsed = planesUsed + 1
-		SetTeamLabel(loc("Wannabe Flyboys"), tostring(planesUsed))
+		SetTeamLabel(playerTeamName, tostring(planesUsed))
 		planeTimer = 0
 		missiles = 0
 	end
@@ -442,7 +443,7 @@
 			PlaySound(sound, player)
 
 
-			DismissTeam(loc("Wannabe Flyboys"))
+			DismissTeam(playerTeamName)
 			EndGame()
 		end
 
--- a/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Dangerous_Ducklings.lua	Fri Dec 21 16:55:34 2018 +0100
+++ b/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Dangerous_Ducklings.lua	Fri Dec 21 17:43:04 2018 +0100
@@ -3,6 +3,7 @@
 HedgewarsScriptLoad("/Scripts/Achievements.lua")
 
 local player = nil -- This variable will point to the hog's gear
+local playerTeamName, enemyTeamName = nil, nil
 local instructor = nil
 local enemy = nil
 
@@ -30,11 +31,11 @@
 	HealthDecrease = 0
 	WaterRise = 0
 
-	AddMissionTeam(-1)
+	playerTeamName = AddMissionTeam(-1)
 	player = AddMissionHog(1)
 	instructor = AddHog(loc("Instructor"), 0, 100, "sf_vega")
 
-	AddTeam(loc("Blue Team"), -2, "bubble", "Island", "Default", "somalia")
+	enemyTeamName = AddTeam(loc("Blue Team"), -2, "bubble", "Island", "Default", "somalia")
 	enemy = AddHog(loc("Filthy Blue"), 1, 100, "Skull")
 
 	SetGearPosition(player,146,902)
@@ -112,9 +113,8 @@
 		endTimer = endTimer + 1
 		if (CurrentHedgehog ~= nil) and (CurrentHedgehog == instructor) then
 			if endTimer >= 3000 then
-				--SetHealth(instructor,0)
 				SetTurnTimeLeft(1)
-				DismissTeam(GetHogTeamName(player))
+				DismissTeam(playerTeamName)
 			end
 			ShowMission(loc("Dangerous Ducklings"), loc("MISSION FAILED"), loc("You've failed. Try again."), -amRope, 5000);
 		end
@@ -137,7 +137,7 @@
 			HogSay(player, loc("See ya!"), SAY_THINK)
 			Retreat(3000)
 			awardAchievement(loc("Naughty Ninja"))
-			DismissTeam(GetHogTeamName(enemy))
+			DismissTeam(enemyTeamName)
 			gameWon = true
 			SaveMissionVar("Won", "true")
 		elseif gear == enemy then