share/hedgewars/Data/Missions/Training/Basic_Training_-_Grenade.lua
author Wuzzy <Wuzzy2@mail.ru>
Wed, 28 Mar 2018 14:06:34 +0200
changeset 13290 a3b07219a091
parent 13165 89a6b862e692
child 13354 f9a15dcd857c
permissions -rw-r--r--
Grenade Training: Add warm-up sequence, introduce timer in separate mission panel
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13075
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
     1
--[[
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
     2
	Basic Grenade Training
7094
f5a5578be66b A few scripts to try out. 2x challenge, 1x GSoC training, 1x user mission.
mikade <redgrinner@gmail.com>
parents:
diff changeset
     3
13075
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
     4
	This training mission teaches players how to use the grenade.
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
     5
	Lesson plan:
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
     6
	- Selecting grenade
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
     7
	- Aiming and shooting
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
     8
	- Timer
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
     9
	- No wind
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    10
	- Bounciness
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    11
]]
7094
f5a5578be66b A few scripts to try out. 2x challenge, 1x GSoC training, 1x user mission.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    12
8043
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 7877
diff changeset
    13
HedgewarsScriptLoad("/Scripts/Locale.lua")
7094
f5a5578be66b A few scripts to try out. 2x challenge, 1x GSoC training, 1x user mission.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    14
13075
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    15
local hog			-- Hog gear
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    16
local weaponSelected = false	-- Player has selected the weapon
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    17
local gamePhase = 0		-- Used to track progress
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    18
local targetsLeft = 0		-- # of targets left in this round
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    19
local targetGears = {}		-- list of target gears
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    20
local gameOver = false		-- If true, game has ended
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    21
local shotsFired = 0		-- Total # of grenades fired
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    22
local maxTargets = 0		-- Target counter, used together with flawless
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    23
local flawless = true		-- track flawless victory (100% accuracy, no hurt, no death)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    24
local missedTauntTimer = -1	-- Wait timer for playing sndMissed. -1 = no-op
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    25
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    26
function onGameInit()
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    27
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    28
	ClearGameFlags()
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    29
	EnableGameFlags(gfDisableWind, gfOneClanMode, gfInfAttack, gfSolidLand, gfArtillery)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    30
	Map = "Mushrooms"
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    31
	Seed = 0
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    32
	Theme = "Nature"
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    33
	TurnTime = 9999000
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    34
	Explosives = 0
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    35
	MinesNum = 0
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    36
	CaseFreq = 0
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    37
	WaterRise = 0
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    38
	HealthDecrease = 0
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    39
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    40
	------ TEAM LIST ------
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    41
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    42
	AddTeam(loc("Grenade Team"), 0xFF0204, "Flower", "Earth", "Default", "cm_grenade")
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    43
	hog = AddHog(loc("Greenhorn"), 0, 1, "NoHat")
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    44
	SetGearPosition(hog, 570, 157)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    45
	SetEffect(hog, heResurrectable, 1)
7094
f5a5578be66b A few scripts to try out. 2x challenge, 1x GSoC training, 1x user mission.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    46
13075
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    47
	SendHealthStatsOff()
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    48
end
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    49
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    50
function onGearResurrect(gear)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    51
	if gear == hog then
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    52
		flawless = false
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    53
		SetGearPosition(hog, 570, 157)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    54
		AddCaption(loc("Your hedgehog has been revived!"))
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    55
	end
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    56
end
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    57
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    58
local function placeGirders()
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    59
	PlaceGirder(918, 248, 1)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    60
	PlaceGirder(888, 129, 6)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    61
	PlaceGirder(844, 35, 1)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    62
	PlaceGirder(932, 37, 3)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    63
	PlaceGirder(926, 148, 6)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    64
	PlaceGirder(73, 812, 5)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    65
	PlaceGirder(189, 930, 5)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    66
	PlaceGirder(15, 669, 6)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    67
	PlaceGirder(15, 507, 6)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    68
	PlaceGirder(15, 344, 6)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    69
	PlaceGirder(62, 27, 0)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    70
	PlaceGirder(229, 115, 0)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    71
	PlaceGirder(1195, 250, 7)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    72
	PlaceGirder(1285, 205, 1)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    73
	PlaceGirder(1358, 201, 3)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    74
	PlaceGirder(1756, 415, 6)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    75
	PlaceGirder(1893, 95, 6)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    76
	PlaceGirder(1005, 333, 5)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    77
	PlaceGirder(1860, 187, 0)
