share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/death01.lua
author sheepluva
Sun, 08 Dec 2019 02:09:19 +0100
branchhedgeroid
changeset 15520 de08a3ae4f8d
parent 15086 3a561db2a71c
permissions -rw-r--r--
hedgeroid/frontlib: update proto and weapons number
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     1
------------------- ABOUT ----------------------
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     2
--
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     3
-- This is the mission to acquire the last part.
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     4
-- This mission is the cameo of Professor Hogevil
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     5
-- who has took hostages H and Dr. Cornelius.
14493
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14447
diff changeset
     6
-- The hero has to defeat him and his thugs.
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     7
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     8
HedgewarsScriptLoad("/Scripts/Locale.lua")
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     9
HedgewarsScriptLoad("/Scripts/Animate.lua")
9578
16139270448f save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
    10
HedgewarsScriptLoad("/Missions/Campaign/A_Space_Adventure/global_functions.lua")
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    11
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    12
----------------- VARIABLES --------------------
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    13
-- globals
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9568
diff changeset
    14
local missionName = loc("The last encounter")
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    15
-- dialogs
9566
5c50949cfd07 dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9564
diff changeset
    16
local dialog01 = {}
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    17
-- missions objectives
9566
5c50949cfd07 dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9564
diff changeset
    18
local goals = {
12231
3ec0261e01f0 Display mines timer in all missions with non-default timer
Wuzzy <almikes@aol.com>
parents: 12229
diff changeset
    19
	[dialog01] = {missionName, loc("The final part"), loc("Defeat Professor Hogevil!") .. "|" .. loc("Mines time: 1.5 seconds"), 1, 4500},
9566
5c50949cfd07 dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9564
diff changeset
    20
}
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    21
-- crates
9627
fd8d766a4476 making death01 easier and less luck dependent
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9626
diff changeset
    22
local teleportCrate = {x = 1935, y = 1830}
fd8d766a4476 making death01 easier and less luck dependent
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9626
diff changeset
    23
local drillCrate = {x = 3810, y = 1705}
9625
18f04441636b making death01 easier and less luck dependent to win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9582
diff changeset
    24
local batCrate = {x = 1975, y = 1830}
18f04441636b making death01 easier and less luck dependent to win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9582
diff changeset
    25
local blowtorchCrate = {x = 1520, y = 1950}
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    26
local cakeCrate = {x = 325, y = 1500}
9568
58cdc9332a54 description and image
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9566
diff changeset
    27
local ropeCrate = {x = 1860, y = 500}
9625
18f04441636b making death01 easier and less luck dependent to win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9582
diff changeset
    28
local pickHammerCrate = {x = 1900, y = 400}
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    29
-- hogs
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    30
local hero = {}
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    31
local paoth1 = {}
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    32
local paoth2 = {}
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    33
local professor = {}
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    34
local thug1 = {}
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    35
local thug2 = {}
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    36
local thug3 = {}
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    37
local thug4 = {}
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    38
local thug5 = {}
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    39
local thug6 = {}
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    40
local thug7 = {}
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    41
local thugs = { thug1, thug2, thug3, thug4, thug5, thug6, thug7 }
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    42
-- teams
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    43
local teamA = {}
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    44
local teamB = {}
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    45
local teamC = {}
14494
e5f1431aea1e ASA death01: Use unique team names for professor teams
Wuzzy <Wuzzy2@mail.ru>
parents: 14493
diff changeset
    46
local teamD = {}
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    47
-- hedgehogs values
11697
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9758
diff changeset
    48
hero.name = loc("Hog Solo")
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    49
hero.x = 520
14628
ea9f0a99b55b ASA death01: Optimize hog spawn positions, animate professor teleportation
Wuzzy <Wuzzy2@mail.ru>
parents: 14617
diff changeset
    50
hero.y = 871
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    51
hero.dead = false
11697
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9758
diff changeset
    52
paoth1.name = loc("H")
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    53
paoth1.x = 3730
14628
ea9f0a99b55b ASA death01: Optimize hog spawn positions, animate professor teleportation
Wuzzy <Wuzzy2@mail.ru>
parents: 14617
diff changeset
    54
paoth1.y = 1538
11697
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9758
diff changeset
    55
paoth2.name = loc("Dr. Cornelius")
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    56
paoth2.x = 3800
14628
ea9f0a99b55b ASA death01: Optimize hog spawn positions, animate professor teleportation
Wuzzy <Wuzzy2@mail.ru>
parents: 14617
diff changeset
    57
paoth2.y = 1538
11697
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9758
diff changeset
    58
