share/hedgewars/Data/Missions/Training/Shotgun Training.lua
author koda
Thu, 01 Apr 2010 00:21:00 +0000
changeset 3223 f0e590790f3b
parent 3080 b7fa8ad60e3b
permissions -rw-r--r--
credits updated, adding Palewolf, sheepluva and prg as devs and replaced my previous openal stuff with something more current fixed diglett hat szczur updated locale
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3011
73c8f618fd8b General:
smxx
parents:
diff changeset
     1
-- Hedgewars Shotgun Training
73c8f618fd8b General:
smxx
parents:
diff changeset
     2
-- Scripting Example
73c8f618fd8b General:
smxx
parents:
diff changeset
     3
73c8f618fd8b General:
smxx
parents:
diff changeset
     4
-- Lines such as this one are comments - they are ignored
73c8f618fd8b General:
smxx
parents:
diff changeset
     5
-- by the game, no matter what kind of text is in there.
73c8f618fd8b General:
smxx
parents:
diff changeset
     6
-- It's also possible to place a comment after some real
73c8f618fd8b General:
smxx
parents:
diff changeset
     7
-- instruction as you see below. In short, everything
73c8f618fd8b General:
smxx
parents:
diff changeset
     8
-- following "--" is ignored.
73c8f618fd8b General:
smxx
parents:
diff changeset
     9
73c8f618fd8b General:
smxx
parents:
diff changeset
    10
---------------------------------------------------------------
73c8f618fd8b General:
smxx
parents:
diff changeset
    11
-- At first we put all text we'd like to use in some arrays.
73c8f618fd8b General:
smxx
parents:
diff changeset
    12
-- This way we're able to localize the text to be shown without
73c8f618fd8b General:
smxx
parents:
diff changeset
    13
-- modifying other files.
73c8f618fd8b General:
smxx
parents:
diff changeset
    14
-- The language to be used is stored in the global variable
73c8f618fd8b General:
smxx
parents:
diff changeset
    15
-- 'L' that is set by the game (string).
73c8f618fd8b General:
smxx
parents:
diff changeset
    16
-- Text may then be accessed using "arrayname[L]".
73c8f618fd8b General:
smxx
parents:
diff changeset
    17
73c8f618fd8b General:
smxx
parents:
diff changeset
    18
local caption = {
73c8f618fd8b General:
smxx
parents:
diff changeset
    19
	["en"] = "Bazooka Training",
3013
dfc1f16aeb53 General:
smxx
parents: 3011
diff changeset
    20
	["de"] = "Bazooka-Training",
3223
f0e590790f3b credits updated, adding Palewolf, sheepluva and prg as devs and replaced my previous openal stuff with something more current
koda
parents: 3080
diff changeset
    21
	["es"] = "Entrenamiento con escopeta",
f0e590790f3b credits updated, adding Palewolf, sheepluva and prg as devs and replaced my previous openal stuff with something more current
koda
parents: 3080
diff changeset
    22
	["pl"] = "Trening strzelecki",
3011
73c8f618fd8b General:
smxx
parents:
diff changeset
    23
	-- To add other languages, just add lines similar to the
73c8f618fd8b General:
smxx
parents:
diff changeset
    24
	-- existing ones - don't forget the trailing ","!
73c8f618fd8b General:
smxx
parents:
diff changeset
    25
	}
73c8f618fd8b General:
smxx
parents:
diff changeset
    26
73c8f618fd8b General:
smxx
parents:
diff changeset
    27
local subcaption = {
73c8f618fd8b General:
smxx
parents:
diff changeset
    28
	["en"] = "Aiming Practice",
3013
dfc1f16aeb53 General:
smxx
parents: 3011
diff changeset
    29
	["de"] = "Zielübung",
3223
f0e590790f3b credits updated, adding Palewolf, sheepluva and prg as devs and replaced my previous openal stuff with something more current
koda
parents: 3080
diff changeset
    30
	["es"] = "Practica tu puntería",
f0e590790f3b credits updated, adding Palewolf, sheepluva and prg as devs and replaced my previous openal stuff with something more current
koda
parents: 3080
diff changeset
    31
	["pl"] = "Potrenuj celność"
3011
73c8f618fd8b General:
smxx
parents:
diff changeset
    32
	}
