share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon01.lua
author Wuzzy <almikes@aol.com>
Tue, 26 Sep 2017 02:31:01 +0200
changeset 12531 e12e2dfda06f
parent 12515 2df340544f25
child 12533 f8801c72a6c8
permissions -rw-r--r--
ASA: Reset checkpoint after completing checkpointed mission
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
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    23
-- dialogs
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    24
local dialog01 = {}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    25
local dialog02 = {}
9316
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
    26
local dialog03 = {}
9318
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
    27
local dialog04 = {}
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    28
-- mission objectives
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    29
local goals = {
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    30
	[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
    31
	[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
    32
	[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
    33
	[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
    34
}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    35
-- crates
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    36
local weaponsY = 100
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    37
local bazookaX = 70
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    38
local parachuteX = 110
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    39
local grenadeX = 160
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    40
local deserteagleX = 200
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    41
-- hogs
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    42
local hero = {}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    43
local paoth1 = {}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    44
local paoth2 = {}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    45
local paoth3 = {}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    46
local paoth4 = {}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    47
local professor = {}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    48
local minion1 = {}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    49
local minion2 = {}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    50
local minion3 = {}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    51
local minion4 = {}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    52
-- teams
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    53
local teamA = {}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    54
local teamB = {}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    55
local teamC = {}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    56
local teamD = {}
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    57
-- hedgehogs values
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9445
diff changeset
    58
hero.name = loc("Hog Solo")
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    59
hero.x = 1380
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    60
hero.y = 1750
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
    61
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
    62
paoth1.name = loc("Joe")
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    63
paoth1.x = 1430
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    64
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
    65
paoth2.name = loc("Bruce")
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    66
paoth2.x = 3760
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    67
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
    68
paoth3.name = loc("Helena")
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    69
paoth3.x = 3800
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    70
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
    71
paoth4.name = loc("Boris")
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    72
paoth4.x = 3860
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    73
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
    74
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
    75
professor.x = 3800
5f2224dce442 smaller moon map and check if hero health is set
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9334
diff changeset
    76
professor.y = 1600
9318
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
    77
professor.dead = false
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
    78
professor.health = 100
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9445
diff changeset
    79
minion1.name = loc("Minion")
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    80
minion1.x = 2460
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    81
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
    82
minion2.name = loc("Minion")
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    83
minion2.x = 2450
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    84
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
    85
minion3.name = loc("Minion")
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    86
minion3.x = 3500
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    87
minion3.y = 1750
9831
afa4e3e04cc5 typos correction
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9765
diff changeset
    88
teamA.name = loc("PAotH")
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    89
teamA.color = tonumber("FF0000",16) -- red
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    90
teamB.name = loc("Minions")
12515
2df340544f25 Fix hard-to-read blue team color in ASA campaign
Wuzzy <almikes@aol.com>
parents: 12514
diff changeset
    91
teamB.color = tonumber("0072FF",16) -- blue
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    92
teamC.name = loc("Professor")
12515
2df340544f25 Fix hard-to-read blue team color in ASA campaign
Wuzzy <almikes@aol.com>
parents: 12514
diff changeset
    93
teamC.color = tonumber("0072FF",16) -- blue
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    94
teamD.name = loc("Hog Solo")
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
    95
teamD.color = tonumber("38D61C",16) -- green
9310
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
    96
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
    97
-------------- LuaAPI EVENT HANDLERS ------------------
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
    98
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
    99
function onGameInit()
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
   100
	Seed = 1
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   101
	GameFlags = gfSolidLand + gfDisableWind
9330
b6483dc78feb I think hog weapons and health is ok like that
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9326
diff changeset
   102
	TurnTime = 25000
9310
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
   103
	CaseFreq = 0
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
   104
	MinesNum = 0
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
   105
	MinesTime = 3000
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
   106
	Explosives = 0
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   107
	Delay = 5
9310
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
   108
	Map = "moon01_map"
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   109
	Theme = "Cheese" -- Because ofc moon is made of cheese :)
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   110
	-- Hog Solo
12049
030464f34d47 Tweak flags used in all missions to fit more to the theme
Wuzzy <almikes@aol.com>
parents: 11976
diff changeset
   111
	AddTeam(teamD.name, teamD.color, "Bone", "Island", "HillBilly", "hedgewars")
9640
a6a903a6c2b3 some changes regarding hp save in cosmos and moon
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9639
diff changeset
   112
	if tonumber(GetCampaignVar("HeroHealth")) then
9326
689f591aa226 added saved hero health between missions
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9324
diff changeset
   113
		hero.gear = AddHog(hero.name, 0, tonumber(GetCampaignVar("HeroHealth")), "war_desertgrenadier1")
689f591aa226 added saved hero health between missions
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9324
diff changeset
   114
	else
689f591aa226 added saved hero health between missions
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9324
diff changeset
   115
		hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
689f591aa226 added saved hero health between missions
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9324
diff changeset
   116
	end
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   117
	AnimSetGearPosition(hero.gear, hero.x, hero.y)
9831
afa4e3e04cc5 typos correction
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9765
diff changeset
   118
	-- PAotH
12049
030464f34d47 Tweak flags used in all missions to fit more to the theme
Wuzzy <almikes@aol.com>
parents: 11976
diff changeset
   119
	AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "cm_galaxy")
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   120
	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
   121
	AnimSetGearPosition(paoth1.gear, paoth1.x, paoth1.y)
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   122
	HogTurnLeft(paoth1.gear, true)
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   123
	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
   124
	AnimSetGearPosition(paoth2.gear, paoth2.x, paoth2.y)
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   125
	HogTurnLeft(paoth2.gear, true)
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   126
	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
   127
	AnimSetGearPosition(paoth3.gear, paoth3.x, paoth3.y)
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   128
	HogTurnLeft(paoth3.gear, true)
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   129
	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
   130
	AnimSetGearPosition(paoth4.gear, paoth4.x, paoth4.y)
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   131
	HogTurnLeft(paoth4.gear, true)
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   132
	-- Professor
12049
030464f34d47 Tweak flags used in all missions to fit more to the theme
Wuzzy <almikes@aol.com>
parents: 11976
diff changeset
   133
	AddTeam(teamC.name, teamC.color, "Bone", "Island", "HillBilly", "cm_sine")
9330
b6483dc78feb I think hog weapons and health is ok like that
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9326
diff changeset
   134
	professor.gear = AddHog(professor.name, 0, 120, "tophats")
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   135
	AnimSetGearPosition(professor.gear, professor.x, professor.y)
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   136
	HogTurnLeft(professor.gear, true)
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   137
	-- Minions
12049
030464f34d47 Tweak flags used in all missions to fit more to the theme
Wuzzy <almikes@aol.com>
parents: 11976
diff changeset
   138
	AddTeam(teamB.name, teamB.color, "Bone", "Island", "HillBilly", "cm_sine")
9330
b6483dc78feb I think hog weapons and health is ok like that
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9326
diff changeset
   139
	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
   140
	AnimSetGearPosition(minion1.gear, minion1.x, minion1.y)
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   141
	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
   142
	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
   143
	AnimSetGearPosition(minion2.gear, minion2.x, minion2.y)
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   144
	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
   145
	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
   146
	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
   147
	HogTurnLeft(minion3.gear, true)
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   148
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   149
	-- 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
   150
	checkPointReached = initCheckpoint("moon01")
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   151
	if checkPointReached == 1 then
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   152
		-- Start of the game
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   153
	elseif checkPointReached == 2 then
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   154
		AnimSetGearPosition(hero.gear, parachuteX, weaponsY)
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   155
		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
   156
			SaveCampaignVar("HeroHealth", 100)
a6a903a6c2b3 some changes regarding hp save in cosmos and moon
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9639
diff changeset
   157
		else
a6a903a6c2b3 some changes regarding hp save in cosmos and moon
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9639
diff changeset
   158
			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
   159
		end
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   160
	end
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   161
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
   162
	AnimInit(true)
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   163
	AnimationSetup()
9310
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
   164
end
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
   165
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
   166
function onGameStart()
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   167
	-- wait for the first turn to start
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   168
	AnimWait(hero.gear, 3000)
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   169
	FollowGear(hero.gear)
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   170
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   171
	ShowMission(campaignName, missionName, loc("Hog Solo has to refuel his saucer.")..
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   172
	"|"..loc("Rescue the imprisoned PAotH team and get the fuel!"), -amSkip, 0)
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   173
9322
18cbaf1436c7 event to endgame when minions killed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9320
diff changeset
   174
	AddAmmo(minion1.gear, amDEagle, 10)
18cbaf1436c7 event to endgame when minions killed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9320
diff changeset
   175
	AddAmmo(minion2.gear, amDEagle, 10)
18cbaf1436c7 event to endgame when minions killed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9320
diff changeset
   176
	AddAmmo(minion3.gear, amDEagle, 10)
9316
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   177
	AddAmmo(minion1.gear, amBazooka, 2)
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   178
	AddAmmo(minion2.gear, amBazooka, 2)
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   179
	AddAmmo(minion3.gear, amBazooka, 2)
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   180
	AddAmmo(minion1.gear, amGrenade, 2)
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   181
	AddAmmo(minion2.gear, amGrenade, 2)
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   182
	AddAmmo(minion3.gear, amGrenade, 2)
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   183
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   184
	-- check for death has to go first
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   185
	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
9318
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   186
	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
   187
	AddEvent(onMinionsDeath, {professor.gear}, minionsDeath, {professor.gear}, 0)
9318
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   188
	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
   189
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   190
	if checkPointReached == 1 then
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   191
		AddAmmo(hero.gear, amRope, 2)
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   192
		SpawnAmmoCrate(bazookaX, weaponsY, amBazooka)
12513
d90db45a0c4f Fix crate types in A Space Adventure and some user missions
Wuzzy <almikes@aol.com>
parents: 12088
diff changeset
   193
		SpawnUtilityCrate(parachuteX, weaponsY, amParachute)
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   194
		SpawnAmmoCrate(grenadeX, weaponsY, amGrenade)
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   195
		SpawnAmmoCrate(deserteagleX, weaponsY, amDEagle)
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   196
		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
   197
		EndTurn(true)
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   198
		AddAnim(dialog01)
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   199
	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
   200
		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
   201
		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
   202
		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
   203
		AddAmmo(hero.gear, amDEagle, 4)
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   204
		SetWind(60)
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   205
		GameFlags = bor(GameFlags,gfDisableWind)
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   206
		weaponsAcquired = true
9733
37f84780eb14 fixed overlapping bubbles and wrong dialog triggering in moon01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   207
		afterDialog02 = true
12514
d89dabfd07ce Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents: 12513
diff changeset
   208
		EndTurn(true)
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   209
		AddAnim(dialog02)
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   210
	end
9616
df14425d9e4c fixed the bug that didn't saved checkpoint 1 reported by mikade
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9582
diff changeset
   211
	-- 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
   212
	AddEvent(onBattleZone, {hero.gear}, battleZone, {hero.gear}, 0)
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   213
9334
4bf3edc24444 custom stats in moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9330
diff changeset
   214
	SendHealthStatsOff()
9310
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
   215
end
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   216
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   217
function onAmmoStoreInit()
9330
b6483dc78feb I think hog weapons and health is ok like that
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9326
diff changeset
   218
	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
   219
	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
   220
	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
   221
	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
   222
	SetAmmo(amSkip, 9, 0, 0, 1)
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   223
end
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   224
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   225
function onGameTick()
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   226
	AnimUnWait()
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   227
	if ShowAnimation() == false then
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   228
		return
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   229
	end
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   230
	ExecuteAfterAnimations()
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   231
	CheckEvents()
9316
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   232
	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
   233
		EndTurn(true)
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   234
	end
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   235
end
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   236
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   237
function onNewTurn()
9318
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   238
	-- rounds start if hero got his weapons or got near the enemies
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   239
	if not weaponsAcquired and not battleZoneReached and CurrentHedgehog ~= hero.gear then
12514
d89dabfd07ce Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents: 12513
diff changeset
   240
		EndTurn(true)
9733
37f84780eb14 fixed overlapping bubbles and wrong dialog triggering in moon01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   241
	elseif weaponsAcquired and not battleZoneReached and CurrentHedgehog ~= hero.gear and afterDialog02 then
37f84780eb14 fixed overlapping bubbles and wrong dialog triggering in moon01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   242
		battleZone(hero.gear)
9318
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   243
	elseif not weaponsAcquired and not battleZoneReached and CurrentHedgehog == hero.gear then
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   244
		TurnTimeLeft = -1
9316
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   245
	elseif CurrentHedgehog == paoth1.gear or CurrentHedgehog == paoth2.gear
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   246
		or CurrentHedgehog == paoth3.gear or CurrentHedgehog == paoth4.gear then
12514
d89dabfd07ce Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents: 12513
diff changeset
   247
		EndTurn(true)
9316
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   248
	elseif CurrentHedgehog == professor.gear then
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   249
		AnimSwitchHog(hero.gear)
12514
d89dabfd07ce Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents: 12513
diff changeset
   250
		EndTurn(true)
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   251
	end
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   252
end
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   253
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   254
function onPrecise()
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   255
	if GameTime > 3000 then
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   256
		SetAnimSkip(true)
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   257
	end
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   258
end
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   259
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   260
function onGearDelete(gear)
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   261
	if gear == hero.gear then
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   262
		hero.dead = true
9320
1845b420cb5d game ends when professor dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9318
diff changeset
   263
	elseif gear == professor.gear then
9318
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   264
		professor.dead = true
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   265
	end
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   266
end
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   267
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   268
-------------- EVENTS ------------------
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   269
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   270
function onWeaponsPlatform(gear)
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   271
	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
   272
			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
   273
		return true
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
	return false
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   276
end
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   277
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   278
function onHeroDeath(gear)
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   279
	if hero.dead then
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   280
		return true
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   281
	end
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   282
	return false
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
9316
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   285
function onBattleZone(gear)
9330
b6483dc78feb I think hog weapons and health is ok like that
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9326
diff changeset
   286
	if not battleZoneReached and not hero.dead and GetX(gear) > 1900 and StoppedGear(gear) then
9318
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   287
		return true
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   288
	end
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   289
	return false
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   290
end
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   291
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   292
function onProfessorHit(gear)
9320
1845b420cb5d game ends when professor dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9318
diff changeset
   293
	if GetHealth(gear) then
1845b420cb5d game ends when professor dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9318
diff changeset
   294
		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
   295
			professor.health = GetHealth(gear)
1845b420cb5d game ends when professor dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9318
diff changeset
   296
			return true
1845b420cb5d game ends when professor dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9318
diff changeset
   297
		elseif GetHealth(gear) < professor.health then
1845b420cb5d game ends when professor dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9318
diff changeset
   298
			professor.health = GetHealth(gear)
1845b420cb5d game ends when professor dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9318
diff changeset
   299
		end
9318
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   300
	end
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   301
	return false
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   302
end
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   303
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   304
function onProfessorDeath(gear)
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   305
	if professor.dead then
9316
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   306
		return true
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   307
	end
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   308
	return false
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   309
end
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   310
9322
18cbaf1436c7 event to endgame when minions killed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9320
diff changeset
   311
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
   312
	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
   313
		return true
18cbaf1436c7 event to endgame when minions killed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9320
diff changeset
   314
	end
18cbaf1436c7 event to endgame when minions killed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9320
diff changeset
   315
	return false
18cbaf1436c7 event to endgame when minions killed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9320
diff changeset
   316
end
18cbaf1436c7 event to endgame when minions killed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9320
diff changeset
   317
9639
6b2ae2eaf1b2 remove unnecessary comments
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9616
diff changeset
   318
-------------- ACTIONS ------------------
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   319
9582
bf314b2258b3 less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9578
diff changeset
   320
function weaponsPlatform(gear)
bf314b2258b3 less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9578
diff changeset
   321
	saveCheckpoint("2")
9326
689f591aa226 added saved hero health between missions
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9324
diff changeset
   322
	SaveCampaignVar("HeroHealth",GetHealth(hero.gear))
12514
d89dabfd07ce Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents: 12513
diff changeset
   323
	EndTurn(true)
9733
37f84780eb14 fixed overlapping bubbles and wrong dialog triggering in moon01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   324
	weaponsAcquired = true
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   325
	SetWind(60)
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   326
	GameFlags = bor(GameFlags,gfDisableWind)
9616
df14425d9e4c fixed the bug that didn't saved checkpoint 1 reported by mikade
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9582
diff changeset
   327
	AddAmmo(hero.gear, amRope, 0)
df14425d9e4c fixed the bug that didn't saved checkpoint 1 reported by mikade
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9582
diff changeset
   328
	if GetX(hero.gear) < 1900 then
df14425d9e4c fixed the bug that didn't saved checkpoint 1 reported by mikade
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9582
diff changeset
   329
		AddAnim(dialog02)
df14425d9e4c fixed the bug that didn't saved checkpoint 1 reported by mikade
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9582
diff changeset
   330
	end
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   331
end
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   332
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   333
function heroDeath(gear)
9642
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9640
diff changeset
   334
	SendStat(siGameResult, loc("Hog Solo lost, try again!"))
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   335
	SendStat(siCustomAchievement, loc("You have to get the weapons and rescue the PAotH researchers."))
9642
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9640
diff changeset
   336
	SendStat(siPlayerKills,'1',teamC.name)
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9640
diff changeset
   337
	SendStat(siPlayerKills,'0',teamD.name)
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   338
	EndGame()
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   339
end
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   340
9316
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   341
function battleZone(gear)
12514
d89dabfd07ce Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents: 12513
diff changeset
   342
	EndTurn(true)
9318
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   343
	battleZoneReached = true
9733
37f84780eb14 fixed overlapping bubbles and wrong dialog triggering in moon01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   344
	if weaponsAcquired then
9318
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   345
		AddAnim(dialog04)
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   346
	else
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   347
		AddAnim(dialog03)
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   348
	end
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   349
end
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   350
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   351
function professorHit(gear)
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   352
	if currentHedgehog ~= hero.gear then
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   353
		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
   354
	end
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   355
end
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   356
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   357
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
   358
	if gameOver then return end
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
   359
	if GetHealth(minion1.gear) then
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
   360
		AnimSay(minion1.gear, loc("The boss has fallen! Retreat!"), SAY_SHOUT, 6000)
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
   361
	elseif GetHealth(minion2.gear) then
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
   362
		AnimSay(minion2.gear, loc("The boss has fallen! Retreat!"), SAY_SHOUT, 6000)
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
   363
	elseif GetHealth(minion3.gear) then
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
   364
		AnimSay(minion3.gear, loc("The boss has fallen! Retreat!"), SAY_SHOUT, 6000)
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
   365
	end
10290
42efccba0711 lua api: DismissTeam(teamname)
sheepluva
parents: 9831
diff changeset
   366
	DismissTeam(teamB.name)
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
   367
	AnimCaption(hero.gear, loc("Congrats! You made them run away!"), 6000)
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   368
	AnimWait(hero.gear,5000)
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   369
9578
16139270448f save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   370
	saveCompletedStatus(1)
9765
6cad4393a315 string/typo fixes
sheepluva
parents: 9757
diff changeset
   371
	SendStat(siGameResult, loc("Hog Solo wins, congratulations!"))
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   372
	SendStat(siCustomAchievement, loc("You have eliminated Professor Hogevil."))
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   373
	SendStat(siCustomAchievement, loc("You drove the minions away."))
9642
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9640
diff changeset
   374
	SendStat(siPlayerKills,'1',teamD.name)
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9640
diff changeset
   375
	SendStat(siPlayerKills,'0',teamC.name)
9342
51b5fffe3892 changes about displaying the ice planet mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9336
diff changeset
   376
	SaveCampaignVar("CosmosCheckPoint", "5") -- hero got fuels
12531
e12e2dfda06f ASA: Reset checkpoint after completing checkpointed mission
Wuzzy <almikes@aol.com>
parents: 12515
diff changeset
   377
	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
   378
	gameOver = true
9318
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   379
	EndGame()
9316
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   380
end
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   381
9322
18cbaf1436c7 event to endgame when minions killed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9320
diff changeset
   382
function minionsDeath(gear)
11975
c52d35c859e8 Fix double achievements and ranks in The First Stop mission (fixes #106)
Wuzzy <almikes@aol.com>
parents: 11692
diff changeset
   383
	if gameOver then return end
9322
18cbaf1436c7 event to endgame when minions killed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9320
diff changeset
   384
	-- do staffs here
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   385
	AnimSay(professor.gear, loc("I may lost this battle, but I haven't lost the war yet!"), SAY_SHOUT, 6000)
10290
42efccba0711 lua api: DismissTeam(teamname)
sheepluva
parents: 9831
diff changeset
   386
	DismissTeam(teamC.name)
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
   387
	AnimCaption(hero.gear, loc("Congrats! You won!"), 6000)
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   388
	AnimWait(hero.gear,5000)
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   389
9578
16139270448f save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   390
	saveCompletedStatus(1)
9642
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9640
diff changeset
   391
	SendStat(siGameResult, loc("Congratulations, you won!"))
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   392
	SendStat(siCustomAchievement, loc("You have eliminated the evil minions."))
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   393
	SendStat(siCustomAchievement, loc("You drove Professor Hogevil away."))
9642
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9640
diff changeset
   394
	SendStat(siPlayerKills,'1',teamD.name)
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9640
diff changeset
   395
	SendStat(siPlayerKills,'0',teamC.name)
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
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
9322
18cbaf1436c7 event to endgame when minions killed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9320
diff changeset
   399
	EndGame()
18cbaf1436c7 event to endgame when minions killed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9320
diff changeset
   400
end
18cbaf1436c7 event to endgame when minions killed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9320
diff changeset
   401
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   402
-------------- ANIMATIONS ------------------
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   403
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   404
function Skipanim(anim)
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   405
	if goals[anim] ~= nil then
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   406
		ShowMission(unpack(goals[anim]))
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   407
    end
9733
37f84780eb14 fixed overlapping bubbles and wrong dialog triggering in moon01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   408
    if anim == dialog02 then
37f84780eb14 fixed overlapping bubbles and wrong dialog triggering in moon01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   409
		setAfterDialog02()
37f84780eb14 fixed overlapping bubbles and wrong dialog triggering in moon01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   410
    elseif anim == dialog03 then
9316
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   411
		startCombat()
9318
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   412
	else
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   413
		AnimSwitchHog(hero.gear)
9316
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   414
	end
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   415
end
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   416
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   417
function AnimationSetup()
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   418
	-- DIALOG 01 - Start, welcome to moon
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   419
	AddSkipFunction(dialog01, Skipanim, {dialog01})
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   420
	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
   421
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Near a PAotH base on the moon ..."),  4000}})
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   422
	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("Hey, Hog Solo! Finally you have come!"), SAY_SAY, 2000}})
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9733
diff changeset
   423
	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
   424
	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
   425
	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
   426
	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
   427
	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
   428
	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
   429
	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
   430
	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
   431
	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Ehm, okay ..."), SAY_SAY, 2500}})
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   432
	table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}})
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   433
	-- DIALOG 02 - To the weapons platform
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   434
	AddSkipFunction(dialog02, Skipanim, {dialog02})
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   435
	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
   436
	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
   437
	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
   438
	table.insert(dialog02, {func = setAfterDialog02, args = {}})
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   439
	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
   440
	-- 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
   441
	AddSkipFunction(dialog03, Skipanim, {dialog03})
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   442
	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
   443
	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
   444
	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
   445
	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}})
