share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon01.lua
author unC0Rr
Sat, 28 Sep 2024 22:27:13 +0200
changeset 16066 2b4f361e3891
parent 15521 e3bf91fbd3f8
permissions -rw-r--r--
Wrap chat lines into div
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
     1
------------------- ABOUT ----------------------
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
     2
--
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
     3
-- This is the first stop of hero's journey.
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
     4
-- Here he'll get fuels to continue traveling.
9831
afa4e3e04cc5 typos correction
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9765
diff changeset
     5
-- However, the PAotH allies of the hero have
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
     6
-- been taken hostages by professor Hogevil.
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
     7
-- So hero has to get whatever available equipement
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
     8
-- there is and rescue them.
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
     9
9310
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
    10
HedgewarsScriptLoad("/Scripts/Locale.lua")
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
    11
HedgewarsScriptLoad("/Scripts/Animate.lua")
9578
16139270448f save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
    12
HedgewarsScriptLoad("/Missions/Campaign/A_Space_Adventure/global_functions.lua")
9310
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
    13
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
    14
----------------- VARIABLES --------------------
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    15
-- globals
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    16
local campaignName = loc("A Space Adventure")
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9445
diff changeset
    17
local missionName = loc("The first stop")
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
    18
local weaponsAcquired = false
9318
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
    19
local battleZoneReached = false
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
    20
local checkPointReached = 1 -- 1 is start of the game
9733
37f84780eb14 fixed overlapping bubbles and wrong dialog triggering in moon01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
    21
local afterDialog02 = false
11975
c52d35c859e8 Fix double achievements and ranks in The First Stop mission (fixes #106)
Wuzzy <almikes@aol.com>
parents: 11692
diff changeset
    22
local gameOver = false
15521
e3bf91fbd3f8 ASA moon01: Fix broken victory condition when eliminating minions
Wuzzy <Wuzzy2@mail.ru>
parents: 15102
diff changeset
    23
local minionsDead = false
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    24
-- dialogs
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    25
local dialog01 = {}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    26
local dialog02 = {}
9316
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
    27
local dialog03 = {}
9318
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
    28
local dialog04 = {}
12615
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
    29
local dialog05 = {}
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
    30
local dialog06 = {}
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    31
-- mission objectives
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    32
local goals = {
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    33
	[dialog01] = {missionName, loc("Getting ready"), loc("Go to the upper platform and get the weapons in the crates!"), 1, 4500},
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9445
diff changeset
    34
	[dialog02] = {missionName, loc("Prepare to fight"), loc("Go down and save these PAotH hogs!"), 1, 5000},
9318
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
    35
	[dialog03] = {missionName, loc("The fight begins!"), loc("Neutralize your enemies and be careful!"), 1, 5000},
9330
b6483dc78feb I think hog weapons and health is ok like that
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9326
diff changeset
    36
	[dialog04] = {missionName, loc("The fight begins!"), loc("Neutralize your enemies and be careful!"), 1, 5000}
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    37
}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    38
-- crates
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    39
local weaponsY = 100
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    40
local bazookaX = 70
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    41
local parachuteX = 110
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    42
local grenadeX = 160
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    43
local deserteagleX = 200
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    44
-- hogs
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    45
local hero = {}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    46
local paoth1 = {}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    47
local paoth2 = {}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    48
local paoth3 = {}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    49
local paoth4 = {}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    50
local professor = {}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    51
local minion1 = {}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    52
local minion2 = {}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    53
local minion3 = {}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    54
local minion4 = {}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    55
-- teams
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    56
local teamA = {}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    57
local teamB = {}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    58
local teamC = {}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    59
local teamD = {}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    60
-- hedgehogs values
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9445
diff changeset
    61
hero.name = loc("Hog Solo")
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    62
hero.x = 1380
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    63
hero.y = 1750
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
    64
hero.dead = false
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9445
diff changeset
    65
paoth1.name = loc("Joe")
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    66
paoth1.x = 1430
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    67
paoth1.y = 1750
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9445
diff changeset
    68
paoth2.name = loc("Bruce")
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    69
paoth2.x = 3760
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    70
paoth2.y = 1800
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9445
diff changeset
    71
paoth3.name = loc("Helena")
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    72
paoth3.x = 3800
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    73
paoth3.y = 1800
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9445
diff changeset
    74
paoth4.name = loc("Boris")
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    75
paoth4.x = 3860
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    76
paoth4.y = 1800
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9445
diff changeset
    77
professor.name = loc("Prof. Hogevil")
9336
5f2224dce442 smaller moon map and check if hero health is set
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9334
diff changeset
    78
professor.x = 3800
5f2224dce442 smaller moon map and check if hero health is set
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9334
diff changeset
    79
professor.y = 1600
9318
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
    80
professor.dead = false
12533
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
    81
professor.health = 120
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9445
diff changeset
    82
minion1.name = loc("Minion")
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    83
minion1.x = 2460
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    84
minion1.y = 1450
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9445
diff changeset
    85
minion2.name = loc("Minion")
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    86
minion2.x = 2450
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    87
minion2.y = 1900
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9445
diff changeset
    88
minion3.name = loc("Minion")
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    89
minion3.x = 3500
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    90
minion3.y = 1750
12533
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
    91
9831
afa4e3e04cc5 typos correction
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9765
diff changeset
    92
teamA.name = loc("PAotH")
13583
141cdfe0f3ca Switch almost all Lua calls of AddTeam to using default clan colors instead of hardcoded color
Wuzzy <Wuzzy2@mail.ru>
parents: 12933
diff changeset
    93
teamA.color = -6
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    94
teamB.name = loc("Minions")
13583
141cdfe0f3ca Switch almost all Lua calls of AddTeam to using default clan colors instead of hardcoded color
Wuzzy <Wuzzy2@mail.ru>
parents: 12933
diff changeset
    95
teamB.color = -2
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    96
teamC.name = loc("Professor")
13583
141cdfe0f3ca Switch almost all Lua calls of AddTeam to using default clan colors instead of hardcoded color
Wuzzy <Wuzzy2@mail.ru>
parents: 12933
diff changeset
    97
teamC.color = -2
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    98
teamD.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: 12933
diff changeset
    99
teamD.color = -6
9310
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
   100
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
   101
-------------- LuaAPI EVENT HANDLERS ------------------
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
   102
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
   103
function onGameInit()
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
   104
	Seed = 1
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   105
	GameFlags = gfSolidLand + gfDisableWind
9330
b6483dc78feb I think hog weapons and health is ok like that
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9326
diff changeset
   106
	TurnTime = 25000
9310
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
   107
	CaseFreq = 0
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
   108
	MinesNum = 0
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
   109
	MinesTime = 3000
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
   110
	Explosives = 0
12549
d8af6f9b51c6 Disable SD in ACF6 and ASA: The first stop
Wuzzy <almikes@aol.com>
parents: 12537
diff changeset
   111
	HealthDecrease = 0
d8af6f9b51c6 Disable SD in ACF6 and ASA: The first stop
Wuzzy <almikes@aol.com>
parents: 12537
diff changeset
   112
	WaterRise = 0
9310
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
   113
	Map = "moon01_map"
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   114
	Theme = "Cheese" -- Because ofc moon is made of cheese :)
