author | Wuzzy <almikes@aol.com> |
Fri, 25 Nov 2016 13:38:24 +0100 | |
changeset 12079 | 8f222872d432 |
parent 12077 | ce3860c82c8b |
child 12287 | faf1b93422ba |
permissions | -rw-r--r-- |
4506
37744d5c877e
Finnished up the lua translations by adding training maps, campaign is ignored for now
Henek
parents:
4503
diff
changeset
|
1 |
-- Hedgewars - Roperace for 2+ Players |
4188 | 2 |
|
9093 | 3 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
4188 | 4 |
|
5 |
-- store number of hedgehogs |
|
6 |
local numhhs = 0 |
|
7 |
||
8 |
-- store hedgehog gears |
|
9 |
local hhs = {} |
|
10 |
||
11 |
-- store best time per team |
|
12 |
local clantimes = {} |
|
13 |
||
14 |
-- store best times |
|
15 |
local times = {} |
|
16 |
||
17 |
-- in milisseconds |
|
18 |
local maxtime = 99000 |
|
19 |
||
20 |
-- define start area (left, top, width, height) |
|
21 |
local start_area = {1606, 498, 356, 80} |
|
22 |
||
23 |
-- define goal area (left, top, width, height) |
|
24 |
local goal_area = {2030, 300, 56, 280} |
|
25 |
||
26 |
-- last active hog |
|
27 |
local lasthog = nil |
|
28 |
||
29 |
-- active hog reached the goal? |
|
30 |
local reached = false |
|
31 |
||
32 |
-- hog with worst time (per round) |
|
33 |
local worsthog = nil |
|
34 |
||
9664
1e528c58e41d
ok. this should avoid calling switch inappropriately. also, add skip to trophyrace and add the per-team achievement reporting.
nemo
parents:
9659
diff
changeset
|
35 |
local besthog = nil |
11201
9301550d2566
TrophyRace: fix nil error warning, caused by needlessly re-retrieving the name of the best hedgehog (which could be dead at that point)
sheepluva
parents:
11180
diff
changeset
|
36 |
local besthogname = '' |
9664
1e528c58e41d
ok. this should avoid calling switch inappropriately. also, add skip to trophyrace and add the per-team achievement reporting.
nemo
parents:
9659
diff
changeset
|
37 |
|
4188 | 38 |
-- best time |
39 |
local besttime = maxtime + 1 |
|
40 |
||
9664
1e528c58e41d
ok. this should avoid calling switch inappropriately. also, add skip to trophyrace and add the per-team achievement reporting.
nemo
parents:
9659
diff
changeset
|
41 |
-- best time per team |
1e528c58e41d
ok. this should avoid calling switch inappropriately. also, add skip to trophyrace and add the per-team achievement reporting.
nemo
parents:
9659
diff
changeset
|
42 |
local bestTimes = {} |
1e528c58e41d
ok. this should avoid calling switch inappropriately. also, add skip to trophyrace and add the per-team achievement reporting.
nemo
parents:
9659
diff
changeset
|
43 |
|
4188 | 44 |
-- worst time (per round) |
45 |
local worsttime = 0 |
|
9657
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
46 |
local startTime = 0; |
4188 | 47 |
|
48 |
function onGameInit() |
|
9657
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
49 |
GameFlags = gfSolidLand + gfInvulnerable |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
50 |
TurnTime = maxtime |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
51 |
CaseFreq = 0 |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
52 |
MinesNum = 0 |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
53 |
Explosives = 0 |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
54 |
Delay = 500 |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
55 |
Theme = 'Olympics' |
12079
8f222872d432
Disable SD for a couple of scripts and mission maps
Wuzzy <almikes@aol.com>
parents:
12077
diff
changeset
|
56 |
-- Disable Sudden Death |
8f222872d432
Disable SD for a couple of scripts and mission maps
Wuzzy <almikes@aol.com>
parents:
12077
diff
changeset
|
57 |
WaterRise = 0 |
8f222872d432
Disable SD for a couple of scripts and mission maps
Wuzzy <almikes@aol.com>
parents:
12077
diff
changeset
|
58 |
HealthDecrease = 0 |
4188 | 59 |
end |
60 |
||
61 |
function onGameStart() |
|
12077
ce3860c82c8b
Rewrite 2nd line of mission panel of most missions for consistency
Wuzzy <almikes@aol.com>
parents:
11201
diff
changeset
|
62 |
ShowMission(loc("TrophyRace"), loc("Race"), loc("Use your rope to get from start to finish as fast as you can!"), -amRope, 0) |
9657
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
63 |
started = true |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
64 |
p=1820 |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
65 |
for i = 0, numhhs - 1 do |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
66 |
p = p + 50 |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
67 |
SetGearPosition(hhs[i], p, 0) |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
68 |
end |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
69 |
|
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
70 |
for i=0, ClansCount-1 do |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
71 |
clantimes[i] = 0 |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
72 |
end |
4188 | 73 |
end |
74 |
||
75 |
function onAmmoStoreInit() |
|
9664
1e528c58e41d
ok. this should avoid calling switch inappropriately. also, add skip to trophyrace and add the per-team achievement reporting.
nemo
parents:
9659
diff
changeset
|
76 |
SetAmmo(amRope, 9, 1, 0) |
1e528c58e41d
ok. this should avoid calling switch inappropriately. also, add skip to trophyrace and add the per-team achievement reporting.
nemo
parents:
9659
diff
changeset
|
77 |
SetAmmo(amSkip, 9, 1, 0) |
4188 | 78 |
end |
79 |
||
9685
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
80 |
function killHog() |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
81 |
SetHealth(CurrentHedgehog, 0) |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
82 |
SetEffect(CurrentHedgehog, heInvulnerable, 0) |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
83 |
x, y = GetGearPosition(CurrentHedgehog) |
11180 | 84 |
AddGear(x, y-2, gtGrenade, 0, 0, 0, 2) |
85 |
SetGearVelocity(CurrentHedgehog, 0, 0) |
|
9685
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
86 |
worsttime = 99999 |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
87 |
worsthog = nil |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
88 |
lasthog = nil |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
89 |
end |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
90 |
|
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
91 |
function onHogAttack() |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
92 |
if TurnTimeLeft == 0 then |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
93 |
killHog() |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
94 |
end |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
95 |
end |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
96 |
|
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
97 |
function onNewTurn() |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
98 |
if lasthog ~= nil then |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
99 |
SetGearPosition(lasthog, p , 0) |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
100 |
if not reached then |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
101 |
end |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
102 |
end |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
103 |
startTime = 0 |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
104 |
reached = false |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
105 |
if CurrentHedgehog ~= nil then |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
106 |
SetGearVelocity(CurrentHedgehog, 1, 0) |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
107 |
SetGearPosition(CurrentHedgehog, start_area[1] + start_area[3] / 2, start_area[2] + start_area[4] / 2) |
10289 | 108 |
SetWeapon(amRope) |
9685
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
109 |
lasthog = CurrentHedgehog |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
110 |
end |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
111 |
end |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
112 |
|
9659
e9c00dd31b07
drop onGameTick20 - it has some savings on cpu, but racers demand millisecond precision not 20 millisecond, apparently
nemo
parents:
9658
diff
changeset
|
113 |
function onGameTick() |
9658 | 114 |
if startTime == 0 and TurnTimeLeft < maxtime then |
9657
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
115 |
startTime = GameTime |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
116 |
end |
9664
1e528c58e41d
ok. this should avoid calling switch inappropriately. also, add skip to trophyrace and add the per-team achievement reporting.
nemo
parents:
9659
diff
changeset
|
117 |
if CurrentHedgehog ~= nil and TurnTimeLeft == 1 then |
9685
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
118 |
killHog() |
9657
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
119 |
elseif CurrentHedgehog ~= nil then |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
120 |
x, y = GetGearPosition(CurrentHedgehog) |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
121 |
if not reached and x > goal_area[1] and x < goal_area[1] + goal_area[3] and y > goal_area[2] and y < goal_area[2] + goal_area[4] then -- hog is within goal rectangle |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
122 |
reached = true |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
123 |
local ttime = GameTime-startTime |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
124 |
--give it a sound;) |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
125 |
if ttime < besttime then |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
126 |
PlaySound (sndHomerun) |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
127 |
else |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
128 |
PlaySound (sndHellish) |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
129 |
end |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
130 |
for i = 0, numhhs - 1 do |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
131 |
if hhs[i] == CurrentHedgehog then |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
132 |
times[numhhs] = ttime |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
133 |
end |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
134 |
end |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
135 |
|
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
136 |
local hscore = "| |" |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
137 |
local clan = GetHogClan(CurrentHedgehog) |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
138 |
if ttime < clantimes[clan] or clantimes[clan] == 0 then |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
139 |
clantimes[clan] = ttime |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
140 |
end |
9664
1e528c58e41d
ok. this should avoid calling switch inappropriately. also, add skip to trophyrace and add the per-team achievement reporting.
nemo
parents:
9659
diff
changeset
|
141 |
local teamname = GetHogTeamName(CurrentHedgehog) |
1e528c58e41d
ok. this should avoid calling switch inappropriately. also, add skip to trophyrace and add the per-team achievement reporting.
nemo
parents:
9659
diff
changeset
|
142 |
if bestTimes[teamname] == nil or bestTimes[teamname] > ttime then |
1e528c58e41d
ok. this should avoid calling switch inappropriately. also, add skip to trophyrace and add the per-team achievement reporting.
nemo
parents:
9659
diff
changeset
|
143 |
bestTimes[teamname] = ttime |
1e528c58e41d
ok. this should avoid calling switch inappropriately. also, add skip to trophyrace and add the per-team achievement reporting.
nemo
parents:
9659
diff
changeset
|
144 |
end |
9657
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
145 |
if ttime < besttime then |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
146 |
besttime = ttime |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
147 |
besthog = CurrentHedgehog |
11201
9301550d2566
TrophyRace: fix nil error warning, caused by needlessly re-retrieving the name of the best hedgehog (which could be dead at that point)
sheepluva
parents:
11180
diff
changeset
|
148 |
besthogname = GetHogName(besthog) |
9657
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
149 |
hscore = hscore .. loc("NEW fastest lap: ") |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
150 |
else |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
151 |
hscore = hscore .. loc("Fastest lap: ") |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
152 |
end |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
153 |
if ttime > worsttime then |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
154 |
worsttime = ttime |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
155 |
worsthog = CurrentHedgehog |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
156 |
end |
11201
9301550d2566
TrophyRace: fix nil error warning, caused by needlessly re-retrieving the name of the best hedgehog (which could be dead at that point)
sheepluva
parents:
11180
diff
changeset
|
157 |
hscore = hscore .. besthogname .. " - " .. (besttime / 1000) .. " s | |" .. loc("Best laps per team: ") |
9657
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
158 |
|
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
159 |
if clan == ClansCount -1 then |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
160 |
-- Time for elimination - worst hog is out and the worst hog vars are reset. |
9685
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
161 |
if worsthog ~= nil then |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
162 |
SetHealth(worsthog, 0) |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
163 |
--Place a grenade to make inactive slowest hog active |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
164 |
x, y = GetGearPosition(worsthog) |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
165 |
AddGear(x, y, gtShell, 0, 0, 0, 0) |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
166 |
worsttime = 0 |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
167 |
worsthog = nil |
9657
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
168 |
end |
9685
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
169 |
end |
9657
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
170 |
|
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
171 |
for i=0, ClansCount -1 do |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
172 |
local tt = "" .. (clantimes[i] / 1000) .. " s" |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
173 |
if clantimes[i] == 0 then |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
174 |
tt = "--" |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
175 |
end |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
176 |
hscore = hscore .. "|" .. string.format(loc("Team %d: "), i+1) .. tt |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
177 |
end |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
178 |
|
12077
ce3860c82c8b
Rewrite 2nd line of mission panel of most missions for consistency
Wuzzy <almikes@aol.com>
parents:
11201
diff
changeset
|
179 |
ShowMission(loc("TrophyRace"), loc("Race"), loc("You've reached the goal!| |Time: ") .. (ttime / 1000) .. " s" .. hscore, 0, 0) |
9657
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
180 |
TurnTimeLeft = 0 |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
181 |
end |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
182 |
end |
4188 | 183 |
end |
184 |
||
185 |
function onGearAdd(gear) |
|
9657
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
186 |
if GetGearType(gear) == gtHedgehog then |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
187 |
hhs[numhhs] = gear |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
188 |
times[numhhs] = 0 |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
189 |
numhhs = numhhs + 1 |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
190 |
end |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
191 |
-- elseif GetGearType(gear) == gtRope then -- rope is shot |
4188 | 192 |
end |
193 |
||
7771 | 194 |
--function onGearDelete(gear) |
9657
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
195 |
-- if GetGearType(gear) == gtRope then -- rope deletion - hog didn't manage to rerope |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
196 |
-- --TurnTimeLeft = 0 -- end turn or not? hm... |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
197 |
-- lasthog = CurrentHedgehog |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
198 |
-- |
2d8cae3c0855
use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents:
9411
diff
changeset
|
199 |
-- end |
7771 | 200 |
--end |
9397 | 201 |
|
202 |
function onAchievementsDeclaration() |
|
9685
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
203 |
for team,time in pairs(bestTimes) do |
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9664
diff
changeset
|
204 |
DeclareAchievement("rope race", team, "TrophyRace", time) |
9397 | 205 |
end |
206 |
end |