share/hedgewars/Data/Missions/Training/Basic_Training_-_Rope.lua
author Wuzzy <Wuzzy2@mail.ru>
Wed, 15 May 2019 03:25:20 +0200
changeset 14951 c173fae0a223
parent 14941 c645327d0a81
child 15068 6f51c75994a4
permissions -rw-r--r--
Hide player ranks in training missions
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
     1
--[[
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
     2
	Basic Rope Training
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
     3
	Teaches the player how to rope! No advanced tricks, just the basics. But fun! (I hope)
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
     4
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
     5
	Lesson plan:
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
     6
	- Select rope
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
     7
	- Shoot rope, attach, detach
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
     8
	- Extend, retract, swing to reach easy target
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
     9
	- Multiple shots / rope re-use to go over water hazard
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    10
	- Drop grenade from rope
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    11
	- Special rules when you only got 1 rope (i.e. when the rope is officially used up)
14455
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
    12
	- Rope around obstacles
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    13
]]
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    14
8043
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 7838
diff changeset
    15
HedgewarsScriptLoad("/Scripts/Locale.lua")
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    16
HedgewarsScriptLoad("/Scripts/Utils.lua")
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    17
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    18
-- Map definition automatically converted from HWMAP file by hwmap2lua.sh
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    19
local map =
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    20
{'\2\30\7\126\135\2\28\5\52\0\1\211\6\203\135\3\207\6\189\0\3\1\5\205\135\4\120\5\203\0\2\30\5\31\135\2\35\4\173\0\1\170\4\216\135\4\150\4\248\0\3\230\4\138\135\4\54\6\22\0\3\205\6\189\135\4\154\7\91\0\4\154\7\91\135\6\57\7\41\0\4\79\6\38\135\4\221\6\112\0\4\221\6\112\135\6\27\6\70\0\3\175\6\196\135\4\51\5\235\0\3\17\6\178\135\3\161\5\226\0\4\33\7\4\135\4\191\6\93\0\4\200\7\75\135\5\45\6\137\0\6\29\6\66\135\6\98\5\123\0\6\107\7\32\135\6\237\5\249\0\6\102\5\95\135\7\169\5\6\0\7\0\5\237\135\7\235\6\20\0\7\233\6\13\135\7\226\8\43\0\13\66\6\47\135\13\100\8\57\0\7\167\5\15\135\7\164\4\51\0\7\71\4\109\135\13\235\4\132\0\13\4\6\75\135\14\242\6\57\0\14\169\6\166\135\15\183\4\86\0',
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    21
'\15\208\5\13\135\15\96\2\248\0\15\206\3\104\135\13\175\2\88\0\14\171\5\17\140\14\219\4\77\138\14\166\3\136\136\13\219\3\31\136\13\184\4\228\136\13\173\3\250\0\14\2\4\19\136\7\36\3\211\0\14\52\2\85\137\7\57\2\76\0\12\196\2\245\137\11\195\3\127\137\10\174\2\223\137\9\174\3\113\137\8\160\2\211\137\8\11\3\111\137\6\249\3\218\131\6\66\3\209\0\5\88\3\202\131\4\38\3\193\0\5\33\3\207\131\5\31\5\31\0\4\235\4\228\131\6\125\4\251\0\6\98\3\214\131\6\80\5\1\0\7\41\2\104\136\3\253\2\72\0\4\31\3\207\133\1\149\3\166\0\2\243\4\15\133\1\117\2\202\0\1\149\3\60\133\1\211\1\87\0\1\138\1\138\133\3\42\0\71\0\2\131\0\96\133\4\168\0\149\0\5\116\1\124\141\7\41\0\204\141\8\252\2\42\141\10\39\0\135\141\11\40\1\124\141\10\17\1\186\141',
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    22
'\12\104\0\151\141\4\29\0\156\137\14\160\0\69\0\13\182\1\133\137\13\171\2\78\0\13\201\0\78\137\13\189\0\197\0\13\194\1\195\137\15\148\2\147\0\14\189\0\59\137\15\222\0\217\0\15\226\0\215\137\15\164\2\145\0\13\217\1\211\137\15\167\1\220\0\14\208\2\37\164\8\89\1\92\139\6\146\1\211\139\8\174\2\39\203\10\19\2\7\203\11\56\1\167\203\12\106\0\217\203\7\36\1\12\203\5\182\1\163\203\6\141\1\165\203\8\71\1\135\203\8\151\3\19\203\8\7\3\70\203\9\227\3\118\203\13\66\3\113\133\13\54\4\104\0\11\200\3\26\133\11\191\4\84\0\9\160\2\255\133\9\160\4\84\0\8\16\3\163\133\8\18\4\109\0\9\108\3\53\197\10\19\3\70\0\14\25\5\228\132\14\43\4\253\130\13\237\3\241\210\13\217\3\225\210\13\95\4\74\140\7\137\4\40\0\2\209\6\75\207\3\255\6\102\0\4\1\6\107\207',
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    23
'\4\182\6\228\0\4\182\6\226\207\6\36\6\189\0\6\36\6\201\207\6\166\5\191\0\4\138\4\100\158\1\183\4\68\0\4\145\5\8\158\4\203\5\201\0\5\141\5\198\158\5\180\5\139\0\7\116\4\230\142\5\49\5\52\0\6\185\4\47\148\6\182\4\186\0\7\64\4\88\153\4\216\4\10\143\13\255\2\42\146\15\100\2\216\0\4\1\6\20\199\2\142\6\29\0\3\255\6\22\199\5\22\6\224\0\7\231\5\198\133\7\235\6\31\0\13\70\6\68\133\13\54\5\237\0\14\36\4\253\197\4\90\2\223\133\4\239\3\97\0\2\181\2\252\133\3\95\2\156\0\2\216\1\90\133\3\113\1\218\0\4\200\1\32\133\4\122\1\167\0\7\169\1\106\133\4\10\4\106\213\1\30\4\86\0\4\58\5\54\219\1\119\5\6\139\1\119\5\157\0\1\238\5\189\139\0\85\5\164\0\0\105\6\63\139\0\119\3\182\0\0\37\3\188\134\1\231\3\195\0',
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    24
'\1\142\5\13\145\1\188\5\102\0\1\199\5\59\145\3\209\5\198\134\5\59\5\102\0\4\63\5\111\134\0\121\3\225\134\4\111\3\234\0\2\255\4\106\134\3\12\4\228\0\2\58\4\120\132\13\148\2\60\132\13\146\1\106\0'}
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    25
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    26
local function drawMap()
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    27
	for m=1, #map do
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    28
		ParseCommand("draw "..map[m])
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    29
	end
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    30
end
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    31
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    32
-- Gears
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    33
local hog
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    34
local ropeGear
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    35
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    36
-- Status vars
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    37
local ropeSelected = false	-- rope was selected the first time, used for msg
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    38
local ropeAttached = false	-- rope was attached, used for msg
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    39
local target1Reached = false	-- hog near 1st first target
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    40
local barrelsBoom = false	-- barrels exploded
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    41
local wasFirstTurn = false	-- first turn msg was displayed
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    42
local gameOver = false		-- game over (only victory possible)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    43
local currentTarget = 0		-- current target ID. First target = 1
14668
38836d6c5c8a Play "Flawless" voice when completing the rope or saucer training perfectly
Wuzzy <Wuzzy2@mail.ru>
parents: 14492
diff changeset
    44