14509
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   115
	-- Hero
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   116
	teamD.name = AddMissionTeam(teamD.color)
9640
a6a903a6c2b3 some changes regarding hp save in cosmos and moon
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9639
diff changeset
   117
	if tonumber(GetCampaignVar("HeroHealth")) then
14509
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   118
		hero.gear = AddMissionHog(tonumber(GetCampaignVar("HeroHealth")))
9326
689f591aa226 added saved hero health between missions
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9324
diff changeset
   119
	else
14509
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   120
		hero.gear = AddMissionHog(100)
9326
689f591aa226 added saved hero health between missions
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9324
diff changeset
   121
	end
14509
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   122
	hero.name = GetHogName(hero.gear)
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   123
	AnimSetGearPosition(hero.gear, hero.x, hero.y)
9831
afa4e3e04cc5 typos correction
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9765
diff changeset
   124
	-- PAotH
14953
ff4003a90ff8 Enable automatic voicepack language selection for all missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14919
diff changeset
   125
	teamA.name = AddTeam(teamA.name, teamA.color, "Earth", "Island", "Default_qau", "cm_galaxy")
14633
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   126
	SetTeamPassive(teamA.name, true)
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   127
	paoth1.gear = AddHog(paoth1.name, 0, 100, "scif_2001O")
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   128
	AnimSetGearPosition(paoth1.gear, paoth1.x, paoth1.y)
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   129
	HogTurnLeft(paoth1.gear, true)
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   130
	paoth2.gear = AddHog(paoth2.name, 0, 100, "scif_2001Y")
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   131
	AnimSetGearPosition(paoth2.gear, paoth2.x, paoth2.y)
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   132
	HogTurnLeft(paoth2.gear, true)
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   133
	paoth3.gear = AddHog(paoth3.name, 0, 100, "hair_purple")
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   134
	AnimSetGearPosition(paoth3.gear, paoth3.x, paoth3.y)
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   135
	HogTurnLeft(paoth3.gear, true)
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   136
	paoth4.gear = AddHog(paoth4.name, 0, 100, "scif_2001Y")
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   137
	AnimSetGearPosition(paoth4.gear, paoth4.x, paoth4.y)
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   138
	HogTurnLeft(paoth4.gear, true)
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   139
	-- Professor
14953
ff4003a90ff8 Enable automatic voicepack language selection for all missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14919
diff changeset
   140
	teamC.name = AddTeam(teamC.name, teamC.color, "star", "Island", "Default_qau", "cm_sine")
14633
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   141
	SetTeamPassive(teamC.name, true)
12533
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   142
	professor.gear = AddHog(professor.name, 0, professor.health, "tophats")
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   143
	AnimSetGearPosition(professor.gear, professor.x, professor.y)
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   144
	HogTurnLeft(professor.gear, true)
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   145
	-- Minions
14953
ff4003a90ff8 Enable automatic voicepack language selection for all missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14919
diff changeset
   146
	teamB.name = AddTeam(teamB.name, teamB.color, "eyecross", "Island", "Default_qau", "cm_sine")
9330
b6483dc78feb I think hog weapons and health is ok like that
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9326
diff changeset
   147
	minion1.gear = AddHog(minion1.name, 1, 50, "Gasmask")
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   148
	AnimSetGearPosition(minion1.gear, minion1.x, minion1.y)
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   149
	HogTurnLeft(minion1.gear, true)
9330
b6483dc78feb I think hog weapons and health is ok like that
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9326
diff changeset
   150
	minion2.gear = AddHog(minion2.name, 1, 50, "Gasmask")
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   151
	AnimSetGearPosition(minion2.gear, minion2.x, minion2.y)
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   152
	HogTurnLeft(minion2.gear, true)
9330
b6483dc78feb I think hog weapons and health is ok like that
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9326
diff changeset
   153
	minion3.gear = AddHog(minion3.name, 1, 50, "Gasmask")
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   154
	AnimSetGearPosition(minion3.gear, minion3.x, minion3.y)
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   155
	HogTurnLeft(minion3.gear, true)
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   156
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   157
	-- get the check point
9582
bf314b2258b3 less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9578
diff changeset
   158
	checkPointReached = initCheckpoint("moon01")
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   159
	if checkPointReached == 1 then
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   160
		-- Start of the game
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   161
	elseif checkPointReached == 2 then
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   162
		AnimSetGearPosition(hero.gear, parachuteX, weaponsY)
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   163
		if GetHealth(hero.gear) + 5 > 100 then
9640
a6a903a6c2b3 some changes regarding hp save in cosmos and moon
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9639
diff changeset
   164
			SaveCampaignVar("HeroHealth", 100)
a6a903a6c2b3 some changes regarding hp save in cosmos and moon
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9639
diff changeset
   165
		else
