share/hedgewars/Data/Missions/Training/Basic_Training_-_Flying_Saucer.lua
author Wuzzy <Wuzzy2@mail.ru>
Wed, 07 Mar 2018 12:33:56 +0100
changeset 13087 b6df6283e2ba
parent 13071 bcb205281f38
child 13172 159004144897
permissions -rw-r--r--
Sort all core missions in training menu more logically The missions are now sorted as specified in the new order.cfg files in the Missions subfolders. Training missions are now sorted in the order you should play them. Challenges are semi-logically grouped. Scenarios are roughly sorted by difficulty. All missions not mentioned in order.cfg are simply added in no particular order at the end.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11405
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
     1
--[[
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
     2
	Flying Saucer Training
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
     3
	This is a training mission which teaches many basic (and not-so-basic) moves
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
     4
	with the flying saucer.
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
     5
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
     6
	Lesson plan:
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
     7
	- Taking off
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
     8
	- Basic flight
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
     9
	- Landing safely
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    10
	- Managing fuel
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    11
	- Changing saucers in mid-flight
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    12
	- Diving
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    13
	- Dropping weapons from flying saucer
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    14
	- Firing from flying saucer with [Precise] + [Attack]
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    15
	- Aiming in flying saucer with [Precise] + [Up]/[Down]
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    16
	- Underwater attack
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    17
	- Free flight with inf. fuel and some weapons at end of training
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    18
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    19
	FIXME:
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    20
	- Bad respawn animation ("explosion" just happens randomly because of the way the resurrection effect works)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    21
	- Hide fuel if infinite (probably needs engine support)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    22
]]
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    23
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    24
HedgewarsScriptLoad("/Scripts/Locale.lua")
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    25
HedgewarsScriptLoad("/Scripts/Tracker.lua")
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    26
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    27
local Player = nil -- Pointer to hog created in: onGameInit
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    28
local Target = nil -- Pointer to target hog
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    29
local Objective = false -- Get to the target
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    30
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    31
local TargetNumber = 0 -- The current target number
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    32
local GrenadeThrown = false -- Used for the Boom Target
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    33
local BazookasLeft = 0 -- Used by the Launch Target and the Unterwater Attack Target
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    34
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    35
local InfFuel = false -- If true, flying saucer has infinite fuel
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    36
local SaucerGear = nil -- Store flying saucer gear here (if one exists)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    37
local TargetGears = {} -- List of remaining gears to collect or destroy in the current round
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    38
local TargetsRemaining = 0
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    39
local Barrels = {} -- Table contraining the explosive barrel gears
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    40
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    41
local CheckTimer = 500 -- Time to wait at least before checking safe landing
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    42
local Check = false -- The last target has recently been collected/destroyed and the CheckTimer is running
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    43
local GrenadeTimer = 0 -- Time after a grenade has been thrown
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    44
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    45
local TargetPos = {} -- Table of targets
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    46
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    47
local StartPos = { X = 742, Y = 290 }
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    48
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    49
--[[
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    50
List of all targets (or "objectives"). The player has to complete them one-by-one and must always land safely afterwards.
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    51
Some target numbers have names for easier reference.
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    52
]]
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    53
TargetPos[1] =  {
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    54
	Targets = {{ X = 1027, Y = 217 }},
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    55
	Ammo = { },
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    56
	Message = loc("Here you will learn how to fly the flying saucer|and get so learn some cool tricks.") .. "|" ..
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    57
	loc("Collect the first crate to begin!"),
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    58
	MessageIcon = -amJetpack, }
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    59
TargetPos[2] = {
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    60
	Targets = {{ X = 1369, Y = 265 }},
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    61
	Ammo = { [amJetpack] = 100 },
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    62
	InfFuel = true,
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    63
	MessageTime = 10000,
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    64
	Message = loc("Get to the crate using your flying saucer!") .. "|" ..
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    65
	loc("Press [Attack] (space bar by default) to start,|repeadedly tap the up, left and right movement keys to accelerate.") .. "|" ..
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    66
	loc("Try to land softly, as you can still take fall damage!"), }
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    67
TargetPos[3] = {
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    68
	Targets = {{ X = 689, Y = 58 }},
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    69
	Ammo = { [amJetpack] = 100 },
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    70
	MessageTime = 5000,
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    71
	Message = loc("Now collect the next crate!") .. "|" .. loc("Be careful, your fuel is limited from now on!") .."|" ..
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    72
	loc("Tip: If you get stuck in this training, use \"Skip turn\" to restart the current objective.") }
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    73
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    74
-- The Double Target
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    75
local DoubleTarget = 4
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    76
TargetPos[4] = {
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    77
	Targets = { { X = 84, Y = -20 }, { X = 1980 , Y = -20 } },
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    78
	Ammo = { [amJetpack] = 2 },
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    79
	MessageTime = 9000,
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    80
	Message = loc("Now collect the 2 crates to the far left and right.") .. "|" ..
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    81
	loc("You only have 2 flying saucers this time.") .. "|" ..
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    82
	loc("Tip: You can change your flying saucer|in mid-flight by hitting the [Attack] key twice."), }
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    83
TargetPos[5] = {
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    84
	Targets = {{ X = 47, Y = 804 }},
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    85
	Ammo = { [amJetpack] = 100 },
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    86
	MessageTime = 5000,
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    87
	Message = loc("Time for a more interesting stunt, but first just collect the next crate!"), }
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    88
TargetPos[6] = {
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    89
	Targets = {{ X = 604, Y = 871}},
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    90
	MessageTime = 15000,
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    91
	Message = loc("You can dive with your flying saucer!") .. "|" ..
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    92
	loc("Try it now and dive here to collect the crate on the right girder.") .. "|" ..
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    93
	loc("You only have one flying saucer this time.") .. "|" ..
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    94
	loc("Beware, though, you will only be able to move slowly through the water.") .. "|" ..
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    95
	loc("Warning: Never ever leave the flying saucer while in water!"),
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    96
	Ammo = { [amJetpack] = 1 }, }
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    97
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    98
TargetPos[7] = { 
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
    99
	Targets = {{ X = 1884, Y = 704 }},
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   100
	MessageTime = 6500,
12424
b9cc405541c1 Fix various loc() syntax errors in scripts
Wuzzy <almikes@aol.com>
parents: 11405
diff changeset
   101
	Message = loc("Now dive just one more time and collect the next crate.") .. "|" ..
b9cc405541c1 Fix various loc() syntax errors in scripts
Wuzzy <almikes@aol.com>
parents: 11405
diff changeset
   102
		loc("Tip: Don't remain for too long in the water, or you won't make it."),
11405
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   103
	Ammo = { [amJetpack] = 1}, }
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   104
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   105
-- The Boom Target
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   106
local BoomTarget = 8
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   107
TargetPos[8] = {
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   108
	Modifier = true, Func = function()
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   109
		Info(loc("Instructions"),
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   110
		loc("Now let's try to drop weapons while flying!") .. "|" ..
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   111
		loc("You have to destroy the target above by dropping a grenade on it from your flying saucer.") .. "|" ..
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   112
		loc("It's not that easy, so listen carefully:") .. "|" ..
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   113
		loc("Step 1: Activate your flying saucer but do NOT move yet!") .. "|" ..
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   114
		loc("Step 2: Select your grenade.") .. "|" ..
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   115
		loc("Step 3: Start flying and get yourself right above the target.") .. "|" ..
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   116
		loc("Step 4: Drop your grenade by pressing the [Long jump] key.") .. "|" ..
12424
b9cc405541c1 Fix various loc() syntax errors in scripts
Wuzzy <almikes@aol.com>
parents: 11405
diff changeset
   117
		loc("Step 5: Get away quickly and land safely anywhere.") .. "| |" ..
b9cc405541c1 Fix various loc() syntax errors in scripts
Wuzzy <almikes@aol.com>
parents: 11405
diff changeset
   118
		loc("Note: We only give you grenades if you stay in your flying saucer."), nil, 20000)
11405
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   119
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   120
		SpawnBoomTarget()
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   121
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   122
		if SaucerGear ~= nil then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   123
			AddAmmo(Player, amGrenade, 1)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   124
		else
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   125
			AddAmmo(Player, amGrenade, 0)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   126
		end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   127
		GrenadeThrown = false
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   128
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   129
	end,
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   130
	Ammo = { [amJetpack] = 100 },
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   131
	Respawn = { X = 2000, Y = 742 }, }
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   132
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   133
-- The Launch Target
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   134
local LaunchTarget = 9
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   135
TargetPos[9] = {
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   136
	Targets = {{ X = 1700, Y = 640, Type = gtTarget }, { X = 1460, Y = 775, Type = gtTarget }},
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   137
	MessageTime = 20000,
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   138
	Message = loc("Only the best pilots can master the following stunts.") .. "|" ..
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   139
		loc("As you've seen, the dropped grenade roughly fell into your flying direction.") .. "|" ..
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   140
		loc("You have to destroy two targets, but the previous technique would be very difficult or dangerous to use.") .. "|" ..
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   141
		loc("So you are able to launch projectiles into your aiming direction, always at full power.") .."|"..
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   142
		loc("To launch a projectile in mid-flight, hold [Precise] and press [Long jump].") .. "|" ..
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   143
		loc("You can even change your aiming direction in mid-flight if you first hold [Precice] and then press [Up] or [Down].") .. "|" ..
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   144
		loc("Tip: Changing your aim while flying is very difficult, so adjust it before you take off."),
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   145
	Ammo = { [amJetpack] = 1, },
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   146
	Respawn = { X = 1764, Y = 916 },
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   147
	ExtraFunc = function()
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   148
		HogTurnLeft(Player, true)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   149
		if SaucerGear ~= nil then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   150
			AddAmmo(Player, amBazooka, 2)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   151
		else
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   152
			AddAmmo(Player, amBazooka, 0)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   153
		end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   154
		BazookasLeft = 2
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   155
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   156
	end }
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   157
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   158
-- The Underwater Attack Target
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   159
local UnderwaterAttackTarget = 10
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   160
TargetPos[10] = {
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   161
	MessageTime = 17000,
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   162
	Message = loc("Now for the supreme discipline of saucer flying, the underwater attack.") .. "|" ..
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   163
	loc("Basically this is a combination of diving and launching.") .. "|" ..
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   164
	loc("Dropping a weapon while in water would just drown it, but launching one would work.") .."|" ..
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   165
	loc("Based on what you've learned, destroy the target on the girder and as always, land safely!"), 
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   166
	Targets = {{ X = 1200, Y = 930, Type = gtTarget }},
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   167
	Ammo = { [amJetpack] = 1, },
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   168
	Respawn = { X = 1027, Y = 217 },
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   169
	ExtraFunc = function()
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   170
		if SaucerGear ~= nil then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   171
			AddAmmo(Player, amBazooka, 1)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   172
		else
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   173
			AddAmmo(Player, amBazooka, 0)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   174
		end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   175
		BazookasLeft = 1
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   176
	end }
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   177
TargetPos[11] = {
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   178
	Targets = {{ X = 742, Y = 290 }},
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   179
	MessageTime = 5000,
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   180
	Message = loc("This almost concludes our tutorial.") .. "|" ..
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   181
	loc("You now have infinite fuel, grenades and bazookas for fun.") .. "|" ..
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   182
	loc("Collect or destroy the final crate to finish the training."),
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   183
	Ammo = { [amJetpack] = 100, [amGrenade] = 100, [amBazooka] = 100 },
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   184
	InfFuel = true, }
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   185
TargetPos[12] = { Modifier = true, Func = function()
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   186
	Objective = true
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   187
	AddCaption(loc("Training complete!"), 0xFFFFFFFF, capgrpGameState)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   188
	Info(loc("Training complete!"), loc("Good bye!"), 4, 5000)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   189
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   190
	if SaucerGear ~= nil then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   191
		DeleteGear(SaucerGear)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   192
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   193
	SetState(Player, band(GetState(Player), bnot(gstHHDriven)))
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   194
	SetState(Player, bor(GetState(Player), gstWinner))
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   195
	PlaySound(sndVictory, Player)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   196
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   197
	SendStat(siGameResult, loc("You have finished the Flying Saucer Training!"))
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   198
	SendStat(siCustomAchievement, loc("Good job!"))
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   199
	SendStat(siPlayerKills, "0", loc("Hogonauts"))
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   200
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   201
	TurnTimeLeft = 0
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   202
	EndGame()
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   203
end,
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   204
}
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   205
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   206
-- Just a wrapper for ShowMission
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   207
function Info(Title, Text, Icon, Time)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   208
	if Time == nil then Time = 0 end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   209
	if Icon == nil then Icon = 2 end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   210
	ShowMission(loc("Flying Saucer Training"), Title, Text, Icon, Time)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   211
