author | Wuzzy <Wuzzy2@mail.ru> |
Thu, 14 Nov 2019 17:12:31 +0100 | |
changeset 15504 | 266ff128a65a |
parent 15081 | 3a561db2a71c |
child 15505 | d94c42c174a1 |
permissions | -rw-r--r-- |
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
1 |
------------------- ABOUT ---------------------- |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
2 |
-- |
14488
7bb7e5e54f70
Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents:
13740
diff
changeset
|
3 |
-- The hero has to catch the other hog in order |
9614
7fa70d381c75
added custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9613
diff
changeset
|
4 |
-- to get informations about the origin of Pr. Hogevil |
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
5 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
6 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
7 |
HedgewarsScriptLoad("/Scripts/Animate.lua") |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
8 |
HedgewarsScriptLoad("/Missions/Campaign/A_Space_Adventure/global_functions.lua") |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
9 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
10 |
----------------- VARIABLES -------------------- |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
11 |
-- globals |
9615
86b82816b222
image and description
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9614
diff
changeset
|
12 |
local missionName = loc("Chasing the blue hog") |
9757 | 13 |
local challengeObjectives = loc("Use the rope in order to catch the blue hedgehog").."|".. |
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
14 |
loc("You have to stand very close to him") |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
15 |
local currentPosition = 1 |
14580
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
16 |
local raceSectionStarted = false |
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
17 |
local runnerCaught = false |
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
18 |
local previousTimeLeft = 0 |
9772
30a9e740ec09
moon02 fixes: bug that didn't called win(), changed map so blue hog not placed on edges, teleport animations, removed amSkip, also error when drow hero and enemy seems fixed
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9758
diff
changeset
|
19 |
local startChallenge = false |
11891
d79621bcb709
Save record time for Chasing the blue hog mission
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
20 |
local winningTime = nil |
14576
2087e50e03e2
ASA: Show current time and personal best in moon02
Wuzzy <Wuzzy2@mail.ru>
parents:
14488
diff
changeset
|
21 |
local currentTime = 0 |
2087e50e03e2
ASA: Show current time and personal best in moon02
Wuzzy <Wuzzy2@mail.ru>
parents:
14488
diff
changeset
|
22 |
local runnerTime = 0 |
2087e50e03e2
ASA: Show current time and personal best in moon02
Wuzzy <Wuzzy2@mail.ru>
parents:
14488
diff
changeset
|
23 |
local record |
14580
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
24 |
local lostGame = false |
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
25 |
local heroHurt = false |
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
26 |
-- dialogs |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
27 |
local dialog01 = {} |
9613
142ba1d08205
cleanup - removed debug prints
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9612
diff
changeset
|
28 |
local dialog02 = {} |
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
29 |
-- mission objectives |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
30 |
local goals = { |
12575
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12538
diff
changeset
|
31 |
[dialog01] = {missionName, loc("Challenge objectives"), challengeObjectives, 1, 0}, |
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
32 |
} |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
33 |
-- hogs |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
34 |
local hero = { |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
35 |
name = loc("Hog Solo"), |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
36 |
x = 1300, |
14581
72b4bdd5052c
ASA: Tweak spawning height of hedgehogs
Wuzzy <Wuzzy2@mail.ru>
parents:
14580
diff
changeset
|
37 |
y = 948 |
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
38 |
} |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
39 |
local runner = { |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
40 |
name = loc("Crazy Runner"), |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
41 |
places = { |
14581
72b4bdd5052c
ASA: Tweak spawning height of hedgehogs
Wuzzy <Wuzzy2@mail.ru>
parents:
14580
diff
changeset
|
42 |
{x = 1400,y = 904, turnTime = 0}, |
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
43 |
{x = 3880,y = 33, turnTime = 30000}, |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
44 |
{x = 250,y = 1780, turnTime = 25000}, |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
45 |
{x = 3850,y = 1940, turnTime = 20000}, |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
46 |
} |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
47 |
} |
14577
221380cdee7e
ASA moon02: Add finishing times in ranking
Wuzzy <Wuzzy2@mail.ru>
parents:
14576
diff
changeset
|
48 |
local runnerTimeTotal = 0 |
221380cdee7e
ASA moon02: Add finishing times in ranking
Wuzzy <Wuzzy2@mail.ru>
parents:
14576
diff
changeset
|
49 |
for i=1, #runner.places do |
221380cdee7e
ASA moon02: Add finishing times in ranking
Wuzzy <Wuzzy2@mail.ru>
parents:
14576
diff
changeset
|
50 |
runnerTimeTotal = runnerTimeTotal + runner.places[i].turnTime |
221380cdee7e
ASA moon02: Add finishing times in ranking
Wuzzy <Wuzzy2@mail.ru>
parents:
14576
diff
changeset
|
51 |
end |
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
52 |
-- teams |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
53 |
local teamA = { |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
54 |
name = loc("Hog Solo"), |
13583
141cdfe0f3ca
Switch almost all Lua calls of AddTeam to using default clan colors instead of hardcoded color
Wuzzy <Wuzzy2@mail.ru>
parents:
12587
diff
changeset
|
55 |
color = -6 |
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
56 |
} |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
57 |
local teamB = { |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
58 |
name = loc("Crazy Runner"), |
13583
141cdfe0f3ca
Switch almost all Lua calls of AddTeam to using default clan colors instead of hardcoded color
Wuzzy <Wuzzy2@mail.ru>
parents:
12587
diff
changeset
|
59 |
color = -2 |
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
60 |
} |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
61 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
62 |
-------------- LuaAPI EVENT HANDLERS ------------------ |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
63 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
64 |
function onGameInit() |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
65 |
GameFlags = gfDisableWind |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
66 |
Seed = 1 |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
67 |
TurnTime = 25000 |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
68 |
CaseFreq = 0 |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
69 |
MinesNum = 0 |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
70 |
Explosives = 0 |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
71 |
Map = "moon02_map" |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
72 |
Theme = "Cheese" |
12468
d652c6f5d5f1
Disable Sudden Death for a couple of ASA missions
Wuzzy <almikes@aol.com>
parents:
12467
diff
changeset
|
73 |
-- Disable Sudden Death |
d652c6f5d5f1
Disable Sudden Death for a couple of ASA missions
Wuzzy <almikes@aol.com>
parents:
12467
diff
changeset
|
74 |
WaterRise = 0 |
d652c6f5d5f1
Disable Sudden Death for a couple of ASA missions
Wuzzy <almikes@aol.com>
parents:
12467
diff
changeset
|
75 |
HealthDecrease = 0 |
9758 | 76 |
|
14488
7bb7e5e54f70
Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents:
13740
diff
changeset
|
77 |
-- Hero |
7bb7e5e54f70
Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents:
13740
diff
changeset
|
78 |
teamA.name = AddMissionTeam(teamA.color) |
7bb7e5e54f70
Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents:
13740
diff
changeset
|
79 |
hero.gear = AddMissionHog(1) |
7bb7e5e54f70
Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents:
13740
diff
changeset
|
80 |
hero.name = GetHogName(hero.gear) |
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
81 |
AnimSetGearPosition(hero.gear, hero.x, hero.y) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
82 |
-- Crazy Runner |
14932
ff4003a90ff8
Enable automatic voicepack language selection for all missions
Wuzzy <Wuzzy2@mail.ru>
parents:
14898
diff
changeset
|
83 |
teamB.name = AddTeam(teamB.name, teamB.color, "ring", "Island", "Default_qau", "cm_sonic") |
9615
86b82816b222
image and description
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9614
diff
changeset
|
84 |
runner.gear = AddHog(runner.name, 0, 100, "sth_Sonic") |
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
85 |
AnimSetGearPosition(runner.gear, runner.places[1].x, runner.places[1].y) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
86 |
HogTurnLeft(runner.gear, true) |
9758 | 87 |
|
14576
2087e50e03e2
ASA: Show current time and personal best in moon02
Wuzzy <Wuzzy2@mail.ru>
parents:
14488
diff
changeset
|
88 |
record = tonumber(GetCampaignVar("FastestBlueHogCatch")) |
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
89 |
initCheckpoint("moon02") |
9758 | 90 |
|
12088
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12049
diff
changeset
|
91 |
AnimInit(true) |
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
92 |
AnimationSetup() |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
93 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
94 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
95 |
function onGameStart() |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
96 |
AnimWait(hero.gear, 3000) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
97 |
FollowGear(hero.gear) |
9758 | 98 |
|
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
99 |
AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0) |
14582
e74acf5141fd
ASA moon02: Don't play victory animation if runner died and hero survived
Wuzzy <Wuzzy2@mail.ru>
parents:
14581
diff
changeset
|
100 |
AddEvent(onRunnerDeath, {runner.gear}, runnerDeath, {runner.gear}, 0) |
9758 | 101 |
|
14576
2087e50e03e2
ASA: Show current time and personal best in moon02
Wuzzy <Wuzzy2@mail.ru>
parents:
14488
diff
changeset
|
102 |
if record ~= nil then |
2087e50e03e2
ASA: Show current time and personal best in moon02
Wuzzy <Wuzzy2@mail.ru>
parents:
14488
diff
changeset
|
103 |
goals[dialog01][3] = goals[dialog01][3] .. "|" .. string.format(loc("Personal best: %.3f seconds"), record/1000) |
2087e50e03e2
ASA: Show current time and personal best in moon02
Wuzzy <Wuzzy2@mail.ru>
parents:
14488
diff
changeset
|
104 |
end |
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
105 |
AddAmmo(hero.gear, amRope, 1) |
9758 | 106 |
|
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
107 |
SendHealthStatsOff() |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
108 |
hogTurn = runner.gear |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
109 |
AddAnim(dialog01) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
110 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
111 |
|
12577
e2b5c6e805e8
A Space Adventure: Remove or shorten intro sequences of side missions
Wuzzy <almikes@aol.com>
parents:
12575
diff
changeset
|
112 |
-- Hide mission panel when jumping or shooting rope |
12575
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12538
diff
changeset
|
113 |
function onGearAdd(gear) |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12538
diff
changeset
|
114 |
if GetGearType(gear) == gtRope then |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12538
diff
changeset
|
115 |
HideMission() |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12538
diff
changeset
|
116 |
end |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12538
diff
changeset
|
117 |
end |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12538
diff
changeset
|
118 |
|
12577
e2b5c6e805e8
A Space Adventure: Remove or shorten intro sequences of side missions
Wuzzy <almikes@aol.com>
parents:
12575
diff
changeset
|
119 |
function onLJump() |
e2b5c6e805e8
A Space Adventure: Remove or shorten intro sequences of side missions
Wuzzy <almikes@aol.com>
parents:
12575
diff
changeset
|
120 |
if startChallenge then |
e2b5c6e805e8
A Space Adventure: Remove or shorten intro sequences of side missions
Wuzzy <almikes@aol.com>
parents:
12575
diff
changeset
|
121 |
HideMission() |
e2b5c6e805e8
A Space Adventure: Remove or shorten intro sequences of side missions
Wuzzy <almikes@aol.com>
parents:
12575
diff
changeset
|
122 |
end |
e2b5c6e805e8
A Space Adventure: Remove or shorten intro sequences of side missions
Wuzzy <almikes@aol.com>
parents:
12575
diff
changeset
|
123 |
end |
e2b5c6e805e8
A Space Adventure: Remove or shorten intro sequences of side missions
Wuzzy <almikes@aol.com>
parents:
12575
diff
changeset
|
124 |
onHJump = onLJump |
e2b5c6e805e8
A Space Adventure: Remove or shorten intro sequences of side missions
Wuzzy <almikes@aol.com>
parents:
12575
diff
changeset
|
125 |
|
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
126 |
function onNewTurn() |
9772
30a9e740ec09
moon02 fixes: bug that didn't called win(), changed map so blue hog not placed on edges, teleport animations, removed amSkip, also error when drow hero and enemy seems fixed
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9758
diff
changeset
|
127 |
if startChallenge and currentPosition < 5 then |
9612 | 128 |
if CurrentHedgehog ~= hero.gear then |
12467
de69155f976b
Use new turn ending method in moon02.lua
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
129 |
EndTurn(true) |
14576
2087e50e03e2
ASA: Show current time and personal best in moon02
Wuzzy <Wuzzy2@mail.ru>
parents:
14488
diff
changeset
|
130 |
runnerTime = runnerTime + runner.places[currentPosition].turnTime |
2087e50e03e2
ASA: Show current time and personal best in moon02
Wuzzy <Wuzzy2@mail.ru>
parents:
14488
diff
changeset
|
131 |
SetTeamLabel(teamB.name, string.format(loc("%.1fs"), runnerTime/1000)) |
9612 | 132 |
else |
10289 | 133 |
SetWeapon(amRope) |
13740
2bb7141496a9
Use SetTurnTimeLeft and SetReadyTimeLeft in all scripts
Wuzzy <Wuzzy2@mail.ru>
parents:
13583
diff
changeset
|
134 |
SetTurnTimeLeft(runner.places[currentPosition].turnTime + previousTimeLeft) |
9612 | 135 |
previousTimeLeft = 0 |
14580
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
136 |
if currentPosition > 1 then |
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
137 |
raceSectionStarted = true |
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
138 |
end |
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
139 |
runnerCaught = false |
9612 | 140 |
end |
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
141 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
142 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
143 |
|
14580
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
144 |
function onEndTurn() |
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
145 |
if raceSectionStarted and currentPosition > 1 and currentPosition < 5 then |
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
146 |
if CurrentHedgehog == hero.gear and (not runnerCaught) and (not heroHurt) then |
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
147 |
-- sndBoring played manually because lose calls EndGame, which suppresses |
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
148 |
-- the taunt. |
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
149 |
PlaySound(sndBoring, hero.gear) |
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
150 |
lose() |
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
151 |
end |
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
152 |
end |
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
153 |
raceSectionStarted = false |
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
154 |
end |
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
155 |
|
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
156 |
function onGameTick() |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
157 |
AnimUnWait() |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
158 |
if ShowAnimation() == false then |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
159 |
return |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
160 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
161 |
ExecuteAfterAnimations() |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
162 |
CheckEvents() |
14576
2087e50e03e2
ASA: Show current time and personal best in moon02
Wuzzy <Wuzzy2@mail.ru>
parents:
14488
diff
changeset
|
163 |
if GetHealth(hero.gear) and CurrentHedgehog == hero.gear and startChallenge and currentPosition < 5 and currentPosition > 1 and ReadyTimeLeft == 0 and band(GetState(CurrentHedgehog), gstHHDriven) ~= 0 then |
2087e50e03e2
ASA: Show current time and personal best in moon02
Wuzzy <Wuzzy2@mail.ru>
parents:
14488
diff
changeset
|
164 |
currentTime = currentTime + 1 |
2087e50e03e2
ASA: Show current time and personal best in moon02
Wuzzy <Wuzzy2@mail.ru>
parents:
14488
diff
changeset
|
165 |
end |
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
166 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
167 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
168 |
function onGameTick20() |
14576
2087e50e03e2
ASA: Show current time and personal best in moon02
Wuzzy <Wuzzy2@mail.ru>
parents:
14488
diff
changeset
|
169 |
if startChallenge and currentPosition < 5 and currentPosition > 1 and CurrentHedgehog == hero.gear and ReadyTimeLeft == 0 and band(GetState(CurrentHedgehog), gstHHDriven) ~= 0 then |
2087e50e03e2
ASA: Show current time and personal best in moon02
Wuzzy <Wuzzy2@mail.ru>
parents:
14488
diff
changeset
|
170 |
SetTeamLabel(teamA.name, string.format(loc("%.1fs"), currentTime/1000)) |
2087e50e03e2
ASA: Show current time and personal best in moon02
Wuzzy <Wuzzy2@mail.ru>
parents:
14488
diff
changeset
|
171 |
end |
9772
30a9e740ec09
moon02 fixes: bug that didn't called win(), changed map so blue hog not placed on edges, teleport animations, removed amSkip, also error when drow hero and enemy seems fixed
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9758
diff
changeset
|
172 |
if GetHealth(hero.gear) and startChallenge and isHeroNextToRunner() and currentPosition < 5 then |
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
173 |
moveRunner() |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
174 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
175 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
176 |
|
15002
3ed1cbd31754
Backed out changeset 4596357d002d (onPreciseLocal causes desyncs)
Wuzzy <Wuzzy2@mail.ru>
parents:
14932
diff
changeset
|
177 |
function onPrecise() |
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
178 |
if GameTime > 3000 then |
9758 | 179 |
SetAnimSkip(true) |
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
180 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
181 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
182 |
|
14580
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
183 |
function onGearDamage(gear) |
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
184 |
if gear == hero.gear then |
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
185 |
heroHurt = true |
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
186 |
end |
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
187 |
end |
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
188 |
|
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
189 |
-------------- EVENTS ------------------ |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
190 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
191 |
function onHeroDeath(gear) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
192 |
if not GetHealth(hero.gear) then |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
193 |
return true |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
194 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
195 |
return false |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
196 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
197 |
|
14582
e74acf5141fd
ASA moon02: Don't play victory animation if runner died and hero survived
Wuzzy <Wuzzy2@mail.ru>
parents:
14581
diff
changeset
|
198 |
function onRunnerDeath(gear) |
e74acf5141fd
ASA moon02: Don't play victory animation if runner died and hero survived
Wuzzy <Wuzzy2@mail.ru>
parents:
14581
diff
changeset
|
199 |
if not GetHealth(runner.gear) then |
e74acf5141fd
ASA moon02: Don't play victory animation if runner died and hero survived
Wuzzy <Wuzzy2@mail.ru>
parents:
14581
diff
changeset
|
200 |
return true |
e74acf5141fd
ASA moon02: Don't play victory animation if runner died and hero survived
Wuzzy <Wuzzy2@mail.ru>
parents:
14581
diff
changeset
|
201 |
end |
e74acf5141fd
ASA moon02: Don't play victory animation if runner died and hero survived
Wuzzy <Wuzzy2@mail.ru>
parents:
14581
diff
changeset
|
202 |
return false |
e74acf5141fd
ASA moon02: Don't play victory animation if runner died and hero survived
Wuzzy <Wuzzy2@mail.ru>
parents:
14581
diff
changeset
|
203 |
end |
e74acf5141fd
ASA moon02: Don't play victory animation if runner died and hero survived
Wuzzy <Wuzzy2@mail.ru>
parents:
14581
diff
changeset
|
204 |
|
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
205 |
-------------- ACTIONS ------------------ |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
206 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
207 |
function heroDeath(gear) |
9614
7fa70d381c75
added custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9613
diff
changeset
|
208 |
lose() |
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
209 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
210 |
|
14582
e74acf5141fd
ASA moon02: Don't play victory animation if runner died and hero survived
Wuzzy <Wuzzy2@mail.ru>
parents:
14581
diff
changeset
|
211 |
function runnerDeath(gear) |
e74acf5141fd
ASA moon02: Don't play victory animation if runner died and hero survived
Wuzzy <Wuzzy2@mail.ru>
parents:
14581
diff
changeset
|
212 |
loseRunnerDeath() |
e74acf5141fd
ASA moon02: Don't play victory animation if runner died and hero survived
Wuzzy <Wuzzy2@mail.ru>
parents:
14581
diff
changeset
|
213 |
end |
e74acf5141fd
ASA moon02: Don't play victory animation if runner died and hero survived
Wuzzy <Wuzzy2@mail.ru>
parents:
14581
diff
changeset
|
214 |
|
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
215 |
-------------- ANIMATIONS ------------------ |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
216 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
217 |
function Skipanim(anim) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
218 |
if goals[anim] ~= nil then |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
219 |
ShowMission(unpack(goals[anim])) |
12575
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12538
diff
changeset
|
220 |
end |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12538
diff
changeset
|
221 |
if anim == dialog01 then |
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
222 |
moveRunner() |
9772
30a9e740ec09
moon02 fixes: bug that didn't called win(), changed map so blue hog not placed on edges, teleport animations, removed amSkip, also error when drow hero and enemy seems fixed
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9758
diff
changeset
|
223 |
elseif anim == dialog02 then |
30a9e740ec09
moon02 fixes: bug that didn't called win(), changed map so blue hog not placed on edges, teleport animations, removed amSkip, also error when drow hero and enemy seems fixed
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9758
diff
changeset
|
224 |
win() |
12575
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12538
diff
changeset
|
225 |
end |
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
226 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
227 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
228 |
function AnimationSetup() |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
229 |
-- DIALOG 01 - Start, game instructions |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
230 |
AddSkipFunction(dialog01, Skipanim, {dialog01}) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
231 |
table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3200}}) |
11692
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
11492
diff
changeset
|
232 |
table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("On the other side of the moon ..."), 5000}}) |
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
11492
diff
changeset
|
233 |
table.insert(dialog01, {func = AnimSay, args = {runner.gear, loc("So you are interested in Professor Hogevil, huh?"), SAY_SAY, 3000}}) |
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
11492
diff
changeset
|
234 |
table.insert(dialog01, {func = AnimSay, args = {runner.gear, loc("We'll play a game first."), SAY_SAY, 3000}}) |
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
11492
diff
changeset
|
235 |
table.insert(dialog01, {func = AnimSay, args = {runner.gear, loc("I'll let you know whatever I know about him if you manage to catch me 3 times."), SAY_SAY, 4000}}) |
9758 | 236 |
table.insert(dialog01, {func = AnimSay, args = {runner.gear, loc("Let's go!"), SAY_SAY, 2000}}) |
12575
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12538
diff
changeset
|
237 |
table.insert(dialog01, {func = ShowMission, args = goals[dialog01]}) |
9613
142ba1d08205
cleanup - removed debug prints
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9612
diff
changeset
|
238 |
table.insert(dialog01, {func = moveRunner, args = {}}) |
14488
7bb7e5e54f70
Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents:
13740
diff
changeset
|
239 |
-- DIALOG 02 - Professor Hogevil story |
9613
142ba1d08205
cleanup - removed debug prints
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9612
diff
changeset
|
240 |
AddSkipFunction(dialog02, Skipanim, {dialog02}) |
142ba1d08205
cleanup - removed debug prints
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9612
diff
changeset
|
241 |
table.insert(dialog02, {func = AnimWait, args = {hero.gear, 3200}}) |
9757 | 242 |
table.insert(dialog02, {func = AnimCaption, args = {hero.gear, loc("The truth about Professor Hogevil"), 5000}}) |
243 |
table.insert(dialog02, {func = AnimSay, args = {runner.gear, loc("Amazing! I was never beaten in a race before!"), SAY_SAY, 4000}}) |
|
11692
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
11492
diff
changeset
|
244 |
table.insert(dialog02, {func = AnimSay, args = {runner.gear, loc("So, let me tell you what I know about Professor Hogevil."), SAY_SAY, 4000}}) |
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
11492
diff
changeset
|
245 |
table.insert(dialog02, {func = AnimSay, args = {runner.gear, loc("Professor Hogevil, then known as James Hogus, worked for PAotH back in my time."), SAY_SAY, 4000}}) |
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
11492
diff
changeset
|
246 |
table.insert(dialog02, {func = AnimSay, args = {runner.gear, loc("He was the lab assistant of Dr. Goodhogan, the inventor of the anti-gravity device."), SAY_SAY, 5000}}) |
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
11492
diff
changeset
|
247 |
table.insert(dialog02, {func = AnimSay, args = {runner.gear, loc("During the final testing of the device an accident happened."), SAY_SAY, 5000}}) |
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
11492
diff
changeset
|
248 |
table.insert(dialog02, {func = AnimSay, args = {runner.gear, loc("In this accident, Professor Hogevil lost all his spines on his head!"), SAY_SAY, 5000}}) |
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
11492
diff
changeset
|
249 |
table.insert(dialog02, {func = AnimSay, args = {runner.gear, loc("That's why he always wears a hat since then."), SAY_SAY, 4000}}) |
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
11492
diff
changeset
|
250 |
table.insert(dialog02, {func = AnimSay, args = {runner.gear, loc("After that incident he went underground and started working on his plan to steal the device."), SAY_SAY, 5000}}) |
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
11492
diff
changeset
|
251 |
table.insert(dialog02, {func = AnimSay, args = {runner.gear, loc("He is a very tough and very determined hedgehog. I would be extremely careful if I were you."), SAY_SAY, 5000}}) |
9613
142ba1d08205
cleanup - removed debug prints
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9612
diff
changeset
|
252 |
table.insert(dialog02, {func = AnimSay, args = {runner.gear, loc("I should go now, goodbye!"), SAY_SAY, 3000}}) |
142ba1d08205
cleanup - removed debug prints
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9612
diff
changeset
|
253 |
table.insert(dialog02, {func = win, args = {}}) |
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
254 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
255 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
256 |
------------- other functions --------------- |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
257 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
258 |
function isHeroNextToRunner() |
15081
3a561db2a71c
ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents:
15002
diff
changeset
|
259 |
if IsHogAlive(hero.gear) and IsHogAlive(runner.gear) and |
11492
806da449d355
Fix Lua error spam in "Chasing the blue hog" after drowning both Crazy Runner and Hog Solo
Wuzzy <almikes@aol.com>
parents:
10289
diff
changeset
|
260 |
math.abs(GetX(hero.gear) - GetX(runner.gear)) < 75 and |
15081
3a561db2a71c
ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents:
15002
diff
changeset
|
261 |
math.abs(GetY(hero.gear) - GetY(runner.gear)) < 75 and |
3a561db2a71c
ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents:
15002
diff
changeset
|
262 |
StoppedGear(hero.gear) and StoppedGear(runner.gear) then |
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
263 |
return true |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
264 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
265 |
return false |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
266 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
267 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
268 |
function moveRunner() |
9772
30a9e740ec09
moon02 fixes: bug that didn't called win(), changed map so blue hog not placed on edges, teleport animations, removed amSkip, also error when drow hero and enemy seems fixed
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9758
diff
changeset
|
269 |
if currentPosition == 4 then |
30a9e740ec09
moon02 fixes: bug that didn't called win(), changed map so blue hog not placed on edges, teleport animations, removed amSkip, also error when drow hero and enemy seems fixed
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9758
diff
changeset
|
270 |
currentPosition = currentPosition + 1 |
9613
142ba1d08205
cleanup - removed debug prints
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9612
diff
changeset
|
271 |
if GetX(hero.gear) > GetX(runner.gear) then |
142ba1d08205
cleanup - removed debug prints
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9612
diff
changeset
|
272 |
HogTurnLeft(runner.gear, false) |
142ba1d08205
cleanup - removed debug prints
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9612
diff
changeset
|
273 |
end |
9772
30a9e740ec09
moon02 fixes: bug that didn't called win(), changed map so blue hog not placed on edges, teleport animations, removed amSkip, also error when drow hero and enemy seems fixed
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9758
diff
changeset
|
274 |
AddAnim(dialog02) |
11891
d79621bcb709
Save record time for Chasing the blue hog mission
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
275 |
|
d79621bcb709
Save record time for Chasing the blue hog mission
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
276 |
-- Update time record |
14577
221380cdee7e
ASA moon02: Add finishing times in ranking
Wuzzy <Wuzzy2@mail.ru>
parents:
14576
diff
changeset
|
277 |
winningTime = runnerTimeTotal - TurnTimeLeft |
14576
2087e50e03e2
ASA: Show current time and personal best in moon02
Wuzzy <Wuzzy2@mail.ru>
parents:
14488
diff
changeset
|
278 |
SetTeamLabel(teamA.name, string.format(loc("%.3fs"), winningTime/1000)) |
11891
d79621bcb709
Save record time for Chasing the blue hog mission
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
279 |
SendStat(siCustomAchievement, string.format(loc("You have managed to catch the blue hedgehog in %.3f seconds."), winningTime/1000)) |
d79621bcb709
Save record time for Chasing the blue hog mission
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
280 |
if record ~= nil and winningTime >= record then |
d79621bcb709
Save record time for Chasing the blue hog mission
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
281 |
SendStat(siCustomAchievement, string.format(loc("Your personal best time so far: %.3f seconds"), record/1000)) |
d79621bcb709
Save record time for Chasing the blue hog mission
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
282 |
end |
d79621bcb709
Save record time for Chasing the blue hog mission
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
283 |
if record == nil or winningTime < record then |
d79621bcb709
Save record time for Chasing the blue hog mission
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
284 |
SaveCampaignVar("FastestBlueHogCatch", tostring(winningTime)) |
d79621bcb709
Save record time for Chasing the blue hog mission
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
285 |
if record ~= nil then |
d79621bcb709
Save record time for Chasing the blue hog mission
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
286 |
SendStat(siCustomAchievement, loc("This is a new personal best time, congratulations!")) |
d79621bcb709
Save record time for Chasing the blue hog mission
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
287 |
end |
d79621bcb709
Save record time for Chasing the blue hog mission
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
288 |
end |
d79621bcb709
Save record time for Chasing the blue hog mission
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
289 |
|
12467
de69155f976b
Use new turn ending method in moon02.lua
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
290 |
EndTurn(true) |
9772
30a9e740ec09
moon02 fixes: bug that didn't called win(), changed map so blue hog not placed on edges, teleport animations, removed amSkip, also error when drow hero and enemy seems fixed
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9758
diff
changeset
|
291 |
elseif currentPosition < 4 then |
9613
142ba1d08205
cleanup - removed debug prints
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9612
diff
changeset
|
292 |
if not startChallenge then |
142ba1d08205
cleanup - removed debug prints
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9612
diff
changeset
|
293 |
startChallenge = true |
142ba1d08205
cleanup - removed debug prints
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9612
diff
changeset
|
294 |
end |
142ba1d08205
cleanup - removed debug prints
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9612
diff
changeset
|
295 |
AddAmmo(hero.gear, amRope, 1) |
142ba1d08205
cleanup - removed debug prints
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9612
diff
changeset
|
296 |
if currentPosition ~= 1 then |
142ba1d08205
cleanup - removed debug prints
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9612
diff
changeset
|
297 |
if currentPosition > 1 and currentPosition < 4 then |
11692
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
11492
diff
changeset
|
298 |
AnimCaption(hero.gear, loc("Go, get him again!"), 3000) |
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
11492
diff
changeset
|
299 |
AnimSay(runner.gear, loc("You got me!"), SAY_SAY, 3000) |
9613
142ba1d08205
cleanup - removed debug prints
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9612
diff
changeset
|
300 |
end |
14580
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
301 |
runnerCaught = true |
9613
142ba1d08205
cleanup - removed debug prints
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9612
diff
changeset
|
302 |
previousTimeLeft = TurnTimeLeft |
142ba1d08205
cleanup - removed debug prints
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9612
diff
changeset
|
303 |
end |
142ba1d08205
cleanup - removed debug prints
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9612
diff
changeset
|
304 |
currentPosition = currentPosition + 1 |
9772
30a9e740ec09
moon02 fixes: bug that didn't called win(), changed map so blue hog not placed on edges, teleport animations, removed amSkip, also error when drow hero and enemy seems fixed
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9758
diff
changeset
|
305 |
AddVisualGear(GetX(runner.gear), GetY(runner.gear), vgtExplosion, 0, false) |
9613
142ba1d08205
cleanup - removed debug prints
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9612
diff
changeset
|
306 |
SetGearPosition(runner.gear, runner.places[currentPosition].x, runner.places[currentPosition].y) |
12467
de69155f976b
Use new turn ending method in moon02.lua
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
307 |
EndTurn(true) |
9612 | 308 |
end |
9611
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
309 |
end |
9612 | 310 |
|
311 |
function lose() |
|
14580
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
312 |
if lostGame then |
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
313 |
return |
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
314 |
end |
1a68c8a07d1f
ASA moon02: Fix player not losing if time runs out while still having the rope
Wuzzy <Wuzzy2@mail.ru>
parents:
14578
diff
changeset
|
315 |
lostGame = true |
11692
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
11492
diff
changeset
|
316 |
SendStat(siGameResult, loc("Too slow! Try again ...")) |
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
11492
diff
changeset
|
317 |
SendStat(siCustomAchievement, loc("You have to catch the other hog 3 times.")) |
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
11492
diff
changeset
|
318 |
SendStat(siCustomAchievement, loc("The time that you have left when you reach the blue hedgehog will be added to the next turn.")) |
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
11492
diff
changeset
|
319 |
SendStat(siCustomAchievement, loc("Each turn you'll have only one rope to use.")) |
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
11492
diff
changeset
|
320 |
SendStat(siCustomAchievement, loc("You'll lose if you die or if your time is up.")) |
14578
50f511588635
Outsource commonly used words in siPointType to QTfrontend
Wuzzy <Wuzzy2@mail.ru>
parents:
14577
diff
changeset
|
321 |
SendStat(siPointType, "!TIME") |
14577
221380cdee7e
ASA moon02: Add finishing times in ranking
Wuzzy <Wuzzy2@mail.ru>
parents:
14576
diff
changeset
|
322 |
SendStat(siPlayerKills, tostring(runnerTimeTotal), teamB.name) |
14578
50f511588635
Outsource commonly used words in siPointType to QTfrontend
Wuzzy <Wuzzy2@mail.ru>
parents:
14577
diff
changeset
|
323 |
SendStat(siPointType, "!EMPTY") |
50f511588635
Outsource commonly used words in siPointType to QTfrontend
Wuzzy <Wuzzy2@mail.ru>
parents:
14577
diff
changeset
|
324 |
SendStat(siPlayerKills, "0", teamA.name) |
9612 | 325 |
EndGame() |
326 |
end |
|
327 |
||
14582
e74acf5141fd
ASA moon02: Don't play victory animation if runner died and hero survived
Wuzzy <Wuzzy2@mail.ru>
parents:
14581
diff
changeset
|
328 |
function loseRunnerDeath() |
e74acf5141fd
ASA moon02: Don't play victory animation if runner died and hero survived
Wuzzy <Wuzzy2@mail.ru>
parents:
14581
diff
changeset
|
329 |
if lostGame then |
e74acf5141fd
ASA moon02: Don't play victory animation if runner died and hero survived
Wuzzy <Wuzzy2@mail.ru>
parents:
14581
diff
changeset
|
330 |
return |
e74acf5141fd
ASA moon02: Don't play victory animation if runner died and hero survived
Wuzzy <Wuzzy2@mail.ru>
parents:
14581
diff
changeset
|
331 |
end |
e74acf5141fd
ASA moon02: Don't play victory animation if runner died and hero survived
Wuzzy <Wuzzy2@mail.ru>
parents:
14581
diff
changeset
|
332 |
lostGame = true |
e74acf5141fd
ASA moon02: Don't play victory animation if runner died and hero survived
Wuzzy <Wuzzy2@mail.ru>
parents:
14581
diff
changeset
|
333 |
SendStat(siGameResult, loc("Race failed!")) |
e74acf5141fd
ASA moon02: Don't play victory animation if runner died and hero survived
Wuzzy <Wuzzy2@mail.ru>
parents:
14581
diff
changeset
|
334 |
SendStat(siCustomAchievement, loc("The other hog has died, he should have survived!")) |
e74acf5141fd
ASA moon02: Don't play victory animation if runner died and hero survived
Wuzzy <Wuzzy2@mail.ru>
parents:
14581
diff
changeset
|
335 |
SendStat(siCustomAchievement, loc("You have to catch the other hog 3 times.")) |
e74acf5141fd
ASA moon02: Don't play victory animation if runner died and hero survived
Wuzzy <Wuzzy2@mail.ru>
parents:
14581
diff
changeset
|
336 |
SendStat(siTeamRank, "1") |
e74acf5141fd
ASA moon02: Don't play victory animation if runner died and hero survived
Wuzzy <Wuzzy2@mail.ru>
parents:
14581
diff
changeset
|
337 |
SendStat(siPlayerKills, tostring(GetTeamStats(teamB.name).Kills), teamB.name) |
e74acf5141fd
ASA moon02: Don't play victory animation if runner died and hero survived
Wuzzy <Wuzzy2@mail.ru>
parents:
14581
diff
changeset
|
338 |
SendStat(siTeamRank, "1") |
e74acf5141fd
ASA moon02: Don't play victory animation if runner died and hero survived
Wuzzy <Wuzzy2@mail.ru>
parents:
14581
diff
changeset
|
339 |
SendStat(siPlayerKills, tostring(GetTeamStats(teamA.name).Kills), teamA.name) |
e74acf5141fd
ASA moon02: Don't play victory animation if runner died and hero survived
Wuzzy <Wuzzy2@mail.ru>
parents:
14581
diff
changeset
|
340 |
EndGame() |
e74acf5141fd
ASA moon02: Don't play victory animation if runner died and hero survived
Wuzzy <Wuzzy2@mail.ru>
parents:
14581
diff
changeset
|
341 |
end |
e74acf5141fd
ASA moon02: Don't play victory animation if runner died and hero survived
Wuzzy <Wuzzy2@mail.ru>
parents:
14581
diff
changeset
|
342 |
|
9613
142ba1d08205
cleanup - removed debug prints
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9612
diff
changeset
|
343 |
function win() |
15504
266ff128a65a
ASA moon02: Disable hog input after victory
Wuzzy <Wuzzy2@mail.ru>
parents:
15081
diff
changeset
|
344 |
AnimSetInputMask(0) |
9642
8a691e0f117a
use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9615
diff
changeset
|
345 |
SendStat(siGameResult, loc("Congratulations, you are the fastest!")) |
11891
d79621bcb709
Save record time for Chasing the blue hog mission
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
346 |
-- siCustomAchievements were added earlier |
14578
50f511588635
Outsource commonly used words in siPointType to QTfrontend
Wuzzy <Wuzzy2@mail.ru>
parents:
14577
diff
changeset
|
347 |
SendStat(siPointType, "!TIME") |
14577
221380cdee7e
ASA moon02: Add finishing times in ranking
Wuzzy <Wuzzy2@mail.ru>
parents:
14576
diff
changeset
|
348 |
SendStat(siPlayerKills, tostring(winningTime), teamA.name) |
14578
50f511588635
Outsource commonly used words in siPointType to QTfrontend
Wuzzy <Wuzzy2@mail.ru>
parents:
14577
diff
changeset
|
349 |
SendStat(siPointType, "!TIME") |
14577
221380cdee7e
ASA moon02: Add finishing times in ranking
Wuzzy <Wuzzy2@mail.ru>
parents:
14576
diff
changeset
|
350 |
SendStat(siPlayerKills, tostring(runnerTimeTotal), teamB.name) |
11952
63988f36debf
Save mission success for A Space Adventure missions
Wuzzy <almikes@aol.com>
parents:
11891
diff
changeset
|
351 |
SaveCampaignVar("Mission13Won", "true") |
11965
72be38f6d0c0
Complete space campaign's spacetrip mission if all main+side missions are completed
Wuzzy <almikes@aol.com>
parents:
11952
diff
changeset
|
352 |
checkAllMissionsCompleted() |
9613
142ba1d08205
cleanup - removed debug prints
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9612
diff
changeset
|
353 |
EndGame() |
9612 | 354 |
end |