local flawless = true		-- flawless if no damage taken and no mistake made
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    45
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    46
local cpX, cpY = 208, 1384	-- hog checkpoint, initialized with start coords
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    47
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    48
-- "Constants"
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    49
local initHogHealth = 50
14455
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
    50
local initHogHealthFinal = 1
14492
6c62f7ebea45 Fix 2 team name mistakes in missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14480
diff changeset
    51
local teamName
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    52
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    53
local girderData = {
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    54
	{2012, 1366, 6}, -- water gate
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    55
	{1156, 678, 2}, -- post-barrel gate
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    56
	{1206, 905, 2}, -- post-barrel gate
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    57
	{1064, 288, 6}, -- top level gate
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    58
	{1064, 455, 6}, -- top level gate
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    59
	{1557, 1009, 0}, -- barrel pit protection
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    60
	{1436, 1003, 4}, -- barrel pit protection
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    61
	{3607, 1307, 4}, -- post-water gate
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    62
	{3809, 1375, 0}, -- post-water gate
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    63
}
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    64
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    65
local targetData = {
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    66
	-- 1: Start
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    67
	{504, 1215},
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    68
	-- 2: Start 2
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    69
	{1082, 1348},
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    70
	-- 3: Before the water
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    71
	{1941, 1490},
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    72
	-- 4: After the water
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    73
	{3504, 1557},
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    74
	-- 5: Barrel pit
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    75
	{2060, 885},
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    76
	-- 6: Grand Finale
13183
fde354aaf978 Rope Training: Place the second-last target at a more reasonable position
Wuzzy <Wuzzy2@mail.ru>
parents: 13094
diff changeset
    77
	{834, 381},
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    78
	-- 7: Goal
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    79
	{3802, 356},
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    80
}
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    81
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    82
function onGameInit()
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
    83
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    84
	ClearGameFlags()
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    85
	EnableGameFlags(gfDisableGirders, gfDisableLandObjects, gfOneClanMode, gfInfAttack, gfSolidLand, gfDisableWind)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    86
	Seed = "{386439b4-748a-48b1-945a-eba6a817ca83}"
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    87
	Theme = "Bamboo"
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    88
	MapGen = mgDrawn
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    89
	MapFeatureSize = 12
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    90
	TemplateFilter = 0
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    91
	TemplateNumber = 0