7094
f5a5578be66b A few scripts to try out. 2x challenge, 1x GSoC training, 1x user mission.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    78
end
f5a5578be66b A few scripts to try out. 2x challenge, 1x GSoC training, 1x user mission.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    79
13075
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    80
local function spawnTargets()
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    81
	-- Warm-up
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    82
	if gamePhase == 0 then
13290
a3b07219a091 Grenade Training: Add warm-up sequence, introduce timer in separate mission panel
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
    83
		AddGear(882, 39, gtTarget, 0, 0, 0, 0)
a3b07219a091 Grenade Training: Add warm-up sequence, introduce timer in separate mission panel
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
    84
	-- Timer
a3b07219a091 Grenade Training: Add warm-up sequence, introduce timer in separate mission panel
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
    85
	elseif gamePhase == 2 then
13075
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    86
		AddGear(233, 97, gtTarget, 0, 0, 0, 0)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    87
		AddGear(333, 255, gtTarget, 0, 0, 0, 0)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    88
		AddGear(753, 225, gtTarget, 0, 0, 0, 0)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    89
	-- No Wind
13290
a3b07219a091 Grenade Training: Add warm-up sequence, introduce timer in separate mission panel
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
    90
	elseif gamePhase == 3 then
a3b07219a091 Grenade Training: Add warm-up sequence, introduce timer in separate mission panel
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
    91
		AddGear(15, 240, gtTarget, 0, 0, 0, 0)
13075
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    92
		AddGear(61, 9, gtTarget, 0, 0, 0, 0)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    93
		AddGear(945, 498, gtTarget, 0, 0, 0, 0)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    94
	-- Bounciness
13290
a3b07219a091 Grenade Training: Add warm-up sequence, introduce timer in separate mission panel
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
    95
	elseif gamePhase == 4 then
13075
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    96
		AddGear(323, 960, gtTarget, 0, 0, 0, 0)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    97
		AddGear(1318, 208, gtTarget, 0, 0, 0, 0)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    98
		AddGear(1697, 250, gtTarget, 0, 0, 0, 0)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
    99
		AddGear(1852, 100, gtTarget, 0, 0, 0, 0)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   100
	-- Grand Final
13290
a3b07219a091 Grenade Training: Add warm-up sequence, introduce timer in separate mission panel
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
   101
	elseif gamePhase == 5 then
13075
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   102
		AddGear(186, 473, gtTarget, 0, 0, 0, 0)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   103
		AddGear(950, 250, gtTarget, 0, 0, 0, 0)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   104
		AddGear(1102, 345, gtTarget, 0, 0, 0, 0)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   105
		AddGear(1556, 297, gtTarget, 0, 0, 0, 0)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   106
	end
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   107
end
7094
f5a5578be66b A few scripts to try out. 2x challenge, 1x GSoC training, 1x user mission.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   108
13075
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   109
function onGameStart()
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   110
	placeGirders()
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   111
	spawnTargets()
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   112
	ShowMission(loc("Basic Grenade Training"), loc("Basic Training"), loc("Destroy all the targets!"), -amGrenade, 0)
