share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice01.lua
author Wuzzy <Wuzzy2@mail.ru>
Tue, 07 May 2019 16:08:27 +0200
changeset 14919 4596357d002d
parent 14636 c3c0f94a5333
child 14953 ff4003a90ff8
permissions -rw-r--r--
Fix cut scenes not being skipped when pressing precise in enemy turn (bug #280)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
     1
------------------- ABOUT ----------------------
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
     2
--
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
     3
-- In this cold planet hero seeks for a part of the
9622
db9f6b7955ba fixed hero win the game in case damage has happened to him previously in the same turn reported by Wuzzy
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9582
diff changeset
     4
-- antigravity device. He has to capture Thanta who
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
     5
-- knows where the device is hidden. Hero will be
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
     6
-- able to use only the ice gun for this mission.
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
     7
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
     8
HedgewarsScriptLoad("/Scripts/Locale.lua")
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
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")
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    11
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    12
----------------- VARIABLES --------------------
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    13
-- globals
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    14
local missionName = loc("A frozen adventure")
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    15
local heroAtAntiFlyArea = false
9346
1245c7636380 more changes, events and bots fighting - also map drawing corrections
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9344
diff changeset
    16
local heroVisitedAntiFlyArea = false
9390
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
    17
local heroAtFinalStep = false
9386
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
    18
local iceGunTaken = false
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
    19
local checkPointReached = 1 -- 1 is normal spawn
9622
db9f6b7955ba fixed hero win the game in case damage has happened to him previously in the same turn reported by Wuzzy
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9582
diff changeset
    20
local heroDamageAtCurrentTurn = 0
9386
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
    21
-- dialogs
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
    22
local dialog01 = {}
9400
b0c1b1972947 added dialog at hero win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9398
diff changeset
    23
local dialog02 = {}
9386
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
    24
-- mission objectives
12529
89d3c3ebc925 Improve and fix poor messaging in ASA: A frozen adventure
Wuzzy <almikes@aol.com>
parents: 12522
diff changeset
    25
local goToThantaString = loc("Go to Thanta and get the device part!")
9386
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
    26
local goals = {
12571
903a30fb49e6 Fix team colors of most teams in A Space Adventure to denote correct ally status
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
    27
	[dialog01] = {missionName, loc("Getting ready"), loc("Collect the freezer and get the device part from Thanta.") .. "|" .. loc("Mines time: 0 seconds"), 1, 4500},
12529
89d3c3ebc925 Improve and fix poor messaging in ASA: A frozen adventure
Wuzzy <almikes@aol.com>
parents: 12522
diff changeset
    28
	["checkpoint"] = {missionName, loc("Objectives"), goToThantaString .. "|" .. loc("Mines time: 0 seconds"), 1, 4500},
9386
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
    29
}
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    30
-- crates
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    31
local icegunY = 1950
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    32
local icegunX = 260
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    33
-- hogs
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    34
local hero = {}
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    35
local ally = {}
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    36
local bandit1 = {}
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    37
local bandit2 = {}
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    38
local bandit3 = {}
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    39
local bandit4 = {}
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    40
local bandit5 = {}
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    41
-- teams
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    42
local teamA = {}
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    43
local teamB = {}
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    44
local teamC = {}
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    45
-- hedgehogs values
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    46
hero.name = loc("Hog Solo")
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    47
hero.x = 340
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    48
hero.y = 1840
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    49
hero.dead = false
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    50
ally.name = loc("Paul McHoggy")
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    51
ally.x = 300
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    52
ally.y = 1840
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    53
bandit1.name = loc("Thanta")
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    54
bandit1.x = 3240
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    55
bandit1.y = 1280
9388
790d4f7d57d1 3rd checkpoint, event to stop game when Thanta is dead
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9386
diff changeset
    56
bandit1.dead = false
9390
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
    57
bandit1.frozen = false
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
    58
bandit1.roundsToUnfreeze = 0
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    59
bandit2.name = loc("Billy Frost")
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    60
bandit2.x = 1480
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    61
bandit2.y = 1990
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    62
bandit3.name = loc("Ice Jake")
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    63
bandit3.x = 1860
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    64
bandit3.y = 1150
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    65
bandit4.name = loc("John Snow")
9388
790d4f7d57d1 3rd checkpoint, event to stop game when Thanta is dead
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9386
diff changeset
    66
bandit4.x = 3200
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    67
bandit4.y = 970
9390
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
    68
bandit4.frozen = false
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
    69
bandit4.roundsToUnfreeze = 0
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    70
bandit5.name = loc("White Tee")
9388
790d4f7d57d1 3rd checkpoint, event to stop game when Thanta is dead
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9386
diff changeset
    71
bandit5.x = 3280
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    72
bandit5.y = 600
9390
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
    73
bandit5.frozen = false
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
    74
bandit5.roundsToUnfreeze = 0
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    75
teamA.name = loc("Allies")
13583
141cdfe0f3ca Switch almost all Lua calls of AddTeam to using default clan colors instead of hardcoded color
Wuzzy <Wuzzy2@mail.ru>
parents: 12933
diff changeset
    76
teamA.color = -6
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    77
teamB.name = loc("Frozen Bandits")
13583
141cdfe0f3ca Switch almost all Lua calls of AddTeam to using default clan colors instead of hardcoded color
Wuzzy <Wuzzy2@mail.ru>
parents: 12933
diff changeset
    78
teamB.color = -2
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    79
teamC.name = loc("Hog Solo")
13583
141cdfe0f3ca Switch almost all Lua calls of AddTeam to using default clan colors instead of hardcoded color
Wuzzy <Wuzzy2@mail.ru>
parents: 12933
diff changeset
    80
teamC.color = -6
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    81
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    82
-------------- LuaAPI EVENT HANDLERS ------------------
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    83
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    84
function onGameInit()
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    85
	Seed = 1
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    86
	TurnTime = 25000
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    87
	CaseFreq = 0
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    88
	MinesNum = 0
9386
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
    89
	MinesTime = 1
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    90
	Explosives = 0
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    91
	Map = "ice01_map"
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
    92
	Theme = "Snow"
12468
d652c6f5d5f1 Disable Sudden Death for a couple of ASA missions
Wuzzy <almikes@aol.com>
parents: 12227
diff changeset
    93
	-- Disable Sudden Death
d652c6f5d5f1 Disable Sudden Death for a couple of ASA missions
Wuzzy <almikes@aol.com>
parents: 12227
diff changeset
    94
	WaterRise = 0
d652c6f5d5f1 Disable Sudden Death for a couple of ASA missions
Wuzzy <almikes@aol.com>
parents: 12227
diff changeset
    95
	HealthDecrease = 0
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9757
diff changeset
    96
9398
3f2ec6e1032f increase health by 5 everytime hero spawn on checkpoint3
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9396
diff changeset
    97
	-- 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
    98
	checkPointReached = initCheckpoint("ice01")
9398
3f2ec6e1032f increase health by 5 everytime hero spawn on checkpoint3
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9396
diff changeset
    99
	-- get hero health
3f2ec6e1032f increase health by 5 everytime hero spawn on checkpoint3
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9396
diff changeset
   100
	local heroHealth = 100
3f2ec6e1032f increase health by 5 everytime hero spawn on checkpoint3
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9396
diff changeset
   101
	if tonumber(GetCampaignVar("HeroHealth")) then
3f2ec6e1032f increase health by 5 everytime hero spawn on checkpoint3
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9396
diff changeset
   102
		heroHealth = tonumber(GetCampaignVar("HeroHealth"))
3f2ec6e1032f increase health by 5 everytime hero spawn on checkpoint3
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9396
diff changeset
   103
	end
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9757
diff changeset
   104
9398
3f2ec6e1032f increase health by 5 everytime hero spawn on checkpoint3
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9396
diff changeset
   105
	if heroHealth ~= 100 then
3f2ec6e1032f increase health by 5 everytime hero spawn on checkpoint3
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9396
diff changeset
   106
		heroHealth = heroHealth + 5
3f2ec6e1032f increase health by 5 everytime hero spawn on checkpoint3
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9396
diff changeset
   107
		if heroHealth > 100 then
3f2ec6e1032f increase health by 5 everytime hero spawn on checkpoint3
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9396
diff changeset
   108
			heroHealth = 100
3f2ec6e1032f increase health by 5 everytime hero spawn on checkpoint3
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9396
diff changeset
   109
		end
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9757
diff changeset
   110
		SaveCampaignVar("HeroHealth", heroHealth)
9398
3f2ec6e1032f increase health by 5 everytime hero spawn on checkpoint3
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9396
diff changeset
   111
	end
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9757
diff changeset
   112
14509
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   113
	-- Hero
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   114
	teamC.name = AddMissionTeam(teamC.color)
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   115
	hero.gear = AddMissionHog(heroHealth)
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   116
	hero.name = GetHogName(hero.gear)
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   117
	AnimSetGearPosition(hero.gear, hero.x, hero.y)
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   118
	HogTurnLeft(hero.gear, true)
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   119
	-- Ally
14509
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   120
	teamA.name = AddTeam(teamA.name, teamA.color, "heart", "Island", "Default", "cm_face")
14633
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   121
	SetTeamPassive(teamA.name, true)
9629
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9624
diff changeset
   122
	ally.gear = AddHog(ally.name, 0, 100, "war_airwarden02")
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   123
	AnimSetGearPosition(ally.gear, ally.x, ally.y)
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   124
	-- Frozen Bandits
14509
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   125
	teamB.name = AddTeam(teamB.name, teamB.color, "plant2", "Island", "Default", "cm_pirate")
9629
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9624
diff changeset
   126
	bandit1.gear = AddHog(bandit1.name, 1, 120, "Santa")
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9757
diff changeset
   127
	AnimSetGearPosition(bandit1.gear, bandit1.x, bandit1.y)
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   128
	HogTurnLeft(bandit1.gear, true)
9629
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9624
diff changeset
   129
	bandit2.gear = AddHog(bandit2.name, 1, 100, "ushanka")
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   130
	AnimSetGearPosition(bandit2.gear, bandit2.x, bandit2.y)
9629
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9624
diff changeset
   131
	bandit3.gear = AddHog(bandit3.name, 1, 100, "thug")
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   132
	AnimSetGearPosition(bandit3.gear, bandit3.x, bandit3.y)
9388
790d4f7d57d1 3rd checkpoint, event to stop game when Thanta is dead
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9386
diff changeset
   133
	bandit4.gear = AddHog(bandit4.name, 1, 40, "tophats")
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   134
	AnimSetGearPosition(bandit4.gear, bandit4.x, bandit4.y)
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   135
	HogTurnLeft(bandit4.gear, true)
9629
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9624
diff changeset
   136
	bandit5.gear = AddHog(bandit5.name, 1, 40, "Sniper")
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   137
	AnimSetGearPosition(bandit5.gear, bandit5.x, bandit5.y)
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   138
	HogTurnLeft(bandit5.gear, true)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9757
diff changeset
   139
9386
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   140
	if checkPointReached == 1 then
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   141
		-- Start of the game
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   142
	elseif checkPointReached == 2 then
9388
790d4f7d57d1 3rd checkpoint, event to stop game when Thanta is dead
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9386
diff changeset
   143
		iceGunTaken = true
9386
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   144
		AnimSetGearPosition(hero.gear, 840, 1650)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9757
diff changeset
   145
	elseif checkPointReached == 3 then
9388
790d4f7d57d1 3rd checkpoint, event to stop game when Thanta is dead
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9386
diff changeset
   146
		iceGunTaken = true
9390
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   147
		heroAtFinalStep = true
9388
790d4f7d57d1 3rd checkpoint, event to stop game when Thanta is dead
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9386
diff changeset
   148
		heroVisitedAntiFlyArea = true
790d4f7d57d1 3rd checkpoint, event to stop game when Thanta is dead
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9386
diff changeset
   149
		AnimSetGearPosition(hero.gear, 1450, 910)
9386
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   150
	end
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9757
diff changeset
   151
12522
228ebbc8656d Fix ASA: A frozen adventure not working when starting from checkpoint
Wuzzy <almikes@aol.com>
parents: 12515
diff changeset
   152
	AnimInit(checkPointReached == 1)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9757
diff changeset
   153
	AnimationSetup()
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   154
end
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   155
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   156
function onGameStart()
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   157
	AnimWait(hero.gear, 3000)
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   158
	FollowGear(hero.gear)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9757
diff changeset
   159
9384
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   160
	-- Add mines
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   161
	AddGear(1612, 940, gtMine, 0, 0, 0, 0)
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   162
	AddGear(1622, 945, gtMine, 0, 0, 0, 0)
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   163
	AddGear(1645, 950, gtMine, 0, 0, 0, 0)
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   164
	AddGear(1655, 960, gtMine, 0, 0, 0, 0)
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   165
	AddGear(1665, 965, gtMine, 0, 0, 0, 0)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9757
diff changeset
   166
9384
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   167
	AddGear(1800, 1000, gtMine, 0, 0, 0, 0)
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   168
	AddGear(1810, 1005, gtMine, 0, 0, 0, 0)
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   169
	AddGear(1820, 1010, gtMine, 0, 0, 0, 0)
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   170
	AddGear(1830, 1015, gtMine, 0, 0, 0, 0)
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   171
	AddGear(1840, 1020, gtMine, 0, 0, 0, 0)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9757
diff changeset
   172
9384
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   173
	AddGear(1900, 1020, gtMine, 0, 0, 0, 0)
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   174
	AddGear(1910, 1020, gtMine, 0, 0, 0, 0)
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   175
	AddGear(1920, 1020, gtMine, 0, 0, 0, 0)
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   176
	AddGear(1930, 1030, gtMine, 0, 0, 0, 0)
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   177
	AddGear(1940, 1040, gtMine, 0, 0, 0, 0)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9757
diff changeset
   178
9384
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   179
	AddGear(2130, 1110, gtMine, 0, 0, 0, 0)
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   180
	AddGear(2140, 1120, gtMine, 0, 0, 0, 0)
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   181
	AddGear(2180, 1120, gtMine, 0, 0, 0, 0)
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   182
	AddGear(2200, 1130, gtMine, 0, 0, 0, 0)
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   183
	AddGear(2210, 1130, gtMine, 0, 0, 0, 0)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9757
diff changeset
   184
9384
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   185
	local x=2300
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   186
	local step=0
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   187
	while x<3100 do
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   188
		AddGear(x, 1150, gtMine, 0, 0, 0, 0)
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   189
		step = step + 1
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   190
		if step == 5 then
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   191
			step = 0
9810
54c0fdec4600 changing math functions that may cause desyncs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9759
diff changeset
   192
			x = x + GetRandom(201)+100
9384
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   193
		else
9810
54c0fdec4600 changing math functions that may cause desyncs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9759
diff changeset
   194
			x = x + GetRandom(21)+10
9384
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   195
		end
557ae509547b added mines to the ice planet01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9346
diff changeset
   196
	end
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9757
diff changeset
   197
9490
b93448b75fa4 fix bugs and some changes regarting the difficulty in desert02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9410
diff changeset
   198
	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
9346
1245c7636380 more changes, events and bots fighting - also map drawing corrections
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9344
diff changeset
   199
	AddEvent(onHeroFinalStep, {hero.gear}, heroFinalStep, {hero.gear}, 0)
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   200
	AddEvent(onAntiFlyArea, {hero.gear}, antiFlyArea, {hero.gear}, 1)
9734
da2cb993fd61 fixed moving npc and flying in forbidden area in ice01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   201
	AddEvent(onAntiFlyAreaVelocity, {hero.gear}, antiFlyAreaVelocity, {hero.gear}, 1)
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   202
	AddEvent(onNonAntiFlyArea, {hero.gear}, nonAntiFlyArea, {hero.gear}, 1)
9624
51e22761679d fixed bug making the game not end when thanta was dead,reported by Wuzzy
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9623
diff changeset
   203
	AddEvent(onThantaDeath, {bandit1.gear}, thantaDeath, {bandit1.gear}, 0)
9622
db9f6b7955ba fixed hero win the game in case damage has happened to him previously in the same turn reported by Wuzzy
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9582
diff changeset
   204
	AddEvent(onHeroWin, {hero.gear}, heroWin, {hero.gear}, 0)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9757
diff changeset
   205
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   206
	AddAmmo(hero.gear, amJetpack, 99)
9346
1245c7636380 more changes, events and bots fighting - also map drawing corrections
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9344
diff changeset
   207
	AddAmmo(bandit1.gear, amBazooka, 5)
1245c7636380 more changes, events and bots fighting - also map drawing corrections
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9344
diff changeset
   208
	AddAmmo(bandit2.gear, amBazooka, 4)
1245c7636380 more changes, events and bots fighting - also map drawing corrections
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9344
diff changeset
   209
	AddAmmo(bandit3.gear, amMine, 2)
1245c7636380 more changes, events and bots fighting - also map drawing corrections
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9344
diff changeset
   210
	AddAmmo(bandit3.gear, amGrenade, 3)
1245c7636380 more changes, events and bots fighting - also map drawing corrections
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9344
diff changeset
   211
	AddAmmo(bandit4.gear, amBazooka, 5)
1245c7636380 more changes, events and bots fighting - also map drawing corrections
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9344
diff changeset
   212
	AddAmmo(bandit5.gear, amBazooka, 5)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9757
diff changeset
   213
9386
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   214
	if checkPointReached == 1 then
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   215
		AddAmmo(hero.gear, amBazooka, 1)
12933
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12603
diff changeset
   216
		SpawnSupplyCrate(icegunX, icegunY, amIceGun)
9386
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   217
		AddEvent(onColumnCheckPoint, {hero.gear}, columnCheckPoint, {hero.gear}, 0)
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   218
		AddEvent(onHeroAtIceGun, {hero.gear}, heroAtIceGun, {hero.gear}, 0)
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   219
		AddAnim(dialog01)
9388
790d4f7d57d1 3rd checkpoint, event to stop game when Thanta is dead
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9386
diff changeset
   220
	elseif checkPointReached == 2 then
12532
3e6e7b258a33 ASA, a frozen adventure: Save bazooka and excess freezers in checkpoints
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   221
		local baz = tonumber(GetCampaignVar("HeroAmmoIce01Bazooka")) or 1
3e6e7b258a33 ASA, a frozen adventure: Save bazooka and excess freezers in checkpoints
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   222
		AddAmmo(hero.gear, amBazooka, baz)
9386
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   223
		AddAmmo(hero.gear, amIceGun, 8)
9759
0efa9672c000 * turned out the no-flight zone is also a no-climb-and-progress zone
sheepluva
parents: 9758
diff changeset
   224
		AnimCaption(hero.gear, goToThantaString, 5000)
12529
89d3c3ebc925 Improve and fix poor messaging in ASA: A frozen adventure
Wuzzy <almikes@aol.com>
parents: 12522
diff changeset
   225
		ShowMission(unpack(goals["checkpoint"]))
9388
790d4f7d57d1 3rd checkpoint, event to stop game when Thanta is dead
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9386
diff changeset
   226
	elseif checkPointReached == 3 then
12532
3e6e7b258a33 ASA, a frozen adventure: Save bazooka and excess freezers in checkpoints
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   227
		local baz = tonumber(GetCampaignVar("HeroAmmoIce01Bazooka")) or 0
3e6e7b258a33 ASA, a frozen adventure: Save bazooka and excess freezers in checkpoints
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   228
		local ice = math.max(6, tonumber(GetCampaignVar("HeroAmmoIce01IceGun")) or 6)
3e6e7b258a33 ASA, a frozen adventure: Save bazooka and excess freezers in checkpoints
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   229
		AddAmmo(hero.gear, amBazooka, baz)
3e6e7b258a33 ASA, a frozen adventure: Save bazooka and excess freezers in checkpoints
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   230
		AddAmmo(hero.gear, amIceGun, ice)
9759
0efa9672c000 * turned out the no-flight zone is also a no-climb-and-progress zone
sheepluva
parents: 9758
diff changeset
   231
		AnimCaption(hero.gear, goToThantaString, 5000)
12529
89d3c3ebc925 Improve and fix poor messaging in ASA: A frozen adventure
Wuzzy <almikes@aol.com>
parents: 12522
diff changeset
   232
		ShowMission(unpack(goals["checkpoint"]))
9402
8e9d062f9a48 ice01 custom stats for defeat
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9400
diff changeset
   233
	end
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9757
diff changeset
   234
9402
8e9d062f9a48 ice01 custom stats for defeat
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9400
diff changeset
   235
	SendHealthStatsOff()
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   236
end
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   237
14633
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   238
function getNextBandit(hog)
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   239
	local continue = true
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   240
	local startHog = hog
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   241
	while true do
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   242
		if (GetHealth(hog) and GetEffect(hog, heFrozen) < 256) and
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   243
		( (heroAtFinalStep and (hog == bandit1.gear or hog == bandit4.gear or hog == bandit5.gear)) or
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   244
		((not heroAtFinalStep) and (hog == bandit2.gear or hog == bandit3.gear)) ) then
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   245
			return hog
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   246
		end
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   247
		if hog == bandit1.gear then
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   248
			hog = bandit2.gear
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   249
		elseif hog == bandit2.gear then
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   250
			hog = bandit3.gear
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   251
		elseif hog == bandit3.gear then
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   252
			hog = bandit4.gear
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   253
		elseif hog == bandit4.gear then
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   254
			hog = bandit5.gear
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   255
		elseif hog == bandit5.gear then
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   256
			hog = bandit1.gear
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   257
		end
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   258
		if startHog == hog then
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   259
			return nil
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   260
		end
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   261
	end
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   262
end
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   263
9622
db9f6b7955ba fixed hero win the game in case damage has happened to him previously in the same turn reported by Wuzzy
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9582
diff changeset
   264
function onNewTurn()
db9f6b7955ba fixed hero win the game in case damage has happened to him previously in the same turn reported by Wuzzy
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9582
diff changeset
   265
	heroDamageAtCurrentTurn = 0
9346
1245c7636380 more changes, events and bots fighting - also map drawing corrections
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9344
diff changeset
   266
	-- round has to start if hero goes near the column
1245c7636380 more changes, events and bots fighting - also map drawing corrections
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9344
diff changeset
   267
	if not heroVisitedAntiFlyArea and CurrentHedgehog ~= hero.gear then
14633
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   268
		SkipTurn()
9346
1245c7636380 more changes, events and bots fighting - also map drawing corrections
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9344
diff changeset
   269
	elseif not heroVisitedAntiFlyArea and CurrentHedgehog == hero.gear then
13752
110d6c1e817f Lua: Rename globals: NoPointX→NO_CURSOR, cMaxTurnTime→MAX_TURN_TIME, cMaxHogHealth→MAX_HOG_HEALTH
Wuzzy <Wuzzy2@mail.ru>
parents: 13742
diff changeset
   270
		SetTurnTimeLeft(MAX_TURN_TIME)
14633
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   271
	elseif (GetHogTeamName(CurrentHedgehog) == teamB.name) then
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   272
		local nextBandit = getNextBandit(CurrentHedgehog)
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   273
		if nextBandit ~= nil then
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   274
			if CurrentHedgehog ~= nextBandit then
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   275
				AnimSwitchHog(nextBandit)
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   276
			end
9390
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   277
		else
14633
bd15c8551318 Make use of passive teams in various campaign missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   278
			SkipTurn()
9390
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   279
		end
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   280
	end
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   281
	-- frozen hogs accounting
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   282
	if CurrentHedgehog == hero.gear and heroAtFinalStep and TurnTimeLeft > 0 then
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   283
		if bandit1.frozen then
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   284
			if bandit1.roundsToUnfreeze == 0 then
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   285
				SetEffect(bandit1.gear, heFrozen, 255)
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   286
				bandit1.frozen = false
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   287
			else
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   288
				bandit1.roundsToUnfreeze = bandit1.roundsToUnfreeze - 1
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   289
			end
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   290
		end
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   291
		if bandit4.frozen then
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   292
			if bandit4.roundsToUnfreeze == 0 then
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   293
				SetEffect(bandit4.gear, heFrozen, 255)
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   294
				bandit4.frozen = false
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   295
			else
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   296
				bandit4.roundsToUnfreeze = bandit4.roundsToUnfreeze - 1
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   297
			end
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   298
		end
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   299
		if bandit5.frozen then
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   300
			if bandit5.roundsToUnfreeze == 0 then
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   301
				SetEffect(bandit5.gear, heFrozen, 255)
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   302
				bandit5.frozen = false
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   303
			else
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   304
				bandit5.roundsToUnfreeze = bandit5.roundsToUnfreeze - 1
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   305
			end
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   306
		end
9392
0dd0adee6831 cleaning up debug prints
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9390
diff changeset
   307
	else
9390
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   308
		if bandit1.frozen then
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   309
			SetEffect(bandit1.gear, heFrozen, 9999999999)
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   310
		end
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   311
		if bandit4.frozen then
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   312
			SetEffect(bandit4.gear, heFrozen, 9999999999)
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   313
		end
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   314
		if bandit5.frozen then
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   315
			SetEffect(bandit5.gear, heFrozen, 9999999999)
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   316
		end
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   317
	end
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   318
end
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   319
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   320
function onGameTick()
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   321
	AnimUnWait()
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   322
	if ShowAnimation() == false then
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   323
		return
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   324
	end
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   325
	ExecuteAfterAnimations()
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   326
	CheckEvents()
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9757
diff changeset
   327
9390
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   328
	if GetEffect(bandit1.gear, heFrozen) > 256 and not bandit1.frozen then
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   329
		bandit1.frozen = true
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   330
		SetEffect(bandit1.gear, heFrozen, 9999999999)
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   331
		bandit1.roundsToUnfreeze = 1
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   332
	end
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   333
	if GetEffect(bandit4.gear, heFrozen) > 256 and not bandit4.frozen then
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   334
		bandit4.frozen = true
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   335
		SetEffect(bandit4.gear, heFrozen, 9999999999)
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   336
		bandit4.roundsToUnfreeze = 2
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   337
	end
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   338
	if GetEffect(bandit5.gear, heFrozen) > 256 and not bandit5.frozen then
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   339
		bandit5.frozen = true
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   340
		SetEffect(bandit5.gear, heFrozen, 9999999999)
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   341
		bandit5.roundsToUnfreeze = 2
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   342
	end
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   343
end
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   345
function onAmmoStoreInit()
9346
1245c7636380 more changes, events and bots fighting - also map drawing corrections
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9344
diff changeset
   346
	SetAmmo(amIceGun, 0, 0, 0, 8)
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   347
end
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   348
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   349
function onGearDelete(gear)
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   350
	if gear == hero.gear then
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   351
		hero.dead = true
9388
790d4f7d57d1 3rd checkpoint, event to stop game when Thanta is dead
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9386
diff changeset
   352
	elseif gear == bandit1.gear then
790d4f7d57d1 3rd checkpoint, event to stop game when Thanta is dead
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9386
diff changeset
   353
		bandit1.dead = true
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   354
	end
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   355
end
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   356
14919
4596357d002d Fix cut scenes not being skipped when pressing precise in enemy turn (bug 280)
Wuzzy <Wuzzy2@mail.ru>
parents: 14636
diff changeset
   357
function onPreciseLocal()
9386
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   358
	if GameTime > 3000 then
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9757
diff changeset
   359
		SetAnimSkip(true)
9386
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   360
	end
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   361
end
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   362
9622
db9f6b7955ba fixed hero win the game in case damage has happened to him previously in the same turn reported by Wuzzy
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9582
diff changeset
   363
function onGearDamage(gear, damage)
db9f6b7955ba fixed hero win the game in case damage has happened to him previously in the same turn reported by Wuzzy
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9582
diff changeset
   364
	if gear == hero.gear then
db9f6b7955ba fixed hero win the game in case damage has happened to him previously in the same turn reported by Wuzzy
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9582
diff changeset
   365
		heroDamageAtCurrentTurn = heroDamageAtCurrentTurn + damage
db9f6b7955ba fixed hero win the game in case damage has happened to him previously in the same turn reported by Wuzzy
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9582
diff changeset
   366
	end
db9f6b7955ba fixed hero win the game in case damage has happened to him previously in the same turn reported by Wuzzy
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9582
diff changeset
   367
end
db9f6b7955ba fixed hero win the game in case damage has happened to him previously in the same turn reported by Wuzzy
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9582
diff changeset
   368
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   369
-------------- EVENTS ------------------
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   370
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   371
function onAntiFlyArea(gear)
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   372
	if not hero.dead and (GetX(gear) > 860 or GetY(gear) < 1400) and not heroAtAntiFlyArea then
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   373
		return true
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   374
	end
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   375
	return false
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   376
end
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   377
9734
da2cb993fd61 fixed moving npc and flying in forbidden area in ice01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   378
function onAntiFlyAreaVelocity(gear)
9759
0efa9672c000 * turned out the no-flight zone is also a no-climb-and-progress zone
sheepluva
parents: 9758
diff changeset
   379
	if not hero.dead and GetY(gear) < 1300 and GetX(gear) < 1190 then
9734
da2cb993fd61 fixed moving npc and flying in forbidden area in ice01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   380
		return true
da2cb993fd61 fixed moving npc and flying in forbidden area in ice01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   381
	end
da2cb993fd61 fixed moving npc and flying in forbidden area in ice01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   382
	return false
da2cb993fd61 fixed moving npc and flying in forbidden area in ice01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   383
end
da2cb993fd61 fixed moving npc and flying in forbidden area in ice01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   384
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   385
function onNonAntiFlyArea(gear)
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   386
	if not hero.dead and (GetX(gear) < 860 and GetY(gear) > 1400) and heroAtAntiFlyArea then
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   387
		return true
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   388
	end
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   389
	return false
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   390
end
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   391
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   392
function onHeroDeath(gear)
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   393
	if hero.dead then
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   394
		return true
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   395
	end
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   396
	return false
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   397
end
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   398
9346
1245c7636380 more changes, events and bots fighting - also map drawing corrections
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9344
diff changeset
   399
function onHeroFinalStep(gear)
9388
790d4f7d57d1 3rd checkpoint, event to stop game when Thanta is dead
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9386
diff changeset
   400
	if not hero.dead and GetY(gear) < 960 and GetX(gear) > 1400 then
9346
1245c7636380 more changes, events and bots fighting - also map drawing corrections
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9344
diff changeset
   401
		return true
1245c7636380 more changes, events and bots fighting - also map drawing corrections
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9344
diff changeset
   402
	end
1245c7636380 more changes, events and bots fighting - also map drawing corrections
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9344
diff changeset
   403
	return false
1245c7636380 more changes, events and bots fighting - also map drawing corrections
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9344
diff changeset
   404
end
1245c7636380 more changes, events and bots fighting - also map drawing corrections
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9344
diff changeset
   405
9386
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   406
function onColumnCheckPoint(gear)
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   407
	if not hero.dead and iceGunTaken and GetX(gear) < 870 and GetX(gear) > 850 and GetY(gear) > 1500 and StoppedGear(gear) then
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   408
		return true
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   409
	end
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   410
	return false
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   411
end
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   412
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   413
function onHeroAtIceGun(gear)
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   414
	if not hero.dead and GetX(gear) < icegunX+15 and GetX(gear) > icegunX-15 and GetY(gear) > icegunY-15 and GetY(gear) < icegunY+15 then
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   415
		return true
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   416
	end
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   417
	return false
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   418
end
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   419
9388
790d4f7d57d1 3rd checkpoint, event to stop game when Thanta is dead
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9386
diff changeset
   420
function onThantaDeath(gear)
790d4f7d57d1 3rd checkpoint, event to stop game when Thanta is dead
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9386
diff changeset
   421
	if bandit1.dead then
790d4f7d57d1 3rd checkpoint, event to stop game when Thanta is dead
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9386
diff changeset
   422
		return true
790d4f7d57d1 3rd checkpoint, event to stop game when Thanta is dead
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9386
diff changeset
   423
	end
790d4f7d57d1 3rd checkpoint, event to stop game when Thanta is dead
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9386
diff changeset
   424
	return false
790d4f7d57d1 3rd checkpoint, event to stop game when Thanta is dead
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9386
diff changeset
   425
end
790d4f7d57d1 3rd checkpoint, event to stop game when Thanta is dead
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9386
diff changeset
   426
9394
ccc2a2099370 event for game win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9392
diff changeset
   427
function onHeroWin(gear)
9622
db9f6b7955ba fixed hero win the game in case damage has happened to him previously in the same turn reported by Wuzzy
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9582
diff changeset
   428
	if (not hero.dead and not bandit1.dead) and heroDamageAtCurrentTurn == 0 and (GetX(hero.gear)>=GetX(bandit1.gear)-80
db9f6b7955ba fixed hero win the game in case damage has happened to him previously in the same turn reported by Wuzzy
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9582
diff changeset
   429
		and GetX(hero.gear)<=GetX(bandit1.gear)+80)	and (GetY(hero.gear)>=GetY(bandit1.gear)-30 and GetY(hero.gear)<=GetY(bandit1.gear)+30) then
9394
ccc2a2099370 event for game win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9392
diff changeset
   430
		return true
ccc2a2099370 event for game win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9392
diff changeset
   431
	end
ccc2a2099370 event for game win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9392
diff changeset
   432
	return false
ccc2a2099370 event for game win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9392
diff changeset
   433
end
ccc2a2099370 event for game win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9392
diff changeset
   434
9639
6b2ae2eaf1b2 remove unnecessary comments
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9629
diff changeset
   435
-------------- ACTIONS ------------------
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   436
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   437
function antiFlyArea(gear)
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   438
	heroAtAntiFlyArea = true
9734
da2cb993fd61 fixed moving npc and flying in forbidden area in ice01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   439
	if not heroVisitedAntiFlyArea then
12514
d89dabfd07ce Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents: 12469
diff changeset
   440
		EndTurn(true)
9346
1245c7636380 more changes, events and bots fighting - also map drawing corrections
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9344
diff changeset
   441
		FollowGear(hero.gear)
14636
c3c0f94a5333 ASA ice01: Clear hero's gear message when entering no-fly zone
Wuzzy <Wuzzy2@mail.ru>
parents: 14633
diff changeset
   442
		SetGearMessage(hero.gear, band(GetGearMessage(hero.gear), bnot(gmAllStoppable)))
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9757
diff changeset
   443
		AnimSwitchHog(bandit1.gear)
9346
1245c7636380 more changes, events and bots fighting - also map drawing corrections
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9344
diff changeset
   444
		FollowGear(hero.gear)
12514
d89dabfd07ce Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents: 12469
diff changeset
   445
		HogSay(hero.gear, loc("My flying saucer stopped working!"), SAY_THINK)
d89dabfd07ce Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents: 12469
diff changeset
   446
		EndTurn(true)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9757
diff changeset
   447
	end
9734
da2cb993fd61 fixed moving npc and flying in forbidden area in ice01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   448
	AddAmmo(hero.gear, amJetpack, 0)
12469
2041d1e98ab2 Allow skipping in two ASA missions
Wuzzy <almikes@aol.com>
parents: 12468
diff changeset
   449
	AddAmmo(hero.gear, amSkip, 100)
9734
da2cb993fd61 fixed moving npc and flying in forbidden area in ice01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   450
	heroVisitedAntiFlyArea = true
da2cb993fd61 fixed moving npc and flying in forbidden area in ice01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   451
end
da2cb993fd61 fixed moving npc and flying in forbidden area in ice01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   452
da2cb993fd61 fixed moving npc and flying in forbidden area in ice01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   453
function antiFlyAreaVelocity(gear)
9759
0efa9672c000 * turned out the no-flight zone is also a no-climb-and-progress zone
sheepluva
parents: 9758
diff changeset
   454
	dx, dy = GetGearVelocity(hero.gear)
0efa9672c000 * turned out the no-flight zone is also a no-climb-and-progress zone
sheepluva
parents: 9758
diff changeset
   455
	SetGearVelocity(hero.gear, dx, math.max(dy, 0))
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   456
end
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   457
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   458
function nonAntiFlyArea(gear)
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   459
	heroAtAntiFlyArea = false
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   460
	AddAmmo(hero.gear, amJetpack, 99)
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   461
end
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   462
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   463
function heroDeath(gear)
14509
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   464
	SendStat(siGameResult, string.format(loc("%s lost, try again!"), hero.name))
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9810
diff changeset
   465
	SendStat(siCustomAchievement, loc("To win the game you have to stand next to Thanta."))
12529
89d3c3ebc925 Improve and fix poor messaging in ASA: A frozen adventure
Wuzzy <almikes@aol.com>
parents: 12522
diff changeset
   466
	SendStat(siCustomAchievement, loc("Most of the time you'll be able to use the freezer only."))
89d3c3ebc925 Improve and fix poor messaging in ASA: A frozen adventure
Wuzzy <almikes@aol.com>
parents: 12522
diff changeset
   467
	SendStat(siCustomAchievement, loc("Use the bazooka and the flying saucer to get the freezer."))
12571
903a30fb49e6 Fix team colors of most teams in A Space Adventure to denote correct ally status
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   468
	sendSimpleTeamRankings({teamB.name, teamC.name, teamA.name})
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   469
	EndGame()
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   470
end
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   471
9346
1245c7636380 more changes, events and bots fighting - also map drawing corrections
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9344
diff changeset
   472
function heroFinalStep(gear)
9390
9956b1fbac8b rounds that hogs remain frozen seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9388
diff changeset
   473
	heroAtFinalStep = true
9582
bf314b2258b3 less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9578
diff changeset
   474
	saveCheckpoint("3")
9490
b93448b75fa4 fix bugs and some changes regarting the difficulty in desert02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9410
diff changeset
   475
	SaveCampaignVar("HeroHealth", GetHealth(hero.gear))
12532
3e6e7b258a33 ASA, a frozen adventure: Save bazooka and excess freezers in checkpoints
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   476
	SaveCampaignVar("HeroAmmoIce01IceGun", GetAmmoCount(hero.gear, amIceGun))
3e6e7b258a33 ASA, a frozen adventure: Save bazooka and excess freezers in checkpoints
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   477
	SaveCampaignVar("HeroAmmoIce01Bazooka", GetAmmoCount(hero.gear, amBazooka))
13643
690cc84e9fd6 Use capcolDefault in Lua scripts
Wuzzy <Wuzzy2@mail.ru>
parents: 13583
diff changeset
   478
	AddCaption(loc("Checkpoint reached!"), capcolDefault, capgrpMessage2)
9346
1245c7636380 more changes, events and bots fighting - also map drawing corrections
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9344
diff changeset
   479
end
1245c7636380 more changes, events and bots fighting - also map drawing corrections
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9344
diff changeset
   480
9386
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   481
function columnCheckPoint(gear)
9582
bf314b2258b3 less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9578
diff changeset
   482
	saveCheckpoint("2")
9388
790d4f7d57d1 3rd checkpoint, event to stop game when Thanta is dead
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9386
diff changeset
   483
	SaveCampaignVar("HeroHealth", GetHealth(hero.gear))
13643
690cc84e9fd6 Use capcolDefault in Lua scripts
Wuzzy <Wuzzy2@mail.ru>
parents: 13583
diff changeset
   484
	AddCaption(loc("Checkpoint reached!"), capcolDefault, capgrpMessage2)
12532
3e6e7b258a33 ASA, a frozen adventure: Save bazooka and excess freezers in checkpoints
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   485
	SaveCampaignVar("HeroAmmoIce01IceGun", GetAmmoCount(hero.gear, amIceGun))
3e6e7b258a33 ASA, a frozen adventure: Save bazooka and excess freezers in checkpoints
Wuzzy <almikes@aol.com>
parents: 12531
diff changeset
   486
	SaveCampaignVar("HeroAmmoIce01Bazooka", GetAmmoCount(hero.gear, amBazooka))
9386
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   487
end
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   488
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   489
function heroAtIceGun(gear)
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   490
	iceGunTaken=true
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   491
end
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   492
9388
790d4f7d57d1 3rd checkpoint, event to stop game when Thanta is dead
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9386
diff changeset
   493
function thantaDeath(gear)
14509
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   494
	SendStat(siGameResult, string.format(loc("%s lost, try again!"), hero.name))
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9810
diff changeset
   495
	SendStat(siCustomAchievement, loc("Noo, Thanta has to stay alive!"))
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9810
diff changeset
   496
	SendStat(siCustomAchievement, loc("To win the game you have to go next to Thanta."))
12529
89d3c3ebc925 Improve and fix poor messaging in ASA: A frozen adventure
Wuzzy <almikes@aol.com>
parents: 12522
diff changeset
   497
	SendStat(siCustomAchievement, loc("Most of the time you'll be able to use the freezer only."))
89d3c3ebc925 Improve and fix poor messaging in ASA: A frozen adventure
Wuzzy <almikes@aol.com>
parents: 12522
diff changeset
   498
	SendStat(siCustomAchievement, loc("Use the bazooka and the flying saucer to get the freezer."))
12571
903a30fb49e6 Fix team colors of most teams in A Space Adventure to denote correct ally status
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   499
	sendSimpleTeamRankings({teamB.name, teamC.name, teamA.name})
9388
790d4f7d57d1 3rd checkpoint, event to stop game when Thanta is dead
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9386
diff changeset
   500
	EndGame()
790d4f7d57d1 3rd checkpoint, event to stop game when Thanta is dead
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9386
diff changeset
   501
end
790d4f7d57d1 3rd checkpoint, event to stop game when Thanta is dead
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9386
diff changeset
   502
9394
ccc2a2099370 event for game win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9392
diff changeset
   503
function heroWin(gear)
12529
89d3c3ebc925 Improve and fix poor messaging in ASA: A frozen adventure
Wuzzy <almikes@aol.com>
parents: 12522
diff changeset
   504
	SetGearMessage(gear, 0)
9400
b0c1b1972947 added dialog at hero win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9398
diff changeset
   505
	if GetX(hero.gear) < GetX(bandit1.gear) then
b0c1b1972947 added dialog at hero win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9398
diff changeset
   506
		HogTurnLeft(bandit1.gear, true)
b0c1b1972947 added dialog at hero win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9398
diff changeset
   507
	else
b0c1b1972947 added dialog at hero win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9398
diff changeset
   508
		HogTurnLeft(bandit1.gear, false)
b0c1b1972947 added dialog at hero win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9398
diff changeset
   509
	end
b0c1b1972947 added dialog at hero win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9398
diff changeset
   510
	AddAnim(dialog02)
9394
ccc2a2099370 event for game win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9392
diff changeset
   511
end
ccc2a2099370 event for game win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9392
diff changeset
   512
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   513
-------------- ANIMATIONS ------------------
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   514
9386
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   515
function Skipanim(anim)
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   516
	if goals[anim] ~= nil then
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   517
		ShowMission(unpack(goals[anim]))
12529
89d3c3ebc925 Improve and fix poor messaging in ASA: A frozen adventure
Wuzzy <almikes@aol.com>
parents: 12522
diff changeset
   518
	end
89d3c3ebc925 Improve and fix poor messaging in ASA: A frozen adventure
Wuzzy <almikes@aol.com>
parents: 12522
diff changeset
   519
	if anim == dialog02 then
9400
b0c1b1972947 added dialog at hero win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9398
diff changeset
   520
		actionsOnWin()
9734
da2cb993fd61 fixed moving npc and flying in forbidden area in ice01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   521
	else
da2cb993fd61 fixed moving npc and flying in forbidden area in ice01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   522
		AnimSwitchHog(hero.gear)
9400
b0c1b1972947 added dialog at hero win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9398
diff changeset
   523
	end
9386
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   524
end
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   525
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   526
function AnimationSetup()
9386
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   527
	-- DIALOG 01 - Start, welcome to moon
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   528
	AddSkipFunction(dialog01, Skipanim, {dialog01})
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   529
	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9810
diff changeset
   530
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("On the Ice Planet, where ice rules ..."), 5000}})
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9810
diff changeset
   531
	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("Finally you are here!"), SAY_SAY, 2000}})