professor.name = loc("Prof. Hogevil")
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    59
professor.dead = false
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    60
thug1.x = 1265
14628
ea9f0a99b55b ASA death01: Optimize hog spawn positions, animate professor teleportation
Wuzzy <Wuzzy2@mail.ru>
parents: 14617
diff changeset
    61
thug1.y = 1465
9627
fd8d766a4476 making death01 easier and less luck dependent
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9626
diff changeset
    62
thug1.health = 70
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    63
thug2.x = 2035
14628
ea9f0a99b55b ASA death01: Optimize hog spawn positions, animate professor teleportation
Wuzzy <Wuzzy2@mail.ru>
parents: 14617
diff changeset
    64
thug2.y = 1380
9627
fd8d766a4476 making death01 easier and less luck dependent
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9626
diff changeset
    65
thug2.health = 95
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    66
thug3.x = 1980
14628
ea9f0a99b55b ASA death01: Optimize hog spawn positions, animate professor teleportation
Wuzzy <Wuzzy2@mail.ru>
parents: 14617
diff changeset
    67
thug3.y = 863
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    68
thug3.health = 35
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    69
thug3.turnLeft = true
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    70
thug4.x = 2830
14628
ea9f0a99b55b ASA death01: Optimize hog spawn positions, animate professor teleportation
Wuzzy <Wuzzy2@mail.ru>
parents: 14617
diff changeset
    71
thug4.y = 2007
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    72
thug4.health = 80
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    73
thug5.x = 2890
14628
ea9f0a99b55b ASA death01: Optimize hog spawn positions, animate professor teleportation
Wuzzy <Wuzzy2@mail.ru>
parents: 14617
diff changeset
    74
thug5.y = 2007
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    75
thug5.health = 80
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    76
thug6.x = 2940
14628
ea9f0a99b55b ASA death01: Optimize hog spawn positions, animate professor teleportation
Wuzzy <Wuzzy2@mail.ru>
parents: 14617
diff changeset
    77
thug6.y = 2007
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    78
thug6.health = 80
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    79
thug7.x = 2990
14628
ea9f0a99b55b ASA death01: Optimize hog spawn positions, animate professor teleportation
Wuzzy <Wuzzy2@mail.ru>
parents: 14617
diff changeset
    80
thug7.y = 2007
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    81
thug7.health = 80
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    82
teamA.name = loc("Hog Solo")
13588
141cdfe0f3ca Switch almost all Lua calls of AddTeam to using default clan colors instead of hardcoded color
Wuzzy <Wuzzy2@mail.ru>
parents: 13479
diff changeset
    83
teamA.color = -6
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    84
teamB.name = loc("PAotH")
13476
b688e2ca9a8d ASA death01: Put PAotH into correct clan
Wuzzy <Wuzzy2@mail.ru>
parents: 12938
diff changeset
    85
teamB.color = teamA.color
14494
e5f1431aea1e ASA death01: Use unique team names for professor teams
Wuzzy <Wuzzy2@mail.ru>
parents: 14493
diff changeset
    86
teamC.name = loc("Professor's Team")
13588
141cdfe0f3ca Switch almost all Lua calls of AddTeam to using default clan colors instead of hardcoded color
Wuzzy <Wuzzy2@mail.ru>
parents: 13479
diff changeset
    87
teamC.color = -2
14494
e5f1431aea1e ASA death01: Use unique team names for professor teams
Wuzzy <Wuzzy2@mail.ru>
parents: 14493
diff changeset
    88
teamD.name = loc("Professor")
e5f1431aea1e ASA death01: Use unique team names for professor teams
Wuzzy <Wuzzy2@mail.ru>
parents: 14493
diff changeset
    89
teamD.color = -2
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    90
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    91
-------------- LuaAPI EVENT HANDLERS ------------------
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    92
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    93
function onGameInit()
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    94
	Seed = 1
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    95
	TurnTime = 25000
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    96
	CaseFreq = 0
14629
2759c5e28c7d ASA death01: Tweak mines and barrels a bit
Wuzzy <Wuzzy2@mail.ru>
parents: 14628
diff changeset
    97
	MinesNum = 0
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    98
	MinesTime = 1500
14629
2759c5e28c7d ASA death01: Tweak mines and barrels a bit
Wuzzy <Wuzzy2@mail.ru>
parents: 14628
diff changeset
    99
	Explosives = 0
9564
114c79f10dcc second human hog for dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9562
diff changeset
   100
	HealthCaseAmount = 50
13479
7a63e0a2d2ca Simplify turn handling in ASA death01
Wuzzy <Wuzzy2@mail.ru>
parents: 13476
diff changeset
   101
	-- gfTagTeam makes it easier to skip the PAotH team
