share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/final.lua
author Wuzzy <Wuzzy2@mail.ru>
Mon, 30 Jul 2018 19:23:28 +0200
changeset 13579 9c83afd65e8c
parent 12938 e65aa3c3d4e6
child 13588 141cdfe0f3ca
permissions -rw-r--r--
ASA, final mission: Redraw map and mask to make borders more distingushable Also fix floating green dashes after blowing up things
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9632
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     1
------------------- ABOUT ----------------------
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     2
--
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     3
-- Hero has collected all the anti-gravity device
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     4
-- parts but because of the size of the meteorite
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     5
-- he needs to detonate some faulty explosives that
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     6
-- PAotH have previously placed on it.
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     7
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     8
HedgewarsScriptLoad("/Scripts/Locale.lua")
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     9
HedgewarsScriptLoad("/Scripts/Animate.lua")
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    10
HedgewarsScriptLoad("/Missions/Campaign/A_Space_Adventure/global_functions.lua")
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    11
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    12
----------------- VARIABLES --------------------
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    13
-- globals
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    14
local missionName = loc("The big bang")
9781
5eb7c3778045 removed bouncy terrain, added visual mark on non-portal/indestructible areas, changed map so only way to win is by using the portal gun
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9758
diff changeset
    15
local challengeObjectives = loc("Find a way to detonate all the explosives and stay alive!").."|"..
13579
9c83afd65e8c ASA, final mission: Redraw map and mask to make borders more distingushable
Wuzzy <Wuzzy2@mail.ru>
parents: 12938
diff changeset
    16
							loc("Areas with a security outline are indestructible.").."|"..
9c83afd65e8c ASA, final mission: Redraw map and mask to make borders more distingushable
Wuzzy <Wuzzy2@mail.ru>
parents: 12938
diff changeset
    17
							loc("Areas with a green dashed outline are portal-proof.").."|"..
12231
3ec0261e01f0 Display mines timer in all missions with non-default timer
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
    18
							loc("Mines time: 0 seconds")
12599
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
    19
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
    20
local dialog01 = {}
9634
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
    21
local explosives = {}
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
    22
local currentHealth = 1
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
    23
local currentDamage = 0
9632
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    24
-- hogs
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    25
local hero = {
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    26
	name = loc("Hog Solo"),
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    27
	x = 790,
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    28
	y = 70
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    29
}
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    30
-- teams
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    31
local teamA = {
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    32
	name = loc("Hog Solo"),
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    33
	color = tonumber("38D61C",16) -- green
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    34
}
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    35
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    36
-------------- LuaAPI EVENT HANDLERS ------------------
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    37
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    38
function onGameInit()
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    39
	GameFlags = gfDisableWind + gfOneClanMode
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    40
	Seed = 1
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    41
	TurnTime = -1
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    42
	CaseFreq = 0
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    43
	MinesNum = 0
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    44
	MinesTime = 1
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    45
	Explosives = 0
9781
5eb7c3778045 removed bouncy terrain, added visual mark on non-portal/indestructible areas, changed map so only way to win is by using the portal gun
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9758
diff changeset
    46
	HealthCaseAmount = 35
9632
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    47
	Map = "final_map"
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    48
	Theme = "EarthRise"
12473
d652c6f5d5f1 Disable Sudden Death for a couple of ASA missions
Wuzzy <almikes@aol.com>
parents: 12231
diff changeset
    49
	-- Disable Sudden Death
d652c6f5d5f1 Disable Sudden Death for a couple of ASA missions
Wuzzy <almikes@aol.com>
parents: 12231
diff changeset
    50
	WaterRise = 0
d652c6f5d5f1 Disable Sudden Death for a couple of ASA missions
Wuzzy <almikes@aol.com>
parents: 12231
diff changeset
    51
	HealthDecrease = 0
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
    52
9632
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    53
	-- Hog Solo
12592
0b27d8b4f8e7 Use Default voice in A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 12591
diff changeset
    54
	AddTeam(teamA.name, teamA.color, "Simple", "Island", "Default", "hedgewars")
9632
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    55
	hero.gear = AddHog(hero.name, 0, 1, "war_desertgrenadier1")
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    56
	AnimSetGearPosition(hero.gear, hero.x, hero.y)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
    57
9632
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    58
	initCheckpoint("final")
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
    59
9632
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    60
	AnimInit()
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    61
end
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    62
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    63
function onGameStart()
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    64
	AnimWait(hero.gear, 3000)
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    65
	FollowGear(hero.gear)