13750
110d6c1e817f Lua: Rename globals: NoPointX→NO_CURSOR, cMaxTurnTime→MAX_TURN_TIME, cMaxHogHealth→MAX_HOG_HEALTH
Wuzzy <Wuzzy2@mail.ru>
parents: 13664
diff changeset
    92
	TurnTime = MAX_TURN_TIME
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    93
	Explosives = 0
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    94
	MinesNum = 0
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    95
	CaseFreq = 0
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    96
	MinesTime = 0
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    97
	WaterRise = 0
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    98
	HealthDecrease = 0
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
    99
14492
6c62f7ebea45 Fix 2 team name mistakes in missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14480
diff changeset
   100
	teamName = AddMissionTeam(-1)
14480
208359558642 Use player-chosen team identity for training and a few challenges
Wuzzy <Wuzzy2@mail.ru>
parents: 14464
diff changeset
   101
	hog = AddMissionHog(initHogHealth)
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   102
	SetGearPosition(hog, cpX, cpY)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   103
	SetEffect(hog, heResurrectable, 1)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   104
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   105
	drawMap()
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   106
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   107
	SendHealthStatsOff()
14951
c173fae0a223 Hide player ranks in training missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14941
diff changeset
   108
	SendRankingStatsOff()
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   109
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   110
end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   111
14455
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
   112
-- The final challenge is to rope through an obstacle course with only 1 rope.
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   113
-- If the player screws up, this functinon will restart it.
14455
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
   114
local function resetFinalChallenge(setPos)
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   115
	if setPos == nil then
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   116
		setPos = true
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   117
	end
14455
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
   118
	SetHealth(hog, initHogHealthFinal)
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   119
	AddAmmo(hog, amRope, 1)
14455
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
   120
	SetGearVelocity(hog, 0, 0)
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   121
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   122
	if setPos then
14455
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
   123
		PlaySound(sndWarp)
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   124
		SetGearPosition(hog, cpX, cpY)
14455
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
   125
		AddVisualGear(cpX, cpY, vgtExplosion, 0, false)
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   126
		FollowGear(hog)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   127
	end
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   128
end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   129
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   130
-- Deletes girder with given girderData ID
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   131
local function eraseGirder(id)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   132
	EraseSprite(girderData[id][1], girderData[id][2], sprAmGirder, girderData[id][3], false, false, false, false)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   133
	PlaySound(sndVaporize)
14941
c645327d0a81 Rope Training, ACF1: Improve visual effects when removing girders
Wuzzy <Wuzzy2@mail.ru>
parents: 14930
diff changeset
   134
	local dir = girderData[id][3]
c645327d0a81 Rope Training, ACF1: Improve visual effects when removing girders
Wuzzy <Wuzzy2@mail.ru>
parents: 14930
diff changeset
   135
	if dir == 4 then
c645327d0a81 Rope Training, ACF1: Improve visual effects when removing girders
Wuzzy <Wuzzy2@mail.ru>
parents: 14930
diff changeset
   136
		-- long horizontal
c645327d0a81 Rope Training, ACF1: Improve visual effects when removing girders
Wuzzy <Wuzzy2@mail.ru>
parents: 14930
diff changeset
   137
		for i=-4,4 do
c645327d0a81 Rope Training, ACF1: Improve visual effects when removing girders
Wuzzy <Wuzzy2@mail.ru>
parents: 14930
diff changeset
   138
			AddVisualGear(girderData[id][1] + i * 18, girderData[id][2], vgtSteam, false, 0)
c645327d0a81 Rope Training, ACF1: Improve visual effects when removing girders
Wuzzy <Wuzzy2@mail.ru>
parents: 14930
diff changeset
   139
		end
c645327d0a81 Rope Training, ACF1: Improve visual effects when removing girders
Wuzzy <Wuzzy2@mail.ru>
parents: 14930
diff changeset
   140
	elseif dir == 0 then
c645327d0a81 Rope Training, ACF1: Improve visual effects when removing girders
Wuzzy <Wuzzy2@mail.ru>
parents: 14930
diff changeset
   141
		-- short horizontal
c645327d0a81 Rope Training, ACF1: Improve visual effects when removing girders
Wuzzy <Wuzzy2@mail.ru>
parents: 14930
diff changeset
   142
		for i=-2,1 do