end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   212
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   213
-- Spawn all the gears for the Boom Target
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   214
function SpawnBoomTarget()
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   215
	if TargetsRemaining < 1 then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   216
		TargetGears[1] = AddGear(1602, 507, gtTarget, 0, 0, 0, 0)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   217
		TargetsRemaining = TargetsRemaining + 1
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   218
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   219
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   220
	if Barrels[1] == nil then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   221
		Barrels[1] = AddGear(1563, 532, gtExplosives, 0, 0, 0, 0)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   222
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   223
	if Barrels[2] == nil then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   224
		Barrels[2] = AddGear(1648, 463, gtExplosives, 0, 0, 0, 0)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   225
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   226
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   227
	for i=1,#Barrels do
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   228
		SetHealth(Barrels[i], 1)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   229
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   230
end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   231
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   232
-- Generic target spawning for the current target
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   233
function SpawnTargets()
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   234
	for i=1,#TargetPos[TargetNumber].Targets do
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   235
		if TargetGears[i] == nil then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   236
			SpawnTarget(TargetPos[TargetNumber].Targets[i].X, TargetPos[TargetNumber].Targets[i].Y,
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   237
				TargetPos[TargetNumber].Targets[i].Type, i)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   238
		end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   239
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   240
end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   241
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   242
function SpawnTarget( PosX, PosY, Type, ID )
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   243
	if Type ~= nil and Type ~= gtCase then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   244
		if Type == gtTarget then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   245
			TargetGears[ID] = AddGear(PosX, PosY, gtTarget, 0, 0, 0, 0)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   246
		end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   247
	else
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   248
		TargetGears[ID] = SpawnFakeUtilityCrate(PosX, PosY, false, false)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   249
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   250
	TargetsRemaining = TargetsRemaining + 1
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   251
end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   252
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   253
function AutoSpawn() -- Auto-spawn the next target after you've obtained the current target!
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   254
	TargetNumber = TargetNumber + 1
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   255
	TargetsRemaining = 0
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   256
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   257
	if TargetPos[TargetNumber].Ammo then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   258
		for ammoType, count in pairs(TargetPos[TargetNumber].Ammo) do
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   259
			AddAmmo(Player, ammoType, count)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   260
		end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   261
		if GetCurAmmoType() ~= amJetpack then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   262
			SetWeapon(amJetpack)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   263
		end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   264
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   265
	if TargetPos[TargetNumber].InfFuel then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   266
		InfFuel = true
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   267
	else
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   268
		InfFuel = false
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   269
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   270
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   271
	-- Func (if present) will be run instead of the ordinary spawning handling
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   272
	if TargetPos[TargetNumber].Modifier then -- If there is a modifier, run the function
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   273
		TargetPos[TargetNumber].Func()
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   274
		return true
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   275
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   276
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   277
	-- ExtraFunc is for additional events for a target
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   278
	if TargetPos[TargetNumber].ExtraFunc ~= nil then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   279
		TargetPos[TargetNumber].ExtraFunc()
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   280
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   281
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   282
	local subcap
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   283
	if TargetNumber == 1 then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   284
		subcap = loc("Training")
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   285
	else
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   286
		subcap = loc("Instructions")
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   287
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   288
	Info(subcap, TargetPos[TargetNumber].Message, TargetPos[TargetNumber].MessageIcon, TargetPos[TargetNumber].MessageTime)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   289
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   290
	-- Spawn targets on the next position
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   291
	SpawnTargets()
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   292
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   293
	if TargetNumber > 1 then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   294
		AddCaption(loc("Next target is ready!"), 0xFFFFFFFF, capgrpMessage2)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   295
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   296
end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   297
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   298
-- Returns true if the hedgehog has safely "landed" (alive, no flying saucer gear and not moving)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   299
-- This is to ensure the training only continues when the player didn't screw up and to restart the current target
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   300
function HasHedgehogLandedYet()
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   301
	if band(GetState(Player), gstMoving) == 0 and SaucerGear == nil and GetHealth(Player) > 0 then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   302
		return true
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   303
	else
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   304
		return false
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   305
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   306
end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   307
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   308
-- Clean up the gear mess left behind when the player failed to get a clean state after restarting
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   309
function CleanUpGears()
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   310
	-- (We track flames, grenades, bazooka shells)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   311
	runOnGears(DeleteGear)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   312