a6a903a6c2b3 some changes regarding hp save in cosmos and moon
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9639
diff changeset
   166
			SaveCampaignVar("HeroHealth", GetHealth(hero.gear) + 5)
a6a903a6c2b3 some changes regarding hp save in cosmos and moon
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9639
diff changeset
   167
		end
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   168
	end
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   169
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
   170
	AnimInit(true)
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   171
	AnimationSetup()
9310
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
   172
end
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
   173
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
   174
function onGameStart()
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   175
	-- wait for the first turn to start
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   176
	AnimWait(hero.gear, 3000)
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   177
	FollowGear(hero.gear)
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   178
14509
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   179
	ShowMission(campaignName, missionName, string.format(loc("%s has to refuel the saucer."), hero.name)..
15088
d59da429d22c Add 2 mission panel icons: hedgehog and flags
Wuzzy <Wuzzy2@mail.ru>
parents: 15023
diff changeset
   180
	"|"..loc("Rescue the imprisoned PAotH team and get the fuel!"), 10, 0)
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   181
9322
18cbaf1436c7 event to endgame when minions killed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9320
diff changeset
   182
	AddAmmo(minion1.gear, amDEagle, 10)
18cbaf1436c7 event to endgame when minions killed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9320
diff changeset
   183
	AddAmmo(minion2.gear, amDEagle, 10)
18cbaf1436c7 event to endgame when minions killed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9320
diff changeset
   184
	AddAmmo(minion3.gear, amDEagle, 10)
9316
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   185
	AddAmmo(minion1.gear, amBazooka, 2)
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   186
	AddAmmo(minion2.gear, amBazooka, 2)
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   187
	AddAmmo(minion3.gear, amBazooka, 2)
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   188
	AddAmmo(minion1.gear, amGrenade, 2)
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   189
	AddAmmo(minion2.gear, amGrenade, 2)
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   190
	AddAmmo(minion3.gear, amGrenade, 2)
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   191
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   192
	-- check for death has to go first
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   193
	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
9318
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   194
	AddEvent(onProfessorDeath, {professor.gear}, professorDeath, {professor.gear}, 0)
9324
98368198a75d added slot for starting campaign by clicking the image and some events in moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9322
diff changeset
   195
	AddEvent(onMinionsDeath, {professor.gear}, minionsDeath, {professor.gear}, 0)
12533
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   196
	AddEvent(onProfessorAndMinionsDeath, {professor.gear}, professorAndMinionsDeath, {professor.gear}, 0)
9318
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   197
	AddEvent(onProfessorHit, {professor.gear}, professorHit, {professor.gear}, 1)
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   198
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   199
	if checkPointReached == 1 then
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   200
		AddAmmo(hero.gear, amRope, 2)
12619
2b529ddf1b01 ASA, moon01, desert01: Enable skip for hero only if there is turn-based play
Wuzzy <almikes@aol.com>
parents: 12617
diff changeset
   201
		AddAmmo(hero.gear, amSkip, 0)
12933
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12619
diff changeset
   202
		SpawnSupplyCrate(bazookaX, weaponsY, amBazooka)
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12619
diff changeset
   203
		SpawnSupplyCrate(parachuteX, weaponsY, amParachute)
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12619
diff changeset
   204
		SpawnSupplyCrate(grenadeX, weaponsY, amGrenade)
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12619
diff changeset
   205
		SpawnSupplyCrate(deserteagleX, weaponsY, amDEagle)
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   206
		AddEvent(onWeaponsPlatform, {hero.gear}, weaponsPlatform, {hero.gear}, 0)
12514
d89dabfd07ce Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents: 12513
diff changeset
   207
		EndTurn(true)
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   208
		AddAnim(dialog01)
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   209
	elseif checkPointReached == 2 then
9330
b6483dc78feb I think hog weapons and health is ok like that
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9326
diff changeset
   210
		AddAmmo(hero.gear, amBazooka, 3)
b6483dc78feb I think hog weapons and health is ok like that
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9326
diff changeset
   211
		AddAmmo(hero.gear, amParachute, 1)
b6483dc78feb I think hog weapons and health is ok like that
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9326
diff changeset
   212
		AddAmmo(hero.gear, amGrenade, 6)
b6483dc78feb I think hog weapons and health is ok like that
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9326
diff changeset
   213
		AddAmmo(hero.gear, amDEagle, 4)
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   214
		SetWind(60)
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   215
		GameFlags = bor(GameFlags,gfDisableWind)
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   216
		weaponsAcquired = true
9733
37f84780eb14 fixed overlapping bubbles and wrong dialog triggering in moon01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   217
		afterDialog02 = true
12514
d89dabfd07ce Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents: 12513
diff changeset
   218
		EndTurn(true)
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   219
		AddAnim(dialog02)
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   220
	end
9616
df14425d9e4c fixed the bug that didn't saved checkpoint 1 reported by mikade
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9582
diff changeset
   221
	-- this event check goes here to be executed after the onWeaponsPlatform check
df14425d9e4c fixed the bug that didn't saved checkpoint 1 reported by mikade
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9582
diff changeset
   222
	AddEvent(onBattleZone, {hero.gear}, battleZone, {hero.gear}, 0)
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   223
9334
4bf3edc24444 custom stats in moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9330
diff changeset
   224
	SendHealthStatsOff()
9310
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
   225
end
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   226
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   227
function onAmmoStoreInit()
9330
b6483dc78feb I think hog weapons and health is ok like that
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9326
diff changeset
   228
	SetAmmo(amBazooka, 0, 0, 0, 3)
b6483dc78feb I think hog weapons and health is ok like that
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9326
diff changeset
   229
	SetAmmo(amParachute, 0, 0, 0, 1)
b6483dc78feb I think hog weapons and health is ok like that
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9326
diff changeset
   230
	SetAmmo(amGrenade, 0, 0, 0, 6)
b6483dc78feb I think hog weapons and health is ok like that
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9326
diff changeset
   231
	SetAmmo(amDEagle, 0, 0, 0, 4)