73c8f618fd8b General:
smxx
parents:
diff changeset
    33
73c8f618fd8b General:
smxx
parents:
diff changeset
    34
local goal = {
73c8f618fd8b General:
smxx
parents:
diff changeset
    35
	["en"] = "Eliminate all targets before your time runs out.|You have unlimited ammo for this mission.",
3013
dfc1f16aeb53 General:
smxx
parents: 3011
diff changeset
    36
	["de"] = "Eliminiere alle Ziele bevor die Zeit ausläuft.|Du hast in dieser Mission unbegrenzte Munition.",
3223
f0e590790f3b credits updated, adding Palewolf, sheepluva and prg as devs and replaced my previous openal stuff with something more current
koda
parents: 3080
diff changeset
    37
	["es"] = "Destruye todos los objetivos antes de que se agote el tiempo.|La munición en esta misión es ilimitada.",
f0e590790f3b credits updated, adding Palewolf, sheepluva and prg as devs and replaced my previous openal stuff with something more current
koda
parents: 3080
diff changeset
    38
	["pl"] = "Zniszcz wszystkie cele zanim upłynie czas.|W tej misji masz nieskończoną ilość amunicji."
3011
73c8f618fd8b General:
smxx
parents:
diff changeset
    39
	}
73c8f618fd8b General:
smxx
parents:
diff changeset
    40
73c8f618fd8b General:
smxx
parents:
diff changeset
    41
local timeout = {
73c8f618fd8b General:
smxx
parents:
diff changeset
    42
	["en"] = "Oh no! Time's up! Just try again.",
3013
dfc1f16aeb53 General:
smxx
parents: 3011
diff changeset
    43
	["de"] = "Oh nein! Die Zeit ist um! Versuche es nochmal.",
3223
f0e590790f3b credits updated, adding Palewolf, sheepluva and prg as devs and replaced my previous openal stuff with something more current
koda
parents: 3080
diff changeset
    44
	["es"] = "¡Oh, no, se te acabó el tiempo! ¿Por qué no lo intentas de nuevo?",
f0e590790f3b credits updated, adding Palewolf, sheepluva and prg as devs and replaced my previous openal stuff with something more current
koda
parents: 3080
diff changeset
    45
	["pl"] = "Ajajaj! Koniec czasu! Spróbuj jeszcze raz."
3011
73c8f618fd8b General:
smxx
parents:
diff changeset
    46
	}
73c8f618fd8b General:
smxx
parents:
diff changeset
    47
73c8f618fd8b General:
smxx
parents:
diff changeset
    48
local success = {
73c8f618fd8b General:
smxx
parents:
diff changeset
    49
	["en"] = "Congratulations! You've eliminated all targets|within the allowed time frame.",
3013
dfc1f16aeb53 General:
smxx
parents: 3011
diff changeset
    50
	["de"] = "Gratulation! Du hast alle Ziele innerhalb der|verfügbaren Zeit ausgeschaltet.",
3223
f0e590790f3b credits updated, adding Palewolf, sheepluva and prg as devs and replaced my previous openal stuff with something more current
koda
parents: 3080
diff changeset
    51
	["es"] = "¡Felicidades! Has destruido todos los objectivos|dentro del tiempo establecido.",
f0e590790f3b credits updated, adding Palewolf, sheepluva and prg as devs and replaced my previous openal stuff with something more current
koda
parents: 3080
diff changeset
    52
	["pl"] = "Gratulacje! Zniszczyłeś przed czasem wszystkie cele."
3011
73c8f618fd8b General:
smxx
parents:
diff changeset
    53
	}
73c8f618fd8b General:
smxx
parents:
diff changeset
    54
