share/hedgewars/Data/Missions/Training/User_Mission_-_That_Sinking_Feeling.lua
author Wuzzy <almikes@aol.com>
Sun, 20 Nov 2016 04:21:24 +0100
changeset 11967 7dd85fe00de3
parent 11521 dc36fad455f4
permissions -rw-r--r--
Fix typo in German campaign translation
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")
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
     4
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
     5
local player
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
     6
local hh = {}
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
     7
local hhCount = 8
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
     8
local GameOver = false
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
     9
local introStage = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    10
local genCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    11
local waterCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    12
local waterPix = 0
5823
mikade
parents: 5278
diff changeset
    13
local frig = 0
mikade
parents: 5278
diff changeset
    14
local watGear = nil
11521
dc36fad455f4 add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents: 11262
diff changeset
    15
local cinematic = false
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    16
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    17
-- allow skipping of the intro via hitting precise key
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    18
function onPrecise()
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    19
	if introStage < 100 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    20
		introStage = 110
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    21
		genCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    22
		FollowGear(CurrentHedgehog)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    23
		AddCaption(loc("Good luck out there!"))
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
    24
		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
    25
		SetInputMask(0xFFFFFFFF)
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    26
	end
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
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    29
function onGameInit()
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    30
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    31
	Seed = 0
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
    32
	GameFlags = gfInfAttack + gfInvulnerable + gfOneClanMode
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    33
	TurnTime = 90000
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    34
	CaseFreq = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    35
	MinesNum = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    36
	MinesTime  = 3000
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    37
	Explosives = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    38
	Delay = 10
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    39
	Map = "Islands"
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    40
	Theme = "City"
5823
mikade
parents: 5278
diff changeset
    41
	SuddenDeathTurns = 1
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    42
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
    43
	AddTeam(loc("Hapless Hogs"), 14483456, "Simple", "Island", "Default")
5823
mikade
parents: 5278
diff changeset
    44
	hh[0] = AddHog(loc("Sinky"), 1, 100, "fr_lemon")
mikade
parents: 5278
diff changeset
    45
	hh[1] = AddHog(loc("Drowner"), 1, 100, "fr_orange")
mikade
parents: 5278
diff changeset
    46
	hh[2] = AddHog(loc("Heavy"), 1, 100, "dish_Teapot")
mikade
parents: 5278
diff changeset
    47
	hh[3] = AddHog(loc("Clumsy"), 1, 100, "dish_SauceBoatSilver")
mikade
parents: 5278
diff changeset
    48
	hh[4] = AddHog(loc("Silly"), 1, 100, "dish_Ladle")
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    49
	hh[5] = AddHog(loc("Careless"), 1, 100, "StrawHatEyes")
5823
mikade
parents: 5278
diff changeset
    50
	hh[6] = AddHog(loc("Sponge"), 1, 100, "sf_chunli")
mikade
parents: 5278
diff changeset
    51
	hh[7] = AddHog(loc("Deadweight"), 1, 100, "dish_Teacup")
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    52
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
    53
	AddTeam(loc("Nameless Heroes"), 14483456, "Simple", "Island", "Default", "cm_crossedswords")
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
    54
	player = AddHog(loc("The Nameless One"), 0, 1, "NoHat")
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
    55
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    56
	SetGearPosition(player, 3992, 733)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    57
	SetGearPosition(hh[0], 938, 1369)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    58
	SetGearPosition(hh[1], 1301, 1439)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    59
	SetGearPosition(hh[2], 2093, 447)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    60
	SetGearPosition(hh[3], 2971, 926)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    61
	SetGearPosition(hh[4], 719, 545)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    62
	SetGearPosition(hh[5], 1630, 821)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    63
	SetGearPosition(hh[6], 2191, 810)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    64
	SetGearPosition(hh[7], 3799, 945)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    65
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
    66
	-- Disable all input except [Precise] for the intro
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
    67
	SetInputMask(gmPrecise)
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    68
end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    69
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    70
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    71
function onGameStart()
11521
dc36fad455f4 add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents: 11262
diff changeset
    72
    cinematic = true