end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   313
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   314
-- Completely restarts the current target/objective; the hedgehog is spawned at the last "checkpoint"
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   315
-- Called when hedgeghog is resurrected or skips turn
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   316
function ResetCurrentTarget()
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   317
	GrenadeThrown = false
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   318
	GrenadeTimer = 0
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   319
	if TargetNumber == LaunchTarget then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   320
		BazookasLeft = 2
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   321
	elseif TargetNumber == UnderwaterAttackTarget then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   322
		BazookasLeft = 1
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   323
	else
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   324
		BazookasLeft = 0
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   325
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   326
	Check = false
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   327
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   328
	CleanUpGears()
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   329
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   330
	local X, Y
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   331
	if TargetNumber == 1 then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   332
		X, Y = StartPos.X, StartPos.Y
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   333
	else
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   334
		if TargetPos[TargetNumber-1].Modifier or TargetPos[TargetNumber-1].Respawn ~= nil then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   335
			X, Y = TargetPos[TargetNumber-1].Respawn.X, TargetPos[TargetNumber-1].Respawn.Y
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   336
		else
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   337
			X, Y = TargetPos[TargetNumber-1].Targets[1].X, TargetPos[TargetNumber-1].Targets[1].Y
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   338
		end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   339
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   340
	if TargetNumber == BoomTarget then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   341
		SpawnBoomTarget()
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   342
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   343
	if TargetPos[TargetNumber].Modifier ~= true then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   344
		SpawnTargets()
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   345
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   346
	if TargetPos[TargetNumber].Ammo then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   347
		for ammoType, count in pairs(TargetPos[TargetNumber].Ammo) do
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   348
			AddAmmo(Player, ammoType, count)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   349
		end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   350
		if GetCurAmmoType() ~= amJetpack then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   351
			SetWeapon(amJetpack)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   352
		end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   353
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   354
	if TargetPos[TargetNumber].InfFuel then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   355
		InfFuel = true
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   356
	else
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   357
		InfFuel = false
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   358
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   359
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   360
	SetGearPosition(Player, X, Y)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   361