11976
d5dabb71d6bf Add skip option to desert01, fruit02, moon01 in A Space Adventure
Wuzzy <almikes@aol.com>
parents: 11975
diff changeset
   232
	SetAmmo(amSkip, 9, 0, 0, 1)
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   233
end
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   234
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   235
function onGameTick()
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   236
	AnimUnWait()
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   237
	if ShowAnimation() == false then
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   238
		return
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   239
	end
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   240
	ExecuteAfterAnimations()
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   241
	CheckEvents()
9316
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   242
	if CurrentHedgehog ~= hero.gear and not battleZone then
12514
d89dabfd07ce Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents: 12513
diff changeset
   243
		EndTurn(true)
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   244
	end
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   245
end
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   246
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   247
function onNewTurn()
9318
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   248
	-- rounds start if hero got his weapons or got near the enemies
12601
726b1edfc511 ASA, moon01: Fix minions sometimes taking double turns
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   249
	if CurrentHedgehog == hero.gear then
726b1edfc511 ASA, moon01: Fix minions sometimes taking double turns
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   250
		if not weaponsAcquired and not battleZoneReached then
13752
110d6c1e817f Lua: Rename globals: NoPointX→NO_CURSOR, cMaxTurnTime→MAX_TURN_TIME, cMaxHogHealth→MAX_HOG_HEALTH
Wuzzy <Wuzzy2@mail.ru>
parents: 13742
diff changeset
   251
			SetTurnTimeLeft(MAX_TURN_TIME)
12601
726b1edfc511 ASA, moon01: Fix minions sometimes taking double turns
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   252
		end
726b1edfc511 ASA, moon01: Fix minions sometimes taking double turns
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   253
	elseif CurrentHedgehog == minion1.gear or CurrentHedgehog == minion2.gear or CurrentHedgehog == minion3.gear then
12616
88b9f41a5789 ASA, moon01: Fix various turn-based and gameplaying bugs
Wuzzy <almikes@aol.com>
parents: 12615
diff changeset
   254
		if not battleZoneReached then
12601
726b1edfc511 ASA, moon01: Fix minions sometimes taking double turns
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   255
			EndTurn(true)
726b1edfc511 ASA, moon01: Fix minions sometimes taking double turns
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   256
		elseif weaponsAcquired and not battleZoneReached and afterDialog02 then
726b1edfc511 ASA, moon01: Fix minions sometimes taking double turns
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   257
			battleZone(hero.gear)
726b1edfc511 ASA, moon01: Fix minions sometimes taking double turns
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   258
		end
9316
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   259
	elseif CurrentHedgehog == professor.gear then
12616
88b9f41a5789 ASA, moon01: Fix various turn-based and gameplaying bugs
Wuzzy <almikes@aol.com>
parents: 12615
diff changeset
   260
		if weaponsAcquired and not battleZoneReached and afterDialog02 then
88b9f41a5789 ASA, moon01: Fix various turn-based and gameplaying bugs
Wuzzy <almikes@aol.com>
parents: 12615
diff changeset
   261
			battleZone(hero.gear)
88b9f41a5789 ASA, moon01: Fix various turn-based and gameplaying bugs
Wuzzy <almikes@aol.com>
parents: 12615
diff changeset
   262
		else
88b9f41a5789 ASA, moon01: Fix various turn-based and gameplaying bugs
Wuzzy <almikes@aol.com>
parents: 12615
diff changeset
   263
			EndTurn(true)
88b9f41a5789 ASA, moon01: Fix various turn-based and gameplaying bugs
Wuzzy <almikes@aol.com>
parents: 12615
diff changeset
   264
		end
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   265
	end
15521
e3bf91fbd3f8 ASA moon01: Fix broken victory condition when eliminating minions
Wuzzy <Wuzzy2@mail.ru>
parents: 15102
diff changeset
   266
	if minionsDead and (not (professor.dead or GetHealth(professor.gear) == nil or GetHealth(professor.gear) == 0)) then
e3bf91fbd3f8 ASA moon01: Fix broken victory condition when eliminating minions
Wuzzy <Wuzzy2@mail.ru>
parents: 15102
diff changeset
   267
		FollowGear(professor.gear)
e3bf91fbd3f8 ASA moon01: Fix broken victory condition when eliminating minions
Wuzzy <Wuzzy2@mail.ru>
parents: 15102
diff changeset
   268
	end
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   269
end
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   270
15023
3ed1cbd31754 Backed out changeset 4596357d002d (onPreciseLocal causes desyncs)
Wuzzy <Wuzzy2@mail.ru>
parents: 14953
diff changeset
   271
function onPrecise()
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   272
	if GameTime > 3000 then
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   273
		SetAnimSkip(true)
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   274
	end
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   275
end
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   276
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   277
function onGearDelete(gear)
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   278
	if gear == hero.gear then
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   279
		hero.dead = true
9320
1845b420cb5d game ends when professor dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9318
diff changeset
   280
	elseif gear == professor.gear then
9318
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   281
		professor.dead = true
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   282
	end
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   283
end
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   284
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   285
-------------- EVENTS ------------------
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   286
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   287
function onWeaponsPlatform(gear)
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   288
	if not hero.dead and (GetAmmoCount(hero.gear, amBazooka) > 0 or GetAmmoCount(hero.gear, amParachute) > 0 or
9616
df14425d9e4c fixed the bug that didn't saved checkpoint 1 reported by mikade
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9582
diff changeset
   289
			GetAmmoCount(hero.gear, amGrenade) > 0 or GetAmmoCount(hero.gear, amDEagle) > 0) and StoppedGear(hero.gear) then
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   290
		return true
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   291
	end
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   292
	return false
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   293
end
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   294
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   295
function onHeroDeath(gear)
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   296
	if hero.dead then
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   297
		return true
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   298
	end
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   299
	return false
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   300
end
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   301
9316
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   302
function onBattleZone(gear)
12616
88b9f41a5789 ASA, moon01: Fix various turn-based and gameplaying bugs
Wuzzy <almikes@aol.com>
parents: 12615
diff changeset
   303
	if not battleZoneReached and not hero.dead and StoppedGear(gear) and
