author | unC0Rr |
Sat, 28 Sep 2024 22:27:13 +0200 | |
changeset 16066 | 2b4f361e3891 |
parent 15023 | 3ed1cbd31754 |
permissions | -rw-r--r-- |
9467
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
1 |
------------------- ABOUT ---------------------- |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
2 |
-- |
9471
867f020b0621
seems ok, stats to be added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9469
diff
changeset
|
3 |
-- Hero has to get to the surface as soon as possible. |
867f020b0621
seems ok, stats to be added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9469
diff
changeset
|
4 |
-- Tunnel is about to get flooded. |
9467
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
5 |
|
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
6 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
7 |
HedgewarsScriptLoad("/Scripts/Animate.lua") |
13839
373813316812
ASA, desert02: Add achievement for escaping with all crates collected and no damage taken
Wuzzy <Wuzzy2@mail.ru>
parents:
13583
diff
changeset
|
8 |
HedgewarsScriptLoad("/Scripts/Achievements.lua") |
9582
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9574
diff
changeset
|
9 |
HedgewarsScriptLoad("/Missions/Campaign/A_Space_Adventure/global_functions.lua") |
9467
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
10 |
|
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
11 |
----------------- VARIABLES -------------------- |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
12 |
-- globals |
9574
da3d39667881
strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9490
diff
changeset
|
13 |
local missionName = loc("Running for survival") |
9474
c255f6c46e33
stats and minor corrections, difficulty adjustment
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9471
diff
changeset
|
14 |
local startChallenge = false |
9467
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
15 |
-- dialogs |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
16 |
local dialog01 = {} |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
17 |
-- mission objectives |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
18 |
local goals = { |
12227
5afbffc6725d
Fix bad mission texts in A Space Adventure
Wuzzy <almikes@aol.com>
parents:
12226
diff
changeset
|
19 |
[dialog01] = {missionName, loc("Getting ready"), loc("Use the rope to quickly get to the surface!") .. "|" .. loc("Mines time: 1 second"), 1, 4500}, |
9467
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
20 |
} |
13839
373813316812
ASA, desert02: Add achievement for escaping with all crates collected and no damage taken
Wuzzy <Wuzzy2@mail.ru>
parents:
13583
diff
changeset
|
21 |
-- For an achievement/award (see below) |
373813316812
ASA, desert02: Add achievement for escaping with all crates collected and no damage taken
Wuzzy <Wuzzy2@mail.ru>
parents:
13583
diff
changeset
|
22 |
local cratesCollected = 0 |
373813316812
ASA, desert02: Add achievement for escaping with all crates collected and no damage taken
Wuzzy <Wuzzy2@mail.ru>
parents:
13583
diff
changeset
|
23 |
local totalCrates = 0 |
373813316812
ASA, desert02: Add achievement for escaping with all crates collected and no damage taken
Wuzzy <Wuzzy2@mail.ru>
parents:
13583
diff
changeset
|
24 |
local damageTaken = false |
15001
f359d8f86501
ASA desert02: Fix mines not working in 1st turn when watching full cut scene
Wuzzy <Wuzzy2@mail.ru>
parents:
14919
diff
changeset
|
25 |
local animStarted = false |
14596
28d00ceb8b54
ASA desert02: Show escape record in-game
Wuzzy <Wuzzy2@mail.ru>
parents:
14509
diff
changeset
|
26 |
local record |
9490
b93448b75fa4
fix bugs and some changes regarting the difficulty in desert02
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9484
diff
changeset
|
27 |
-- health crates |
b93448b75fa4
fix bugs and some changes regarting the difficulty in desert02
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9484
diff
changeset
|
28 |
healthX = 565 |
b93448b75fa4
fix bugs and some changes regarting the difficulty in desert02
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9484
diff
changeset
|
29 |
health1Y = 1400 |
b93448b75fa4
fix bugs and some changes regarting the difficulty in desert02
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9484
diff
changeset
|
30 |
health2Y = 850 |
9467
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
31 |
-- hogs |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
32 |
local hero = {} |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
33 |
-- teams |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
34 |
local teamA = {} |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
35 |
-- hedgehogs values |
9574
da3d39667881
strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9490
diff
changeset
|
36 |
hero.name = loc("Hog Solo") |
9467
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
37 |
hero.x = 1600 |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
38 |
hero.y = 1950 |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
39 |
hero.dead = false |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
40 |
teamA.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
|
41 |
teamA.color = -6 |
9467
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
42 |
-- way points |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
43 |
local current waypoint = 1 |
9758 | 44 |
local waypoints = { |
9467
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
45 |
[1] = {x=1450, y=140}, |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
46 |
[2] = {x=990, y=580}, |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
47 |
[3] = {x=1650, y=950}, |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
48 |
[4] = {x=620, y=630}, |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
49 |
[5] = {x=1470, y=540}, |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
50 |
[6] = {x=1960, y=60}, |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
51 |
[7] = {x=1600, y=400}, |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
52 |
[8] = {x=240, y=940}, |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
53 |
[9] = {x=200, y=530}, |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
54 |
[10] = {x=1180, y=120}, |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
55 |
[11] = {x=1950, y=660}, |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
56 |
[12] = {x=1280, y=980}, |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
57 |
[13] = {x=590, y=1100}, |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
58 |
[14] = {x=20, y=620}, |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
59 |
[15] = {x=hero.x, y=hero.y} |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
60 |
} |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
61 |
|
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
62 |
-------------- LuaAPI EVENT HANDLERS ------------------ |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
63 |
|
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
64 |
function onGameInit() |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
65 |
GameFlags = gfOneClanMode |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
66 |
Seed = 1 |
9474
c255f6c46e33
stats and minor corrections, difficulty adjustment
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9471
diff
changeset
|
67 |
TurnTime = 8000 |
9467
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
68 |
CaseFreq = 0 |
9490
b93448b75fa4
fix bugs and some changes regarting the difficulty in desert02
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9484
diff
changeset
|
69 |
HealthCaseAmount = 50 |
9471
867f020b0621
seems ok, stats to be added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9469
diff
changeset
|
70 |
MinesNum = 500 |
867f020b0621
seems ok, stats to be added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9469
diff
changeset
|
71 |
MinesTime = 1000 |
867f020b0621
seems ok, stats to be added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9469
diff
changeset
|
72 |
MineDudPercent = 75 |
9467
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
73 |
Explosives = 0 |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
74 |
SuddenDeathTurns = 1 |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
75 |
WaterRise = 150 |
9490
b93448b75fa4
fix bugs and some changes regarting the difficulty in desert02
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9484
diff
changeset
|
76 |
HealthDecrease = 0 |
9467
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
77 |
Map = "desert02_map" |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
78 |
Theme = "Desert" |
9758 | 79 |
|
14509
7bb7e5e54f70
Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents:
14422
diff
changeset
|
80 |
-- Hero |
7bb7e5e54f70
Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents:
14422
diff
changeset
|
81 |
teamA.name = AddMissionTeam(teamA.color) |
7bb7e5e54f70
Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents:
14422
diff
changeset
|
82 |
hero.gear = AddMissionHog(100) |
7bb7e5e54f70
Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents:
14422
diff
changeset
|
83 |
hero.name = GetHogName(hero.gear) |
9467
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
84 |
AnimSetGearPosition(hero.gear, hero.x, hero.y) |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
85 |
HogTurnLeft(hero.gear, true) |
9758 | 86 |
|
14596
28d00ceb8b54
ASA desert02: Show escape record in-game
Wuzzy <Wuzzy2@mail.ru>
parents:
14509
diff
changeset
|
87 |
record = tonumber(GetCampaignVar("FastestMineEscape")) |
9582
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9574
diff
changeset
|
88 |
initCheckpoint("desert02") |
9758 | 89 |
|
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
|
90 |
AnimInit(true) |
9490
b93448b75fa4
fix bugs and some changes regarting the difficulty in desert02
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9484
diff
changeset
|
91 |
AnimationSetup() |
9467
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
92 |
end |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
93 |
|
12469
2041d1e98ab2
Allow skipping in two ASA missions
Wuzzy <almikes@aol.com>
parents:
12227
diff
changeset
|
94 |
function onAmmoStoreInit() |
2041d1e98ab2
Allow skipping in two ASA missions
Wuzzy <almikes@aol.com>
parents:
12227
diff
changeset
|
95 |
SetAmmo(amRope, 9, 0, 0, 0) |
2041d1e98ab2
Allow skipping in two ASA missions
Wuzzy <almikes@aol.com>
parents:
12227
diff
changeset
|
96 |
SetAmmo(amSkip, 9, 0, 0, 0) |
2041d1e98ab2
Allow skipping in two ASA missions
Wuzzy <almikes@aol.com>
parents:
12227
diff
changeset
|
97 |
end |
2041d1e98ab2
Allow skipping in two ASA missions
Wuzzy <almikes@aol.com>
parents:
12227
diff
changeset
|
98 |
|
9467
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
99 |
function onGameStart() |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
100 |
AnimWait(hero.gear, 3000) |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
101 |
FollowGear(hero.gear) |
9758 | 102 |
|
14596
28d00ceb8b54
ASA desert02: Show escape record in-game
Wuzzy <Wuzzy2@mail.ru>
parents:
14509
diff
changeset
|
103 |
if record ~= nil then |
28d00ceb8b54
ASA desert02: Show escape record in-game
Wuzzy <Wuzzy2@mail.ru>
parents:
14509
diff
changeset
|
104 |
goals[dialog01][3] = goals[dialog01][3] .. "|" .. string.format(loc("Fastest escape: %d turns"), record) |
28d00ceb8b54
ASA desert02: Show escape record in-game
Wuzzy <Wuzzy2@mail.ru>
parents:
14509
diff
changeset
|
105 |
end |
12575
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12539
diff
changeset
|
106 |
ShowMission(unpack(goals[dialog01])) |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12539
diff
changeset
|
107 |
HideMission() |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12539
diff
changeset
|
108 |
|
9467
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
109 |
AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0) |
9471
867f020b0621
seems ok, stats to be added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9469
diff
changeset
|
110 |
AddEvent(onHeroSafe, {hero.gear}, heroSafe, {hero.gear}, 0) |
9758 | 111 |
|
9490
b93448b75fa4
fix bugs and some changes regarting the difficulty in desert02
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9484
diff
changeset
|
112 |
SpawnHealthCrate(healthX, health1Y) |
b93448b75fa4
fix bugs and some changes regarting the difficulty in desert02
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9484
diff
changeset
|
113 |
SpawnHealthCrate(healthX, health2Y) |
9758 | 114 |
|
9467
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
115 |
SendHealthStatsOff() |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
116 |
end |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
117 |
|
9645
da7b4d8c181e
autoselect weapon in time challenges
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9642
diff
changeset
|
118 |
function onNewTurn() |
15001
f359d8f86501
ASA desert02: Fix mines not working in 1st turn when watching full cut scene
Wuzzy <Wuzzy2@mail.ru>
parents:
14919
diff
changeset
|
119 |
if not animStarted then |
f359d8f86501
ASA desert02: Fix mines not working in 1st turn when watching full cut scene
Wuzzy <Wuzzy2@mail.ru>
parents:
14919
diff
changeset
|
120 |
AddAnim(dialog01) |
f359d8f86501
ASA desert02: Fix mines not working in 1st turn when watching full cut scene
Wuzzy <Wuzzy2@mail.ru>
parents:
14919
diff
changeset
|
121 |
animStarted = true |
f359d8f86501
ASA desert02: Fix mines not working in 1st turn when watching full cut scene
Wuzzy <Wuzzy2@mail.ru>
parents:
14919
diff
changeset
|
122 |
end |
10289 | 123 |
SetWeapon(amRope) |
14596
28d00ceb8b54
ASA desert02: Show escape record in-game
Wuzzy <Wuzzy2@mail.ru>
parents:
14509
diff
changeset
|
124 |
if TotalRounds >= 0 and record ~= nil then |
28d00ceb8b54
ASA desert02: Show escape record in-game
Wuzzy <Wuzzy2@mail.ru>
parents:
14509
diff
changeset
|
125 |
SetTeamLabel(teamA.name, tostring(TotalRounds)) |
28d00ceb8b54
ASA desert02: Show escape record in-game
Wuzzy <Wuzzy2@mail.ru>
parents:
14509
diff
changeset
|
126 |
end |
9645
da7b4d8c181e
autoselect weapon in time challenges
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9642
diff
changeset
|
127 |
end |
da7b4d8c181e
autoselect weapon in time challenges
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9642
diff
changeset
|
128 |
|
9467
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
129 |
function onGameTick() |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
130 |
AnimUnWait() |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
131 |
if ShowAnimation() == false then |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
132 |
return |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
133 |
end |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
134 |
ExecuteAfterAnimations() |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
135 |
CheckEvents() |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
136 |
end |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
137 |
|
12575
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12539
diff
changeset
|
138 |
function onGearAdd(gear) |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12539
diff
changeset
|
139 |
if GetGearType(gear) == gtRope then |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12539
diff
changeset
|
140 |
HideMission() |
13839
373813316812
ASA, desert02: Add achievement for escaping with all crates collected and no damage taken
Wuzzy <Wuzzy2@mail.ru>
parents:
13583
diff
changeset
|
141 |
elseif GetGearType(gear) == gtCase then |
373813316812
ASA, desert02: Add achievement for escaping with all crates collected and no damage taken
Wuzzy <Wuzzy2@mail.ru>
parents:
13583
diff
changeset
|
142 |
totalCrates = totalCrates + 1 |
12575
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12539
diff
changeset
|
143 |
end |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12539
diff
changeset
|
144 |
end |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12539
diff
changeset
|
145 |
|
9467
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
146 |
function onGearDelete(gear) |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
147 |
if gear == hero.gear then |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
148 |
hero.dead = true |
13839
373813316812
ASA, desert02: Add achievement for escaping with all crates collected and no damage taken
Wuzzy <Wuzzy2@mail.ru>
parents:
13583
diff
changeset
|
149 |
damageTaken = true |
373813316812
ASA, desert02: Add achievement for escaping with all crates collected and no damage taken
Wuzzy <Wuzzy2@mail.ru>
parents:
13583
diff
changeset
|
150 |
end |
373813316812
ASA, desert02: Add achievement for escaping with all crates collected and no damage taken
Wuzzy <Wuzzy2@mail.ru>
parents:
13583
diff
changeset
|
151 |
-- Crate collected |
373813316812
ASA, desert02: Add achievement for escaping with all crates collected and no damage taken
Wuzzy <Wuzzy2@mail.ru>
parents:
13583
diff
changeset
|
152 |
if GetGearType(gear) == gtCase and band(GetGearMessage(gear), gmDestroy) ~= 0 then |
373813316812
ASA, desert02: Add achievement for escaping with all crates collected and no damage taken
Wuzzy <Wuzzy2@mail.ru>
parents:
13583
diff
changeset
|
153 |
cratesCollected = cratesCollected + 1 |
373813316812
ASA, desert02: Add achievement for escaping with all crates collected and no damage taken
Wuzzy <Wuzzy2@mail.ru>
parents:
13583
diff
changeset
|
154 |
end |
373813316812
ASA, desert02: Add achievement for escaping with all crates collected and no damage taken
Wuzzy <Wuzzy2@mail.ru>
parents:
13583
diff
changeset
|
155 |
end |
373813316812
ASA, desert02: Add achievement for escaping with all crates collected and no damage taken
Wuzzy <Wuzzy2@mail.ru>
parents:
13583
diff
changeset
|
156 |
|
373813316812
ASA, desert02: Add achievement for escaping with all crates collected and no damage taken
Wuzzy <Wuzzy2@mail.ru>
parents:
13583
diff
changeset
|
157 |
function onGearDamage(gear) |
373813316812
ASA, desert02: Add achievement for escaping with all crates collected and no damage taken
Wuzzy <Wuzzy2@mail.ru>
parents:
13583
diff
changeset
|
158 |
if gear == hero.gear then |
373813316812
ASA, desert02: Add achievement for escaping with all crates collected and no damage taken
Wuzzy <Wuzzy2@mail.ru>
parents:
13583
diff
changeset
|
159 |
damageTaken = true |
9467
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
160 |
end |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
161 |
end |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
162 |
|
15023
3ed1cbd31754
Backed out changeset 4596357d002d (onPreciseLocal causes desyncs)
Wuzzy <Wuzzy2@mail.ru>
parents:
15001
diff
changeset
|
163 |
function onPrecise() |
9467
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
164 |
if GameTime > 3000 then |
9758 | 165 |
SetAnimSkip(true) |
9467
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
166 |
end |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
167 |
end |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
168 |
|
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
169 |
-------------- EVENTS ------------------ |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
170 |
|
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
171 |
function onHeroDeath(gear) |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
172 |
if hero.dead then |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
173 |
return true |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
174 |
end |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
175 |
return false |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
176 |
end |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
177 |
|
9469 | 178 |
function onHeroSafe(gear) |
9474
c255f6c46e33
stats and minor corrections, difficulty adjustment
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9471
diff
changeset
|
179 |
if not hero.dead and GetY(hero.gear) < 170 and StoppedGear(hero.gear) then |
9469 | 180 |
return true |
181 |
end |
|
182 |
return false |
|
183 |
end |
|
184 |
||
9639
6b2ae2eaf1b2
remove unnecessary comments
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9582
diff
changeset
|
185 |
-------------- ACTIONS ------------------ |
9467
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
186 |
|
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
187 |
function heroDeath(gear) |
14509
7bb7e5e54f70
Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents:
14422
diff
changeset
|
188 |
SendStat(siGameResult, string.format(loc("%s lost, try again!"), hero.name)) |
11692
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
10289
diff
changeset
|
189 |
SendStat(siCustomAchievement, loc("To win the game you have to go to the surface.")) |
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
10289
diff
changeset
|
190 |
SendStat(siCustomAchievement, loc("Most mines are not active.")) |
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
10289
diff
changeset
|
191 |
SendStat(siCustomAchievement, loc("From the second turn and beyond the water rises.")) |
12539
19192a3cb674
Use correct kill counts for the remaining ASA missions as well
Wuzzy <almikes@aol.com>
parents:
12514
diff
changeset
|
192 |
sendSimpleTeamRankings({teamA.name}) |
9471
867f020b0621
seems ok, stats to be added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9469
diff
changeset
|
193 |
EndGame() |
9467
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
194 |
end |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
195 |
|
9469 | 196 |
function heroSafe(gear) |
9642
8a691e0f117a
use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9639
diff
changeset
|
197 |
SendStat(siGameResult, loc("Congratulations, you won!")) |
11692
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
10289
diff
changeset
|
198 |
SendStat(siCustomAchievement, loc("You have escaped successfully.")) |
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
10289
diff
changeset
|
199 |
SendStat(siCustomAchievement, string.format(loc("Your escape took you %d turns."), TotalRounds)) |
11890
712e20a3d895
Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
200 |
if record ~= nil and TotalRounds >= record then |
712e20a3d895
Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
201 |
SendStat(siCustomAchievement, string.format(loc("Your fastest escape so far: %d turns"), record)) |
712e20a3d895
Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
202 |
end |
712e20a3d895
Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
203 |
if record == nil or TotalRounds < record then |
712e20a3d895
Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
204 |
SaveCampaignVar("FastestMineEscape", tostring(TotalRounds)) |
712e20a3d895
Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
205 |
if record ~= nil then |
712e20a3d895
Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
206 |
SendStat(siCustomAchievement, loc("This is a new personal best, congratulations!")) |
712e20a3d895
Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
207 |
end |
712e20a3d895
Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
208 |
end |
13839
373813316812
ASA, desert02: Add achievement for escaping with all crates collected and no damage taken
Wuzzy <Wuzzy2@mail.ru>
parents:
13583
diff
changeset
|
209 |
-- Achievement awarded for escaping with all crates collected and no damage taken |
373813316812
ASA, desert02: Add achievement for escaping with all crates collected and no damage taken
Wuzzy <Wuzzy2@mail.ru>
parents:
13583
diff
changeset
|
210 |
if (not damageTaken) and (cratesCollected >= totalCrates) then |
373813316812
ASA, desert02: Add achievement for escaping with all crates collected and no damage taken
Wuzzy <Wuzzy2@mail.ru>
parents:
13583
diff
changeset
|
211 |
awardAchievement(loc("Better Safe Than Sorry")) |
373813316812
ASA, desert02: Add achievement for escaping with all crates collected and no damage taken
Wuzzy <Wuzzy2@mail.ru>
parents:
13583
diff
changeset
|
212 |
end |
12539
19192a3cb674
Use correct kill counts for the remaining ASA missions as well
Wuzzy <almikes@aol.com>
parents:
12514
diff
changeset
|
213 |
sendSimpleTeamRankings({teamA.name}) |
11952
63988f36debf
Save mission success for A Space Adventure missions
Wuzzy <almikes@aol.com>
parents:
11890
diff
changeset
|
214 |
SaveCampaignVar("Mission7Won", "true") |
11965
72be38f6d0c0
Complete space campaign's spacetrip mission if all main+side missions are completed
Wuzzy <almikes@aol.com>
parents:
11952
diff
changeset
|
215 |
checkAllMissionsCompleted() |
9469 | 216 |
EndGame() |
217 |
end |
|
218 |
||
9467
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
219 |
-------------- ANIMATIONS ------------------ |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
220 |
|
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
221 |
function Skipanim(anim) |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
222 |
if goals[anim] ~= nil then |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
223 |
ShowMission(unpack(goals[anim])) |
12575
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12539
diff
changeset
|
224 |
end |
9474
c255f6c46e33
stats and minor corrections, difficulty adjustment
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9471
diff
changeset
|
225 |
challengeStart() |
9467
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
226 |
end |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
227 |
|
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
228 |
function AnimationSetup() |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
229 |
-- DIALOG 01 - Start |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
230 |
AddSkipFunction(dialog01, Skipanim, {dialog01}) |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
231 |
table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}}) |
11692
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
10289
diff
changeset
|
232 |
table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Many meters below the surface ..."), 5000}}) |
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
10289
diff
changeset
|
233 |
table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("The tunnel is about to get flooded!"), SAY_THINK, 4000}}) |
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
10289
diff
changeset
|
234 |
table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("I have to reach the surface as quickly as I can."), SAY_THINK, 4000}}) |
9467
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
235 |
table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}}) |
12575
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12539
diff
changeset
|
236 |
table.insert(dialog01, {func = ShowMission, args = goals[dialog01]}) |
9467
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
237 |
table.insert(dialog01, {func = challengeStart, args = {hero.gear}}) |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
238 |
end |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
239 |
|
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
240 |
------------------ Other Functions ------------------- |
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
241 |
|
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
242 |
function challengeStart() |
9474
c255f6c46e33
stats and minor corrections, difficulty adjustment
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9471
diff
changeset
|
243 |
startChallenge = true |
12514
d89dabfd07ce
Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents:
12469
diff
changeset
|
244 |
EndTurn(true) |
14596
28d00ceb8b54
ASA desert02: Show escape record in-game
Wuzzy <Wuzzy2@mail.ru>
parents:
14509
diff
changeset
|
245 |
if record ~= nil then |
28d00ceb8b54
ASA desert02: Show escape record in-game
Wuzzy <Wuzzy2@mail.ru>
parents:
14509
diff
changeset
|
246 |
SetTeamLabel(teamA.name, "0") |
28d00ceb8b54
ASA desert02: Show escape record in-game
Wuzzy <Wuzzy2@mail.ru>
parents:
14509
diff
changeset
|
247 |
end |
9467
483a73697535
desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
248 |
end |