end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   362
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   363
function onGameInit()
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   364
	Seed = 1
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   365
	GameFlags = gfInfAttack + gfOneClanMode + gfSolidLand + gfDisableWind
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   366
	TurnTime = 2000000 --[[ This rffectively hides the turn time; a turn time above 1000s is not displayed.
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   367
				We will also ensure this timer always stays above 999s later ]]
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   368
	CaseFreq = 0
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   369
	MinesNum = 0
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   370
	Explosives = 0
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   371
	Map = "Eyes"
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   372
	Theme = "EarthRise"
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   373
	SuddenDeathTurns = 50
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   374
	WaterRise = 0
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   375
	HealthDecrease = 0
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   376
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   377
	-- Team name is a pun on “hedgehog” and “astronauts”
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   378
	AddTeam( loc( "Hogonauts" ), 0xDDDD00, "earth", "Earth", "Default", "cm_galaxy" )
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   379
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   380
	-- Hedgehog name is a pun on “Neil Armstrong”
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   381
	Player = AddHog( loc( "Neil Hogstrong" ), 0, 1, "NoHat" )
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   382
	SetGearPosition( Player, StartPos.X, StartPos.Y)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   383
	SetEffect( Player, heResurrectable, 1 )
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   384
end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   385
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   386
function onGameStart()
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   387
	SendHealthStatsOff()
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   388
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   389
	-- Girder near first crate
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   390
	PlaceGirder(1257, 204, 6)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   391
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   392
	-- The upper girders
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   393
	PlaceGirder(84, 16, 0)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   394
	PlaceGirder(1980, 16, 0)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   395
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   396
	-- The lower girder platform at the water pit
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   397
	PlaceGirder(509, 896, 4)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   398
	PlaceGirder(668, 896, 4)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   399
	PlaceGirder(421, 896, 2)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   400
	PlaceGirder(758, 896, 2)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   401
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   402
	-- Girders for the Launch Target and the Underwater Attack Target
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   403
	PlaceGirder(1191, 960, 4)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   404
	PlaceGirder(1311, 960, 0)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   405
	PlaceGirder(1460, 827, 3)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   406
	PlaceGirder(1509, 763, 2)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   407
	PlaceGirder(1605, 672, 4)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   408
	PlaceGirder(1764, 672, 4)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   409
	PlaceGirder(1803, 577, 6)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   410
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   411
	-- Spawn our 1st target using the wrapper function
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   412
	AutoSpawn()
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   413
end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   414
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   415
function onAmmoStoreInit()
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   416
	SetAmmo(amJetpack, 0, 0, 0, 0)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   417
	SetAmmo(amGrenade, 0, 0, 0, 0)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   418
	SetAmmo(amBazooka, 0, 0, 0, 0)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   419
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   420
	-- Added for resetting current target/objective when player is stuck somehow
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   421
	SetAmmo(amSkip, 9, 0, 0, 0)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   422