88b9f41a5789 ASA, moon01: Fix various turn-based and gameplaying bugs
Wuzzy <almikes@aol.com>
parents: 12615
diff changeset
   304
			(GetX(gear) > 1900 or (weaponsAcquired and GetY(gear) > 1200)) then
9318
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   305
		return true
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   306
	end
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   307
	return false
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   308
end
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   309
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   310
function onProfessorHit(gear)
9320
1845b420cb5d game ends when professor dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9318
diff changeset
   311
	if GetHealth(gear) then
1845b420cb5d game ends when professor dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9318
diff changeset
   312
		if CurrentHedgehog ~= hero.gear and GetHealth(gear) < professor.health then
1845b420cb5d game ends when professor dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9318
diff changeset
   313
			professor.health = GetHealth(gear)
1845b420cb5d game ends when professor dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9318
diff changeset
   314
			return true
1845b420cb5d game ends when professor dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9318
diff changeset
   315
		elseif GetHealth(gear) < professor.health then
1845b420cb5d game ends when professor dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9318
diff changeset
   316
			professor.health = GetHealth(gear)
1845b420cb5d game ends when professor dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9318
diff changeset
   317
		end
9318
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   318
	end
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   319
	return false
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   320
end
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   321
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   322
function onProfessorDeath(gear)
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   323
	if professor.dead then
9316
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   324
		return true
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   325
	end
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   326
	return false
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   327
end
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   328
9322
18cbaf1436c7 event to endgame when minions killed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9320
diff changeset
   329
function onMinionsDeath(gear)
9324
98368198a75d added slot for starting campaign by clicking the image and some events in moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9322
diff changeset
   330
	if not (GetHealth(minion1.gear) or GetHealth(minion2.gear) or GetHealth(minion3.gear)) then
9322
18cbaf1436c7 event to endgame when minions killed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9320
diff changeset
   331
		return true
18cbaf1436c7 event to endgame when minions killed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9320
diff changeset
   332
	end
18cbaf1436c7 event to endgame when minions killed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9320
diff changeset
   333
	return false
18cbaf1436c7 event to endgame when minions killed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9320
diff changeset
   334
end
18cbaf1436c7 event to endgame when minions killed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9320
diff changeset
   335
12533
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   336
function onProfessorAndMinionsDeath(gear)
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   337
	if professor.dead and (not (GetHealth(minion1.gear) or GetHealth(minion2.gear) or GetHealth(minion3.gear))) then
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   338
		return true
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   339
	end
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   340
	return false
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   341
end
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   342
9639
6b2ae2eaf1b2 remove unnecessary comments
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9616
diff changeset
   343
-------------- ACTIONS ------------------
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   344
9582
bf314b2258b3 less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9578
diff changeset
   345
function weaponsPlatform(gear)
12617
bcd679240cd2 ASA, moon01: Don't save checkpoint if player was first detected, and then grabbed the weapons
Wuzzy <almikes@aol.com>
parents: 12616
diff changeset
   346
	if not battleZoneReached then
bcd679240cd2 ASA, moon01: Don't save checkpoint if player was first detected, and then grabbed the weapons
Wuzzy <almikes@aol.com>
parents: 12616
diff changeset
   347
		-- Player entered weapons platform before entering battle zone.
bcd679240cd2 ASA, moon01: Don't save checkpoint if player was first detected, and then grabbed the weapons
Wuzzy <almikes@aol.com>
parents: 12616
diff changeset
   348
		-- Checkpoint and dialog!
bcd679240cd2 ASA, moon01: Don't save checkpoint if player was first detected, and then grabbed the weapons
Wuzzy <almikes@aol.com>
parents: 12616
diff changeset
   349
		saveCheckpoint("2")
bcd679240cd2 ASA, moon01: Don't save checkpoint if player was first detected, and then grabbed the weapons
Wuzzy <almikes@aol.com>
parents: 12616
diff changeset
   350
		SaveCampaignVar("HeroHealth",GetHealth(hero.gear))
bcd679240cd2 ASA, moon01: Don't save checkpoint if player was first detected, and then grabbed the weapons
Wuzzy <almikes@aol.com>
parents: 12616
diff changeset
   351
		EndTurn(true)
bcd679240cd2 ASA, moon01: Don't save checkpoint if player was first detected, and then grabbed the weapons
Wuzzy <almikes@aol.com>
parents: 12616
diff changeset
   352
		weaponsAcquired = true
bcd679240cd2 ASA, moon01: Don't save checkpoint if player was first detected, and then grabbed the weapons
Wuzzy <almikes@aol.com>
parents: 12616
diff changeset
   353
		SetWind(60)
bcd679240cd2 ASA, moon01: Don't save checkpoint if player was first detected, and then grabbed the weapons
Wuzzy <almikes@aol.com>
parents: 12616
diff changeset
   354
		GameFlags = bor(GameFlags,gfDisableWind)
bcd679240cd2 ASA, moon01: Don't save checkpoint if player was first detected, and then grabbed the weapons
Wuzzy <almikes@aol.com>
parents: 12616
diff changeset
   355
		AddAmmo(hero.gear, amRope, 0)
12619
2b529ddf1b01 ASA, moon01, desert01: Enable skip for hero only if there is turn-based play
Wuzzy <almikes@aol.com>
parents: 12617
diff changeset
   356
		AddAmmo(hero.gear, amSkip, 100)
12617
bcd679240cd2 ASA, moon01: Don't save checkpoint if player was first detected, and then grabbed the weapons
Wuzzy <almikes@aol.com>
parents: 12616
diff changeset
   357
		if GetX(hero.gear) < 1900 then
bcd679240cd2 ASA, moon01: Don't save checkpoint if player was first detected, and then grabbed the weapons
Wuzzy <almikes@aol.com>
parents: 12616
diff changeset
   358
			AddAnim(dialog02)
bcd679240cd2 ASA, moon01: Don't save checkpoint if player was first detected, and then grabbed the weapons
Wuzzy <almikes@aol.com>
parents: 12616
diff changeset
   359
		end
