share/hedgewars/Data/Missions/Challenge/User_Mission_-_That_Sinking_Feeling.lua
author nemo
Fri, 17 Aug 2018 22:23:19 -0400
changeset 13669 c6ee1b0b957f
parent 13583 141cdfe0f3ca
child 13742 2bb7141496a9
permissions -rw-r--r--
more wrapping
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")
13501
cbda0f842364 Standardize hidden mission achievement in new Lua library "Achievements"
Wuzzy <Wuzzy2@mail.ru>
parents: 12933
diff changeset
     4
HedgewarsScriptLoad("/Scripts/Achievements.lua")
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
     5
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
     6
local player
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
     7
local hh = {}
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
     8
local hhCount = 8
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
     9
local GameOver = false
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    10
local introStage = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    11
local genCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    12
local waterCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    13
local waterPix = 0
5823
mikade
parents: 5278
diff changeset
    14
local frig = 0
mikade
parents: 5278
diff changeset
    15
local watGear = nil
11521
dc36fad455f4 add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents: 11262
diff changeset
    16
local cinematic = false
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    17
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    18
-- allow skipping of the intro via hitting precise key
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    19
function onPrecise()
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    20
	if introStage < 100 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    21
		introStage = 110
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    22
		genCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    23
		FollowGear(CurrentHedgehog)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    24
		AddCaption(loc("Good luck out there!"))
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
    25
		ShowMission(loc("That Sinking Feeling"), loc("Challenge"), loc("Save as many hapless hogs as possible!"), 4, 0)
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
    26
		SetInputMask(0xFFFFFFFF)
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    27
	end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    28
end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    29
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    30
function onGameInit()
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    31
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    32
	Seed = 0
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
    33
	GameFlags = gfInfAttack + gfInvulnerable + gfOneClanMode
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    34
	TurnTime = 90000
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    35
	CaseFreq = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    36
	MinesNum = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    37
	MinesTime  = 3000
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    38
	Explosives = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    39
	Delay = 10
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    40
	Map = "Islands"
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    41
	Theme = "City"
5823
mikade
parents: 5278
diff changeset
    42
	SuddenDeathTurns = 1
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    43
13583
141cdfe0f3ca Switch almost all Lua calls of AddTeam to using default clan colors instead of hardcoded color
Wuzzy <Wuzzy2@mail.ru>
parents: 13501
diff changeset
    44
	AddTeam(loc("Hapless Hogs"), -1, "Simple", "Island", "Default")
5823
mikade
parents: 5278
diff changeset
    45
	hh[0] = AddHog(loc("Sinky"), 1, 100, "fr_lemon")
mikade
parents: 5278
diff changeset
    46
	hh[1] = AddHog(loc("Drowner"), 1, 100, "fr_orange")
mikade
parents: 5278
diff changeset
    47
	hh[2] = AddHog(loc("Heavy"), 1, 100, "dish_Teapot")
mikade
parents: 5278
diff changeset
    48
	hh[3] = AddHog(loc("Clumsy"), 1, 100, "dish_SauceBoatSilver")
mikade
parents: 5278
diff changeset
    49
	hh[4] = AddHog(loc("Silly"), 1, 100, "dish_Ladle")
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    50
	hh[5] = AddHog(loc("Careless"), 1, 100, "StrawHatEyes")
5823
mikade
parents: 5278
diff changeset
    51
	hh[6] = AddHog(loc("Sponge"), 1, 100, "sf_chunli")
mikade
parents: 5278
diff changeset
    52
	hh[7] = AddHog(loc("Deadweight"), 1, 100, "dish_Teacup")
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    53
13583
141cdfe0f3ca Switch almost all Lua calls of AddTeam to using default clan colors instead of hardcoded color
Wuzzy <Wuzzy2@mail.ru>
parents: 13501
diff changeset
    54
	AddTeam(loc("Nameless Heroes"), -1, "Simple", "Island", "Default", "cm_crossedswords")
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
    55
	player = AddHog(loc("The Nameless One"), 0, 1, "NoHat")
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
    56
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    57
	SetGearPosition(player, 3992, 733)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    58
	SetGearPosition(hh[0], 938, 1369)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    59
	SetGearPosition(hh[1], 1301, 1439)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    60
	SetGearPosition(hh[2], 2093, 447)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    61
	SetGearPosition(hh[3], 2971, 926)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    62
	SetGearPosition(hh[4], 719, 545)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    63
	SetGearPosition(hh[5], 1630, 821)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    64
	SetGearPosition(hh[6], 2191, 810)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    65
	SetGearPosition(hh[7], 3799, 945)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    66
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
    67
	-- Disable all input except [Precise] for the intro
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
    68
	SetInputMask(gmPrecise)
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    69
end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    70
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    71
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    72
function onGameStart()
11521
dc36fad455f4 add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents: 11262
diff changeset
    73
    cinematic = true