7a63e0a2d2ca Simplify turn handling in ASA death01
Wuzzy <Wuzzy2@mail.ru>
parents: 13476
diff changeset
   102
	GameFlags = gfTagTeam
12229
d62d6f8ebef1 Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents: 12093
diff changeset
   103
	-- Disable Sudden Death
d62d6f8ebef1 Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents: 12093
diff changeset
   104
	HealthDecrease = 0
d62d6f8ebef1 Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents: 12093
diff changeset
   105
	WaterRise = 0
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   106
	Map = "death01_map"
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   107
	Theme = "Hell"
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9754
diff changeset
   108
14493
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14447
diff changeset
   109
	-- Hero
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14447
diff changeset
   110
	teamA.name = AddMissionTeam(teamA.color)
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14447
diff changeset
   111
	hero.gear = AddMissionHog(100)
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14447
diff changeset
   112
	hero.name = GetHogName(hero.gear)
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   113
	AnimSetGearPosition(hero.gear, hero.x, hero.y)
13476
b688e2ca9a8d ASA death01: Put PAotH into correct clan
Wuzzy <Wuzzy2@mail.ru>
parents: 12938
diff changeset
   114
14494
e5f1431aea1e ASA death01: Use unique team names for professor teams
Wuzzy <Wuzzy2@mail.ru>
parents: 14493
diff changeset
   115
	-- PAotH (passive team)
14937
ff4003a90ff8 Enable automatic voicepack language selection for all missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14903
diff changeset
   116
	teamB.name = AddTeam(teamB.name, teamB.color, "Earth", "Island", "Default_qau", "cm_galaxy")
14617
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14613
diff changeset
   117
	SetTeamPassive(teamB.name, true)
13479
7a63e0a2d2ca Simplify turn handling in ASA death01
Wuzzy <Wuzzy2@mail.ru>
parents: 13476
diff changeset
   118
	paoth1.gear = AddHog(paoth1.name, 0, 100, "hair_yellow")
7a63e0a2d2ca Simplify turn handling in ASA death01
Wuzzy <Wuzzy2@mail.ru>
parents: 13476
diff changeset
   119
	AnimSetGearPosition(paoth1.gear, paoth1.x, paoth1.y)
7a63e0a2d2ca Simplify turn handling in ASA death01
Wuzzy <Wuzzy2@mail.ru>
parents: 13476
diff changeset
   120
	HogTurnLeft(paoth1.gear, true)
7a63e0a2d2ca Simplify turn handling in ASA death01
Wuzzy <Wuzzy2@mail.ru>
parents: 13476
diff changeset
   121
	SetGearAIHints(paoth1.gear, aihDoesntMatter)
7a63e0a2d2ca Simplify turn handling in ASA death01
Wuzzy <Wuzzy2@mail.ru>
parents: 13476
diff changeset
   122
	paoth2.gear = AddHog(paoth2.name, 0, 100, "Glasses")
7a63e0a2d2ca Simplify turn handling in ASA death01
Wuzzy <Wuzzy2@mail.ru>
parents: 13476
diff changeset
   123
	AnimSetGearPosition(paoth2.gear, paoth2.x, paoth2.y)
7a63e0a2d2ca Simplify turn handling in ASA death01
Wuzzy <Wuzzy2@mail.ru>
parents: 13476
diff changeset
   124
	HogTurnLeft(paoth2.gear, true)
7a63e0a2d2ca Simplify turn handling in ASA death01
Wuzzy <Wuzzy2@mail.ru>
parents: 13476
diff changeset
   125
	SetGearAIHints(paoth2.gear, aihDoesntMatter)
7a63e0a2d2ca Simplify turn handling in ASA death01
Wuzzy <Wuzzy2@mail.ru>
parents: 13476
diff changeset
   126
14494
e5f1431aea1e ASA death01: Use unique team names for professor teams
Wuzzy <Wuzzy2@mail.ru>
parents: 14493
diff changeset
   127
	-- Professor's Team (computer enemy)
14937
ff4003a90ff8 Enable automatic voicepack language selection for all missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14903
diff changeset
   128
	teamC.name = AddTeam(teamC.name, teamC.color, "eyecross", "Island", "Default_qau", "cm_sine")
9568
58cdc9332a54 description and image
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9566
diff changeset
   129
	professor.bot = AddHog(professor.name, 1, 300, "tophats")
9564
114c79f10dcc second human hog for dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9562
diff changeset
   130
	AnimSetGearPosition(professor.bot, paoth1.x - 100, paoth1.y)
114c79f10dcc second human hog for dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9562
diff changeset
   131
	HogTurnLeft(professor.bot, true)
114c79f10dcc second human hog for dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9562
diff changeset
   132
	professor.gear = professor.bot
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   133
	for i=1,table.getn(thugs) do