73c8f618fd8b General:
smxx
parents:
diff changeset
    55
local teamname = {
73c8f618fd8b General:
smxx
parents:
diff changeset
    56
	["en"] = "Shotgun Team",
3013
dfc1f16aeb53 General:
smxx
parents: 3011
diff changeset
    57
	["de"] = "Die Knalltüten",
3223
f0e590790f3b credits updated, adding Palewolf, sheepluva and prg as devs and replaced my previous openal stuff with something more current
koda
parents: 3080
diff changeset
    58
	["es"] = "Escopeteros",
f0e590790f3b credits updated, adding Palewolf, sheepluva and prg as devs and replaced my previous openal stuff with something more current
koda
parents: 3080
diff changeset
    59
	["pl"] = "Shotgun Team",
3011
73c8f618fd8b General:
smxx
parents:
diff changeset
    60
	}
73c8f618fd8b General:
smxx
parents:
diff changeset
    61
73c8f618fd8b General:
smxx
parents:
diff changeset
    62
local hogname = {
73c8f618fd8b General:
smxx
parents:
diff changeset
    63
	["en"] = "Hunter",
3013
dfc1f16aeb53 General:
smxx
parents: 3011
diff changeset
    64
	["de"] = "Jäger",
3223
f0e590790f3b credits updated, adding Palewolf, sheepluva and prg as devs and replaced my previous openal stuff with something more current
koda
parents: 3080
diff changeset
    65
	["es"] = "Cazador",
f0e590790f3b credits updated, adding Palewolf, sheepluva and prg as devs and replaced my previous openal stuff with something more current
koda
parents: 3080
diff changeset
    66
	["en"] = "Strzelec",
3011
73c8f618fd8b General:
smxx
parents:
diff changeset
    67
	}
73c8f618fd8b General:
smxx
parents:
diff changeset
    68
73c8f618fd8b General:
smxx
parents:
diff changeset
    69
-- To handle missing texts we define a small wrapper function that
73c8f618fd8b General:
smxx
parents:
diff changeset
    70
-- we'll use to retrieve text.
73c8f618fd8b General:
smxx
parents:
diff changeset
    71
local function loc(text)
73c8f618fd8b General:
smxx
parents:
diff changeset
    72
	if text == nil then return "**missing**"
73c8f618fd8b General:
smxx
parents:
diff changeset
    73
	elseif text[L] == nil then return text["en"]
73c8f618fd8b General:
smxx
parents:
diff changeset
    74
	else return text[L]
73c8f618fd8b General:
smxx
parents:
diff changeset
    75
	end
73c8f618fd8b General:
smxx
parents:
diff changeset
    76
end
73c8f618fd8b General:
smxx
parents:
diff changeset
    77
73c8f618fd8b General:
smxx
parents:
diff changeset
    78
---------------------------------------------------------------
73c8f618fd8b General:
smxx
parents:
diff changeset
    79
73c8f618fd8b General:
smxx
parents:
diff changeset
    80
-- This variable will hold the number of destroyed targets.
73c8f618fd8b General:
smxx
parents:
diff changeset
    81
local score = 0
73c8f618fd8b General:
smxx
parents:
diff changeset
    82
-- This variable represents the number of targets to destroy.
73c8f618fd8b General:
smxx
parents:
diff changeset
    83
local score_goal = 5
73c8f618fd8b General:
smxx
parents:
diff changeset
    84
-- This variable controls how many milliseconds/ticks we'd
73c8f618fd8b General:
smxx
parents:
diff changeset
    85
-- like to wait before we end the round once all targets
73c8f618fd8b General:
smxx
parents:
diff changeset
    86
-- have been destroyed.
73c8f618fd8b General:
smxx
parents:
diff changeset
    87
local end_timer = 5000 -- 5000 ms = 5 s
73c8f618fd8b General:
smxx
parents:
diff changeset
    88