13579
9c83afd65e8c ASA, final mission: Redraw map and mask to make borders more distingushable
Wuzzy <Wuzzy2@mail.ru>
parents: 12938
diff changeset
    66
	ShowMission(missionName, loc("Challenge objectives"), challengeObjectives, -amSkip, 7500)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
    67
9632
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    68
	-- explosives
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    69
	x = 400
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    70
	while x < 815 do
9634
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
    71
		local gear = AddGear(x, 500, gtExplosives, 0, 0, 0, 0)
9810
54c0fdec4600 changing math functions that may cause desyncs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9802
diff changeset
    72
		x = x + GetRandom(26) + 15
9634
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
    73
		table.insert(explosives, gear)
9632
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    74
	end
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    75
	-- mines
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    76
	local x = 360
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    77
	while x < 815 do
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    78
		AddGear(x, 480, gtMine, 0, 0, 0, 0)
9810
54c0fdec4600 changing math functions that may cause desyncs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9802
diff changeset
    79
		x = x + GetRandom(16) + 5
9632
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    80
	end
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
    81
	-- health crate
9781
5eb7c3778045 removed bouncy terrain, added visual mark on non-portal/indestructible areas, changed map so only way to win is by using the portal gun
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9758
diff changeset
    82
	SpawnHealthCrate(910, 5)
9632
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    83
	-- ammo crates
12938
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12599
diff changeset
    84
	SpawnSupplyCrate(930, 1000, amRCPlane)
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12599
diff changeset
    85
	SpawnSupplyCrate(1260, 652, amGirder)
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12599
diff changeset
    86
	SpawnSupplyCrate(1220, 652, amPickHammer)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
    87
9632
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    88
	-- ammo
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
    89
	AddAmmo(hero.gear, amPortalGun, 1)
9634
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
    90
	AddAmmo(hero.gear, amFirePunch, 1)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
    91
9634
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
    92
	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
12599
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
    93
	AddEvent(onBoom, {hero.gear}, heroBoomReaction, {hero.gear}, 0)
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
    94
	AnimationSetup()
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9642
diff changeset
    95
9632
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    96
	SendHealthStatsOff()
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    97
end
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    98
9634
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
    99
function onGameTick()
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   100
	AnimUnWait()
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   101
	if ShowAnimation() == false then
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   102
		return
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   103
	end
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   104
	ExecuteAfterAnimations()
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   105
	CheckEvents()
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   106
end
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   107
9632
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   108
function onAmmoStoreInit()
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   109
	SetAmmo(amRCPlane, 0, 0, 0, 1)
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   110
	SetAmmo(amPickHammer, 0, 0, 0, 2)
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   111
	SetAmmo(amGirder, 0, 0, 0, 1)
9dd1c36d8b54 final mission map and most logic
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   112
end
9634
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   113
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   114
function onNewTurn()
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   115
	currentDamage = 0
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   116
	currentHealth = GetHealth(hero.gear)
12599
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   117
	if onBoom(hero.gear) then
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   118
		heroWin(hero.gear)
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   119
	end
9634
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   120
end
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   121
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   122
function onGearDamage(gear, damage)
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   123
	if gear == hero.gear then
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   124
		currentDamage = currentDamage + damage
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   125
	end
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   126
end
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   127
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   128
-------------- EVENTS ------------------
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   129
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   130
function onHeroDeath(gear)
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   131
	if not GetHealth(hero.gear) then
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   132
		return true
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   133
	end
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   134
	return false
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   135
end
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   136
12599
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   137
function onBoom(gear)
9634
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   138
	local win = true
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   139
	for i=1,table.getn(explosives) do
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   140
		if GetHealth(explosives[i]) then
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   141
			win = false
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   142
			break
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   143
		end
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   144
	end
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   145
	if currentHealth <= currentDamage then
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   146
		win = false
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   147
	end
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   148
	return win
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   149
end
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   150
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   151
-------------- ACTIONS ------------------
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   152
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   153
function heroDeath(gear)
9642
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9634
diff changeset
   154
	SendStat(siGameResult, loc("Hog Solo lost, try again!"))
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9634
diff changeset
   155
	SendStat(siCustomAchievement, loc("You have to destroy all the explosives without dying!"))
13579
9c83afd65e8c ASA, final mission: Redraw map and mask to make borders more distingushable
Wuzzy <Wuzzy2@mail.ru>
parents: 12938
diff changeset
   156
	SendStat(siCustomAchievement, loc("Areas surrounded by a security border are indestructible."))