c645327d0a81 Rope Training, ACF1: Improve visual effects when removing girders
Wuzzy <Wuzzy2@mail.ru>
parents: 14930
diff changeset
   143
			AddVisualGear(10 + girderData[id][1] + i * 20, girderData[id][2], vgtSteam, false, 0)
c645327d0a81 Rope Training, ACF1: Improve visual effects when removing girders
Wuzzy <Wuzzy2@mail.ru>
parents: 14930
diff changeset
   144
		end
c645327d0a81 Rope Training, ACF1: Improve visual effects when removing girders
Wuzzy <Wuzzy2@mail.ru>
parents: 14930
diff changeset
   145
	elseif dir == 6 then
c645327d0a81 Rope Training, ACF1: Improve visual effects when removing girders
Wuzzy <Wuzzy2@mail.ru>
parents: 14930
diff changeset
   146
		-- long vertical
c645327d0a81 Rope Training, ACF1: Improve visual effects when removing girders
Wuzzy <Wuzzy2@mail.ru>
parents: 14930
diff changeset
   147
		for i=-4,4 do
c645327d0a81 Rope Training, ACF1: Improve visual effects when removing girders
Wuzzy <Wuzzy2@mail.ru>
parents: 14930
diff changeset
   148
			AddVisualGear(girderData[id][1], girderData[id][2] + i * 18, vgtSteam, false, 0)
c645327d0a81 Rope Training, ACF1: Improve visual effects when removing girders
Wuzzy <Wuzzy2@mail.ru>
parents: 14930
diff changeset
   149
		end
c645327d0a81 Rope Training, ACF1: Improve visual effects when removing girders
Wuzzy <Wuzzy2@mail.ru>
parents: 14930
diff changeset
   150
	elseif dir == 2 then
c645327d0a81 Rope Training, ACF1: Improve visual effects when removing girders
Wuzzy <Wuzzy2@mail.ru>
parents: 14930
diff changeset
   151
		-- short vertical
c645327d0a81 Rope Training, ACF1: Improve visual effects when removing girders
Wuzzy <Wuzzy2@mail.ru>
parents: 14930
diff changeset
   152
		for i=-2,1 do
c645327d0a81 Rope Training, ACF1: Improve visual effects when removing girders
Wuzzy <Wuzzy2@mail.ru>
parents: 14930
diff changeset
   153
			AddVisualGear(girderData[id][1], 10 + girderData[id][2] + i * 20, vgtSteam, false, 0)
c645327d0a81 Rope Training, ACF1: Improve visual effects when removing girders
Wuzzy <Wuzzy2@mail.ru>
parents: 14930
diff changeset
   154
		end
c645327d0a81 Rope Training, ACF1: Improve visual effects when removing girders
Wuzzy <Wuzzy2@mail.ru>
parents: 14930
diff changeset
   155
	else
c645327d0a81 Rope Training, ACF1: Improve visual effects when removing girders
Wuzzy <Wuzzy2@mail.ru>
parents: 14930
diff changeset
   156
		AddVisualGear(girderData[id][1], girderData[id][2], vgtSteam, false, 0)
c645327d0a81 Rope Training, ACF1: Improve visual effects when removing girders
Wuzzy <Wuzzy2@mail.ru>
parents: 14930
diff changeset
   157
	end
c645327d0a81 Rope Training, ACF1: Improve visual effects when removing girders
Wuzzy <Wuzzy2@mail.ru>
parents: 14930
diff changeset
   158
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   159
	AddCaption(loc("Barrier unlocked!"))
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   160
end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   161
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   162
local function loadGearData()
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   163
	------ GIRDERS ------
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   164
	for g=1, #girderData do
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   165
		PlaceGirder(unpack(girderData[g]))
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   166
	end
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   167
14455
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
   168
	PlaceSprite(1678, 546, sprTargetBee, 0)
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
   169
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   170
	------ BARRELS ------
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   171
	local barrels = {}
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   172
	table.insert(barrels, AddGear(1370, 1223, gtExplosives, 0, 0, 0, 0))
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   173
	table.insert(barrels, AddGear(1430, 1226, gtExplosives, 0, 0, 0, 0))
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   174
	table.insert(barrels, AddGear(1489, 1218, gtExplosives, 0, 0, 0, 0))
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   175
	table.insert(barrels, AddGear(1537, 1211, gtExplosives, 0, 0, 0, 0))
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   176
	table.insert(barrels, AddGear(1578, 1206, gtExplosives, 0, 0, 0, 0))
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   177
	for b=1, #barrels do
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   178
		SetHealth(barrels[b], 1)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   179
	end
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   180
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   181
	------ FIRST TARGET ------
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   182
	currentTarget = 1
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   183
	AddGear(targetData[currentTarget][1], targetData[currentTarget][2], gtTarget, 0, 0, 0, 0)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   184