-- This variable is set to true if the game is lost (i.e.
73c8f618fd8b General:
smxx
parents:
diff changeset
    89
-- time runs out).
73c8f618fd8b General:
smxx
parents:
diff changeset
    90
local game_lost = false
73c8f618fd8b General:
smxx
parents:
diff changeset
    91
-- This variable will point to the hog's gear
73c8f618fd8b General:
smxx
parents:
diff changeset
    92
local player = nil
73c8f618fd8b General:
smxx
parents:
diff changeset
    93
-- This variable will grab the time left at the end of the round
73c8f618fd8b General:
smxx
parents:
diff changeset
    94
local time_goal = 0
73c8f618fd8b General:
smxx
parents:
diff changeset
    95
73c8f618fd8b General:
smxx
parents:
diff changeset
    96
-- This is a custom function to make it easier to
73c8f618fd8b General:
smxx
parents:
diff changeset
    97
-- spawn more targets with just one line of code
73c8f618fd8b General:
smxx
parents:
diff changeset
    98
-- You may define as many custom functions as you
73c8f618fd8b General:
smxx
parents:
diff changeset
    99
-- like.
73c8f618fd8b General:
smxx
parents:
diff changeset
   100
function spawnTarget()
73c8f618fd8b General:
smxx
parents:
diff changeset
   101
	-- add a new target gear
73c8f618fd8b General:
smxx
parents:
diff changeset
   102
	gear = AddGear(0, 0, gtTarget, 0, 0, 0, 0)
73c8f618fd8b General:
smxx
parents:
diff changeset
   103
	
73c8f618fd8b General:
smxx
parents:
diff changeset
   104
	-- move it to a random position within 0 and
73c8f618fd8b General:
smxx
parents:
diff changeset
   105
	-- LAND_WIDTH - the width of the map
73c8f618fd8b General:
smxx
parents:
diff changeset
   106
	FindPlace(gear, true, 0, LAND_WIDTH)
73c8f618fd8b General:
smxx
parents:
diff changeset
   107
	
73c8f618fd8b General:
smxx
parents:
diff changeset
   108
	-- move the target to a higher vertical position
73c8f618fd8b General:
smxx
parents:
diff changeset
   109
	-- to ensure it's not somewhere down below
73c8f618fd8b General:
smxx
parents:
diff changeset
   110
	x, y = GetGearPosition(gear)
73c8f618fd8b General:
smxx
parents:
diff changeset
   111
	SetGearPosition(gear, x, 500)
73c8f618fd8b General:
smxx
parents:
diff changeset
   112
end
73c8f618fd8b General:
smxx
parents:
diff changeset
   113
73c8f618fd8b General:
smxx
parents:
diff changeset
   114
-- This function is called before the game loads its
73c8f618fd8b General:
smxx
parents:
diff changeset
   115
-- resources.
73c8f618fd8b General:
smxx
parents:
diff changeset
   116
-- It's one of the predefined function names that will
73c8f618fd8b General:
smxx
parents:
diff changeset
   117
-- be called by the game. They give you entry points
73c8f618fd8b General:
smxx
parents:
diff changeset
   118
-- where you're able to call your own code using either
73c8f618fd8b General:
smxx
parents:
diff changeset
   119
-- provided instructions or custom functions.
73c8f618fd8b General:
smxx
parents:
diff changeset
   120
function onGameInit()
73c8f618fd8b General:
smxx
parents:
diff changeset
   121
	-- At first we have to overwrite/set some global variables
73c8f618fd8b General:
smxx
parents:
diff changeset
   122
	-- that define the map, the game has to load, as well as
73c8f618fd8b General:
smxx
parents:
diff changeset
   123
	-- other things such as the game rules to use, etc.
73c8f618fd8b General:
smxx
parents:
diff changeset
   124
	-- Things we don't modify here will use their default values.
73c8f618fd8b General:
smxx
parents:
diff changeset
   125
73c8f618fd8b General:
smxx
parents:
diff changeset
   126
	-- The base number for the random number generator
