share/hedgewars/Data/Missions/Challenge/User_Mission_-_That_Sinking_Feeling.lua
author Wuzzy <Wuzzy2@mail.ru>
Fri, 21 Dec 2018 16:54:41 +0100
changeset 14513 6c62f7ebea45
parent 14505 764ba6182389
child 14599 50f511588635
permissions -rw-r--r--
Fix 2 team name mistakes in missions
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
     1
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
     2
8043
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 5823
diff changeset
     3
HedgewarsScriptLoad("/Scripts/Locale.lua")
14496
2113296b7a29 Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents: 14485
diff changeset
     4
HedgewarsScriptLoad("/Scripts/Utils.lua")
13501
cbda0f842364 Standardize hidden mission achievement in new Lua library "Achievements"
Wuzzy <Wuzzy2@mail.ru>
parents: 12933
diff changeset
     5
HedgewarsScriptLoad("/Scripts/Achievements.lua")
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
     6
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
     7
local player
14503
d4aa64f51c9f Use player-chosen team identity for most challenges and scenarios
Wuzzy <Wuzzy2@mail.ru>
parents: 14496
diff changeset
     8
local playerTeamName, haplessTeamName
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
     9
local hh = {}
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    10
local hhCount = 8
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    11
local GameOver = false
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    12
local introStage = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    13
local genCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    14
local waterCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    15
local waterPix = 0
5823
mikade
parents: 5278
diff changeset
    16
local frig = 0
mikade
parents: 5278
diff changeset
    17
local watGear = nil
11521
dc36fad455f4 add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents: 11262
diff changeset
    18
local cinematic = false
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    19
14496
2113296b7a29 Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents: 14485
diff changeset
    20
function printMission()
2113296b7a29 Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents: 14485
diff changeset
    21
	local highscore = tonumber(GetMissionVar("Highscore"))
2113296b7a29 Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents: 14485
diff changeset
    22
	local show = (type(highscore) == "number") and (highscore > 0)
2113296b7a29 Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents: 14485
diff changeset
    23
	local recordInfo = ""
2113296b7a29 Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents: 14485
diff changeset
    24
	if show then
2113296b7a29 Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents: 14485
diff changeset
    25
		recordInfo = getReadableChallengeRecord("Highscore")
2113296b7a29 Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents: 14485
diff changeset
    26
	end
14503
d4aa64f51c9f Use player-chosen team identity for most challenges and scenarios
Wuzzy <Wuzzy2@mail.ru>
parents: 14496
diff changeset
    27
	ShowMission(loc("That Sinking Feeling"), loc("Challenge"), loc("Save as many hogs as possible!")
14496
2113296b7a29 Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents: 14485
diff changeset
    28
	.. "|" .. recordInfo, 4, 0)
2113296b7a29 Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents: 14485
diff changeset
    29
end
2113296b7a29 Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents: 14485
diff changeset
    30
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    31
-- allow skipping of the intro via hitting precise key
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    32
function onPrecise()
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    33
	if introStage < 100 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    34
		introStage = 110
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    35
		genCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    36
		FollowGear(CurrentHedgehog)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    37
		AddCaption(loc("Good luck out there!"))
14496
2113296b7a29 Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents: 14485
diff changeset
    38
		printMission()
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
    39
		SetInputMask(0xFFFFFFFF)
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    40
	end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    41
end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    42
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    43
function onGameInit()
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    44
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    45
	Seed = 0
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
    46
	GameFlags = gfInfAttack + gfInvulnerable + gfOneClanMode
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    47
	TurnTime = 90000
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    48
	CaseFreq = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    49
	MinesNum = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    50
	MinesTime  = 3000
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    51
	Explosives = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    52
	Map = "Islands"
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    53
	Theme = "City"
14424
8af01d65ccda Properly disable SD in That Sinking Feeling
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
    54
	HealthDecrease = 0
