share/hedgewars/Data/Missions/Scenario/User_Mission_-_Diver.lua
changeset 15112 5c8c729a16ce
parent 15036 a1165392c9db
--- a/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Diver.lua	Fri May 31 21:10:17 2019 +0200
+++ b/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Diver.lua	Fri May 31 21:39:47 2019 +0200
@@ -1,6 +1,7 @@
 
 HedgewarsScriptLoad("/Scripts/Locale.lua")
 
+local playerTeamName
 local player = nil -- This variable will point to the hog's gear
 local enemy = nil
 
@@ -26,7 +27,7 @@
 	HealthDecrease = 0
 	WaterRise = 0
 
-	AddMissionTeam(-1)
+	playerTeamName = AddMissionTeam(-1)
 	player = AddMissionHog(1)
 			
 	AddTeam(loc("Toxic Team"), -6, "skull", "Island", "Default_qau", "cm_magicskull")
@@ -96,12 +97,12 @@
 
 function onGameResult(winner)
 
-	if winner == 0 then
-		ShowMission(loc("Diver"), loc("MISSION SUCCESSFUL"), loc("Congratulations!"), 0, 0)
+	if winner == GetTeamClan(playerTeamName) then
+		SendStat(siGameResult, loc("Mission succeeded!"))
 		SaveMissionVar("Won", "true")
 		GameOver = true
 	else
-		ShowMission(loc("Diver"), loc("MISSION FAILED"), loc("Oh no! Just try again!"), -amSkip, 0)		
+		SendStat(siGameResult, loc("Mission failed!"))
 		GameOver = true
 	end