end
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   185
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   186
function onGameStart()
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   187
	loadGearData()
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   188
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   189
	ShowMission(loc("Basic Rope Training"), loc("Basic Training"),
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   190
	loc("Use the rope to complete the obstacle course!"), -amRope, 0)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   191
	FollowGear(hog)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   192
end
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   193
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   194
function onNewTurn()
14382
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   195
	local ctrl = ""
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   196
	if not wasFirstTurn then
14382
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   197
		if INTERFACE == "desktop" then
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   198
			ctrl = loc("Open ammo menu: [Right click]")
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   199
		elseif INTERFACE == "touch" then
14388
cf49fac6e88a Make better re-use of some mission strings
Wuzzy <Wuzzy2@mail.ru>
parents: 14382
diff changeset
   200
			ctrl = loc("Open ammo menu: Tap the [Suitcase]")
14382
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   201
		end
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   202
		ShowMission(loc("Basic Rope Training"), loc("Select Rope"),
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   203
		loc("Select the rope to begin!").."|"..
14382
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   204
		ctrl, 2, 7500)
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   205
		wasFirstTurn = true
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   206
	end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   207
end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   208
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   209
function onGameTick()
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   210
	if gameOver or (not CurrentHedgehog) then
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   211
		return
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   212
	end
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   213
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   214
	-- First rope selection
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   215
	if not ropeSelected and GetCurAmmoType() == amRope then
14382
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   216
		local ctrl = ""
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   217
		if INTERFACE == "desktop" then
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   218
			ctrl = loc("Aim: [Up]/[Down]").."|"..
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   219
			loc("Attack: [Space]")
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   220
		elseif INTERFACE == "touch" then
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   221
			ctrl = loc("Aim: [Up]/[Down]").."|"..
14388
cf49fac6e88a Make better re-use of some mission strings
Wuzzy <Wuzzy2@mail.ru>
parents: 14382
diff changeset
   222
			loc("Attack: Tap the [Bomb]")
14382
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   223
		end
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   224
		ShowMission(loc("Basic Rope Training"), loc("Getting Started"),
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   225
		loc("You can use the rope to reach new places.").."|"..
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   226
		loc("Aim at the ceiling and hold [Attack] pressed until the rope attaches.").."|"..
14382
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   227
		ctrl, 2, 15000)
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   228
		ropeSelected = true
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   229
	-- Rope attach
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   230
	elseif ropeGear and band(GetState(ropeGear), gstCollision) ~= 0 then
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   231
		-- First rope attach
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   232
		if not ropeAttached and not target1Reached then
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   233
			ShowMission(loc("Basic Rope Training"), loc("How to Rope"),
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   234
			loc("Great!").."|"..
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   235
			loc("Use the rope to get to the target!").."|"..
13094
ffa5cdc75826 Rope training: Fix confused order of retract/extend controls
Wuzzy <Wuzzy2@mail.ru>
parents: 13082
diff changeset
   236
			loc("Retract/Extend rope: [Up]/[Down]").."|"..
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   237
			loc("Swing: [Left]/[Right]").."|"..
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   238
			loc("Release rope: [Attack]"), 2, 15000)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   239
			ropeAttached = true
14455
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
   240
		elseif currentTarget > 1 and (not (currentTarget == 6 and barrelsBoom)) then
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   241
			HideMission()
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   242
		end
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   243
	end
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   244
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   245
	-- Prevent grenade being thrown by hand (must use from rope instead)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   246
	local allowAttack = true
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   247
	if GetCurAmmoType() == amGrenade and ropeGear == nil then
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   248
		allowAttack = false
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   249
	end
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   250
	if allowAttack then
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   251
		SetInputMask(bor(GetInputMask(), gmAttack))
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   252
	else
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   253
		SetInputMask(band(GetInputMask(), bnot(gmAttack)))
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   254
	end
14455
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
   255
	if isInFinalChallenge then
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
   256
		local dX, dY = GetGearVelocity(CurrentHedgehog)
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
   257
		local x, y = GetGearPosition(CurrentHedgehog)
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
   258
		if band(GetState(CurrentHedgehog), gstHHDriven) ~= 0 and GetAmmoCount(CurrentHedgehog, amRope) == 0 and
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
   259
				GetFlightTime(CurrentHedgehog) == 0 and (not ropeGear) and
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
   260
				math.abs(dX) < 5 and math.abs(dY) < 5 and
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
   261
				(x < 3417 or y > 471) then
14668
38836d6c5c8a Play "Flawless" voice when completing the rope or saucer training perfectly
Wuzzy <Wuzzy2@mail.ru>
parents: 14492
diff changeset
   262
			flawless = false