11697
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9758
diff changeset
   134
		thugs[i].gear = AddHog(string.format(loc("Thug #%d"), i), 1, thugs[i].health, "war_desertgrenadier1")
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   135
		AnimSetGearPosition(thugs[i].gear, thugs[i].x, thugs[i].y)
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   136
		HogTurnLeft(thugs[i].gear, not thugs[i].turnLeft)
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   137
	end
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9754
diff changeset
   138
14494
e5f1431aea1e ASA death01: Use unique team names for professor teams
Wuzzy <Wuzzy2@mail.ru>
parents: 14493
diff changeset
   139
	-- Professor (special team for cut sequence only)
14937
ff4003a90ff8 Enable automatic voicepack language selection for all missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14903
diff changeset
   140
	teamD.name = AddTeam(teamD.name, teamD.color, "star", "Island", "Default_qau", "cm_sine")
13476
b688e2ca9a8d ASA death01: Put PAotH into correct clan
Wuzzy <Wuzzy2@mail.ru>
parents: 12938
diff changeset
   141
	professor.human = AddHog(professor.name, 0, 300, "tophats")
14494
e5f1431aea1e ASA death01: Use unique team names for professor teams
Wuzzy <Wuzzy2@mail.ru>
parents: 14493
diff changeset
   142
	-- hog will be removed and replaced by professor.bot after cut sequence
13476
b688e2ca9a8d ASA death01: Put PAotH into correct clan
Wuzzy <Wuzzy2@mail.ru>
parents: 12938
diff changeset
   143
	AnimSetGearPosition(professor.human, hero.x + 70, hero.y)
b688e2ca9a8d ASA death01: Put PAotH into correct clan
Wuzzy <Wuzzy2@mail.ru>
parents: 12938
diff changeset
   144
	HogTurnLeft(professor.human, true)
b688e2ca9a8d ASA death01: Put PAotH into correct clan
Wuzzy <Wuzzy2@mail.ru>
parents: 12938
diff changeset
   145
9582
bf314b2258b3 less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9578
diff changeset
   146
	initCheckpoint("death01")
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9754
diff changeset
   147
12093
1da37e2ba6fd Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
   148
	AnimInit(true)
9566
5c50949cfd07 dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9564
diff changeset
   149
	AnimationSetup()
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   150
end
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   151
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   152
function onGameStart()
14447
448213112508 Fix incorrect message in ASA death01
Wuzzy <Wuzzy2@mail.ru>
parents: 14406
diff changeset
   153
	ShowMission(unpack(goals[dialog01]))
448213112508 Fix incorrect message in ASA death01
Wuzzy <Wuzzy2@mail.ru>
parents: 14406
diff changeset
   154
	HideMission()
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   155
	AnimWait(hero.gear, 3000)
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   156
	FollowGear(hero.gear)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9754
diff changeset
   157
9562
241ffe433c3d win event
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9560
diff changeset
   158
	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
241ffe433c3d win event
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9560
diff changeset
   159
	AddEvent(onEnemiesDeath, {hero.gear}, enemiesDeath, {hero.gear}, 0)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9754
diff changeset
   160
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   161
	-- add crates
12938
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12592
diff changeset
   162
	SpawnSupplyCrate(teleportCrate.x, teleportCrate.y, amTeleport)
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12592
diff changeset
   163
	SpawnSupplyCrate(drillCrate.x, drillCrate.y, amTeleport)
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12592
diff changeset
   164
	SpawnSupplyCrate(drillCrate.x, drillCrate.y, amDrill)
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12592
diff changeset
   165
	SpawnSupplyCrate(batCrate.x, batCrate.y, amBaseballBat)
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12592
diff changeset
   166
	SpawnSupplyCrate(blowtorchCrate.x, blowtorchCrate.y, amBlowTorch)
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12592
diff changeset
   167
	SpawnSupplyCrate(cakeCrate.x, cakeCrate.y, amCake)
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12592
diff changeset
   168
	SpawnSupplyCrate(ropeCrate.x, ropeCrate.y, amRope)
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12592
diff changeset
   169
	SpawnSupplyCrate(pickHammerCrate.x, pickHammerCrate.y, amPickHammer)
9564
114c79f10dcc second human hog for dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9562
diff changeset
   170
	SpawnHealthCrate(cakeCrate.x + 40, cakeCrate.y)