9386
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   532
	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 2000}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9810
diff changeset
   533
	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Hi! Nice to meet you."), SAY_SAY, 3000}})
9386
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   534
	table.insert(dialog01, {func = AnimWait, args = {ally.gear, 2000}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9810
diff changeset
   535
	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("Listen carefully! The bandit leader, Thanta, has recently found a very strange device."), SAY_SAY, 4000}})
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9810
diff changeset
   536
	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("He doesn't know it but this device is a part of the anti-gravity device."), SAY_SAY, 2500}})
9386
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   537
	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 8000}})
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   538
	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Nice, then I should get the part as soon as possible!"), SAY_SAY, 4000}})
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   539
	table.insert(dialog01, {func = AnimWait, args = {ally.gear, 4000}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9810
diff changeset
   540
	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("Be careful, your gadgets won't work in the bandit area. You should get an ice gun."), SAY_SAY, 7000}})
9386
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   541
	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("There is one below us!"), SAY_SAY, 4000}})
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   542
	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
808d38b2182c map changes to let hog climb, checkpoint one after icegun,starting dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9384
diff changeset
   543
	table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}})
12529
89d3c3ebc925 Improve and fix poor messaging in ASA: A frozen adventure
Wuzzy <almikes@aol.com>
parents: 12522
diff changeset
   544
	table.insert(dialog01, {func = ShowMission, args = goals[dialog01]})