end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   423
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   424
function onGearAdd(Gear)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   425
	if GetGearType(Gear) == gtJetpack then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   426
		SaucerGear = Gear
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   427
		if TargetNumber == BoomTarget and GrenadeThrown == false then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   428
			AddAmmo(Player, amGrenade, 1)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   429
		end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   430
		if (TargetNumber == LaunchTarget or TargetNumber == UnderwaterAttackTarget) and BazookasLeft > 0 then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   431
			AddAmmo(Player, amBazooka, BazookasLeft)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   432
		end
13071
bcb205281f38 Some minor convenience improvements in Basic Flying Saucer Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12424
diff changeset
   433
		-- If player starts using saucer, the player probably finished reading and the mission panel
bcb205281f38 Some minor convenience improvements in Basic Flying Saucer Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12424
diff changeset
   434
		-- would just get in the way. So we hide it!
bcb205281f38 Some minor convenience improvements in Basic Flying Saucer Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12424
diff changeset
   435
		HideMission()
11405
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   436
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   437
	if GetGearType(Gear) == gtGrenade then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   438
		GrenadeThrown = true
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   439
		GrenadeTimer = 0
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   440
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   441
	if GetGearType(Gear) == gtShell then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   442
		BazookasLeft = BazookasLeft - 1
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   443
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   444
	if GetGearType(Gear) == gtFlame or GetGearType(Gear) == gtGrenade or GetGearType(Gear) == gtShell then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   445
		trackGear(Gear)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   446
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   447
end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   448
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   449
function onGearDelete(Gear)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   450
	if GetGearType(Player) ~= nil and (GetGearType(Gear) == gtTarget or GetGearType(Gear) == gtCase) then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   451
		for i=1, #TargetGears do
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   452
			if Gear == TargetGears[i] then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   453
				TargetGears[i] = nil
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   454
				TargetsRemaining = TargetsRemaining - 1
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   455
			end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   456
		end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   457
		if TargetsRemaining <= 0 then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   458
			if TargetNumber == BoomTarget or not HasHedgehogLandedYet() then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   459
				if SaucerGear then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   460
					AddCaption(loc("Objective completed! Now land safely."), 0xFFFFFFFF, capgrpMessage2)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   461
				end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   462
				Check = true
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   463
				CheckTimer = 500
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   464
			else
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   465
				AutoSpawn()
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   466
			end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   467
		end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   468
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   469
	if GetGearType(Gear) == gtGrenade then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   470
		GrenadeTimer = 0
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   471
		GrenadeExploded = true
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   472
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   473
	if GetGearType(Gear) == gtJetpack then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   474
		SaucerGear = nil
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   475
		if TargetNumber == BoomTarget then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   476
			AddAmmo(Player, amGrenade, 0)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   477
		end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   478
		if TargetNumber == LaunchTarget or TargetNumber == UnderwaterAttackTarget then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   479
			AddAmmo(Player, amBazooka, 0)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   480
		end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   481
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   482
	if GetGearType(Gear) == gtCase and GetGearType(Player) ~= nil then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   483
		PlaySound(sndShotgunReload)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   484
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   485
	if Gear == Barrels[1] then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   486
		Barrels[1] = nil
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   487
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   488
	if Gear == Barrels[2] then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   489
		Barrels[2] = nil
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   490
		AddCaption(loc("Kaboom!"), 0xFFFFFFFF, capgrpMessage)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   491
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   492
end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   493
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   494
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   495
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   496
function onNewTurn()
13071
bcb205281f38 Some minor convenience improvements in Basic Flying Saucer Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12424
diff changeset
   497
	if GetAmmoCount(CurrentHedgehog, amJetpack) > 0 then