9625
18f04441636b making death01 easier and less luck dependent to win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9582
diff changeset
   171
	SpawnHealthCrate(blowtorchCrate.x + 40, blowtorchCrate.y)
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   172
	-- add explosives
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   173
	AddGear(1900, 850, gtExplosives, 0, 0, 0, 0)
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   174
	AddGear(1900, 800, gtExplosives, 0, 0, 0, 0)
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   175
	AddGear(1900, 750, gtExplosives, 0, 0, 0, 0)
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   176
	AddGear(1900, 710, gtExplosives, 0, 0, 0, 0)
14629
2759c5e28c7d ASA death01: Tweak mines and barrels a bit
Wuzzy <Wuzzy2@mail.ru>
parents: 14628
diff changeset
   177
2759c5e28c7d ASA death01: Tweak mines and barrels a bit
Wuzzy <Wuzzy2@mail.ru>
parents: 14628
diff changeset
   178
	AddGear(698, 1544, gtExplosives, 0, 0, 0, 0)
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   179
	-- add mines
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   180
	AddGear(3520, 1650, gtMine, 0, 0, 0, 0)
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   181
	AddGear(3480, 1680, gtMine, 0, 0, 0, 0)
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   182
	AddGear(3440, 1690, gtMine, 0, 0, 0, 0)
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   183
	AddGear(3400, 1710, gtMine, 0, 0, 0, 0)
9627
fd8d766a4476 making death01 easier and less luck dependent
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9626
diff changeset
   184
	AddGear(2100, 1730, gtMine, 0, 0, 0, 0)
fd8d766a4476 making death01 easier and less luck dependent
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9626
diff changeset
   185
	AddGear(2150, 1730, gtMine, 0, 0, 0, 0)
fd8d766a4476 making death01 easier and less luck dependent
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9626
diff changeset
   186
	AddGear(2200, 1750, gtMine, 0, 0, 0, 0)
14629
2759c5e28c7d ASA death01: Tweak mines and barrels a bit
Wuzzy <Wuzzy2@mail.ru>
parents: 14628
diff changeset
   187
2759c5e28c7d ASA death01: Tweak mines and barrels a bit
Wuzzy <Wuzzy2@mail.ru>
parents: 14628
diff changeset
   188
	AddGear(1891, 1468, gtMine, 0, 0, 0, 0)
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   189
	-- add girders
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   190
	PlaceGirder(3770, 1370, 4)
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   191
	PlaceGirder(3700, 1460, 6)
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   192
	PlaceGirder(3840, 1460, 6)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9754
diff changeset
   193
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   194
	-- add ammo
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   195
	-- hero ammo
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   196
	AddAmmo(hero.gear, amRope, 2)
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   197
	AddAmmo(hero.gear, amBazooka, 3)
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   198
	AddAmmo(hero.gear, amParachute, 1)
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   199
	AddAmmo(hero.gear, amGrenade, 6)
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   200
	AddAmmo(hero.gear, amDEagle, 4)
9626
5fee7cdb4bcb add skip to hero
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9625
diff changeset
   201
	AddAmmo(hero.gear, amSkip, 100)
9630
df942cfac4e6 add bonuses
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9627
diff changeset
   202
	local bonus = tonumber(getBonus(3))
df942cfac4e6 add bonuses
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9627
diff changeset
   203
	if bonus > 0 then
df942cfac4e6 add bonuses
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9627
diff changeset
   204
		SetHealth(hero.gear, 120)
df942cfac4e6 add bonuses
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9627
diff changeset
   205
		AddAmmo(hero.gear, amLaserSight, 1)
df942cfac4e6 add bonuses
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9627
diff changeset
   206
		saveBonus(3, bonus-1)
df942cfac4e6 add bonuses
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9627
diff changeset
   207
	end
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   208
	-- evil ammo
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   209
	AddAmmo(professor.gear, amRope, 4)
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   210
	AddAmmo(professor.gear, amBazooka, 8)
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   211
	AddAmmo(professor.gear, amSwitch, 100)
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   212
	AddAmmo(professor.gear, amGrenade, 8)
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   213
	AddAmmo(professor.gear, amDEagle, 8)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9754
diff changeset
   214
9564
114c79f10dcc second human hog for dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9562
diff changeset
   215
	HideHog(professor.bot)
9566
5c50949cfd07 dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9564
diff changeset
   216
	AddAnim(dialog01)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9754
diff changeset
   217
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   218
	SendHealthStatsOff()
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   219
end
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   220
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   221
function onGameTick()
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   222
	AnimUnWait()
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   223
	if ShowAnimation() == false then
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   224
		return
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   225
	end
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   226
	ExecuteAfterAnimations()
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   227
	CheckEvents()
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   228
end
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   229
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   230
function onAmmoStoreInit()
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   231
	SetAmmo(amCake, 0, 0, 0, 1)
9627
fd8d766a4476 making death01 easier and less luck dependent
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9626
diff changeset
   232
	SetAmmo(amTeleport, 0, 0, 0, 1)