8af01d65ccda Properly disable SD in That Sinking Feeling
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
    55
	WaterRise = 0
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    56
14505
764ba6182389 Change AddTeam/AddMissionTeam to return real team name and index (in that order)
Wuzzy <Wuzzy2@mail.ru>
parents: 14503
diff changeset
    57
	haplessTeamName = AddTeam(loc("Hapless Hogs"), -1, "Simple", "Island", "Default")
5823
mikade
parents: 5278
diff changeset
    58
	hh[0] = AddHog(loc("Sinky"), 1, 100, "fr_lemon")
mikade
parents: 5278
diff changeset
    59
	hh[1] = AddHog(loc("Drowner"), 1, 100, "fr_orange")
mikade
parents: 5278
diff changeset
    60
	hh[2] = AddHog(loc("Heavy"), 1, 100, "dish_Teapot")
mikade
parents: 5278
diff changeset
    61
	hh[3] = AddHog(loc("Clumsy"), 1, 100, "dish_SauceBoatSilver")
mikade
parents: 5278
diff changeset
    62
	hh[4] = AddHog(loc("Silly"), 1, 100, "dish_Ladle")
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    63
	hh[5] = AddHog(loc("Careless"), 1, 100, "StrawHatEyes")
5823
mikade
parents: 5278
diff changeset
    64
	hh[6] = AddHog(loc("Sponge"), 1, 100, "sf_chunli")
mikade
parents: 5278
diff changeset
    65
	hh[7] = AddHog(loc("Deadweight"), 1, 100, "dish_Teacup")
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    66
14513
6c62f7ebea45 Fix 2 team name mistakes in missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14505
diff changeset
    67
	playerTeamName = AddMissionTeam(-1)
14503
d4aa64f51c9f Use player-chosen team identity for most challenges and scenarios
Wuzzy <Wuzzy2@mail.ru>
parents: 14496
diff changeset
    68
	player = AddMissionHog(1)
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
    69
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    70
	SetGearPosition(player, 3992, 733)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    71
	SetGearPosition(hh[0], 938, 1369)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    72
	SetGearPosition(hh[1], 1301, 1439)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    73
	SetGearPosition(hh[2], 2093, 447)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    74
	SetGearPosition(hh[3], 2971, 926)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    75
	SetGearPosition(hh[4], 719, 545)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    76
	SetGearPosition(hh[5], 1630, 821)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    77
	SetGearPosition(hh[6], 2191, 810)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    78
	SetGearPosition(hh[7], 3799, 945)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    79
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
    80
	-- Disable all input except [Precise] for the intro
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
    81
	SetInputMask(gmPrecise)
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    82
end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    83
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    84
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    85
function onGameStart()
14496
2113296b7a29 Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents: 14485
diff changeset
    86
	cinematic = true
2113296b7a29 Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents: 14485
diff changeset
    87
	SetCinematicMode(true)
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
    88
	SendHealthStatsOff()
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    89
14496
2113296b7a29 Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents: 14485
diff changeset
    90
	printMission()
2113296b7a29 Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents: 14485
diff changeset
    91
	HideMission()
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    92
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    93
	HogTurnLeft(hh[0], false)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    94
	HogTurnLeft(hh[1], true)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    95
12933
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12346
diff changeset
    96
	SpawnSupplyCrate(148,265,amLowGravity)
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12346
diff changeset
    97
	SpawnSupplyCrate(2124,1516,amJetpack)
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    98
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    99
end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   100
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   101
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   102
function onNewTurn()
13752
110d6c1e817f Lua: Rename globals: NoPointX→NO_CURSOR, cMaxTurnTime→MAX_TURN_TIME, cMaxHogHealth→MAX_HOG_HEALTH
Wuzzy <Wuzzy2@mail.ru>
parents: 13742
diff changeset
   103
	SetTurnTimeLeft(MAX_TURN_TIME)
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   104
end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   105
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   106
function onGameTick()
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   107
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   108
	-- intro sequence
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   109
	if introStage < 100 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   110