73c8f618fd8b General:
smxx
parents:
diff changeset
   127
	Seed = 0
73c8f618fd8b General:
smxx
parents:
diff changeset
   128
	-- Game settings and rules
73c8f618fd8b General:
smxx
parents:
diff changeset
   129
	GameFlags = gfMultiWeapon + gfOneClanMode
73c8f618fd8b General:
smxx
parents:
diff changeset
   130
	-- The time the player has to move each round (in ms)
73c8f618fd8b General:
smxx
parents:
diff changeset
   131
	TurnTime = 25000
73c8f618fd8b General:
smxx
parents:
diff changeset
   132
	-- The frequency of crate drops
73c8f618fd8b General:
smxx
parents:
diff changeset
   133
	CaseFreq = 0
73c8f618fd8b General:
smxx
parents:
diff changeset
   134
	-- The number of mines being placed
73c8f618fd8b General:
smxx
parents:
diff changeset
   135
	LandAdds = 0
73c8f618fd8b General:
smxx
parents:
diff changeset
   136
	-- The number of explosives being placed
73c8f618fd8b General:
smxx
parents:
diff changeset
   137
	Explosives = 0
73c8f618fd8b General:
smxx
parents:
diff changeset
   138
	-- The delay between each round
73c8f618fd8b General:
smxx
parents:
diff changeset
   139
	Delay = 0
73c8f618fd8b General:
smxx
parents:
diff changeset
   140
	-- The map to be played
3080
b7fa8ad60e3b Engine:
smxx
parents: 3013
diff changeset
   141
	Map = "Mushrooms"
3011
73c8f618fd8b General:
smxx
parents:
diff changeset
   142
	-- The theme to be used
3080
b7fa8ad60e3b Engine:
smxx
parents: 3013
diff changeset
   143
	Theme = "Nature"
3011
73c8f618fd8b General:
smxx
parents:
diff changeset
   144
73c8f618fd8b General:
smxx
parents:
diff changeset
   145
	-- Create the player team
73c8f618fd8b General:
smxx
parents:
diff changeset
   146
	AddTeam(loc(teamname), 14483456, "Simple", "Island", "Default")
73c8f618fd8b General:
smxx
parents:
diff changeset
   147
	-- And add a hog to it
73c8f618fd8b General:
smxx
parents:
diff changeset
   148
	player = AddHog(loc(hogname), 0, 1, "NoHat")
73c8f618fd8b General:
smxx
parents:
diff changeset
   149
	SetGearPosition(player, 2334, 1254);
73c8f618fd8b General:
smxx
parents:
diff changeset
   150
end
73c8f618fd8b General:
smxx
parents:
diff changeset
   151
73c8f618fd8b General:
smxx
parents:
diff changeset
   152
-- This function is called when the round starts
73c8f618fd8b General:
smxx
parents:
diff changeset
   153
-- it spawns the first target that has to be destroyed.
73c8f618fd8b General:
smxx
parents:
diff changeset
   154
-- In addition it shows the scenario goal(s).
73c8f618fd8b General:
smxx
parents:
diff changeset
   155
function onGameStart()
73c8f618fd8b General:
smxx
parents:
diff changeset
   156
	-- Spawn the first target.
73c8f618fd8b General:
smxx
parents:
diff changeset
   157
	spawnTarget()
73c8f618fd8b General:
smxx
parents:
diff changeset
   158
	
73c8f618fd8b General:
smxx
parents:
diff changeset
   159
	-- Show some nice mission goals.
73c8f618fd8b General:
smxx
parents:
diff changeset
   160
	-- Parameters are: caption, sub caption, description,
73c8f618fd8b General:
smxx
parents:
diff changeset
   161
	-- extra text, icon and time to show.
73c8f618fd8b General:
smxx
parents:
diff changeset
   162
	-- A negative icon parameter (-n) represents the n-th weapon icon