89d3c3ebc925 Improve and fix poor messaging in ASA: A frozen adventure
Wuzzy <almikes@aol.com>
parents: 12522
diff changeset
   545
	-- DIALOG 02 - Hero got to Thanta
9623
d3f7d1b8b46d end game when skip in last dialog
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9622
diff changeset
   546
	AddSkipFunction(dialog02, Skipanim, {dialog02})
9400
b0c1b1972947 added dialog at hero win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9398
diff changeset
   547
	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 3000}})
9402
8e9d062f9a48 ice01 custom stats for defeat
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9400
diff changeset
   548
	table.insert(dialog02, {func = AnimSay, args = {bandit1.gear, loc("Oh! Please spare me. You can take all my treasures!"), SAY_SAY, 3000}})
9400
b0c1b1972947 added dialog at hero win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9398
diff changeset
   549
	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 5000}})
b0c1b1972947 added dialog at hero win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9398
diff changeset
   550
	table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("I just want the strange device you found!"), SAY_SAY, 3000}})
b0c1b1972947 added dialog at hero win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9398
diff changeset
   551
	table.insert(dialog02, {func = AnimWait, args = {bandit1.gear, 4000}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9810
diff changeset
   552
	table.insert(dialog02, {func = AnimSay, args = {bandit1.gear, loc("Here! Take it!"), SAY_SAY, 3000}})
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9757
diff changeset
   553
	table.insert(dialog02, {func = actionsOnWin, args = {}})
9344
f8e7e9858a8c ice planet mission wip
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9340
diff changeset
   554
end
9400
b0c1b1972947 added dialog at hero win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9398
diff changeset
   555
b0c1b1972947 added dialog at hero win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9398
diff changeset
   556
-------------- Other Functions -------------------
b0c1b1972947 added dialog at hero win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9398
diff changeset
   557
b0c1b1972947 added dialog at hero win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9398
diff changeset
   558
function actionsOnWin()
12529
89d3c3ebc925 Improve and fix poor messaging in ASA: A frozen adventure
Wuzzy <almikes@aol.com>
parents: 12522
diff changeset
   559
	AddCaption(loc("Anti-Gravity Device Part (+1)"), GetClanColor(GetHogClan(hero.gear)), capgrpAmmoinfo)
89d3c3ebc925 Improve and fix poor messaging in ASA: A frozen adventure
Wuzzy <almikes@aol.com>
parents: 12522
diff changeset
   560
	PlaySound(sndShotgunReload)
89d3c3ebc925 Improve and fix poor messaging in ASA: A frozen adventure
Wuzzy <almikes@aol.com>
parents: 12522
diff changeset
   561
89d3c3ebc925 Improve and fix poor messaging in ASA: A frozen adventure
Wuzzy <almikes@aol.com>
parents: 12522
diff changeset
   562
	ShowMission(missionName, loc("Win"), loc("Congratulations, you collected the device part!"), 1, 3500)
89d3c3ebc925 Improve and fix poor messaging in ASA: A frozen adventure
Wuzzy <almikes@aol.com>
parents: 12522
diff changeset
   563
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9757
diff changeset
   564
	saveCompletedStatus(4)
9757
9be28be004d4 string tweaks and whitespace fixes
sheepluva
parents: 9734
diff changeset
   565
	SendStat(siGameResult, loc("Congratulations, you acquired the device part!"))
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9810
diff changeset
   566
	SendStat(siCustomAchievement, string.format(loc("At the end of the game your health was %d."), GetHealth(hero.gear)))
9402
8e9d062f9a48 ice01 custom stats for defeat
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9400
diff changeset
   567
	-- maybe add number of tries for each part?
12571
903a30fb49e6 Fix team colors of most teams in A Space Adventure to denote correct ally status
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   568
	sendSimpleTeamRankings({teamC.name, teamA.name, teamB.name})
12531
e12e2dfda06f ASA: Reset checkpoint after completing checkpointed mission
Wuzzy <almikes@aol.com>
parents: 12530
diff changeset
   569
	resetCheckpoint() -- reset this mission
9400
b0c1b1972947 added dialog at hero win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9398
diff changeset
   570
	EndGame()
b0c1b1972947 added dialog at hero win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9398
diff changeset
   571
end