fd8d766a4476 making death01 easier and less luck dependent
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9626
diff changeset
   233
	SetAmmo(amBaseballBat, 0, 0, 0, 4)
fd8d766a4476 making death01 easier and less luck dependent
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9626
diff changeset
   234
	SetAmmo(amBlowTorch, 0, 0, 0, 1)
9568
58cdc9332a54 description and image
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9566
diff changeset
   235
	SetAmmo(amRope, 0, 0, 0, 2)
58cdc9332a54 description and image
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9566
diff changeset
   236
	SetAmmo(amPickHammer, 0, 0, 0, 1)
9627
fd8d766a4476 making death01 easier and less luck dependent
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9626
diff changeset
   237
	SetAmmo(amDrill, 0, 0, 0, 1)
9558
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   238
end
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   239
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   240
function onGearDelete(gear)
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   241
	if gear == hero.gear then
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   242
		hero.dead = true
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   243
	elseif gear == professor.gear then
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   244
		professor.dead = true
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   245
	end
455f1260ef43 forgotten file and death planet map and some logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   246
end
9560
5872edd6864e event in case hero dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9558
diff changeset
   247
15007
3ed1cbd31754 Backed out changeset 4596357d002d (onPreciseLocal causes desyncs)
Wuzzy <Wuzzy2@mail.ru>
parents: 14937
diff changeset
   248
function onPrecise()
9560
5872edd6864e event in case hero dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9558
diff changeset
   249
	if GameTime > 3000 then
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9754
diff changeset
   250
		SetAnimSkip(true)
9560
5872edd6864e event in case hero dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9558
diff changeset
   251
	end
5872edd6864e event in case hero dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9558
diff changeset
   252
end
5872edd6864e event in case hero dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9558
diff changeset
   253
5872edd6864e event in case hero dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9558
diff changeset
   254
-------------- EVENTS ------------------
5872edd6864e event in case hero dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9558
diff changeset
   255
5872edd6864e event in case hero dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9558
diff changeset
   256
function onHeroDeath(gear)
5872edd6864e event in case hero dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9558
diff changeset
   257
	if hero.dead then
5872edd6864e event in case hero dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9558
diff changeset
   258
		return true
5872edd6864e event in case hero dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9558
diff changeset
   259
	end
5872edd6864e event in case hero dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9558
diff changeset
   260
	return false
5872edd6864e event in case hero dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9558
diff changeset
   261
end
5872edd6864e event in case hero dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9558
diff changeset
   262
9562
241ffe433c3d win event
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9560
diff changeset
   263
function onEnemiesDeath(gear)
15086
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15007
diff changeset
   264
	if (not IsHogAlive(gear)) or (not StoppedGear(gear)) then
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15007
diff changeset
   265
		return false
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15007
diff changeset
   266
	end
9562
241ffe433c3d win event
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9560
diff changeset
   267
	local allDead = true
9754
12702ab1ba5f fix buggy win conditions and stats in death01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   268
	if GetHealth(hero.gear) and professor.dead then
9562
241ffe433c3d win event
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9560
diff changeset
   269
		for i=1,table.getn(thugs) do
241ffe433c3d win event
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9560
diff changeset
   270
			if GetHealth(thugs[i]) then
241ffe433c3d win event
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9560
diff changeset
   271
				allDead = false
241ffe433c3d win event
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9560
diff changeset
   272
				break
241ffe433c3d win event
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9560
diff changeset
   273
			end
241ffe433c3d win event
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9560
diff changeset
   274
		end
241ffe433c3d win event
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9560
diff changeset
   275
	else
241ffe433c3d win event
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9560
diff changeset
   276
		allDead = false
241ffe433c3d win event
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9560
diff changeset
   277
	end
241ffe433c3d win event
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9560
diff changeset
   278
	return allDead
241ffe433c3d win event
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9560
diff changeset
   279
end
241ffe433c3d win event
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9560
diff changeset
   280
9560
5872edd6864e event in case hero dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9558
diff changeset
   281
-------------- ACTIONS ------------------
5872edd6864e event in case hero dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9558
diff changeset
   282
5872edd6864e event in case hero dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9558
diff changeset
   283
function heroDeath(gear)
14493
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14447
diff changeset
   284
	SendStat(siGameResult, string.format(loc("%s lost, try again!"), hero.name))
14447
448213112508 Fix incorrect message in ASA death01
Wuzzy <Wuzzy2@mail.ru>
parents: 14406
diff changeset
   285
	SendStat(siCustomAchievement, loc("To win the game you have to eliminate Professor Hogevil."))