dc36fad455f4 add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents: 11262
diff changeset
    74
    SetCinematicMode(true)
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
    75
	SendHealthStatsOff()
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    76
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
    77
	ShowMission(loc("That Sinking Feeling"), loc("Challenge"), loc("Save as many hapless hogs as possible!"), 4, 1)
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    78
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    79
	HogTurnLeft(hh[0], false)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    80
	HogTurnLeft(hh[1], true)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    81
12933
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12346
diff changeset
    82
	SpawnSupplyCrate(148,265,amLowGravity)
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12346
diff changeset
    83
	SpawnSupplyCrate(2124,1516,amJetpack)
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    84
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    85
end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    86
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    87
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    88
function onNewTurn()
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    89
	TurnTimeLeft = -1
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    90
end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    91
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    92
function onGameTick()
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    93
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    94
	-- intro sequence
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    95
	if introStage < 100 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    96
5823
mikade
parents: 5278
diff changeset
    97
		frig = frig + 1
mikade
parents: 5278
diff changeset
    98
		if frig == 50 then
mikade
parents: 5278
diff changeset
    99
			frig = 0			
mikade
parents: 5278
diff changeset
   100
			AddCaption(loc("Press [Precise] to skip intro"))
mikade
parents: 5278
diff changeset
   101
			if watGear ~= nil then			
mikade
parents: 5278
diff changeset
   102
				FollowGear(watGear)
mikade
parents: 5278
diff changeset
   103
			end
mikade
parents: 5278
diff changeset
   104
		end
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   105
5823
mikade
parents: 5278
diff changeset
   106
		
mikade
parents: 5278
diff changeset
   107
		--AddCaption(loc("Press [Precise] to skip intro"))
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   108
		genCounter = genCounter + 1
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   109
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   110
		if introStage == 0 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   111
5823
mikade
parents: 5278
diff changeset
   112
						
mikade
parents: 5278
diff changeset
   113
			--FollowGear(hh[0])
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   114
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   115
			if genCounter == 2000 then
5823
mikade
parents: 5278
diff changeset
   116
				watGear = hh[0]
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   117
				HogSay(hh[0], loc("This rain is really something..."), SAY_SAY,2)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   118
			elseif genCounter == 5000 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   119
				introStage = 1
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   120
				genCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   121
			end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   122
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   123
		elseif introStage == 1 then
5823
mikade
parents: 5278
diff changeset
   124
						
mikade
parents: 5278
diff changeset
   125
			--FollowGear(hh[1])
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   126
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   127
			if genCounter == 2000 then
5823
mikade
parents: 5278
diff changeset
   128
				watGear = hh[1]
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   129
				HogSay(hh[1], loc("Heh, it's not that bad."), SAY_SAY,2)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   130
			elseif genCounter == 5000 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   131
				introStage = 2
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   132
				genCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   133
			end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   134
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   135
		elseif introStage == 2 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   136
5823
mikade
parents: 5278
diff changeset
   137
			--FollowGear(hh[0])
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   138
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   139
			if genCounter == 2000 then
5823
mikade
parents: 5278
diff changeset
   140
				watGear = hh[0]
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   141
				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
   142
			elseif genCounter == 6000 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   143
				introStage = 3
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   144
				genCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   145
			end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   146
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   147
		elseif introStage == 3 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   148
5823
mikade
parents: 5278
diff changeset
   149
			--FollowGear(hh[1])
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   150
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   151
			if genCounter == 2000 then
5823
mikade
parents: 5278
diff changeset
   152
				watGear = hh[1]
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   153
				HogSay(hh[1], loc("Haha, now THAT would be something!"), SAY_SAY,2)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   154
			elseif genCounter == 6000 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   155
				introStage = 4
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   156
				genCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   157
			end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   158
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   159
		elseif introStage == 4 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   160
5823
mikade
parents: 5278
diff changeset
   161
			--FollowGear(hh[0])
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   162
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   163
			if genCounter == 2000 then
5823
mikade
parents: 5278
diff changeset
   164
				watGear = hh[0]
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   165
				HogSay(hh[0], loc("Hahahaha!"), SAY_SHOUT,2)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   166
				HogSay(hh[1], loc("Hahahaha!"), SAY_SHOUT,2)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   167
			elseif genCounter == 3000 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   168
				introStage = 5
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   169
				genCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   170
			end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   171
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   172
		elseif introStage == 5 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   173
5823
mikade
parents: 5278
diff changeset
   174
			--FollowGear(hh[1])
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   175
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   176
			if genCounter == 2000 then
5823
mikade
parents: 5278
diff changeset
   177
				watGear = hh[1]
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   178
				HogSay(hh[0], loc("..."), SAY_THINK,2)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   179
				HogSay(hh[1], loc("..."), SAY_THINK,2)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   180
			elseif genCounter == 5000 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   181
				introStage = 6
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   182
				genCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   183
			end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   184
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   185
		elseif introStage == 6 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   186
5823
mikade
parents: 5278
diff changeset
   187
			--FollowGear(hh[0])
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   188
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   189
			if genCounter == 2000 then