213b4267db81 more moon code, most things work ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9314
diff changeset
   446
	table.insert(dialog03, {func = startCombat, args = {hero.gear}})
9318
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   447
	-- DIALOG 04 - Hero spotted and *HAS* weapons
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   448
	AddSkipFunction(dialog04, Skipanim, {dialog04})
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   449
	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
   450
	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
   451
	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
   452
	table.insert(dialog04, {func = AnimSay, args = {hero.gear, loc("Here we go!"), SAY_THINK, 4000}})
413dd0eab399 moar event handlers and fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9316
diff changeset
   453
	table.insert(dialog04, {func = startCombat, args = {hero.gear}})
9312
f6bec1cfbfbd progress on the main moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9310
diff changeset
   454
end
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   455
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   456
------------------- custom "animation" functions --------------------------
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   457
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   458
function startCombat()
9733
37f84780eb14 fixed overlapping bubbles and wrong dialog triggering in moon01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   459
	-- 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
   460
	AnimSwitchHog(minion3.gear)
12514
d89dabfd07ce Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents: 12513
diff changeset
   461
	EndTurn(true)
9314
b7ee054888f8 more progress on the moon main mission
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9312
diff changeset
   462
end
9733
37f84780eb14 fixed overlapping bubbles and wrong dialog triggering in moon01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   463
37f84780eb14 fixed overlapping bubbles and wrong dialog triggering in moon01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   464
function setAfterDialog02()
37f84780eb14 fixed overlapping bubbles and wrong dialog triggering in moon01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   465
	afterDialog02 = true
37f84780eb14 fixed overlapping bubbles and wrong dialog triggering in moon01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   466
end