13476
b688e2ca9a8d ASA death01: Put PAotH into correct clan
Wuzzy <Wuzzy2@mail.ru>
parents: 12938
diff changeset
   286
	sendSimpleTeamRankings({teamC.name, teamA.name, teamB.name})
9560
5872edd6864e event in case hero dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9558
diff changeset
   287
	EndGame()
5872edd6864e event in case hero dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9558
diff changeset
   288
end
5872edd6864e event in case hero dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9558
diff changeset
   289
9562
241ffe433c3d win event
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9560
diff changeset
   290
function enemiesDeath(gear)
9578
16139270448f save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   291
	saveCompletedStatus(6)
9642
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9638
diff changeset
   292
	SendStat(siGameResult, loc("Congratulations, you won!"))
11697
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9758
diff changeset
   293
	SendStat(siCustomAchievement, loc("You have successfully eliminated Professor Hogevil."))
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9758
diff changeset
   294
	SendStat(siCustomAchievement, loc("You have rescued H and Dr. Cornelius."))
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9758
diff changeset
   295
	SendStat(siCustomAchievement, loc("You have acquired the last device part."))
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9758
diff changeset
   296
	SendStat(siCustomAchievement, loc("Now go and play the menu mission to complete the campaign."))
13476
b688e2ca9a8d ASA death01: Put PAotH into correct clan
Wuzzy <Wuzzy2@mail.ru>
parents: 12938
diff changeset
   297
	sendSimpleTeamRankings({teamA.name, teamB.name, teamC.name})
9562
241ffe433c3d win event
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9560
diff changeset
   298
	EndGame()
241ffe433c3d win event
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9560
diff changeset
   299
end
241ffe433c3d win event
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9560
diff changeset
   300
9560
5872edd6864e event in case hero dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9558
diff changeset
   301
-------------- ANIMATIONS ------------------
5872edd6864e event in case hero dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9558
diff changeset
   302
5872edd6864e event in case hero dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9558
diff changeset
   303
function Skipanim(anim)
12540
baee67bfa5c2 ASA, the final battle: Fix mission panel not appearing if you watched the dialog
Wuzzy <almikes@aol.com>
parents: 12539
diff changeset
   304
	startBattle()
9560
5872edd6864e event in case hero dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9558
diff changeset
   305
end
5872edd6864e event in case hero dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9558
diff changeset
   306
5872edd6864e event in case hero dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9558
diff changeset
   307
function AnimationSetup()
12539
34a91e2b927e ASA, death01: Slightly change professor's response if he got killed on the moon
Wuzzy <almikes@aol.com>
parents: 12520
diff changeset
   308
	local profDiedOnMoon = GetCampaignVar("ProfDiedOnMoon") == "1"
9566
5c50949cfd07 dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9564
diff changeset
   309
	-- DIALOG01, GAME START, INTRODUCTION
5c50949cfd07 dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9564
diff changeset
   310
	AddSkipFunction(dialog01, Skipanim, {dialog01})
5c50949cfd07 dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9564
diff changeset
   311
	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
11697
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9758
diff changeset
   312
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Somewhere on the uninhabitable Death Planet ..."), 5000}})
14493
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14447
diff changeset
   313
	table.insert(dialog01, {func = AnimSay, args = {professor.human, string.format(loc("Welcome, %s, surprised to see me?"), hero.name), SAY_SAY, 4000}})
12539
34a91e2b927e ASA, death01: Slightly change professor's response if he got killed on the moon
Wuzzy <almikes@aol.com>
parents: 12520
diff changeset
   314
	if profDiedOnMoon then
34a91e2b927e ASA, death01: Slightly change professor's response if he got killed on the moon
Wuzzy <almikes@aol.com>
parents: 12520
diff changeset
   315
		table.insert(dialog01, {func = AnimSay, args = {professor.human, loc("After you left the moon, my other loyal minions came and resurrected me so I could complete my master plan."), SAY_SAY, 6000}})
34a91e2b927e ASA, death01: Slightly change professor's response if he got killed on the moon
Wuzzy <almikes@aol.com>
parents: 12520
diff changeset
   316
	else
34a91e2b927e ASA, death01: Slightly change professor's response if he got killed on the moon
Wuzzy <almikes@aol.com>
parents: 12520
diff changeset
   317
		table.insert(dialog01, {func = AnimSay, args = {professor.human, loc("As you can see I have survived our last encounter and I had time to plot my master plan!"), SAY_SAY, 4000}})
34a91e2b927e ASA, death01: Slightly change professor's response if he got killed on the moon
Wuzzy <almikes@aol.com>
parents: 12520
diff changeset
   318
	end
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9754
diff changeset
   319
	table.insert(dialog01, {func = AnimSay, args = {professor.human, loc("I've thought that the best way to get the device is to let you collect most of the parts for me!"), SAY_SAY, 4000}})