5823
mikade
parents: 5278
diff changeset
   190
				watGear = hh[0]
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   191
				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
   192
			elseif genCounter == 6000 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   193
				introStage = 7
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   194
				genCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   195
			end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   196
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   197
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   198
		elseif introStage == 7 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   199
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   200
			if genCounter == 2000 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   201
				introStage = 110
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   202
				FollowGear(CurrentHedgehog)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   203
				ShowMission(loc("That Sinking Feeling"), loc("User Challenge"), loc("Save as many hapless hogs as possible!"), 4, 0)
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   204
				SetInputMask(0xFFFFFFFF)
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   205
			end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   206
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   207
		end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   208
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
	-- start the water rising when the intro is finished
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   212
	if introStage == 110 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   213
11521
dc36fad455f4 add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents: 11262
diff changeset
   214
        if cinematic then
dc36fad455f4 add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents: 11262
diff changeset
   215
            SetCinematicMode(false)
dc36fad455f4 add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents: 11262
diff changeset
   216
            cinematic = false
dc36fad455f4 add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents: 11262
diff changeset
   217
        end
dc36fad455f4 add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents: 11262
diff changeset
   218
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   219
		waterCounter = waterCounter + 1
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   220
		if (waterCounter == 100) and (waterPix < 1615) then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   221
			waterCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   222
			SetTag(AddGear(0, 0, gtWaterUp, 0, 0, 0, 0), 1)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   223
			waterPix = waterPix +1
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   224
			--AddCaption(waterPix)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   225
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   226
			if (waterPix >= 1615) and (GameOver == false) then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   227
				GameOver = true
11262
6e1aa1144a2b - Finally added rus localization for all User Missions
antonc27 <antonc27@mail.ru>
parents: 11009
diff changeset
   228
				AddCaption(loc("The flood has stopped! Challenge over."))
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   229
				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
   230
				SendStat(siPointType, loc("rescues"))
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   231
				SendStat(siPlayerKills, tostring(hhCount), loc("Nameless Heroes"))
5823
mikade
parents: 5278
diff changeset
   232
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   233
				-- Do not count drowning hedgehogs
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   234
				local hhLeft = hhCount
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   235
				for i=1,#hh do
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   236
					local isDrowning = band(GetState(hh[i]),gstDrowning) ~= 0
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   237
					if isDrowning then
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   238
						hhLeft = hhLeft - 1
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   239
					end
5823
mikade
parents: 5278
diff changeset
   240
				end
mikade
parents: 5278
diff changeset
   241
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   242
				SendStat(siCustomAchievement, string.format(loc("You saved %d of 8 Hapless Hogs."), hhLeft))
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   243
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   244
				if hhLeft == 8 then
13501
cbda0f842364 Standardize hidden mission achievement in new Lua library "Achievements"
Wuzzy <Wuzzy2@mail.ru>
parents: 12933
diff changeset
   245
					awardAchievement(loc("Lively Lifeguard"))
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   246
				end
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   247
				EndGame()
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   248
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   249
			end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   250
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   251
		end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   252
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   253
	end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   254
end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   255
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   256
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   257
function onAmmoStoreInit()
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   258
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   259
	SetAmmo(amBazooka, 9, 0, 0, 0)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   260
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   261
	SetAmmo(amRope, 9, 0, 0, 0)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   262
	SetAmmo(amParachute, 9, 0, 0, 0)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   263
	SetAmmo(amJetpack, 2, 0, 0, 2)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   264
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   265
	SetAmmo(amGirder, 9, 0, 0, 0)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   266
	SetAmmo(amBaseballBat, 9, 0, 0, 0)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   267
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   268
	SetAmmo(amTeleport, 1, 0, 0, 1)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   269
	SetAmmo(amPortalGun, 3, 0, 0, 1)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   270
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   271
	SetAmmo(amLowGravity, 0, 0, 0, 1)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   272
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   273
end
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 onGearDelete(gear)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   276
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   277
	if GetGearType(gear) == gtHedgehog then
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   278
		if GetHogTeamName(gear) == loc("Hapless Hogs") then
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   279
			hhCount = hhCount - 1
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   280
			AddCaption(string.format(loc("%d Hapless Hogs left"), hhCount))
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   281
		end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   282
	end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   283
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   284
	if ((gear == player) or (hhCount == 0)) and (GameOver == false) then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   285
		SetHealth(player, 0)
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   286
		AddCaption(loc("Disqualified!"))
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   287
		if gear == player then
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   288
			SendStat(siCustomAchievement, loc("Your hedgehog died!"))
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   289
			SendStat(siCustomAchievement, loc("You must survive the flood in order to score."))
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   290
		else
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   291
			SendStat(siCustomAchievement, loc("You haven't rescued anyone."))
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   292
		end
12346
fb22caa19600 Fix incorrect PointsType in sniper rifle training and That Sinking Feeling
Wuzzy <almikes@aol.com>
parents: 12344
diff changeset
   293
		SendStat(siPointType, loc("points"))
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   294
		SendStat(siPlayerKills, "0", loc("Nameless Heroes"))
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   295
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   296
		SendStat(siGameResult, loc("Disqualified!"))
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   297
		GameOver = true
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   298
		EndGame()
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
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   301
end