73c8f618fd8b General:
smxx
parents:
diff changeset
   163
	-- A positive icon paramter (n) represents the (n+1)-th mission icon
73c8f618fd8b General:
smxx
parents:
diff changeset
   164
	-- A timeframe of 0 is replaced with the default time to show.
73c8f618fd8b General:
smxx
parents:
diff changeset
   165
	ShowMission(loc(caption), loc(subcaption), loc(goal), -amShotgun, 0);
73c8f618fd8b General:
smxx
parents:
diff changeset
   166
end
73c8f618fd8b General:
smxx
parents:
diff changeset
   167
73c8f618fd8b General:
smxx
parents:
diff changeset
   168
-- This function is called every game tick.
73c8f618fd8b General:
smxx
parents:
diff changeset
   169
-- Note that there are 1000 ticks within one second.
73c8f618fd8b General:
smxx
parents:
diff changeset
   170
-- You shouldn't try to calculate too complicated
73c8f618fd8b General:
smxx
parents:
diff changeset
   171
-- code here as this might slow down your game.
73c8f618fd8b General:
smxx
parents:
diff changeset
   172
function onGameTick()
73c8f618fd8b General:
smxx
parents:
diff changeset
   173
	-- If time's up, set the game to be lost.
73c8f618fd8b General:
smxx
parents:
diff changeset
   174
	-- We actually check the time to be "1 ms" as it
73c8f618fd8b General:
smxx
parents:
diff changeset
   175
	-- will be at "0 ms" right at the start of the game.
73c8f618fd8b General:
smxx
parents:
diff changeset
   176
	if TurnTimeLeft == 1 and score < score_goal then
73c8f618fd8b General:
smxx
parents:
diff changeset
   177
		game_lost = true
73c8f618fd8b General:
smxx
parents:
diff changeset
   178
		-- ... and show a short message.
73c8f618fd8b General:
smxx
parents:
diff changeset
   179
		ShowMission(loc(caption), loc(subcaption), loc(timeout), -amSkip, 0);
73c8f618fd8b General:
smxx
parents:
diff changeset
   180
		-- How about killing our poor hog due to his poor performance?
73c8f618fd8b General:
smxx
parents:
diff changeset
   181
		SetHealth(player, 0);
73c8f618fd8b General:
smxx
parents:
diff changeset
   182
		-- Just to be sure set the goal time to 1 ms
73c8f618fd8b General:
smxx
parents:
diff changeset
   183
		time_goal = 1
73c8f618fd8b General:
smxx
parents:
diff changeset
   184
	end
73c8f618fd8b General:
smxx
parents:
diff changeset
   185
	-- If the goal is reached or we've lost ...
73c8f618fd8b General:
smxx
parents:
diff changeset
   186
	if score == score_goal or game_lost then
73c8f618fd8b General:
smxx
parents:
diff changeset
   187
		-- ... check to see if the time we'd like to
73c8f618fd8b General:
smxx
parents:
diff changeset
   188
		-- wait has passed and then ...
73c8f618fd8b General:
smxx
parents:
diff changeset
   189
		if end_timer == 0 then
73c8f618fd8b General:
smxx
parents:
diff changeset
   190
			-- ... end the game ...
73c8f618fd8b General:
smxx
parents:
diff changeset
   191
			EndGame()
73c8f618fd8b General:
smxx
parents:
diff changeset
   192
		else
73c8f618fd8b General:
smxx
parents:
diff changeset
   193
			-- ... or just lower the timer by 1.
73c8f618fd8b General:
smxx
parents:
diff changeset
   194
			end_timer = end_timer - 1
73c8f618fd8b General:
smxx
parents:
diff changeset
   195
			-- Reset the time left to stop the timer
73c8f618fd8b General:
smxx
parents:
diff changeset
   196
			TurnTimeLeft = time_goal
73c8f618fd8b General:
smxx
parents:
diff changeset
   197
		end
73c8f618fd8b General:
smxx
parents:
diff changeset
   198
	end