9616
df14425d9e4c fixed the bug that didn't saved checkpoint 1 reported by mikade
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9582
diff changeset
   360
	end
12617
bcd679240cd2 ASA, moon01: Don't save checkpoint if player was first detected, and then grabbed the weapons
Wuzzy <almikes@aol.com>
parents: 12616
diff changeset
   361
	-- The player may screw up by going into the battle zone too early (dialog03).
bcd679240cd2 ASA, moon01: Don't save checkpoint if player was first detected, and then grabbed the weapons
Wuzzy <almikes@aol.com>
parents: 12616
diff changeset
   362
	-- In that case, the player is punished for this stupid move (no checkpoint),
bcd679240cd2 ASA, moon01: Don't save checkpoint if player was first detected, and then grabbed the weapons
Wuzzy <almikes@aol.com>
parents: 12616
diff changeset
   363
	-- but it is still theoretically possible to win by going for the weapons
bcd679240cd2 ASA, moon01: Don't save checkpoint if player was first detected, and then grabbed the weapons
Wuzzy <almikes@aol.com>
parents: 12616
diff changeset
   364
	-- very fast.
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   365
end
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   366
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   367
function heroDeath(gear)
14509
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   368
	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: 10290
diff changeset
   369
	SendStat(siCustomAchievement, loc("You have to get the weapons and rescue the PAotH researchers."))
12537
66566cfe0a7e ASA, The first stop: Fix team ranking and kills in stats screen (bug 147)
Wuzzy <almikes@aol.com>
parents: 12534
diff changeset
   370
	sendSimpleTeamRankings({teamC.name, teamB.name, teamD.name, teamA.name})
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   371
	EndGame()
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   372
end
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   373
9316
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   374
function battleZone(gear)
12616
88b9f41a5789 ASA, moon01: Fix various turn-based and gameplaying bugs
Wuzzy <almikes@aol.com>
parents: 12615
diff changeset
   375
	battleZoneReached = true
12619
2b529ddf1b01 ASA, moon01, desert01: Enable skip for hero only if there is turn-based play
Wuzzy <almikes@aol.com>
parents: 12617
diff changeset
   376
	AddAmmo(hero.gear, amSkip, 100)
12514
d89dabfd07ce Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents: 12513
diff changeset
   377
	EndTurn(true)
9733
37f84780eb14 fixed overlapping bubbles and wrong dialog triggering in moon01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   378
	if weaponsAcquired then
9318
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   379
		AddAnim(dialog04)
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   380
	else
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   381
		AddAnim(dialog03)
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   382
	end
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   383
end
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   384
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   385
function professorHit(gear)
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   386
	if currentHedgehog ~= hero.gear then
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   387
		AnimSay(professor.gear,loc("Don't hit me, you fools!"), SAY_SHOUT, 2000)
9318
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   388
	end
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   389
end
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   390
12533
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   391
function victory()
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   392
	AnimCaption(hero.gear, loc("Congrats! You won!"), 6000)
9578
16139270448f save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   393
	saveCompletedStatus(1)
14509
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   394
	SendStat(siGameResult, string.format(loc("%s wins, congratulations!"), hero.name))
12537
66566cfe0a7e ASA, The first stop: Fix team ranking and kills in stats screen (bug 147)
Wuzzy <almikes@aol.com>
parents: 12534
diff changeset
   395
	sendSimpleTeamRankings({teamD.name, teamA.name, teamC.name, teamB.name})
9342
51b5fffe3892 changes about displaying the ice planet mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9336
diff changeset
   396
	SaveCampaignVar("CosmosCheckPoint", "5") -- hero got fuels
12531
e12e2dfda06f ASA: Reset checkpoint after completing checkpointed mission
Wuzzy <almikes@aol.com>
parents: 12515
diff changeset
   397
	resetCheckpoint() -- reset this mission