11697
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9758
diff changeset
   320
	table.insert(dialog01, {func = AnimSay, args = {professor.human, loc("So, now I got the last part and I have your friends captured."), SAY_SAY, 4000}})
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9568
diff changeset
   321
	table.insert(dialog01, {func = AnimSay, args = {professor.human, loc("Will you give me the other parts?"), SAY_SAY, 4000}})
9566
5c50949cfd07 dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9564
diff changeset
   322
	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9754
diff changeset
   323
	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("I will never hand you the parts!"), SAY_SAY, 4000}})
9566
5c50949cfd07 dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9564
diff changeset
   324
	table.insert(dialog01, {func = AnimWait, args = {professor.human, 3000}})
12539
34a91e2b927e ASA, death01: Slightly change professor's response if he got killed on the moon
Wuzzy <almikes@aol.com>
parents: 12520
diff changeset
   325
	if profDiedOnMoon then
34a91e2b927e ASA, death01: Slightly change professor's response if he got killed on the moon
Wuzzy <almikes@aol.com>
parents: 12520
diff changeset
   326
		table.insert(dialog01, {func = AnimSay, args = {professor.human, loc("Then prepare for battle!"), SAY_SHOUT, 4000}})
34a91e2b927e ASA, death01: Slightly change professor's response if he got killed on the moon
Wuzzy <almikes@aol.com>
parents: 12520
diff changeset
   327
	else
34a91e2b927e ASA, death01: Slightly change professor's response if he got killed on the moon
Wuzzy <almikes@aol.com>
parents: 12520
diff changeset
   328
		table.insert(dialog01, {func = AnimSay, args = {professor.human, loc("Then prepare for battle!"), SAY_SAY, 4000}})
34a91e2b927e ASA, death01: Slightly change professor's response if he got killed on the moon
Wuzzy <almikes@aol.com>
parents: 12520
diff changeset
   329
	end
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9754
diff changeset
   330
	table.insert(dialog01, {func = startBattle, args = {}})
9560
5872edd6864e event in case hero dies
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9558
diff changeset
   331
end
9566
5c50949cfd07 dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9564
diff changeset
   332
5c50949cfd07 dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9564
diff changeset
   333
-------------- OTHER FUNCTIONS -----------------
5c50949cfd07 dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9564
diff changeset
   334
5c50949cfd07 dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9564
diff changeset
   335
function startBattle()
12540
baee67bfa5c2 ASA, the final battle: Fix mission panel not appearing if you watched the dialog
Wuzzy <almikes@aol.com>
parents: 12539
diff changeset
   336
	ShowMission(unpack(goals[dialog01]))
14628
ea9f0a99b55b ASA death01: Optimize hog spawn positions, animate professor teleportation
Wuzzy <Wuzzy2@mail.ru>
parents: 14617
diff changeset
   337
	AddVisualGear(GetX(professor.human), GetY(professor.human), vgtExplosion, 0, false)
14613
bca306a47060 ASA death01: Hide, don't delete "human" professor, to avoid traitor taunt
Wuzzy <Wuzzy2@mail.ru>
parents: 14612
diff changeset
   338
	HideHog(professor.human)
9566
5c50949cfd07 dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9564
diff changeset
   339
	RestoreHog(professor.bot)
14628
ea9f0a99b55b ASA death01: Optimize hog spawn positions, animate professor teleportation
Wuzzy <Wuzzy2@mail.ru>
parents: 14617
diff changeset
   340
	AddVisualGear(GetX(professor.bot), GetY(professor.bot), vgtExplosion, 0, false)
ea9f0a99b55b ASA death01: Optimize hog spawn positions, animate professor teleportation
Wuzzy <Wuzzy2@mail.ru>
parents: 14617
diff changeset
   341
	PlaySound(sndWarp)
14612
364ab0ae4417 ASA death01: Fix precise key not getting cleared
Wuzzy <Wuzzy2@mail.ru>
parents: 14494
diff changeset
   342
	SetGearMessage(hero.gear, 0)
9566
5c50949cfd07 dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9564
diff changeset
   343
	AnimSwitchHog(professor.gear)
14628
ea9f0a99b55b ASA death01: Optimize hog spawn positions, animate professor teleportation
Wuzzy <Wuzzy2@mail.ru>
parents: 14617
diff changeset
   344
	FollowGear(professor.gear)
12519
d89dabfd07ce Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents: 12518
diff changeset
   345
	EndTurn(true)
9566
5c50949cfd07 dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9564
diff changeset
   346
end