author | Periklis Ntanasis <pntanasis@gmail.com> |
Wed, 11 Sep 2013 08:39:00 +0300 | |
branch | spacecampaign |
changeset 9611 | ef374528a9fb |
child 9612 | 825856c67563 |
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 |
-- |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
3 |
-- Hog Solo has to catch the other hog in order |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
4 |
-- to get infoormations about the origin of Pr. Hogevil |
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 |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
12 |
local missionName = loc("Chasing ghosts in moon") |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
13 |
local challengeObjectives = loc("Use your available weapons in order to catch the other hog").."|".. |
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 |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
16 |
local previousTimeLeft = 0 |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
17 |
-- dialogs |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
18 |
local dialog01 = {} |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
19 |
-- mission objectives |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
20 |
local goals = { |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
21 |
[dialog01] = {missionName, loc("Challenge Objectives"), challengeObjectives, 1, 4500}, |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
22 |
} |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
23 |
-- hogs |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
24 |
local hero = { |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
25 |
name = loc("Hog Solo"), |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
26 |
x = 1300, |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
27 |
y = 850 |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
28 |
} |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
29 |
local runner = { |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
30 |
name = loc("Crazy Runner"), |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
31 |
places = { |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
32 |
{x = 1400,y = 850, turnTime = 0}, |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
33 |
{x = 3880,y = 33, turnTime = 30000}, |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
34 |
{x = 250,y = 1780, turnTime = 25000}, |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
35 |
{x = 3850,y = 1940, turnTime = 20000}, |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
36 |
} |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
37 |
} |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
38 |
-- teams |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
39 |
local teamA = { |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
40 |
name = loc("Hog Solo"), |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
41 |
color = tonumber("38D61C",16) -- green |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
42 |
} |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
43 |
local teamB = { |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
44 |
name = loc("Crazy Runner"), |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
45 |
color = tonumber("FF0000",16) -- red |
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 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
48 |
-------------- LuaAPI EVENT HANDLERS ------------------ |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
49 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
50 |
function onGameInit() |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
51 |
GameFlags = gfDisableWind |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
52 |
Seed = 1 |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
53 |
TurnTime = 25000 |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
54 |
CaseFreq = 0 |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
55 |
MinesNum = 0 |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
56 |
MinesTime = 1 |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
57 |
Explosives = 0 |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
58 |
Map = "moon02_map" |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
59 |
Theme = "Cheese" |
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 |
-- Hog Solo |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
62 |
AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "cm_birdy") |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
63 |
hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1") |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
64 |
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
|
65 |
-- Crazy Runner |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
66 |
AddTeam(teamB.name, teamB.color, "Bone", "Island", "HillBilly", "cm_birdy") |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
67 |
runner.gear = AddHog(runner.name, 0, 100, "war_desertgrenadier1") |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
68 |
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
|
69 |
HogTurnLeft(runner.gear, true) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
70 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
71 |
initCheckpoint("moon02") |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
72 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
73 |
AnimInit() |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
74 |
AnimationSetup() |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
75 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
76 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
77 |
function onGameStart() |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
78 |
AnimWait(hero.gear, 3000) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
79 |
FollowGear(hero.gear) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
80 |
ShowMission(missionName, loc("Challenge Objectives"), challengeObjectives, -amSkip, 0) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
81 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
82 |
AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
83 |
AddEvent(onLose, {hero.gear}, lose, {hero.gear}, 0) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
84 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
85 |
AddAmmo(hero.gear, amRope, 1) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
86 |
AddAmmo(hero.gear, amTeleport, 100) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
87 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
88 |
SendHealthStatsOff() |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
89 |
hogTurn = runner.gear |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
90 |
AddAnim(dialog01) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
91 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
92 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
93 |
function onNewTurn() |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
94 |
WriteLnToConsole("NEW TURN "..CurrentHedgehog) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
95 |
if CurrentHedgehog == hero.gear then |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
96 |
TurnTimeLeft = runner.places[currentPosition].turnTime + previousTimeLeft |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
97 |
WriteLnToConsole("Turn Time is "..TurnTimeLeft) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
98 |
previousTimeLeft = 0 |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
99 |
WriteLnToConsole("STILL HERE AND "..TurnTimeLeft.." prev hog = "..hogTurn) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
100 |
else |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
101 |
TurnTimeLeft = 0 |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
102 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
103 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
104 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
105 |
function onGameTick() |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
106 |
AnimUnWait() |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
107 |
if ShowAnimation() == false then |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
108 |
return |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
109 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
110 |
ExecuteAfterAnimations() |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
111 |
CheckEvents() |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
112 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
113 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
114 |
function onGameTick20() |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
115 |
if isHeroNextToRunner() then |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
116 |
moveRunner() |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
117 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
118 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
119 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
120 |
function onPrecise() |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
121 |
if GameTime > 3000 then |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
122 |
SetAnimSkip(true) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
123 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
124 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
125 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
126 |
-------------- EVENTS ------------------ |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
127 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
128 |
function onHeroDeath(gear) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
129 |
if not GetHealth(hero.gear) then |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
130 |
return true |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
131 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
132 |
return false |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
133 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
134 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
135 |
function onLose(gear) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
136 |
if (GetAmmoCount(hero.gear, amRope) == 0 and previousTimeLeft == 0) or (CurrentHedgehog == hero.gear and TurnTimeLeft == 0)then |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
137 |
return true |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
138 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
139 |
return false |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
140 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
141 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
142 |
-------------- ACTIONS ------------------ |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
143 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
144 |
function heroDeath(gear) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
145 |
-- game over |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
146 |
WriteLnToConsole("END GAME 1") |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
147 |
EndGame() |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
148 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
149 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
150 |
function lose(gear) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
151 |
-- game over |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
152 |
WriteLnToConsole("END GAME 2") |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
153 |
EndGame() |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
154 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
155 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
156 |
-------------- ANIMATIONS ------------------ |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
157 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
158 |
function Skipanim(anim) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
159 |
if goals[anim] ~= nil then |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
160 |
ShowMission(unpack(goals[anim])) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
161 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
162 |
if anim == dialog01 then |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
163 |
moveRunner() |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
164 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
165 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
166 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
167 |
function AnimationSetup() |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
168 |
-- DIALOG 01 - Start, game instructions |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
169 |
AddSkipFunction(dialog01, Skipanim, {dialog01}) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
170 |
table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3200}}) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
171 |
table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("In the other side of the moon..."), 5000}}) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
172 |
table.insert(dialog01, {func = AnimSay, args = {runner.gear, loc("So you are interested in Pr. Hogevil"), SAY_SAY, 3000}}) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
173 |
table.insert(dialog01, {func = AnimSay, args = {runner.gear, loc("We'll play a game first"), SAY_SAY, 3000}}) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
174 |
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}}) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
175 |
table.insert(dialog01, {func = AnimSay, args = {runner.gear, loc("Let's go!"), SAY_SAY, 2000}}) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
176 |
table.insert(dialog01, {func = moveRunner, args = {}}) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
177 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
178 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
179 |
------------- other functions --------------- |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
180 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
181 |
function isHeroNextToRunner() |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
182 |
if GetHealth(hero.gear) and math.abs(GetX(hero.gear) - GetX(runner.gear)) < 75 and |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
183 |
math.abs(GetY(hero.gear) - GetY(runner.gear)) < 75 and StoppedGear(hero.gear) then |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
184 |
return true |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
185 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
186 |
return false |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
187 |
end |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
188 |
|
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
189 |
function moveRunner() |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
190 |
AddAmmo(hero.gear, amRope, 1) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
191 |
-- add anim dialogs here |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
192 |
if currentPosition ~= 1 then |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
193 |
PlaySound(sndVictory) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
194 |
AnimSay(runner.gear, loc("You got me"), SAY_SAY, 3000) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
195 |
previousTimeLeft = TurnTimeLeft |
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 |
currentPosition = currentPosition + 1 |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
198 |
SetGearPosition(runner.gear, runner.places[currentPosition].x, runner.places[currentPosition].y) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
199 |
WriteLnToConsole("HERE 1") |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
200 |
AnimSwitchHog(runner.gear) |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
201 |
TurnTimeLeft = 0 |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
202 |
WriteLnToConsole("HERE 2") |
ef374528a9fb
moon side mission map and most of the logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
203 |
end |