dc36fad455f4 add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents: 11262
diff changeset
    73
    SetCinematicMode(true)
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
    74
	SendHealthStatsOff()
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    75
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
    76
	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
    77
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    78
	HogTurnLeft(hh[0], false)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    79
	HogTurnLeft(hh[1], true)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    80
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    81
	SpawnUtilityCrate(148,265,amLowGravity)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    82
	SpawnUtilityCrate(2124,1516,amJetpack)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    83
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    84
end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    85
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    86
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    87
function onNewTurn()
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    88
	TurnTimeLeft = -1
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    89
end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    90
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    91
function onGameTick()
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    92
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    93
	-- intro sequence
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    94
	if introStage < 100 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
    95
5823
mikade
parents: 5278
diff changeset
    96
		frig = frig + 1
mikade
parents: 5278
diff changeset
    97
		if frig == 50 then
mikade
parents: 5278
diff changeset
    98
			frig = 0			
mikade
parents: 5278
diff changeset
    99
			AddCaption(loc("Press [Precise] to skip intro"))
mikade
parents: 5278
diff changeset
   100
			if watGear ~= nil then			
mikade
parents: 5278
diff changeset
   101
				FollowGear(watGear)
mikade
parents: 5278
diff changeset
   102
			end
mikade
parents: 5278
diff changeset
   103
		end
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   104
5823
mikade
parents: 5278
diff changeset
   105
		
mikade
parents: 5278
diff changeset
   106
		--AddCaption(loc("Press [Precise] to skip intro"))
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   107
		genCounter = genCounter + 1
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   108
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   109
		if introStage == 0 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   110
5823
mikade
parents: 5278
diff changeset
   111
						
mikade
parents: 5278
diff changeset
   112
			--FollowGear(hh[0])
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   113
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   114
			if genCounter == 2000 then
5823
mikade
parents: 5278
diff changeset
   115
				watGear = hh[0]
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   116
				HogSay(hh[0], loc("This rain is really something..."), SAY_SAY,2)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   117
			elseif genCounter == 5000 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   118
				introStage = 1
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   119
				genCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   120
			end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   121
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   122
		elseif introStage == 1 then
5823
mikade
parents: 5278
diff changeset
   123
						
mikade
parents: 5278
diff changeset
   124
			--FollowGear(hh[1])
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   125
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   126
			if genCounter == 2000 then
5823
mikade
parents: 5278
diff changeset
   127
				watGear = hh[1]
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   128
				HogSay(hh[1], loc("Heh, it's not that bad."), SAY_SAY,2)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   129
			elseif genCounter == 5000 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   130
				introStage = 2
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   131
				genCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   132
			end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   133
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   134
		elseif introStage == 2 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   135
5823
mikade
parents: 5278
diff changeset
   136
			--FollowGear(hh[0])
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   137
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   138
			if genCounter == 2000 then
5823
mikade
parents: 5278
diff changeset
   139
				watGear = hh[0]
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   140
				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
   141
			elseif genCounter == 6000 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   142
				introStage = 3
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   143
				genCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   144
			end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   145
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   146
		elseif introStage == 3 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   147
5823
mikade
parents: 5278
diff changeset
   148
			--FollowGear(hh[1])
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   149
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   150
			if genCounter == 2000 then
5823
mikade
parents: 5278
diff changeset
   151
				watGear = hh[1]
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   152
				HogSay(hh[1], loc("Haha, now THAT would be something!"), SAY_SAY,2)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   153
			elseif genCounter == 6000 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   154
				introStage = 4
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   155
				genCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   156
			end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   157
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   158
		elseif introStage == 4 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   159
5823
mikade
parents: 5278
diff changeset
   160
			--FollowGear(hh[0])
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   161
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   162
			if genCounter == 2000 then
5823
mikade
parents: 5278
diff changeset
   163
				watGear = hh[0]
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   164
				HogSay(hh[0], loc("Hahahaha!"), SAY_SHOUT,2)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   165
				HogSay(hh[1], loc("Hahahaha!"), SAY_SHOUT,2)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   166
			elseif genCounter == 3000 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   167
				introStage = 5
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   168
				genCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   169
			end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   170
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   171
		elseif introStage == 5 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   172
5823
mikade
parents: 5278
diff changeset
   173
			--FollowGear(hh[1])
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   174
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   175
			if genCounter == 2000 then