7094
f5a5578be66b A few scripts to try out. 2x challenge, 1x GSoC training, 1x user mission.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   113
end
f5a5578be66b A few scripts to try out. 2x challenge, 1x GSoC training, 1x user mission.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   114
13075
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   115
function newGamePhase()
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   116
	-- Spawn targets, update wind and ammo, show instructions
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   117
	if gamePhase == 0 then
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   118
		ShowMission(loc("Basic Grenade Training"), loc("Select Weapon"), loc("To begin with the training, select the grenade from the ammo menu!").."|"..
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   119
		loc("Open ammo menu: [Right click]").."|"..
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   120
		loc("Select weapon: [Left click]"), 2, 5000)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   121
	elseif gamePhase == 1 then
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   122
		ShowMission(loc("Basic Grenade Training"), loc("Warming Up"),
13290
a3b07219a091 Grenade Training: Add warm-up sequence, introduce timer in separate mission panel
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
   123
		loc("Throw a grenade to destroy the target!").."|"..
13075
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   124
		loc("Hold the Attack key pressed for more power.").."|"..
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   125
		loc("Attack: [Space]").."|"..
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   126
		loc("Aim: [Up]/[Down]").."|"..
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   127
		loc("Change direction: [Left]/[Right]"), 2, 20000)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   128
		spawnTargets()
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   129
	elseif gamePhase == 2 then
13290
a3b07219a091 Grenade Training: Add warm-up sequence, introduce timer in separate mission panel
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
   130
		ShowMission(loc("Basic Grenade Training"), loc("Timer"),
a3b07219a091 Grenade Training: Add warm-up sequence, introduce timer in separate mission panel
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
   131
		loc("You can change the detonation timer of grenades.").."|"..
a3b07219a091 Grenade Training: Add warm-up sequence, introduce timer in separate mission panel
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
   132
		loc("Grenades explode after 1 to 5 seconds (you decide).").."|"..
a3b07219a091 Grenade Training: Add warm-up sequence, introduce timer in separate mission panel
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
   133
		loc("Set detonation timer: [1]-[5]"), 2, 15000)
a3b07219a091 Grenade Training: Add warm-up sequence, introduce timer in separate mission panel
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
   134
		spawnTargets()
a3b07219a091 Grenade Training: Add warm-up sequence, introduce timer in separate mission panel
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
   135
	elseif gamePhase == 3 then
13075
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   136
		ShowMission(loc("Basic Grenade Training"), loc("No Wind Influcence"), loc("Unlike bazookas, grenades are not influenced by wind.").."|"..
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   137
		loc("Destroy the targets!"), 2, 6000)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   138
		SetWind(50)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   139
		spawnTargets()
13290
a3b07219a091 Grenade Training: Add warm-up sequence, introduce timer in separate mission panel
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
   140
	elseif gamePhase == 4 then
13075
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   141
		ShowMission(loc("Basic Grenade Training"), loc("Bounciness"),
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   142
		loc("You can set the bounciness of grenades (and grenade-like weapons).").."|"..
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   143
		loc("Grenades with high bounciness bounce a lot and behave chaotic.").."|"..
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   144
		loc("With low bounciness, it barely bounces at all, but it is much more predictable.").."|"..
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   145
		loc("Try out different bounciness levels to reach difficult targets.").."|"..
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   146
		loc("Set bounciness: [Left Shift] + [1]-[5]"),
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   147
		2, 20000)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   148
		spawnTargets()
13290
a3b07219a091 Grenade Training: Add warm-up sequence, introduce timer in separate mission panel
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
   149
	elseif gamePhase == 5 then
13075
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   150
		ShowMission(loc("Basic Grenade Training"), loc("Final Targets"), loc("Good job! Now destroy the final targets to finish the training.").."|"..
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   151
		loc("Precise Aim: [Left Shift] + [Up]/[Down]"),
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   152
		2, 7000)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   153
		spawnTargets()
13290
a3b07219a091 Grenade Training: Add warm-up sequence, introduce timer in separate mission panel
Wuzzy <Wuzzy2@mail.ru>
parents: 13165
diff changeset
   154
	elseif gamePhase == 6 then