5823
mikade
parents: 5278
diff changeset
   111
		frig = frig + 1
mikade
parents: 5278
diff changeset
   112
		if frig == 50 then
mikade
parents: 5278
diff changeset
   113
			frig = 0			
mikade
parents: 5278
diff changeset
   114
			AddCaption(loc("Press [Precise] to skip intro"))
mikade
parents: 5278
diff changeset
   115
			if watGear ~= nil then			
mikade
parents: 5278
diff changeset
   116
				FollowGear(watGear)
mikade
parents: 5278
diff changeset
   117
			end
mikade
parents: 5278
diff changeset
   118
		end
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   119
5823
mikade
parents: 5278
diff changeset
   120
		
mikade
parents: 5278
diff changeset
   121
		--AddCaption(loc("Press [Precise] to skip intro"))
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   122
		genCounter = genCounter + 1
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   123
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   124
		if introStage == 0 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   125
5823
mikade
parents: 5278
diff changeset
   126
						
mikade
parents: 5278
diff changeset
   127
			--FollowGear(hh[0])
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   128
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   129
			if genCounter == 2000 then
5823
mikade
parents: 5278
diff changeset
   130
				watGear = hh[0]
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   131
				HogSay(hh[0], loc("This rain is really something..."), SAY_SAY,2)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   132
			elseif genCounter == 5000 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   133
				introStage = 1
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   134
				genCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   135
			end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   136
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   137
		elseif introStage == 1 then
5823
mikade
parents: 5278
diff changeset
   138
						
mikade
parents: 5278
diff changeset
   139
			--FollowGear(hh[1])
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   140
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   141
			if genCounter == 2000 then
5823
mikade
parents: 5278
diff changeset
   142
				watGear = hh[1]
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   143
				HogSay(hh[1], loc("Heh, it's not that bad."), SAY_SAY,2)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   144
			elseif genCounter == 5000 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   145
				introStage = 2
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   146
				genCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   147
			end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   148
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   149
		elseif introStage == 2 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   150
5823
mikade
parents: 5278
diff changeset
   151
			--FollowGear(hh[0])
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   152
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   153
			if genCounter == 2000 then
5823
mikade
parents: 5278
diff changeset
   154
				watGear = hh[0]
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   155
				HogSay(hh[0], loc("You'd almost swear the water was rising!"), SAY_SHOUT,2)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   156
			elseif genCounter == 6000 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   157
				introStage = 3
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   158
				genCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   159
			end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   160
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   161
		elseif introStage == 3 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   162
5823
mikade
parents: 5278
diff changeset
   163
			--FollowGear(hh[1])
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   164
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   165
			if genCounter == 2000 then
5823
mikade
parents: 5278
diff changeset
   166
				watGear = hh[1]
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   167
				HogSay(hh[1], loc("Haha, now THAT would be something!"), SAY_SAY,2)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   168
			elseif genCounter == 6000 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   169
				introStage = 4
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   170
				genCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   171
			end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   172
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   173
		elseif introStage == 4 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   174
5823
mikade
parents: 5278
diff changeset
   175
			--FollowGear(hh[0])
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   176
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   177
			if genCounter == 2000 then
5823
mikade
parents: 5278
diff changeset
   178
				watGear = hh[0]
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   179
				HogSay(hh[0], loc("Hahahaha!"), SAY_SHOUT,2)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   180
				HogSay(hh[1], loc("Hahahaha!"), SAY_SHOUT,2)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   181
			elseif genCounter == 3000 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   182
				introStage = 5
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   183
				genCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   184
			end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   185
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   186
		elseif introStage == 5 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   187
5823
mikade
parents: 5278
diff changeset
   188
			--FollowGear(hh[1])
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   189
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   190
			if genCounter == 2000 then