14455
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
   263
			AddCaption(loc("Your rope is gone! Try again!"))
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
   264
			resetFinalChallenge()
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
   265
			PlaySound(sndWarp)
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
   266
		end
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
   267
	end
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   268
end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   269
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   270
function onGameTick20()
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   271
	if not gameOver and not target1Reached and CurrentHedgehog and gearIsInCircle(CurrentHedgehog, targetData[1][1], targetData[1][2], 48, false) then
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   272
		ShowMission(loc("Basic Rope Training"), loc("Target Puncher"),
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   273
		loc("Okay, now destroy the target|using the baseball bat.").."|"..
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   274
		loc("Release rope: [Attack]"), 2, 9000)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   275
		target1Reached = true
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   276
	end
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   277
end
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   278
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   279
function onGearAdd(gear)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   280
	if GetGearType(gear) == gtRope then
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   281
		ropeGear = gear
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   282
	elseif GetGearType(gear) == gtGrenade then
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   283
		if not ropeGear then
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   284
			DeleteGear(gear)
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   285
		end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   286
	end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   287
end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   288
13630
fe7d2bbf5f3f Fix resurrection animation appearing at wrong position for some missions and styles
Wuzzy <Wuzzy2@mail.ru>
parents: 13583
diff changeset
   289
function onGearResurrect(gear, vGear)
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   290
	-- Teleport hog to previous checkpoint
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   291
	if gear == hog then
14668
38836d6c5c8a Play "Flawless" voice when completing the rope or saucer training perfectly
Wuzzy <Wuzzy2@mail.ru>
parents: 14492
diff changeset
   292
		flawless = false
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   293
		SetGearPosition(hog, cpX, cpY)
13630
fe7d2bbf5f3f Fix resurrection animation appearing at wrong position for some missions and styles
Wuzzy <Wuzzy2@mail.ru>
parents: 13583
diff changeset
   294
		if vGear then
fe7d2bbf5f3f Fix resurrection animation appearing at wrong position for some missions and styles
Wuzzy <Wuzzy2@mail.ru>
parents: 13583
diff changeset
   295
			SetVisualGearValues(vGear, GetX(hog), GetY(hog))
fe7d2bbf5f3f Fix resurrection animation appearing at wrong position for some missions and styles
Wuzzy <Wuzzy2@mail.ru>
parents: 13583
diff changeset
   296
		end
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   297
		FollowGear(hog)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   298
		AddCaption(loc("Your hedgehog has been revived!"))
14455
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
   299
		if isInFinalChallenge then
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
   300
			resetFinalChallenge(false)
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   301
		end
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   302
	end
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   303
end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   304
14668
38836d6c5c8a Play "Flawless" voice when completing the rope or saucer training perfectly
Wuzzy <Wuzzy2@mail.ru>
parents: 14492
diff changeset
   305
function onGearDamage(gear)
38836d6c5c8a Play "Flawless" voice when completing the rope or saucer training perfectly
Wuzzy <Wuzzy2@mail.ru>
parents: 14492
diff changeset
   306
	if gear == hog then
38836d6c5c8a Play "Flawless" voice when completing the rope or saucer training perfectly
Wuzzy <Wuzzy2@mail.ru>
parents: 14492
diff changeset
   307
		flawless = false
38836d6c5c8a Play "Flawless" voice when completing the rope or saucer training perfectly
Wuzzy <Wuzzy2@mail.ru>
parents: 14492
diff changeset
   308
	end
38836d6c5c8a Play "Flawless" voice when completing the rope or saucer training perfectly
Wuzzy <Wuzzy2@mail.ru>
parents: 14492
diff changeset
   309
end
38836d6c5c8a Play "Flawless" voice when completing the rope or saucer training perfectly
Wuzzy <Wuzzy2@mail.ru>
parents: 14492
diff changeset
   310
14930
632538406573 Rope Training: Re-display nade help text when trying to throw nade by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 14928
diff changeset
   311
local function dropNadeText(time)
632538406573 Rope Training: Re-display nade help text when trying to throw nade by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 14928
diff changeset
   312
	ShowMission(loc("Basic Rope Training"), loc("Rope Weapons"),
632538406573 Rope Training: Re-display nade help text when trying to throw nade by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 14928
diff changeset
   313
	loc("Some weapons can be dropped from the rope.").."|"..
632538406573 Rope Training: Re-display nade help text when trying to throw nade by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 14928
diff changeset
   314
	loc("Collect the weapon crate and drop|a grenade from rope to destroy the barrels.").."|"..
632538406573 Rope Training: Re-display nade help text when trying to throw nade by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 14928
diff changeset
   315
	loc("Step 1: Start roping").."|"..
632538406573 Rope Training: Re-display nade help text when trying to throw nade by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 14928
diff changeset
   316
	loc("Step 2: Select grenade").."|"..
632538406573 Rope Training: Re-display nade help text when trying to throw nade by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 14928
diff changeset
   317
	loc("Step 3: Drop the grenade").."| |"..
632538406573 Rope Training: Re-display nade help text when trying to throw nade by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 14928
diff changeset
   318
	loc("Drop weapon (while on rope): [Long Jump]"), 2, time)
