|
1 |
|
2 loadfile(GetDataPath() .. "Scripts/Locale.lua")() |
|
3 |
|
4 |
|
5 local player = nil -- This variable will point to the hog's gear |
|
6 local instructor = nil |
|
7 local enemy = nil |
|
8 --local givenSpeech = false |
|
9 |
|
10 local speechStage = 0 |
|
11 |
|
12 local gameLost = false |
|
13 local gameWon = false |
|
14 local notListening = false |
|
15 |
|
16 local endTimer = 0 |
|
17 |
|
18 function onGameInit() |
|
19 |
|
20 -- Things we don't modify here will use their default values. |
|
21 |
|
22 Seed = 0 -- The base number for the random number generator |
|
23 GameFlags = gfInfAttack -- Game settings and rules |
|
24 TurnTime = 60000 -- The time the player has to move each round (in ms) |
|
25 CaseFreq = 0 -- The frequency of crate drops |
|
26 MinesNum = 0 -- The number of mines being placed |
|
27 Explosives = 0 -- The number of explosives being placed |
|
28 Delay = 0 -- The delay between each round |
|
29 Map = "Bath" -- The map to be played |
|
30 Theme = "Bath" -- The theme to be used |
|
31 |
|
32 |
|
33 AddTeam(loc("Bloody Rookies"), 14483456, "Simple", "Island", "Default") |
|
34 player = AddHog(loc("Hunter"), 0, 1, "NoHat") |
|
35 |
|
36 --AddTeam("Instructors", 14483456, "Simple", "Island", "Default") |
|
37 instructor = AddHog(loc("Instructor"), 1, 1, "Vega") |
|
38 |
|
39 AddTeam("Blue Team", 29439, "Simple", "Island", "Default") |
|
40 enemy = AddHog("Filthy Blue", 1, 100, "Skull") |
|
41 |
|
42 SetGearPosition(player, 1170, 1926) |
|
43 SetGearPosition(instructor, 1341, 1926) |
|
44 SetGearPosition(enemy, 2942, 1861) |
|
45 |
|
46 |
|
47 HogSay(player, ".............................", SAY_THINK) |
|
48 HogTurnLeft(instructor, true) |
|
49 |
|
50 |
|
51 end |
|
52 |
|
53 |
|
54 function onGameStart() |
|
55 |
|
56 SpawnAmmoCrate(1499,1500,amRope) |
|
57 SpawnAmmoCrate(2753,1500,amFirePunch) |
|
58 |
|
59 FollowGear(player) |
|
60 |
|
61 --spawnTarget() |
|
62 |
|
63 -- Show some nice mission goals. |
|
64 -- Parameters are: caption, sub caption, description, |
|
65 -- extra text, icon and time to show. |
|
66 -- A negative icon parameter (-n) represents the n-th weapon icon |
|
67 -- A positive icon paramter (n) represents the (n+1)-th mission icon |
|
68 -- A timeframe of 0 is replaced with the default time to show. |
|
69 ShowMission(loc("Dangerous Ducklings"), loc("by mikade"), loc("Eliminate the Blue Team"), -amRope, 1); |
|
70 |
|
71 end |
|
72 |
|
73 |
|
74 function onGameTick() |
|
75 |
|
76 |
|
77 -- opening speech |
|
78 if (notListening == false) and (gameLost == false) then |
|
79 |
|
80 if (TurnTimeLeft == 58000) and (speechStage == 0) then |
|
81 HogSay(instructor, loc("Listen up, maggot!!"), SAY_SHOUT) |
|
82 speechStage = 1 |
|
83 elseif (TurnTimeLeft == 57000) and (speechStage == 1) then |
|
84 HogSay(player,loc("!!!"),SAY_SHOUT) |
|
85 elseif (TurnTimeLeft == 55000) and (speechStage == 1) then |
|
86 HogSay(instructor, loc("The enemy is hiding out on yonder ducky!"), SAY_SAY) |
|
87 speechStage = 2 |
|
88 |
|
89 elseif (TurnTimeLeft == 49000) and (speechStage == 2) then |
|
90 FollowGear(enemy) |
|
91 elseif (TurnTimeLeft == 46500) and (speechStage == 2) then |
|
92 FollowGear(instructor) |
|
93 HogSay(instructor, loc("Get on over there and take him out!"), SAY_SAY) |
|
94 speechStage = 3 |
|
95 elseif (TurnTimeLeft == 43500) and (speechStage == 3) then |
|
96 HogSay(instructor, loc("GO! GO! GO!"), SAY_SHOUT) |
|
97 speechStage = 4 |
|
98 givenSpeech = true |
|
99 end |
|
100 |
|
101 end |
|
102 |
|
103 |
|
104 -- if player falls in water or if player ignores speech |
|
105 if (CurrentHedgehog ~= nil) and (CurrentHedgehog == player) then |
|
106 if (GetY(player) > 2060) and (gameLost == false) then |
|
107 HogSay(instructor, loc("DAMMIT, ROOKIE!"), SAY_SHOUT) |
|
108 gameLost = true |
|
109 end |
|
110 |
|
111 if (GetX(player) > 1324) and (GetY(player) > 1908) and (notListening == false) and (speechStage < 3) then |
|
112 HogSay(instructor, loc("DAMMIT, ROOKIE! GET OFF MY HEAD!"), SAY_SHOUT) |
|
113 notListening = true |
|
114 end |
|
115 |
|
116 end |
|
117 |
|
118 --player out of time |
|
119 if (TurnTimeLeft == 1) and (gameWon == false) then |
|
120 SetHealth(player, 0) |
|
121 end |
|
122 |
|
123 -- meh |
|
124 if gameLost == true then |
|
125 endTimer = endTimer + 1 |
|
126 if (CurrentHedgehog ~= nil) and (CurrentHedgehog == instructor) then |
|
127 if endTimer >= 3000 then |
|
128 SetHealth(instructor,0) |
|
129 TurnTimeLeft = 0 |
|
130 end |
|
131 ShowMission(loc("MISSION FAILED"), loc(":("), loc("You've failed. Try again."), -amRope, 1); |
|
132 end |
|
133 end |
|
134 |
|
135 end |
|
136 |
|
137 |
|
138 function onAmmoStoreInit() |
|
139 SetAmmo(amFirePunch, 0, 0, 0, 1) |
|
140 SetAmmo(amParachute, 1, 0, 0, 0) |
|
141 SetAmmo(amRope, 0, 0, 0, 1) |
|
142 end |
|
143 |
|
144 function onGearDelete(gear) |
|
145 if GetGearType(gear) == gtHedgehog then |
|
146 if gear == player then |
|
147 gameLost = true |
|
148 elseif gear == instructor then |
|
149 HogSay(player, loc("See ya!"), SAY_THINK) |
|
150 TurnTimeLeft = 3000 |
|
151 elseif gear == enemy then |
|
152 HogSay(player, loc("Enjoy the swim..."), SAY_THINK) |
|
153 gameWon = true |
|
154 TurnTimeLeft = 3000 |
|
155 end |
|
156 |
|
157 end |
|
158 end |