bcb205281f38 Some minor convenience improvements in Basic Flying Saucer Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12424
diff changeset
   498
		SetWeapon(amJetpack)
bcb205281f38 Some minor convenience improvements in Basic Flying Saucer Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12424
diff changeset
   499
	end
11405
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   500
end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   501
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   502
function onGameTick20()
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   503
	if (TurnTimeLeft < 1500000 and not Objective) then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   504
		TurnTimeLeft = TurnTime
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   505
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   506
	if Check then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   507
		CheckTimer = CheckTimer - 20
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   508
		if CheckTimer <= 0 then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   509
			if HasHedgehogLandedYet() then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   510
				AutoSpawn()
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   511
				Check = false
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   512
				GrenadeThrown = false
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   513
			end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   514
		end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   515
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   516
	if GrenadeExploded and TargetNumber == BoomTarget then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   517
		GrenadeTimer = GrenadeTimer + 20
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   518
		if GrenadeTimer > 1500 then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   519
			GrenadeTimer = 0
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   520
			GrenadeThrown = false
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   521
			GrenadeExploded = false
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   522
			if SaucerGear and TargetNumber == BoomTarget and TargetsRemaining > 0 then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   523
				PlaySound(sndShotgunReload)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   524
				AddCaption(loc("+1 Grenade"), 0xDDDD00FF, capgrpAmmoinfo)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   525
				AddAmmo(Player, amGrenade, 1)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   526
			end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   527
		end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   528
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   529
	ResetFuel()
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   530
end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   531
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   532
-- Used to ensure infinite fuel
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   533
function ResetFuel()
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   534
	if SaucerGear and InfFuel then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   535
		SetHealth(SaucerGear, 2000)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   536
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   537
end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   538
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   539
onUp = ResetFuel
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   540
onLeft = ResetFuel
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   541
onRight = ResetFuel
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   542
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   543
function onGearDamage(Gear)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   544
	if Gear == Player then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   545
		CleanUpGears()
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   546
		GrenadeThrown = false
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   547
		Check = false
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   548
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   549
end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   550
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   551
function onGearResurrect(Gear)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   552
	if Gear == Player then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   553
		AddCaption(loc("Oh no! You have died. Try again!"), 0xFFFFFFFF, capgrpMessage2)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   554
		ResetCurrentTarget()
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   555
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   556
end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   557
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   558
function onHogAttack(ammoType)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   559
	if ammoType == amSkip then
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   560
		AddCaption(loc("Try again!"), 0xFFFFFFFF, capgrpMessage2)
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   561
		ResetCurrentTarget()
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   562
	end
307832da2756 Add Basic Flying Saucer Training
Wuzzy <almikes@aol.com>
parents:
diff changeset
   563
end