632538406573 Rope Training: Re-display nade help text when trying to throw nade by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 14928
diff changeset
   319
end
632538406573 Rope Training: Re-display nade help text when trying to throw nade by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 14928
diff changeset
   320
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   321
function onGearDelete(gear)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   322
	if GetGearType(gear) == gtTarget then
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   323
		-- Update checkpoint
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   324
		cpX, cpY = GetGearPosition(gear)
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   325
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   326
		-- New message
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   327
		if currentTarget == 1 then
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   328
			ShowMission(loc("Basic Rope Training"), loc("Obstacle"),
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   329
			loc("Well done! Let's destroy the next target!").."|"..
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   330
			loc("The targets will guide you through the training.").."|"..
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   331
			loc("Use your rope to get to the next target, then destroy it!"), 2, 8000)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   332
		elseif currentTarget == 2 then
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   333
			ShowMission(loc("Basic Rope Training"), loc("Speed Roping"),
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   334
			loc("Try to reach and destroy the next target quickly.").."|"..
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   335
			loc("Hint: When you shorten the rope, you move faster!|And when you lengthen it, you move slower."), 2, 15000)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   336
		elseif currentTarget == 3 then
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   337
			ShowMission(loc("Basic Rope Training"), loc("Over the Water"),
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   338
			loc("When you're in mid-air, you can continue to aim|and fire another rope if you're not attached.").."|"..
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   339
			loc("To get over the water, you have to do multiple|rope shots and swings.").."|"..
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   340
			loc("It needs some practice, but you have infinite lives.").."|"..
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   341
			loc("Good luck!"), 2, 22500)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   342
			eraseGirder(1)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   343
		elseif currentTarget == 4 then
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   344
			ShowMission(loc("Basic Rope Training"), loc("Little Obstacle Course"),
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   345
			loc("Well done! The next target awaits.").."|"..
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   346
			loc("Hint: The rope only bends around objects.|When it doesn't hit anything, it's always straight."), 2, 7000)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   347
			eraseGirder(8)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   348
			eraseGirder(9)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   349
		elseif currentTarget == 5 then
14930
632538406573 Rope Training: Re-display nade help text when trying to throw nade by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 14928
diff changeset
   350
			dropNadeText(20000)
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   351
			AddAmmo(hog, amBaseballBat, 0)
14455
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
   352
			SpawnAmmoCrate(1849, 920, amGrenade, AMMO_INFINITE)
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   353
		elseif currentTarget == 6 then
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   354
			ShowMission(loc("Basic Rope Training"), loc("Finite Ropes"),
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   355
			loc("So far, you had infinite ropes, but in the|real world, ropes are usually limited.").."|"..
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   356
			loc("Rules:").." |"..
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   357
			loc("As long you don't touch the ground, you can|re-use the same rope as often as you like.").."|"..
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   358
			loc("If you miss a shot while trying to|re-attach, your rope is gone, too!").."| |"..
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   359
			loc("Final Challenge:").." |"..
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   360
			loc("Reach and destroy the final target to win.").."|"..
14455
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
   361
			loc("You only get 1 rope this time, don't waste it!"),
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
   362
			2, 25000)
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   363
			eraseGirder(4)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   364
			eraseGirder(5)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   365
			AddAmmo(hog, amRope, 1)
14455
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
   366
			SetHealth(hog, initHogHealthFinal)
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
   367
			isInFinalChallenge = true
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   368
		elseif currentTarget == 7 then
14464
ead8928a59f8 Report mission victory for most missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14455
diff changeset
   369
			SaveMissionVar("Won", "true")
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   370
			ShowMission(loc("Basic Rope Training"), loc("Training complete!"),
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   371
			loc("Congratulations!"), 0, 0)
14668
38836d6c5c8a Play "Flawless" voice when completing the rope or saucer training perfectly
Wuzzy <Wuzzy2@mail.ru>
parents: 14492
diff changeset
   372
			if flawless then
38836d6c5c8a Play "Flawless" voice when completing the rope or saucer training perfectly
Wuzzy <Wuzzy2@mail.ru>
parents: 14492
diff changeset
   373
				PlaySound(sndFlawless, hog)
38836d6c5c8a Play "Flawless" voice when completing the rope or saucer training perfectly
Wuzzy <Wuzzy2@mail.ru>
parents: 14492
diff changeset
   374
			else