13075
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   155
		ShowMission(loc("Basic Grenade Training"), loc("Training complete!"), loc("Congratulations!"), 0, 0)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   156
		SetInputMask(0)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   157
		AddAmmo(CurrentHedgehog, amGrenade, 0)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   158
		if shotsFired > maxTargets then
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   159
			flawless = false
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   160
		end
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   161
		if flawless then
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   162
			PlaySound(sndFlawless, hog)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   163
		else
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   164
			PlaySound(sndVictory, hog)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   165
		end
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   166
		SendStat(siCustomAchievement, loc("Good job!"))
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   167
		SendStat(siGameResult, loc("You have completed the Basic Grenade Training!"))
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   168
		SendStat(siPlayerKills, "0", loc("Grenade Team"))
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   169
		EndGame()
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   170
		gameOver = true
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   171
	end
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   172
	gamePhase = gamePhase + 1
7094
f5a5578be66b A few scripts to try out. 2x challenge, 1x GSoC training, 1x user mission.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   173
end
f5a5578be66b A few scripts to try out. 2x challenge, 1x GSoC training, 1x user mission.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   174
f5a5578be66b A few scripts to try out. 2x challenge, 1x GSoC training, 1x user mission.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   175
function onNewTurn()
13075
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   176
	if gamePhase == 0 then
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   177
		newGamePhase()
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   178
	end
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   179
end
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   180
13165
89a6b862e692 Bazooka/Grenade Training: Make weapon selection detection future-proof
Wuzzy <Wuzzy2@mail.ru>
parents: 13075
diff changeset
   181
function onGameTick20()
89a6b862e692 Bazooka/Grenade Training: Make weapon selection detection future-proof
Wuzzy <Wuzzy2@mail.ru>
parents: 13075
diff changeset
   182
	if not weaponSelected and gamePhase == 1 and GetCurAmmoType() == amGrenade then
13075
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   183
		newGamePhase()
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   184
		weaponSelected = true
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   185
	end
7094
f5a5578be66b A few scripts to try out. 2x challenge, 1x GSoC training, 1x user mission.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   186
end
f5a5578be66b A few scripts to try out. 2x challenge, 1x GSoC training, 1x user mission.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   187
13075
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   188
function onHogAttack(ammoType)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   189
	if ammoType == amGrenade then
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   190
		HideMission()
7094
f5a5578be66b A few scripts to try out. 2x challenge, 1x GSoC training, 1x user mission.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   191
	end
13075
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   192
end
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   193
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   194
function onGearAdd(gear)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   195
	if GetGearType(gear) == gtTarget then
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   196
		targetsLeft = targetsLeft + 1
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   197
		maxTargets = maxTargets + 1
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   198
		targetGears[gear] = true
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   199
	elseif GetGearType(gear) == gtGrenade then
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   200
		shotsFired = shotsFired + 1
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   201
	end
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   202
end
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   203
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   204
function onGearDelete(gear)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   205
	if GetGearType(gear) == gtTarget then
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   206
		targetsLeft = targetsLeft - 1
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   207
		targetGears[gear] = nil
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   208
		if targetsLeft <= 0 then
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   209
			newGamePhase()
7094
f5a5578be66b A few scripts to try out. 2x challenge, 1x GSoC training, 1x user mission.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   210
		end
f5a5578be66b A few scripts to try out. 2x challenge, 1x GSoC training, 1x user mission.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   211
	end
f5a5578be66b A few scripts to try out. 2x challenge, 1x GSoC training, 1x user mission.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   212
end
f5a5578be66b A few scripts to try out. 2x challenge, 1x GSoC training, 1x user mission.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   213
13075
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   214
function onGearDamage(gear)
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   215
	if gear == hog then
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   216
		flawless = false
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   217
	end
7094
f5a5578be66b A few scripts to try out. 2x challenge, 1x GSoC training, 1x user mission.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   218
end
f5a5578be66b A few scripts to try out. 2x challenge, 1x GSoC training, 1x user mission.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   219
13075
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   220
function onAmmoStoreInit()
730db0a3eb43 Completely redo Basic Grenade Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12224
diff changeset
   221
	SetAmmo(amGrenade, 9, 0, 0, 0)
7094
f5a5578be66b A few scripts to try out. 2x challenge, 1x GSoC training, 1x user mission.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   222
end