author | Wuzzy <Wuzzy2@mail.ru> |
Fri, 11 Oct 2019 13:35:13 +0200 | |
changeset 15465 | 421da44ff218 |
parent 15096 | 5c8c729a16ce |
permissions | -rw-r--r-- |
8043 | 1 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
2 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
3 |
local player = nil -- This variable will point to the hog's gear |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
4 |
local p2 = nil |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
5 |
local enemy = nil |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
6 |
local bCrate = nil |
14471
734a7af2dfc2
Fix victory check of a few scenarios
Wuzzy <Wuzzy2@mail.ru>
parents:
14469
diff
changeset
|
7 |
local playerTeamName = loc("Feeble Resistance") |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
8 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
9 |
local GameOver = false |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
10 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
11 |
function onGameInit() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
12 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
13 |
-- Things we don't modify here will use their default values. |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
14 |
Seed = 0 -- The base number for the random number generator |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
15 |
GameFlags = gfDisableWind-- Game settings and rules |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
16 |
TurnTime = 30000 -- The time the player has to move each round (in ms) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
17 |
CaseFreq = 0 -- The frequency of crate drops |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
18 |
MinesNum = 0 -- The number of mines being placed |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
19 |
MinesTime = 1 |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
20 |
Explosives = 0 -- The number of explosives being placed |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
21 |
Map = "Mushrooms" -- The map to be played |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
22 |
Theme = "Nature" -- The theme to be used |
12229
d62d6f8ebef1
Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents:
12082
diff
changeset
|
23 |
-- Disable Sudden Death |
d62d6f8ebef1
Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents:
12082
diff
changeset
|
24 |
HealthDecrease = 0 |
d62d6f8ebef1
Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents:
12082
diff
changeset
|
25 |
WaterRise = 0 |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
26 |
|
14500 | 27 |
playerTeamName = AddMissionTeam(-1) |
14487
d4aa64f51c9f
Use player-chosen team identity for most challenges and scenarios
Wuzzy <Wuzzy2@mail.ru>
parents:
14471
diff
changeset
|
28 |
player = AddMissionHog(50) |
d4aa64f51c9f
Use player-chosen team identity for most challenges and scenarios
Wuzzy <Wuzzy2@mail.ru>
parents:
14471
diff
changeset
|
29 |
p2 = AddMissionHog(20) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
30 |
|
14937
ff4003a90ff8
Enable automatic voicepack language selection for all missions
Wuzzy <Wuzzy2@mail.ru>
parents:
14500
diff
changeset
|
31 |
AddTeam(loc("Cybernetic Empire"), -6, "ring", "Island", "Robot_qau", "cm_cyborg") |
5823 | 32 |
enemy = AddHog(loc("Unit 3378"), 5, 30, "cyborg1") |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
33 |
|
7877
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
5823
diff
changeset
|
34 |
SetGearPosition(player,1403,235) |
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
5823
diff
changeset
|
35 |
SetGearPosition(p2,1269,239) |
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
5823
diff
changeset
|
36 |
SetGearPosition(enemy,492,495) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
37 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
38 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
39 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
40 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
41 |
function onGameStart() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
42 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
43 |
--mines |
7877
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
5823
diff
changeset
|
44 |
AddGear(276,76,gtMine, 0, 0, 0, 0) |
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
5823
diff
changeset
|
45 |
AddGear(301,76,gtMine, 0, 0, 0, 0) |
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
5823
diff
changeset
|
46 |
AddGear(326,76,gtMine, 0, 0, 0, 0) |
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
5823
diff
changeset
|
47 |
AddGear(351,76,gtMine, 0, 0, 0, 0) |
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
5823
diff
changeset
|
48 |
AddGear(376,76,gtMine, 0, 0, 0, 0) |
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
5823
diff
changeset
|
49 |
AddGear(401,76,gtMine, 0, 0, 0, 0) |
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
5823
diff
changeset
|
50 |
AddGear(426,76,gtMine, 0, 0, 0, 0) |
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
5823
diff
changeset
|
51 |
AddGear(451,76,gtMine, 0, 0, 0, 0) |
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
5823
diff
changeset
|
52 |
AddGear(476,76,gtMine, 0, 0, 0, 0) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
53 |
|
7877
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
5823
diff
changeset
|
54 |
AddGear(886,356,gtMine, 0, 0, 0, 0) |
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
5823
diff
changeset
|
55 |
AddGear(901,356,gtMine, 0, 0, 0, 0) |
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
5823
diff
changeset
|
56 |
AddGear(926,356,gtMine, 0, 0, 0, 0) |
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
5823
diff
changeset
|
57 |
AddGear(951,356,gtMine, 0, 0, 0, 0) |
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
5823
diff
changeset
|
58 |
AddGear(976,356,gtMine, 0, 0, 0, 0) |
b3fb94986255
Fix training script positions altered by variable land dimension change. Issue #453
nemo
parents:
5823
diff
changeset
|
59 |
AddGear(1001,356,gtMine, 0, 0, 0, 0) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
60 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
61 |
-- crates crates and more crates |
12938
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12591
diff
changeset
|
62 |
bCrate = SpawnSupplyCrate(1688,476,amBaseballBat) |
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12591
diff
changeset
|
63 |
SpawnSupplyCrate(572,143,amGirder) |
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12591
diff
changeset
|
64 |
SpawnSupplyCrate(1704,954,amPickHammer) |
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12591
diff
changeset
|
65 |
SpawnSupplyCrate(704,623,amBlowTorch) |
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12591
diff
changeset
|
66 |
SpawnSupplyCrate(1543,744,amJetpack) |
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12591
diff
changeset
|
67 |
SpawnSupplyCrate(227,442,amDrill) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
68 |
|
15073
6f51c75994a4
Semi-standardize usage of icons in many mission panels
Wuzzy <Wuzzy2@mail.ru>
parents:
14937
diff
changeset
|
69 |
ShowMission(loc("Teamwork"), loc("Scenario"), loc("Eliminate Unit 3378.") .. "|" .. loc("Both your hedgehogs must survive.") .. "|" .. loc("Mines time: 0 seconds"), 1, 0) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
70 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
71 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
72 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
73 |
function onAmmoStoreInit() |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
74 |
SetAmmo(amBlowTorch, 0, 0, 0, 1) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
75 |
SetAmmo(amGirder, 0, 0, 0, 1) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
76 |
SetAmmo(amPickHammer, 0, 0, 0, 2) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
77 |
SetAmmo(amJetpack, 0, 0, 0, 1) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
78 |
SetAmmo(amDrill, 0, 0, 0, 2) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
79 |
SetAmmo(amBaseballBat, 0, 0, 0, 1) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
80 |
SetAmmo(amSwitch, 9, 0, 0, 0) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
81 |
SetAmmo(amSkip, 9, 0, 0, 0) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
82 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
83 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
84 |
function onGearDelete(gear) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
85 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
86 |
if gear == bCrate then |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
87 |
HogSay(CurrentHedgehog, loc("Hmmm..."), SAY_THINK) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
88 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
89 |
|
14245
c94905a5109c
Teamwork: Play sound for time bonus, don't give time bonus for destroying crate
Wuzzy <Wuzzy2@mail.ru>
parents:
14244
diff
changeset
|
90 |
if (GetGearType(gear) == gtCase) and (band(GetGearMessage(gear), gmDestroy) ~= 0) then |
13745
2bb7141496a9
Use SetTurnTimeLeft and SetReadyTimeLeft in all scripts
Wuzzy <Wuzzy2@mail.ru>
parents:
13588
diff
changeset
|
91 |
SetTurnTimeLeft(TurnTimeLeft + 5000) |
14246
bf627790da14
Show extra seconds when collecting a crate in Teamwork
Wuzzy <Wuzzy2@mail.ru>
parents:
14245
diff
changeset
|
92 |
AddCaption(string.format(loc("+%d seconds!"), 5), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage) |
14245
c94905a5109c
Teamwork: Play sound for time bonus, don't give time bonus for destroying crate
Wuzzy <Wuzzy2@mail.ru>
parents:
14244
diff
changeset
|
93 |
PlaySound(sndExtraTime) |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
94 |
end |
12357
7f09d01ecb45
Fix false victory in Teamwork/Teamwork 2 when one of your hogs die in same turn as enemy
Wuzzy <almikes@aol.com>
parents:
12234
diff
changeset
|
95 |
-- Note: The victory sequence is done automatically by Hedgewars |
7f09d01ecb45
Fix false victory in Teamwork/Teamwork 2 when one of your hogs die in same turn as enemy
Wuzzy <almikes@aol.com>
parents:
12234
diff
changeset
|
96 |
if ( ((gear == player) or (gear == p2)) and (GameOver == false)) then |
4662
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
97 |
GameOver = true |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
98 |
SetHealth(p2,0) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
99 |
SetHealth(player,0) |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
100 |
end |
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
101 |
|
63aafc9c2a81
Add a bunch of lua from mikade, update translation files
mikade+nemo
parents:
diff
changeset
|
102 |
end |
14469
ead8928a59f8
Report mission victory for most missions
Wuzzy <Wuzzy2@mail.ru>
parents:
14406
diff
changeset
|
103 |
|
15096
5c8c729a16ce
Scenarios: Show "Mission succeeded/failed!" in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
15073
diff
changeset
|
104 |
function onGameResult(winner) |
5c8c729a16ce
Scenarios: Show "Mission succeeded/failed!" in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
15073
diff
changeset
|
105 |
if winner == GetTeamClan(playerTeamName) then |
14471
734a7af2dfc2
Fix victory check of a few scenarios
Wuzzy <Wuzzy2@mail.ru>
parents:
14469
diff
changeset
|
106 |
SaveMissionVar("Won", "true") |
15096
5c8c729a16ce
Scenarios: Show "Mission succeeded/failed!" in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
15073
diff
changeset
|
107 |
SendStat(siGameResult, loc("Mission succeeded!")) |
5c8c729a16ce
Scenarios: Show "Mission succeeded/failed!" in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
15073
diff
changeset
|
108 |
GameOver = true |
5c8c729a16ce
Scenarios: Show "Mission succeeded/failed!" in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
15073
diff
changeset
|
109 |
else |
5c8c729a16ce
Scenarios: Show "Mission succeeded/failed!" in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
15073
diff
changeset
|
110 |
SendStat(siGameResult, loc("Mission failed!")) |
5c8c729a16ce
Scenarios: Show "Mission succeeded/failed!" in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
15073
diff
changeset
|
111 |
GameOver = true |
14471
734a7af2dfc2
Fix victory check of a few scenarios
Wuzzy <Wuzzy2@mail.ru>
parents:
14469
diff
changeset
|
112 |
end |
734a7af2dfc2
Fix victory check of a few scenarios
Wuzzy <Wuzzy2@mail.ru>
parents:
14469
diff
changeset
|
113 |
end |