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