5823
mikade
parents: 5278
diff changeset
   176
				watGear = hh[1]
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   177
				HogSay(hh[0], loc("..."), SAY_THINK,2)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   178
				HogSay(hh[1], loc("..."), SAY_THINK,2)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   179
			elseif genCounter == 5000 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   180
				introStage = 6
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   181
				genCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   182
			end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   183
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   184
		elseif introStage == 6 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   185
5823
mikade
parents: 5278
diff changeset
   186
			--FollowGear(hh[0])
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   187
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   188
			if genCounter == 2000 then
5823
mikade
parents: 5278
diff changeset
   189
				watGear = hh[0]
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   190
				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
   191
			elseif genCounter == 6000 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   192
				introStage = 7
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   193
				genCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   194
			end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   195
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   196
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   197
		elseif introStage == 7 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   198
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   199
			if genCounter == 2000 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   200
				introStage = 110
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   201
				FollowGear(CurrentHedgehog)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   202
				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
   203
				SetInputMask(0xFFFFFFFF)
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   204
			end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   205
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   206
		end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   207
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   208
	end
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   209
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   210
	-- start the water rising when the intro is finished
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   211
	if introStage == 110 then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   212
11521
dc36fad455f4 add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents: 11262
diff changeset
   213
        if cinematic then
dc36fad455f4 add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents: 11262
diff changeset
   214
            SetCinematicMode(false)
dc36fad455f4 add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents: 11262
diff changeset
   215
            cinematic = false
dc36fad455f4 add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents: 11262
diff changeset
   216
        end
dc36fad455f4 add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents: 11262
diff changeset
   217
5278
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   218
		waterCounter = waterCounter + 1
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   219
		if (waterCounter == 100) and (waterPix < 1615) then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   220
			waterCounter = 0
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   221
			SetTag(AddGear(0, 0, gtWaterUp, 0, 0, 0, 0), 1)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   222
			waterPix = waterPix +1
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   223
			--AddCaption(waterPix)
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   224
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   225
			if (waterPix >= 1615) and (GameOver == false) then
1aadb3312828 New User Mission: That Sinking Feeling
mikade
parents:
diff changeset
   226
				GameOver = true
11262
6e1aa1144a2b - Finally added rus localization for all User Missions
antonc27 <antonc27@mail.ru>
parents: 11009
diff changeset
   227
				AddCaption(loc("The flood has stopped! Challenge over."))
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   228
				SendStat(siGameResult, loc("Challenge completed!"))
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   229
				SendStat(siPlayerKills, tostring(hhCount), loc("Nameless Heroes"))
11262
6e1aa1144a2b - Finally added rus localization for all User Missions
antonc27 <antonc27@mail.ru>
parents: 11009
diff changeset
   230
				SendStat(siPointType, loc("rescues"))
5823
mikade
parents: 5278
diff changeset
   231
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   232
				-- Do not count drowning hedgehogs
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   233
				local hhLeft = hhCount
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   234
				for i=1,#hh do
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   235
					local isDrowning = band(GetState(hh[i]),gstDrowning) ~= 0
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   236
					if isDrowning then
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   237
						hhLeft = hhLeft - 1
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   238
					end
5823
mikade
parents: 5278
diff changeset
   239
				end
mikade
parents: 5278
diff changeset
   240
11009
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   241
				SendStat(siCustomAchievement, string.format(loc("You saved %d of 8 Hapless Hogs."), hhLeft))
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   242
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   243
				if hhLeft == 8 then
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   244
					AddCaption(loc("Achievement obtained: Lively Lifeguard"),0xffba00ff,capgrpMessage2)
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   245
					SendStat(siCustomAchievement, loc("You have obtained an achievement: Lively Lifeguard"))
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
5b37f240edf8 update for "that sinking feeling"
wuzzy
parents: 8043
diff changeset
   293
		SendStat(siPlayerKills, "0", loc("Nameless Heroes"))
11262
6e1aa1144a2b - Finally added rus localization for all User Missions
antonc27 <antonc27@mail.ru>
parents: 11009
diff changeset
   294
		SendStat(siPointType, loc("points"))
11009
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