9c83afd65e8c ASA, final mission: Redraw map and mask to make borders more distingushable
Wuzzy <Wuzzy2@mail.ru>
parents: 12938
diff changeset
   157
	SendStat(siCustomAchievement, loc("Areas surrounded by a green dashed outline are portal-proof and repel portals."))
12544
19192a3cb674 Use correct kill counts for the remaining ASA missions as well
Wuzzy <almikes@aol.com>
parents: 12543
diff changeset
   158
	sendSimpleTeamRankings({teamA.name})
9634
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   159
	EndGame()
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   160
end
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   161
12599
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   162
function heroBoomReaction(gear)
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   163
	if GetHealth(gear) and GetHealth(gear) > 0 then
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   164
		HogSay(gear, loc("Kaboom! Hahahaha! Take this, stupid meteorite!"), SAY_SHOUT, 2)
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   165
	end
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   166
end
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   167
9634
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   168
function heroWin(gear)
12599
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   169
	AddAnim(dialog01)
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   170
end
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   171
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   172
function win()
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   173
	SetWeapon(amNothing)
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   174
	AnimSetInputMask(0)
9802
00216d609140 desert01 fixed destructible terrain marks and cosmos marks for completed main missions
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9781
diff changeset
   175
	saveCompletedStatus(7)
11954
079d687671b2 Store campaign victories in campaign variable "Won"
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   176
	SaveCampaignVar("Won", "true")
11970
72be38f6d0c0 Complete space campaign's spacetrip mission if all main+side missions are completed
Wuzzy <almikes@aol.com>
parents: 11957
diff changeset
   177
	checkAllMissionsCompleted()
9642
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9634
diff changeset
   178
	SendStat(siGameResult, loc("Congratulations, you have saved Hogera!"))
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9634
diff changeset
   179
	SendStat(siCustomAchievement, loc("Hogera is safe!"))
12544
19192a3cb674 Use correct kill counts for the remaining ASA missions as well
Wuzzy <almikes@aol.com>
parents: 12543
diff changeset
   180
	sendSimpleTeamRankings({teamA.name})
9634
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   181
	EndGame()
8032df67a249 custom stats and win/lose events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9632
diff changeset
   182
end
12599
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   183
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   184
------------ ANIMATION STUFF ------------
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   185
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   186
function Skipanim(anim)
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   187
	if anim == dialog01 then
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   188
		win()
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   189
	end
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   190
end
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   191
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   192
function onPrecise()
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   193
	if GameTime > 3000 then
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   194
		SetAnimSkip(true)
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   195
	end
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   196
end
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   197
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   198
function AnimationSetup()
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   199
	-- DIALOG 01 - Start, welcome to moon
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   200
	AddSkipFunction(dialog01, Skipanim, {dialog01})
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   201
	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 100}})
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   202
	table.insert(dialog01, {func = FollowGear, args = {hero.gear}})
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   203
	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Hooray! I actually did it! Hogera is safe!"), SAY_SHOUT, 3000}})
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   204
	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("I'm so glad this is finally over!"), SAY_SAY, 3000}})
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   205
	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 4000}})
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   206
	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Wait a moment …"), SAY_THINK, 2000}})
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   207
	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("If some good old explosives were enough to save Hogera …"), SAY_THINK, 5000}})
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   208
	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("… why did I risk my life to collect all the parts of the anti-gravity device?"), SAY_THINK, 6000}})
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   209
	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("It was completely useless!"), SAY_THINK, 3000}})
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   210
	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("We could just have blown up the meteorite from the the beginning!"), SAY_THINK, 5000}})
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   211
        -- Hogerian =  Inhabitant of the planet Hogera
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   212
	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Stupid, stupid Hogerians!"), SAY_SAY, 5000}})
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   213
	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Or maybe this was all part of an evil plan, so evil that even Prof. Hogevil can't think of it!"), SAY_THINK, 9000}})
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   214
	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Nah, probably everyone was just stupid."), SAY_THINK, 4000}})
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   215
	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Except me, of course! I just saved a whole planet!"), SAY_THINK, 5000}})
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   216
	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("But one thing's for sure:"), SAY_THINK, 4000}})
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   217
	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Hogera is definitely the last planet I saved!"), SAY_THINK, 4000}})
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   218
	table.insert(dialog01, {func = win, args = {hero.gear}})
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   219
end
d8adae379d3c A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   220