38836d6c5c8a Play "Flawless" voice when completing the rope or saucer training perfectly
Wuzzy <Wuzzy2@mail.ru>
parents: 14492
diff changeset
   375
				PlaySound(sndVictory, hog)
38836d6c5c8a Play "Flawless" voice when completing the rope or saucer training perfectly
Wuzzy <Wuzzy2@mail.ru>
parents: 14492
diff changeset
   376
			end
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   377
			AddAmmo(hog, amBaseballBat, 0)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   378
			AddAmmo(hog, amGrenade, 0)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   379
			AddAmmo(hog, amRope, 0)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   380
			SendStat(siCustomAchievement, loc("Oh yeah! You sure know how to rope!"))
12050
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   381
			SendStat(siGameResult, loc("You have finished the Basic Rope Training!"))
daf63e2a21d2 Rewrite some help texts in the basic rope training mission
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   382
			EndGame()
14928
4c5fb1ee75b7 Add winner animation for missions that didn't have it
Wuzzy <Wuzzy2@mail.ru>
parents: 14668
diff changeset
   383
			SetState(hog, gstWinner)
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   384
			gameOver = true
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   385
			SetInputMask(0)
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   386
		end
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   387
		currentTarget = currentTarget + 1
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   388
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   389
		if currentTarget <= #targetData then
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   390
			AddGear(targetData[currentTarget][1], targetData[currentTarget][2], gtTarget, 0, 0, 0, 0)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   391
		end
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   392
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   393
	elseif GetGearType(gear) == gtExplosives then
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   394
		if not barrelsBoom then
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   395
			barrelsBoom = true
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   396
			AddAmmo(hog, amGrenade, 0)
14455
df366c5b8440 Rope training: Simplify final challenge, remove mines
Wuzzy <Wuzzy2@mail.ru>
parents: 14454
diff changeset
   397
			AddAmmo(hog, amBaseballBat, AMMO_INFINITE)
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   398
			eraseGirder(2)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   399
			eraseGirder(3)
14454
fd34b9037c69 Rope training: Show hint after destroying barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 14388
diff changeset
   400
			ShowMission(loc("Basic Rope Training"),
fd34b9037c69 Rope training: Show hint after destroying barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 14388
diff changeset
   401
				loc("Kaboom!"),
fd34b9037c69 Rope training: Show hint after destroying barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 14388
diff changeset
   402
				loc("Follow the path and destroy the next target."),
fd34b9037c69 Rope training: Show hint after destroying barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 14388
diff changeset
   403
				2, 5000)
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   404
		end
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   405
	elseif GetGearType(gear) == gtRope then
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   406
		ropeGear = nil
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   407
		if ropeAttached and not target1Reached then
14382
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   408
			local ctrl = ""
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   409
			if INTERFACE == "desktop" then
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   410
				ctrl = loc("Aim: [Up]/[Down]").."|"..
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   411
				loc("Attack: [Space]")
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   412
			elseif INTERFACE == "touch" then
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   413
				ctrl = loc("Aim: [Up]/[Down]").."|"..
14388
cf49fac6e88a Make better re-use of some mission strings
Wuzzy <Wuzzy2@mail.ru>
parents: 14382
diff changeset
   414
				loc("Attack: Tap the [Bomb]")
14382
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   415
			end
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   416
			ShowMission(loc("Basic Rope Training"), loc("How to Rope"),
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   417
			loc("Go to the target.").."|"..
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   418
			loc("Hold [Attack] to attach the rope.").."|"..
14382
f9d4b8222903 Add tutorial texts for Touch interface
Wuzzy <Wuzzy2@mail.ru>
parents: 13750
diff changeset
   419
			ctrl, 2, 13000)
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   420
			ropeAttached = false
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   421
		end
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   422
	elseif GetGearType(gear) == gtCase then
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   423
		eraseGirder(6)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   424
		eraseGirder(7)
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   425
	end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   426
end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   427
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   428
function onAmmoStoreInit()
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   429
	SetAmmo(amRope, 9, 0, 0, 1)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   430
	SetAmmo(amBaseballBat, 9, 0, 0, 1)
6501
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   431
end
4a6666deb85b Add some (slightly modified) GCI missions.
mikade
parents:
diff changeset
   432
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   433
function onAttack()
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   434
	if GetCurAmmoType() == amGrenade and not ropeGear then
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   435
		AddCaption(loc("You have to drop the grenade from rope!"), 0xFF4000FF, capgrpMessage)
14930
632538406573 Rope Training: Re-display nade help text when trying to throw nade by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 14928
diff changeset
   436
		dropNadeText(5000)
13082
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   437
		PlaySound(sndDenied)
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   438
	end
aa9e871f9685 Complete overhaul of Basic Rope Training
Wuzzy <Wuzzy2@mail.ru>
parents: 12771
diff changeset
   439
end