11975
c52d35c859e8 Fix double achievements and ranks in The First Stop mission (fixes #106)
Wuzzy <almikes@aol.com>
parents: 11692
diff changeset
   398
	gameOver = true
9318
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   399
	EndGame()
9316
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   400
end
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   401
12533
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   402
function professorAndMinionsDeath(gear)
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   403
	if gameOver then return end
15102
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15088
diff changeset
   404
	if (not IsHogAlive(hero.gear)) or (not StoppedGear(hero.gear)) then return end
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15088
diff changeset
   405
	SendStat(siCustomAchievement, loc("You have eliminated Professor Hogevil."))
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15088
diff changeset
   406
	SendStat(siCustomAchievement, loc("You have eliminated the evil minions."))
12533
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   407
12534
34a91e2b927e ASA, death01: Slightly change professor's response if he got killed on the moon
Wuzzy <almikes@aol.com>
parents: 12533
diff changeset
   408
	SaveCampaignVar("ProfDiedOnMoon", "1")
12533
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   409
	victory()
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   410
end
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   411
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   412
function professorDeath(gear)
11975
c52d35c859e8 Fix double achievements and ranks in The First Stop mission (fixes #106)
Wuzzy <almikes@aol.com>
parents: 11692
diff changeset
   413
	if gameOver then return end
15102
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15088
diff changeset
   414
	if (not IsHogAlive(hero.gear)) or (not StoppedGear(hero.gear)) then return end
12533
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   415
	local m1h = GetHealth(minion1.gear)
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   416
	local m2h = GetHealth(minion2.gear)
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   417
	local m3h = GetHealth(minion3.gear)
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   418
	if m1h == 0 or m2h == 0 or m3h == 0 then return end
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   419
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   420
	if m1h and m1h > 0 and StoppedGear(minion1.gear) then
12615
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   421
		Dialog06Setup(minion1.gear)
12533
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   422
	elseif m2h and m2h > 0 and StoppedGear(minion2.gear) then
12615
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   423
		Dialog06ASetup(minion2.gear)
12533
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   424
	elseif m3h and m3h > 0 and StoppedGear(minion3.gear) then
12615
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   425
		Dialog06Setup(minion3.gear)
12533
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   426
	end
12615
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   427
	AddAnim(dialog06)
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   428
end
12533
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   429
12615
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   430
function afterDialog06()
15102
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15088
diff changeset
   431
	if (not IsHogAlive(hero.gear)) or (not StoppedGear(hero.gear)) then return end
12615
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   432
	EndTurn(true)
12533
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   433
	SendStat(siCustomAchievement, loc("You have eliminated Professor Hogevil."))
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   434
	SendStat(siCustomAchievement, loc("You drove the minions away."))
12615
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   435
	SaveCampaignVar("ProfDiedOnMoon", "1")
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   436
	victory()
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   437
end
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   438
12615
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   439
function afterDialog05()
15102
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15088
diff changeset
   440
	if (not IsHogAlive(hero.gear)) or (not StoppedGear(hero.gear)) then return end
12615
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   441
	EndTurn(true)
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   442
	HideHog(professor.gear)
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   443
	SendStat(siCustomAchievement, loc("You have eliminated the evil minions."))
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   444
	SendStat(siCustomAchievement, loc("You drove Professor Hogevil away."))
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   445
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   446
	SaveCampaignVar("ProfDiedOnMoon", "0")
12533
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   447
	victory()
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   448
end
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   449
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   450
function minionsDeath(gear)
15521
e3bf91fbd3f8 ASA moon01: Fix broken victory condition when eliminating minions
Wuzzy <Wuzzy2@mail.ru>
parents: 15102
diff changeset
   451
	minionsDead = true
12533
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   452
	if professor.dead or GetHealth(professor.gear) == nil or GetHealth(professor.gear) == 0 then return end
f8801c72a6c8 ASA, The first stop: Take possibility into account that whole team can be wiped out
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   453
	if gameOver then return end
15102
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15088
diff changeset
   454
	if (not IsHogAlive(hero.gear)) or (not StoppedGear(hero.gear)) then return end
15521
e3bf91fbd3f8 ASA moon01: Fix broken victory condition when eliminating minions
Wuzzy <Wuzzy2@mail.ru>
parents: 15102
diff changeset
   455
	SetTeamPassive(teamC.name, false)
12615
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   456
	AddAnim(dialog05)
9322
18cbaf1436c7 event to endgame when minions killed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9320
diff changeset
   457
end
18cbaf1436c7 event to endgame when minions killed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9320
diff changeset
   458
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   459
-------------- ANIMATIONS ------------------
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   460
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   461
function Skipanim(anim)
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   462
	if goals[anim] ~= nil then
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   463
		ShowMission(unpack(goals[anim]))
12575
0c5ce463949b ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents: 12571
diff changeset
   464
	end
12616
88b9f41a5789 ASA, moon01: Fix various turn-based and gameplaying bugs
Wuzzy <almikes@aol.com>
parents: 12615
diff changeset
   465
	if anim == dialog01 then
88b9f41a5789 ASA, moon01: Fix various turn-based and gameplaying bugs
Wuzzy <almikes@aol.com>
parents: 12615
diff changeset
   466
		AnimSwitchHog(hero.gear)
88b9f41a5789 ASA, moon01: Fix various turn-based and gameplaying bugs
Wuzzy <almikes@aol.com>
parents: 12615
diff changeset
   467
	elseif anim == dialog02 then
9733
37f84780eb14 fixed overlapping bubbles and wrong dialog triggering in moon01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   468
		setAfterDialog02()
12616
88b9f41a5789 ASA, moon01: Fix various turn-based and gameplaying bugs
Wuzzy <almikes@aol.com>
parents: 12615
diff changeset
   469
		AnimSwitchHog(hero.gear)
88b9f41a5789 ASA, moon01: Fix various turn-based and gameplaying bugs
Wuzzy <almikes@aol.com>
parents: 12615
diff changeset
   470
	elseif anim == dialog03 or anim == dialog04 then
9316
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   471
		startCombat()
12615
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   472
	elseif anim == dialog05 then
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   473
		runaway(professor.gear)
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   474
		afterDialog05()
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   475
	elseif anim == dialog06 then
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   476
		runaway(minion1.gear)
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   477
		runaway(minion2.gear)
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   478
		runaway(minion3.gear)
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   479
		afterDialog06()
9316
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   480
	end
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   481
end
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   482
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   483
function AnimationSetup()
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   484
	-- DIALOG 01 - Start, welcome to moon
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   485
	AddSkipFunction(dialog01, Skipanim, {dialog01})
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   486
	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   487
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Near a PAotH base on the moon ..."),  4000}})
14509
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   488
	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, string.format(loc("Hey, %s! Finally you have come!"), hero.name), SAY_SAY, 2000}})
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   489
	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("It seems that Professor Hogevil has prepared for your arrival!"), SAY_SAY, 4000}})
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   490
	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("He has captured the rest of the PAotH team and awaits to capture you!"), SAY_SAY, 5000}})
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   491
	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("We have to hurry! Are you armed?"), SAY_SAY, 4300}})
9733
37f84780eb14 fixed overlapping bubbles and wrong dialog triggering in moon01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   492
	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 450}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   493
	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("No, I am afraid I had to travel light."), SAY_SAY, 2500}})
9733
37f84780eb14 fixed overlapping bubbles and wrong dialog triggering in moon01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   494
	table.insert(dialog01, {func = AnimWait, args = {paoth1.gear, 3200}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   495
	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("Okay, then you have to go and take some of the weapons we have hidden in case of an emergency!"), SAY_SAY, 7000}})
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   496
	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("They are up there! Take this rope and hurry!"), SAY_SAY, 7000}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   497
	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Ehm, okay ..."), SAY_SAY, 2500}})
12575
0c5ce463949b ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents: 12571
diff changeset
   498
	table.insert(dialog01, {func = ShowMission, args = goals[dialog01]})
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   499
	table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}})
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   500
	-- DIALOG 02 - To the weapons platform
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   501
	AddSkipFunction(dialog02, Skipanim, {dialog02})