5823
mikade
parents: 5278
diff changeset
   191
				watGear = hh[1]
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   192
				HogSay(hh[0], loc("..."), SAY_THINK,2)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   193
				HogSay(hh[1], loc("..."), SAY_THINK,2)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   194
			elseif genCounter == 5000 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   195
				introStage = 6
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   196
				genCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   197
			end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   198
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   199
		elseif introStage == 6 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   200
5823
mikade
parents: 5278
diff changeset
   201
			--FollowGear(hh[0])
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   202
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   203
			if genCounter == 2000 then
5823
mikade
parents: 5278
diff changeset
   204
				watGear = hh[0]
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   205
				HogSay(hh[0], loc("It's a good thing SUDDEN DEATH is 99 turns away..."), SAY_THINK,2)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   206
			elseif genCounter == 6000 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   207
				introStage = 7
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   208
				genCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   209
			end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   210
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   211
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   212
		elseif introStage == 7 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   213
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   214
			if genCounter == 2000 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   215
				introStage = 110
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   216
				FollowGear(CurrentHedgehog)
14503
d4aa64f51c9f Use player-chosen team identity for most challenges and scenarios
Wuzzy <Wuzzy2@mail.ru>
parents: 14496
diff changeset
   217
				ShowMission(loc("That Sinking Feeling"), loc("User Challenge"), loc("Save as many hogs as possible!"), 4, 0)
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   218
				SetInputMask(0xFFFFFFFF)
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   219
			end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   220
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   221
		end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   222
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   223
	end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   224
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   225
	-- start the water rising when the intro is finished
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   226
	if introStage == 110 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   227
11521
dc36fad455f4 add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents: 11262
diff changeset
   228
        if cinematic then
dc36fad455f4 add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents: 11262
diff changeset
   229
            SetCinematicMode(false)
dc36fad455f4 add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents: 11262
diff changeset
   230
            cinematic = false
dc36fad455f4 add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents: 11262
diff changeset
   231
        end
dc36fad455f4 add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents: 11262
diff changeset
   232
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   233
		waterCounter = waterCounter + 1
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   234
		if (waterCounter == 100) and (waterPix < 1615) then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   235
			waterCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   236
			SetTag(AddGear(0, 0, gtWaterUp, 0, 0, 0, 0), 1)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   237
			waterPix = waterPix +1
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   238
			--AddCaption(waterPix)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   239
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   240
			if (waterPix >= 1615) and (GameOver == false) then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   241
				GameOver = true
11262
6e1aa1144a2b - Finally added rus localization for all User Missions
antonc27 <antonc27@mail.ru>
parents: 11009
diff changeset
   242
				AddCaption(loc("The flood has stopped! Challenge over."))
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   243
				SendStat(siGameResult, loc("Challenge completed!"))
12346
fb22caa19600 Fix incorrect PointsType in sniper rifle training and That Sinking Feeling
Wuzzy <almikes@aol.com>
parents: 12344
diff changeset
   244
				SendStat(siPointType, loc("rescues"))
14503
d4aa64f51c9f Use player-chosen team identity for most challenges and scenarios
Wuzzy <Wuzzy2@mail.ru>
parents: 14496
diff changeset
   245
				SendStat(siPlayerKills, tostring(hhCount), playerTeamName)
5823
mikade
parents: 5278
diff changeset
   246
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   247
				-- Do not count drowning hedgehogs
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   248
				local hhLeft = hhCount
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   249
				for i=1,#hh do
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   250
					local isDrowning = band(GetState(hh[i]),gstDrowning) ~= 0
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   251
					if isDrowning then
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   252
						hhLeft = hhLeft - 1
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   253
					end
5823
mikade
parents: 5278
diff changeset
   254
				end
mikade
parents: 5278
diff changeset
   255
14503
d4aa64f51c9f Use player-chosen team identity for most challenges and scenarios
Wuzzy <Wuzzy2@mail.ru>
parents: 14496
diff changeset
   256
				SendStat(siCustomAchievement, string.format(loc("You saved %d of 8 hegehogs."), hhLeft))
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   257
14496
2113296b7a29 Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents: 14485
diff changeset
   258
				-- Update highscore