73c8f618fd8b General:
smxx
parents:
diff changeset
   199
end
73c8f618fd8b General:
smxx
parents:
diff changeset
   200
73c8f618fd8b General:
smxx
parents:
diff changeset
   201
-- This function is called when the game is initialized
73c8f618fd8b General:
smxx
parents:
diff changeset
   202
-- to request the available ammo and probabilities
73c8f618fd8b General:
smxx
parents:
diff changeset
   203
function onAmmoStoreInit()
73c8f618fd8b General:
smxx
parents:
diff changeset
   204
	-- add an unlimited supply of shotgun ammo
73c8f618fd8b General:
smxx
parents:
diff changeset
   205
	SetAmmo(amShotgun, 9, 0, 0)
73c8f618fd8b General:
smxx
parents:
diff changeset
   206
end
73c8f618fd8b General:
smxx
parents:
diff changeset
   207
73c8f618fd8b General:
smxx
parents:
diff changeset
   208
-- This function is called when a new gear is added.
73c8f618fd8b General:
smxx
parents:
diff changeset
   209
-- We don't need it for this training, so we can
73c8f618fd8b General:
smxx
parents:
diff changeset
   210
-- keep it empty.
73c8f618fd8b General:
smxx
parents:
diff changeset
   211
function onGearAdd(gear)
73c8f618fd8b General:
smxx
parents:
diff changeset
   212
end
73c8f618fd8b General:
smxx
parents:
diff changeset
   213
73c8f618fd8b General:
smxx
parents:
diff changeset
   214
-- This function is called before a gear is destroyed.
73c8f618fd8b General:
smxx
parents:
diff changeset
   215
-- We use it to count the number of targets destroyed.
73c8f618fd8b General:
smxx
parents:
diff changeset
   216
function onGearDelete(gear)
73c8f618fd8b General:
smxx
parents:
diff changeset
   217
	-- We're only interested in target gears.
73c8f618fd8b General:
smxx
parents:
diff changeset
   218
	if GetGearType(gear) == gtTarget then
73c8f618fd8b General:
smxx
parents:
diff changeset
   219
		-- Add one point to our score/counter
73c8f618fd8b General:
smxx
parents:
diff changeset
   220
		score = score + 1
73c8f618fd8b General:
smxx
parents:
diff changeset
   221
		-- If we haven't reached the goal ...
73c8f618fd8b General:
smxx
parents:
diff changeset
   222
		if score < score_goal then
73c8f618fd8b General:
smxx
parents:
diff changeset
   223
			-- ... spawn another target.
73c8f618fd8b General:
smxx
parents:
diff changeset
   224
			spawnTarget()
73c8f618fd8b General:
smxx
parents:
diff changeset
   225
		else
73c8f618fd8b General:
smxx
parents:
diff changeset
   226
			if not game_lost then
73c8f618fd8b General:
smxx
parents:
diff changeset
   227
			-- Otherwise show that the goal was accomplished
73c8f618fd8b General:
smxx
parents:
diff changeset
   228
			ShowMission(loc(caption), loc(subcaption), loc(success), 0, 0);
73c8f618fd8b General:
smxx
parents:
diff changeset
   229
			-- Also let the hogs shout "victory!"
73c8f618fd8b General:
smxx
parents:
diff changeset
   230
			PlaySound(sndVictory)
73c8f618fd8b General:
smxx
parents:
diff changeset
   231
			-- Save the time left so we may keep it.
73c8f618fd8b General:
smxx
parents:
diff changeset
   232
			time_goal = TurnTimeLeft
73c8f618fd8b General:
smxx
parents:
diff changeset
   233
			end
73c8f618fd8b General:
smxx
parents:
diff changeset
   234
		end
73c8f618fd8b General:
smxx
parents:
diff changeset
   235
	end
3223
f0e590790f3b credits updated, adding Palewolf, sheepluva and prg as devs and replaced my previous openal stuff with something more current
koda
parents: 3080
diff changeset
   236
end