12615
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   502
	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 100}})
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   503
	table.insert(dialog02, {func = AnimCaption, args = {hero.gear, loc("Checkpoint reached!"), 4000}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   504
	table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("I've made it! Yeah!"), SAY_SHOUT, 4000}})
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   505
	table.insert(dialog02, {func = AnimSay, args = {paoth1.gear, loc("Nice! Now hurry and get down! You have to rescue my friends!"), SAY_SHOUT, 7000}})
9733
37f84780eb14 fixed overlapping bubbles and wrong dialog triggering in moon01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   506
	table.insert(dialog02, {func = setAfterDialog02, args = {}})
12575
0c5ce463949b ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents: 12571
diff changeset
   507
	table.insert(dialog02, {func = ShowMission, args = goals[dialog02]})
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   508
	table.insert(dialog02, {func = AnimSwitchHog, args = {hero.gear}})
9316
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   509
	-- DIALOG 03 - Hero spotted and has no weapons
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   510
	AddSkipFunction(dialog03, Skipanim, {dialog03})
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   511
	table.insert(dialog03, {func = AnimCaption, args = {hero.gear, loc("Get ready to fight!"), 4000}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   512
	table.insert(dialog03, {func = AnimSay, args = {minion1.gear, loc("Look, boss! There is the target!"), SAY_SHOUT, 4000}})
9316
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   513
	table.insert(dialog03, {func = AnimSay, args = {professor.gear, loc("Prepare for battle!"), SAY_SHOUT, 4000}})
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   514
	table.insert(dialog03, {func = AnimSay, args = {hero.gear, loc("Oops, I've been spotted and I have no weapons! I am doomed!"), SAY_THINK, 4000}})
12575
0c5ce463949b ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents: 12571
diff changeset
   515
	table.insert(dialog03, {func = ShowMission, args = goals[dialog03]})
9316
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   516
	table.insert(dialog03, {func = startCombat, args = {hero.gear}})
9318
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   517
	-- DIALOG 04 - Hero spotted and *HAS* weapons
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   518
	AddSkipFunction(dialog04, Skipanim, {dialog04})
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   519
	table.insert(dialog04, {func = AnimCaption, args = {hero.gear, loc("Get ready to fight!"), 4000}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   520
	table.insert(dialog04, {func = AnimSay, args = {minion1.gear, loc("Look, boss! There is the target!"), SAY_SHOUT, 4000}})
9318
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   521
	table.insert(dialog04, {func = AnimSay, args = {professor.gear, loc("Prepare for battle!"), SAY_SHOUT, 4000}})
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   522
	table.insert(dialog04, {func = AnimSay, args = {hero.gear, loc("Here we go!"), SAY_THINK, 4000}})
12575
0c5ce463949b ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents: 12571
diff changeset
   523
	table.insert(dialog04, {func = ShowMission, args = goals[dialog04]})
9318
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   524
	table.insert(dialog04, {func = startCombat, args = {hero.gear}})
12615
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   525
	-- DIALOG 05 - All minions dead
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   526
	AddSkipFunction(dialog05, Skipanim, {dialog05})
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   527
	table.insert(dialog05, {func = AnimWait, args = {professor.gear, 1500}})
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   528
	table.insert(dialog05, {func = AnimSay, args = {professor.gear, loc("I may lost this battle, but I haven't lost the war yet!"), SAY_SHOUT, 5000}})
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   529
	table.insert(dialog05, {func = runaway, args = {professor.gear}})
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   530
	table.insert(dialog05, {func = afterDialog05, args = {professor.gear}})
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   531
end
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   532
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   533
function Dialog06Setup(livingMinion)
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   534
	-- DIALOG 06 - Professor dead
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   535
	AddSkipFunction(dialog06, Skipanim, {dialog06})
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   536
	table.insert(dialog06, {func = AnimWait, args = {livingMinion, 1500}})
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   537
	table.insert(dialog06, {func = AnimSay, args = {livingMinion, loc("The boss has fallen! Retreat!"), SAY_SHOUT, 3000}})
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   538
	table.insert(dialog06, {func = runaway, args = {minion1.gear}})
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   539
	table.insert(dialog06, {func = runaway, args = {minion2.gear}})
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   540
	table.insert(dialog06, {func = runaway, args = {minion3.gear}})
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   541
	table.insert(dialog06, {func = afterDialog06, args = {livingMinion}})
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   542
end
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   543
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   544
function runaway(gear)
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   545
	if GetHealth(gear) then
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   546
		AddVisualGear(GetX(gear)-5, GetY(gear)-5, vgtSmoke, 0, false)
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   547
		AddVisualGear(GetX(gear)+5, GetY(gear)+5, vgtSmoke, 0, false)
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   548
		AddVisualGear(GetX(gear)-5, GetY(gear)+5, vgtSmoke, 0, false)
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   549
		AddVisualGear(GetX(gear)+5, GetY(gear)-5, vgtSmoke, 0, false)
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   550
		SetState(gear, bor(GetState(gear), gstInvisible))
fbd0001ba2e7 ASA, moon01: Move escape dialog into a proper animation dialogue
Wuzzy <almikes@aol.com>
parents: 12601
diff changeset
   551
	end
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   552
end
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   553
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   554
------------------- custom "animation" functions --------------------------
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   555
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   556
function startCombat()
9733
37f84780eb14 fixed overlapping bubbles and wrong dialog triggering in moon01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   557
	-- use this so minion3 will gain control
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   558
	AnimSwitchHog(minion3.gear)
12514
d89dabfd07ce Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents: 12513
diff changeset
   559
	EndTurn(true)
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   560
end
9733
37f84780eb14 fixed overlapping bubbles and wrong dialog triggering in moon01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   561
37f84780eb14 fixed overlapping bubbles and wrong dialog triggering in moon01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   562
function setAfterDialog02()
37f84780eb14 fixed overlapping bubbles and wrong dialog triggering in moon01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   563
	afterDialog02 = true
37f84780eb14 fixed overlapping bubbles and wrong dialog triggering in moon01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   564
end