2113296b7a29 Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents: 14485
diff changeset
   259
				updateChallengeRecord("Highscore", hhLeft)
2113296b7a29 Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents: 14485
diff changeset
   260
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   261
				if hhLeft == 8 then
14485
ead8928a59f8 Report mission victory for most missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14424
diff changeset
   262
					SaveMissionVar("Won", "true")
13501
cbda0f842364 Standardize hidden mission achievement in new Lua library "Achievements"
Wuzzy <Wuzzy2@mail.ru>
parents: 12933
diff changeset
   263
					awardAchievement(loc("Lively Lifeguard"))
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   264
				end
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   265
				EndGame()
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   266
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   267
			end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   268
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   269
		end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   270
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   271
	end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   272
end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   273
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   274
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   275
function onAmmoStoreInit()
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   276
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   277
	SetAmmo(amBazooka, 9, 0, 0, 0)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   279
	SetAmmo(amRope, 9, 0, 0, 0)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   280
	SetAmmo(amParachute, 9, 0, 0, 0)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   281
	SetAmmo(amJetpack, 2, 0, 0, 2)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   282
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   283
	SetAmmo(amGirder, 9, 0, 0, 0)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   284
	SetAmmo(amBaseballBat, 9, 0, 0, 0)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   285
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   286
	SetAmmo(amTeleport, 1, 0, 0, 1)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   287
	SetAmmo(amPortalGun, 3, 0, 0, 1)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   288
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   289
	SetAmmo(amLowGravity, 0, 0, 0, 1)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   290
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   291
end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   292
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   293
function onGearDelete(gear)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   294
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   295
	if GetGearType(gear) == gtHedgehog then
14503
d4aa64f51c9f Use player-chosen team identity for most challenges and scenarios
Wuzzy <Wuzzy2@mail.ru>
parents: 14496
diff changeset
   296
		if GetHogTeamName(gear) == haplessTeamName then
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   297
			hhCount = hhCount - 1
14503
d4aa64f51c9f Use player-chosen team identity for most challenges and scenarios
Wuzzy <Wuzzy2@mail.ru>
parents: 14496
diff changeset
   298
			AddCaption(string.format(loc("Hedgehogs left: %d"), hhCount))
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   299
		end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   300
	end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   301
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   302
	if ((gear == player) or (hhCount == 0)) and (GameOver == false) then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   303
		SetHealth(player, 0)
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   304
		AddCaption(loc("Disqualified!"))
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   305
		if gear == player then
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   306
			SendStat(siCustomAchievement, loc("Your hedgehog died!"))
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   307
			SendStat(siCustomAchievement, loc("You must survive the flood in order to score."))
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   308
		else
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   309
			SendStat(siCustomAchievement, loc("You haven't rescued anyone."))
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   310
		end
12346
fb22caa19600 Fix incorrect PointsType in sniper rifle training and That Sinking Feeling
Wuzzy <almikes@aol.com>
parents: 12344
diff changeset
   311
		SendStat(siPointType, loc("points"))
14503
d4aa64f51c9f Use player-chosen team identity for most challenges and scenarios
Wuzzy <Wuzzy2@mail.ru>
parents: 14496
diff changeset
   312
		SendStat(siPlayerKills, "0", playerTeamName)
14496
2113296b7a29 Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents: 14485
diff changeset
   313
		local highscore = tonumber(GetMissionVar("Highscore"))
2113296b7a29 Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents: 14485
diff changeset
   314
		show = (type(highscore) == "number") and (highscore > 0)
2113296b7a29 Keep track of singleplayer high scores in challenges
Wuzzy <Wuzzy2@mail.ru>
parents: 14485
diff changeset
   315
		updateChallengeRecord("Highscore", 0, show)
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   316
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   317
		SendStat(siGameResult, loc("Disqualified!"))
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   318
		GameOver = true
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   319
		EndGame()
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   320
	end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   321
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   322
end