share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit01.lua
author sheepluva
Tue, 22 Jun 2021 22:13:55 +0200
changeset 15824 d5c37e78ab83
parent 15106 84bab72a0b7f
permissions -rw-r--r--
hedgewars-engine (rust): fix "protocol_version" -> "hedgewars_engine_protocol_version" That function/symbol was renamed in ef2fc0210362
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     1
------------------- ABOUT ----------------------
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     2
--
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     3
-- In this adventure hero visits the fruit planet
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     4
-- to search for the missing part. However, a war
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     5
-- has broke out and hero has to take part or leave.
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     6
9523
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
     7
-- NOTES:
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
     8
-- There is an ugly hack out there! I use 2 Captain Limes
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
     9
-- One in human level and one in bot level
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
    10
-- I want to have a Captain Lime in human level when the game
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
    11
-- begins because in animation if the hog is in bot level skip
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
    12
-- doesn't work - onPrecise() isn't triggered
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
    13
-- Later I want the hog to take place in the battle in bot level
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
    14
-- However if I use SetHogLevel I get an error: Engine bug: AI may break demos playing
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
    15
-- So I have 2 hogs, one in bot level and one in hog level that I hide them
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
    16
-- or restore them regarding the case
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
    17
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    18
HedgewarsScriptLoad("/Scripts/Locale.lua")
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    19
HedgewarsScriptLoad("/Scripts/Animate.lua")
9578
16139270448f save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
    20
HedgewarsScriptLoad("/Missions/Campaign/A_Space_Adventure/global_functions.lua")
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    21
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    22
----------------- VARIABLES --------------------
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    23
-- globals
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9525
diff changeset
    24
local missionName = loc("Bad timing")
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
    25
local chooseToBattle = false
12607
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
    26
local awaitingInput = false
9498
54bfc44f9554 fixed bug that make hog not able to move
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9496
diff changeset
    27
local previousHog = 0
9643
cddb5de11af9 fixed bug that didn't set TurnTimeLeft in first round if dialog not skipped
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
    28
local heroPlayedFirstTurn = false
cddb5de11af9 fixed bug that didn't set TurnTimeLeft in first round if dialog not skipped
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
    29
local startBattleCalled = false
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    30
-- dialogs
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    31
local dialog01 = {}
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
    32
local dialog02 = {}
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
    33
local dialog03 = {}
12607
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
    34
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    35
-- mission objectives
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    36
local goals = {
12607
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
    37
	[dialog01] = {missionName, loc("Ready for Battle?"),
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
    38
		loc("Captain Lime offered his help if you assist him in battle.").."|"..
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
    39
		loc("What do you want to do?").."| |"..
12609
12d4886de2b1 ASA, fruit01: Change choice keys
Wuzzy <almikes@aol.com>
parents: 12608
diff changeset
    40
		loc("Fight: Press [Attack]").."|"..
15089
6f51c75994a4 Semi-standardize usage of icons in many mission panels
Wuzzy <Wuzzy2@mail.ru>
parents: 15023
diff changeset
    41
		loc("Flee: Press [Jump]"), 3, 9999000, true},
14509
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
    42
	[dialog02] = {missionName, loc("Battle Starts Now!"), loc("You have chosen to fight!").."|"..loc("Lead your allies to battle and eliminate all the enemies!"), 1, 5000},
12608
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
    43
	[dialog03] = {missionName, loc("Time to run!"), loc("You have chosen to flee.").."|"..loc("You have to reach the left-most place on the map."), 1, 5000},
15089
6f51c75994a4 Semi-standardize usage of icons in many mission panels
Wuzzy <Wuzzy2@mail.ru>
parents: 15023
diff changeset
    44
	["fight"] = {missionName, loc("Ready for Battle?"), loc("You have chosen to fight!"), 2, 2000},
6f51c75994a4 Semi-standardize usage of icons in many mission panels
Wuzzy <Wuzzy2@mail.ru>
parents: 15023
diff changeset
    45
	["flee"] = {missionName, loc("Coward"), loc("You have chosen to flee."), 2, 2000},
12608
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
    46
	["flee_final"] = {missionName, loc("Time to run!"), loc("Knock off the enemies from the left-most place of the map!") .. "|" .. loc("Stay there to flee!"), 1, 6000},
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    47
}
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
    48
-- crates
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
    49
local crateWMX = 2170
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
    50
local crateWMY = 1950
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
    51
local health1X = 2680
9508
c23bff98e3d2 added crates
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9506
diff changeset
    52
local health1Y = 916
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    53
-- hogs
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    54
local hero = {}
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    55
local yellow1 = {}
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    56
local green1 = {}
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    57
local green2 = {}
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    58
local green3 = {}
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    59
local green4 = {}
9523
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
    60
local green5 = {}
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    61
-- teams
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    62
local teamA = {}
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    63
local teamB = {}
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    64
local teamC = {}
9523
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
    65
local teamD = {}
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    66
-- hedgehogs values
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9525
diff changeset
    67
hero.name = loc("Hog Solo")
9523
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
    68
hero.x = 3350
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
    69
hero.y = 365
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    70
hero.dead = false
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9525
diff changeset
    71
green1.name = loc("Captain Lime")
9523
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
    72
green1.x = 3300
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
    73
green1.y = 395
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
    74
green1.dead = false
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9525
diff changeset
    75
green2.name = loc("Mister Pear")
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    76
green2.x = 3600
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    77
green2.y = 1570
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9525
diff changeset
    78
green3.name = loc("Lady Mango")
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    79
green3.x = 2170
9500
c9487f415fd3 some changes in the map, hog placing etc
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9498
diff changeset
    80
green3.y = 980
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9525
diff changeset
    81
green4.name = loc("Green Hog Grape")
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    82
green4.x = 2900
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    83
green4.y = 1650
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9525
diff changeset
    84
green5.name = loc("Mr Mango")
9523
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
    85
green5.x = 1350
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
    86
green5.y = 850
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9525
diff changeset
    87
yellow1.name = loc("General Lemon")
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    88
yellow1.x = 140
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    89
yellow1.y = 1980
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    90
local yellowArmy = {
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9525
diff changeset
    91
	{name = loc("Robert Yellow Apple"), x = 710, y = 1780, health = 100},
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9525
diff changeset
    92
	{name = loc("Summer Squash"), x = 315 , y = 1960, health = 100},
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9525
diff changeset
    93
	{name = loc("Tall Potato"), x = 830 , y = 1748, health = 80},
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9525
diff changeset
    94
	{name = loc("Yellow Pepper"), x = 2160 , y = 820, health = 60},
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9525
diff changeset
    95
	{name = loc("Corn"), x = 1320 , y = 740, health = 60},
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9525
diff changeset
    96
	{name = loc("Max Citrus"), x = 1900 , y = 1700, health = 40},
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9525
diff changeset
    97
	{name = loc("Naranja Jed"), x = 960 , y = 516, health = 40},
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    98
}
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    99
teamA.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: 13468
diff changeset
   100
teamA.color = -6
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   101
teamB.name = loc("Green Bananas")
13583
141cdfe0f3ca Switch almost all Lua calls of AddTeam to using default clan colors instead of hardcoded color
Wuzzy <Wuzzy2@mail.ru>
parents: 13468
diff changeset
   102
teamB.color = -6
9508
c23bff98e3d2 added crates
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9506
diff changeset
   103
teamC.name = loc("Yellow Watermelons")
13583
141cdfe0f3ca Switch almost all Lua calls of AddTeam to using default clan colors instead of hardcoded color
Wuzzy <Wuzzy2@mail.ru>
parents: 13468
diff changeset
   104
teamC.color = -9
9523
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
   105
teamD.name = loc("Captain Lime")
13583
141cdfe0f3ca Switch almost all Lua calls of AddTeam to using default clan colors instead of hardcoded color
Wuzzy <Wuzzy2@mail.ru>
parents: 13468
diff changeset
   106
teamD.color = -6
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   107
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   108
function onGameInit()
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   109
	Seed = 1
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   110
	TurnTime = 20000
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   111
	CaseFreq = 0
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   112
	MinesNum = 0
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   113
	MinesTime = 1
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   114
	Explosives = 0
12224
d62d6f8ebef1 Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents: 12088
diff changeset
   115
	-- Disable Sudden Death
d62d6f8ebef1 Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents: 12088
diff changeset
   116
	HealthDecrease = 0
d62d6f8ebef1 Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents: 12088
diff changeset
   117
	WaterRise = 0
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   118
	HealthCaseAmount = 50
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   119
	Map = "fruit01_map"
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   120
	Theme = "Fruit"
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   121
14509
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   122
	-- Hero
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   123
	teamA.name = AddMissionTeam(teamA.color)
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   124
	hero.gear = AddMissionHog(100)
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   125
	hero.name = GetHogName(hero.gear)
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   126
	AnimSetGearPosition(hero.gear, hero.x, hero.y)
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   127
	HogTurnLeft(hero.gear, true)
9523
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
   128
	-- Captain Lime
14953
ff4003a90ff8 Enable automatic voicepack language selection for all missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14919
diff changeset
   129
	teamD.name = AddTeam(teamD.name, teamD.color, "Cherry", "Island", "Default_qau", "congo-brazzaville")
12580
ef71e032254f ASA, fruit01: Use 1 hog instead of 2 for Captain Lime
Wuzzy <almikes@aol.com>
parents: 12575
diff changeset
   130
	green1.gear = AddHog(green1.name, 0, 200, "war_desertofficer")
ef71e032254f ASA, fruit01: Use 1 hog instead of 2 for Captain Lime
Wuzzy <almikes@aol.com>
parents: 12575
diff changeset
   131
	AnimSetGearPosition(green1.gear, green1.x, green1.y)
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   132
	-- Green Bananas
14953
ff4003a90ff8 Enable automatic voicepack language selection for all missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14919
diff changeset
   133
	teamB.name = AddTeam(teamB.name, teamB.color, "Cherry", "Island", "Default_qau", "congo-brazzaville")
9629
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9626
diff changeset
   134
	green2.gear = AddHog(green2.name, 0, 100, "war_britmedic")
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   135
	AnimSetGearPosition(green2.gear, green2.x, green2.y)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   136
	HogTurnLeft(green2.gear, true)
9629
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9626
diff changeset
   137
	green3.gear = AddHog(green3.name, 0, 100, "hair_red")
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   138
	AnimSetGearPosition(green3.gear, green3.x, green3.y)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   139
	HogTurnLeft(green3.gear, true)
9629
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9626
diff changeset
   140
	green4.gear = AddHog(green4.name, 0, 100, "war_desertsapper1")
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   141
	AnimSetGearPosition(green4.gear, green4.x, green4.y)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   142
	HogTurnLeft(green4.gear, true)
9629
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9626
diff changeset
   143
	green5.gear = AddHog(green5.name, 0, 100, "war_sovietcomrade2")
9523
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
   144
	AnimSetGearPosition(green5.gear, green5.x, green5.y)
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
   145
	HogTurnLeft(green5.gear, true)
9508
c23bff98e3d2 added crates
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9506
diff changeset
   146
	-- Yellow Watermelons
14953
ff4003a90ff8 Enable automatic voicepack language selection for all missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14919
diff changeset
   147
	teamC.name = AddTeam(teamC.name, teamC.color, "Flower", "Island", "Default_qau", "cm_mog")
9629
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9626
diff changeset
   148
	yellow1.gear = AddHog(yellow1.name, 1, 100, "war_desertgrenadier2")
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   149
	AnimSetGearPosition(yellow1.gear, yellow1.x, yellow1.y)
9508
c23bff98e3d2 added crates
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9506
diff changeset
   150
	-- the rest of the Yellow Watermelons
9629
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9626
diff changeset
   151
	local yellowHats = { "fr_apple", "fr_banana", "fr_lemon", "fr_orange" }
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
   152
	for i=1,7 do
9810
54c0fdec4600 changing math functions that may cause desyncs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9758
diff changeset
   153
		yellowArmy[i].gear = AddHog(yellowArmy[i].name, 1, yellowArmy[i].health, yellowHats[GetRandom(4)+1])
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
   154
		AnimSetGearPosition(yellowArmy[i].gear, yellowArmy[i].x, yellowArmy[i].y)
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
   155
	end
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   156
9582
bf314b2258b3 less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9578
diff changeset
   157
	initCheckpoint("fruit01")
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
   158
12088
1da37e2ba6fd Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   159
	AnimInit(true)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   160
	AnimationSetup()
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   161
end
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   162
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   163
function onGameStart()
12607
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   164
	AnimSetInputMask(0)
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   165
	AnimWait(hero.gear, 3000)
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   166
	FollowGear(hero.gear)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   167
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   168
	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   169
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   170
	-- Green team weapons
9523
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
   171
	local greenArmy = { green1, green2 }
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
   172
	for i=1,2 do
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
   173
		AddAmmo(greenArmy[i].gear, amBlowTorch, 5)
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
   174
		AddAmmo(greenArmy[i].gear, amRope, 5)
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
   175
		AddAmmo(greenArmy[i].gear, amBazooka, 10)
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
   176
		AddAmmo(greenArmy[i].gear, amGrenade, 7)
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
   177
		AddAmmo(greenArmy[i].gear, amFirePunch, 2)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   178
		AddAmmo(greenArmy[i].gear, amDrill, 3)
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   179
		AddAmmo(greenArmy[i].gear, amSwitch, 2)
9523
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
   180
		AddAmmo(greenArmy[i].gear, amSkip, 100)
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
   181
	end
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   182
	-- Yellow team weapons
9494
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   183
	AddAmmo(yellow1.gear, amBlowTorch, 1)
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   184
	AddAmmo(yellow1.gear, amRope, 1)
9500
c9487f415fd3 some changes in the map, hog placing etc
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9498
diff changeset
   185
	AddAmmo(yellow1.gear, amBazooka, 10)
c9487f415fd3 some changes in the map, hog placing etc
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9498
diff changeset
   186
	AddAmmo(yellow1.gear, amGrenade, 10)
c9487f415fd3 some changes in the map, hog placing etc
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9498
diff changeset
   187
	AddAmmo(yellow1.gear, amFirePunch, 5)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   188
	AddAmmo(yellow1.gear, amDrill, 3)
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   189
	AddAmmo(yellow1.gear, amBee, 1)
9523
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
   190
	AddAmmo(yellow1.gear, amMortar, 3)
9500
c9487f415fd3 some changes in the map, hog placing etc
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9498
diff changeset
   191
	AddAmmo(yellow1.gear, amDEagle, 4)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   192
	AddAmmo(yellow1.gear, amDynamite, 1)
9500
c9487f415fd3 some changes in the map, hog placing etc
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9498
diff changeset
   193
	AddAmmo(yellow1.gear, amSwitch, 100)
c9487f415fd3 some changes in the map, hog placing etc
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9498
diff changeset
   194
	for i=3,7 do
c9487f415fd3 some changes in the map, hog placing etc
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9498
diff changeset
   195
		HideHog(yellowArmy[i].gear)
9494
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   196
	end
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   197
9508
c23bff98e3d2 added crates
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9506
diff changeset
   198
	-- crates
c23bff98e3d2 added crates
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9506
diff changeset
   199
	SpawnHealthCrate(health1X, health1Y)
12933
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12901
diff changeset
   200
	SpawnSupplyCrate(crateWMX, crateWMY, amWatermelon)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   201
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   202
	AddAnim(dialog01)
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   203
	SendHealthStatsOff()
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   204
end
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   205
9494
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   206
function onNewTurn()
9643
cddb5de11af9 fixed bug that didn't set TurnTimeLeft in first round if dialog not skipped
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   207
	if not heroPlayedFirstTurn and CurrentHedgehog ~= hero.gear and startBattleCalled then
12514
d89dabfd07ce Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents: 12224
diff changeset
   208
		EndTurn(true)
9643
cddb5de11af9 fixed bug that didn't set TurnTimeLeft in first round if dialog not skipped
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   209
	elseif not heroPlayedFirstTurn and CurrentHedgehog == hero.gear and startBattleCalled then
cddb5de11af9 fixed bug that didn't set TurnTimeLeft in first round if dialog not skipped
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   210
		heroPlayedFirstTurn = true
9740
d159ddae0358 fixed user gain control of npc, rope cheat and overlapping bubbles in fruit01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9643
diff changeset
   211
	elseif not heroPlayedFirstTurn and CurrentHedgehog == green1.gear then
12514
d89dabfd07ce Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents: 12224
diff changeset
   212
		EndTurn(true)
9643
cddb5de11af9 fixed bug that didn't set TurnTimeLeft in first round if dialog not skipped
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   213
	else
cddb5de11af9 fixed bug that didn't set TurnTimeLeft in first round if dialog not skipped
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   214
		if chooseToBattle then
cddb5de11af9 fixed bug that didn't set TurnTimeLeft in first round if dialog not skipped
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   215
			if CurrentHedgehog == green1.gear then
cddb5de11af9 fixed bug that didn't set TurnTimeLeft in first round if dialog not skipped
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   216
				TotalRounds = TotalRounds - 2
cddb5de11af9 fixed bug that didn't set TurnTimeLeft in first round if dialog not skipped
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   217
				AnimSwitchHog(previousHog)
12514
d89dabfd07ce Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents: 12224
diff changeset
   218
				EndTurn(true)
9643
cddb5de11af9 fixed bug that didn't set TurnTimeLeft in first round if dialog not skipped
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   219
			end
cddb5de11af9 fixed bug that didn't set TurnTimeLeft in first round if dialog not skipped
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   220
			previousHog = CurrentHedgehog
9510
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   221
		end
9643
cddb5de11af9 fixed bug that didn't set TurnTimeLeft in first round if dialog not skipped
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   222
		getNextWave()
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   223
	end
9494
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   224
end
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   225
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   226
function onGameTick()
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   227
	AnimUnWait()
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   228
	if ShowAnimation() == false then
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   229
		return
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   230
	end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   231
	ExecuteAfterAnimations()
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   232
	CheckEvents()
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   233
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   234
12624
705dde538519 ACF1, fruit01, WxW: Make sure the selection dialogues never disappear on their own
Wuzzy <almikes@aol.com>
parents: 12609
diff changeset
   235
local choiceDialogTimer = 0
705dde538519 ACF1, fruit01, WxW: Make sure the selection dialogues never disappear on their own
Wuzzy <almikes@aol.com>
parents: 12609
diff changeset
   236
function onGameTick20()
705dde538519 ACF1, fruit01, WxW: Make sure the selection dialogues never disappear on their own
Wuzzy <almikes@aol.com>
parents: 12609
diff changeset
   237
  -- Make sure the choice dialog never disappears while it is active
705dde538519 ACF1, fruit01, WxW: Make sure the selection dialogues never disappear on their own
Wuzzy <almikes@aol.com>
parents: 12609
diff changeset
   238
  if awaitingInput then
705dde538519 ACF1, fruit01, WxW: Make sure the selection dialogues never disappear on their own
Wuzzy <almikes@aol.com>
parents: 12609
diff changeset
   239
    choiceDialogTimer = choiceDialogTimer + 20
705dde538519 ACF1, fruit01, WxW: Make sure the selection dialogues never disappear on their own
Wuzzy <almikes@aol.com>
parents: 12609
diff changeset
   240
    if choiceDialogTimer > 9990000 then
705dde538519 ACF1, fruit01, WxW: Make sure the selection dialogues never disappear on their own
Wuzzy <almikes@aol.com>
parents: 12609
diff changeset
   241
      ShowMission(unpack(goals[dialog01]))
705dde538519 ACF1, fruit01, WxW: Make sure the selection dialogues never disappear on their own
Wuzzy <almikes@aol.com>
parents: 12609
diff changeset
   242
      choiceDialogTimer = 0
705dde538519 ACF1, fruit01, WxW: Make sure the selection dialogues never disappear on their own
Wuzzy <almikes@aol.com>
parents: 12609
diff changeset
   243
    end
705dde538519 ACF1, fruit01, WxW: Make sure the selection dialogues never disappear on their own
Wuzzy <almikes@aol.com>
parents: 12609
diff changeset
   244
  end
705dde538519 ACF1, fruit01, WxW: Make sure the selection dialogues never disappear on their own
Wuzzy <almikes@aol.com>
parents: 12609
diff changeset
   245
end
705dde538519 ACF1, fruit01, WxW: Make sure the selection dialogues never disappear on their own
Wuzzy <almikes@aol.com>
parents: 12609
diff changeset
   246
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   247
function onGearDelete(gear)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   248
	if gear == hero.gear then
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   249
		hero.dead = true
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   250
	elseif gear == green1.gear then
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   251
		green1.dead = true
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   252
	end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   253
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   254
9508
c23bff98e3d2 added crates
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9506
diff changeset
   255
function onAmmoStoreInit()
c23bff98e3d2 added crates
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9506
diff changeset
   256
	SetAmmo(amWatermelon, 0, 0, 0, 1)
c23bff98e3d2 added crates
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9506
diff changeset
   257
end
c23bff98e3d2 added crates
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9506
diff changeset
   258
15023
3ed1cbd31754 Backed out changeset 4596357d002d (onPreciseLocal causes desyncs)
Wuzzy <Wuzzy2@mail.ru>
parents: 14953
diff changeset
   259
function onPrecise()
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   260
	if GameTime > 3000 then
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   261
		SetAnimSkip(true)
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   262
	end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   263
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   264
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   265
function onHogHide(gear)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   266
	for i=3,7 do
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   267
		if gear == yellowArmy[i].gear then
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   268
			yellowArmy[i].hidden = true
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   269
			break
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   270
		end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   271
	end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   272
end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   273
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   274
function onHogRestore(gear)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   275
	for i=3,7 do
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   276
		if gear == yellowArmy[i].gear then
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   277
			yellowArmy[i].hidden = false
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   278
			break
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   279
		end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   280
	end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   281
end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   282
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   283
-------------- EVENTS ------------------
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   284
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   285
function onHeroDeath(gear)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   286
	if hero.dead then
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   287
		return true
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   288
	end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   289
	return false
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   290
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   291
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   292
function onGreen1Death(gear)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   293
	if green1.dead then
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   294
		return true
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   295
	end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   296
	return false
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   297
end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   298
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   299
function onBattleWin(gear)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   300
	for i=1,7 do
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   301
		if i<3 then
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   302
			if GetHealth(yellowArmy[i].gear) then
15102
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15098
diff changeset
   303
				return false
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   304
			end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   305
		else
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   306
			if GetHealth(yellowArmy[i].gear) and not yellowArmy[i].hidden then
15102
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15098
diff changeset
   307
				return false
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   308
			end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   309
		end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   310
	end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   311
	if GetHealth(yellow1.gear) then
15102
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15098
diff changeset
   312
		return false
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   313
	end
15102
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15098
diff changeset
   314
	if (not IsHogAlive(gear)) or (not StoppedGear(gear)) then
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15098
diff changeset
   315
		return false
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15098
diff changeset
   316
	end
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15098
diff changeset
   317
	return true
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   318
end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   319
15098
a2d09a597fbb ASA fruit01: Recognize victory if killing all enemy hogs in "flee" variant
Wuzzy <Wuzzy2@mail.ru>
parents: 15089
diff changeset
   320
function onEscapeWinByKill(gear)
a2d09a597fbb ASA fruit01: Recognize victory if killing all enemy hogs in "flee" variant
Wuzzy <Wuzzy2@mail.ru>
parents: 15089
diff changeset
   321
	for i=1,7 do
a2d09a597fbb ASA fruit01: Recognize victory if killing all enemy hogs in "flee" variant
Wuzzy <Wuzzy2@mail.ru>
parents: 15089
diff changeset
   322
		if GetHealth(yellowArmy[i].gear) or yellowArmy[i].hidden then
15102
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15098
diff changeset
   323
			return false
15098
a2d09a597fbb ASA fruit01: Recognize victory if killing all enemy hogs in "flee" variant
Wuzzy <Wuzzy2@mail.ru>
parents: 15089
diff changeset
   324
		end
a2d09a597fbb ASA fruit01: Recognize victory if killing all enemy hogs in "flee" variant
Wuzzy <Wuzzy2@mail.ru>
parents: 15089
diff changeset
   325
	end
a2d09a597fbb ASA fruit01: Recognize victory if killing all enemy hogs in "flee" variant
Wuzzy <Wuzzy2@mail.ru>
parents: 15089
diff changeset
   326
	if GetHealth(yellow1.gear) then
15102
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15098
diff changeset
   327
		return false
15098
a2d09a597fbb ASA fruit01: Recognize victory if killing all enemy hogs in "flee" variant
Wuzzy <Wuzzy2@mail.ru>
parents: 15089
diff changeset
   328
	end
15102
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15098
diff changeset
   329
	if (not IsHogAlive(gear)) or (not StoppedGear(gear)) then
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15098
diff changeset
   330
		return false
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15098
diff changeset
   331
	end
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15098
diff changeset
   332
	return true
15098
a2d09a597fbb ASA fruit01: Recognize victory if killing all enemy hogs in "flee" variant
Wuzzy <Wuzzy2@mail.ru>
parents: 15089
diff changeset
   333
end
a2d09a597fbb ASA fruit01: Recognize victory if killing all enemy hogs in "flee" variant
Wuzzy <Wuzzy2@mail.ru>
parents: 15089
diff changeset
   334
12608
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
   335
function isHeroOnLaunchPad()
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
   336
	if not hero.dead and GetX(hero.gear) < 170 and GetY(hero.gear) > 1980 and StoppedGear(hero.gear) then
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
   337
		return true
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
   338
	end
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
   339
	return false
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
   340
end
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
   341
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
   342
function isLaunchPadEmpty(gear)
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
   343
	local yellowTeam = { yellow1, unpack(yellowArmy) }
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
   344
	for i=1, #yellowArmy+1 do
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
   345
		if not yellowTeam[i].hidden and GetHealth(yellowTeam[i].gear) and GetX(yellowTeam[i].gear) < 170 then
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
   346
			return false
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
   347
		end
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
   348
	end
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
   349
	return true
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
   350
end
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
   351
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
   352
function onHeroOnLaunchPadWithEnemies()
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
   353
	return isHeroOnLaunchPad() and not isLaunchPadEmpty()
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
   354
end
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
   355
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
   356
function heroOnLaunchPadWithEnemies()
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
   357
	ShowMission(unpack(goals["flee_final"]))
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
   358
end
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
   359
9504
cdba61cfba93 event for escape win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9502
diff changeset
   360
function onEscapeWin(gear)
9510
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   361
	local escape = false
12608
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
   362
	if isHeroOnLaunchPad() then
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
   363
		escape = isLaunchPadEmpty()
9504
cdba61cfba93 event for escape win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9502
diff changeset
   364
	end
9510
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   365
	return escape
9504
cdba61cfba93 event for escape win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9502
diff changeset
   366
end
cdba61cfba93 event for escape win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9502
diff changeset
   367
9639
6b2ae2eaf1b2 remove unnecessary comments
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9629
diff changeset
   368
-------------- ACTIONS ------------------
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   369
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   370
function heroDeath(gear)
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   371
	gameLost()
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   372
end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   373
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   374
function green1Death(gear)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   375
	gameLost()
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   376
end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   377
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   378
function battleWin(gear)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   379
	-- add stats
9578
16139270448f save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   380
	saveVariables()
14509
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   381
	SendStat(siGameResult, string.format(loc("%s won!"), teamB.name))
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   382
	SendStat(siCustomAchievement, loc("You have eliminated all visible enemy hedgehogs!"))
12538
952afc3d2df2 Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents: 12514
diff changeset
   383
	sendSimpleTeamRankings({teamA.name, teamD.name, teamB.name, teamC.name})
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   384
	EndGame()
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   385
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   386
9504
cdba61cfba93 event for escape win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9502
diff changeset
   387
function escapeWin(gear)
12608
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
   388
	RemoveEventFunc(heroOnLaunchPadWithEnemies)
9504
cdba61cfba93 event for escape win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9502
diff changeset
   389
	-- add stats
9578
16139270448f save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   390
	saveVariables()
14509
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   391
	SendStat(siGameResult, string.format(loc("%s escaped successfully!"), hero.name))
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   392
	SendStat(siCustomAchievement, loc("You have reached the take-off area successfully!"))
12538
952afc3d2df2 Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents: 12514
diff changeset
   393
	sendSimpleTeamRankings({teamA.name, teamD.name, teamB.name, teamC.name})
9504
cdba61cfba93 event for escape win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9502
diff changeset
   394
	EndGame()
cdba61cfba93 event for escape win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9502
diff changeset
   395
end
cdba61cfba93 event for escape win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9502
diff changeset
   396
15098
a2d09a597fbb ASA fruit01: Recognize victory if killing all enemy hogs in "flee" variant
Wuzzy <Wuzzy2@mail.ru>
parents: 15089
diff changeset
   397
function escapeWinByKill(gear)
a2d09a597fbb ASA fruit01: Recognize victory if killing all enemy hogs in "flee" variant
Wuzzy <Wuzzy2@mail.ru>
parents: 15089
diff changeset
   398
	RemoveEventFunc(heroOnLaunchPadWithEnemies)
a2d09a597fbb ASA fruit01: Recognize victory if killing all enemy hogs in "flee" variant
Wuzzy <Wuzzy2@mail.ru>
parents: 15089
diff changeset
   399
	-- add stats
a2d09a597fbb ASA fruit01: Recognize victory if killing all enemy hogs in "flee" variant
Wuzzy <Wuzzy2@mail.ru>
parents: 15089
diff changeset
   400
	saveVariables()
a2d09a597fbb ASA fruit01: Recognize victory if killing all enemy hogs in "flee" variant
Wuzzy <Wuzzy2@mail.ru>
parents: 15089
diff changeset
   401
	SendStat(siGameResult, string.format(loc("%s won!"), teamB.name))
a2d09a597fbb ASA fruit01: Recognize victory if killing all enemy hogs in "flee" variant
Wuzzy <Wuzzy2@mail.ru>
parents: 15089
diff changeset
   402
	sendSimpleTeamRankings({teamA.name, teamD.name, teamB.name, teamC.name})
a2d09a597fbb ASA fruit01: Recognize victory if killing all enemy hogs in "flee" variant
Wuzzy <Wuzzy2@mail.ru>
parents: 15089
diff changeset
   403
	EndGame()
a2d09a597fbb ASA fruit01: Recognize victory if killing all enemy hogs in "flee" variant
Wuzzy <Wuzzy2@mail.ru>
parents: 15089
diff changeset
   404
end
a2d09a597fbb ASA fruit01: Recognize victory if killing all enemy hogs in "flee" variant
Wuzzy <Wuzzy2@mail.ru>
parents: 15089
diff changeset
   405
12607
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   406
function heroSelect()
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   407
	awaitingInput = false
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   408
	FollowGear(hero.gear)
12607
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   409
	if chooseToBattle == true then
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   410
		chooseToBattle = true
12607
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   411
		ShowMission(unpack(goals["fight"]))
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   412
		AddEvent(onGreen1Death, {green1.gear}, green1Death, {green1.gear}, 0)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   413
		AddEvent(onBattleWin, {hero.gear}, battleWin, {hero.gear}, 0)
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   414
		AddAnim(dialog02)
12607
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   415
	else
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   416
		ShowMission(unpack(goals["flee"]))
9510
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   417
		AddAmmo(green1.gear, amSwitch, 100)
12608
5976d1119534 ASA, fruit01: Show mission text when reaching launch pad with enemies
Wuzzy <almikes@aol.com>
parents: 12607
diff changeset
   418
		AddEvent(onHeroOnLaunchPadWithEnemies, {hero.gear}, heroOnLaunchPadWithEnemies, {hero.gear}, 0)
9504
cdba61cfba93 event for escape win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9502
diff changeset
   419
		AddEvent(onEscapeWin, {hero.gear}, escapeWin, {hero.gear}, 0)
15098
a2d09a597fbb ASA fruit01: Recognize victory if killing all enemy hogs in "flee" variant
Wuzzy <Wuzzy2@mail.ru>
parents: 15089
diff changeset
   420
		-- Alternative victory in the "flee" mission: ALL yellow hedgehogs killed
a2d09a597fbb ASA fruit01: Recognize victory if killing all enemy hogs in "flee" variant
Wuzzy <Wuzzy2@mail.ru>
parents: 15089
diff changeset
   421
		AddEvent(onEscapeWinByKill, {hero.gear}, escapeWinByKill, {hero.gear}, 0)
9525
8bcfb3a9f92b small fix and image/description
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9523
diff changeset
   422
		local greenTeam = { green2, green3, green4, green5 }
9523
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
   423
		for i=1,4 do
9504
cdba61cfba93 event for escape win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9502
diff changeset
   424
			SetHogLevel(greenTeam[i].gear, 1)
cdba61cfba93 event for escape win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9502
diff changeset
   425
		end
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   426
		AddAnim(dialog03)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   427
	end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   428
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   429
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   430
-------------- ANIMATIONS ------------------
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   431
12607
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   432
function AfterDialog01()
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   433
	AnimSwitchHog(hero.gear)
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   434
	awaitingInput = true
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   435
end
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   436
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   437
function Skipanim(anim)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   438
	if goals[anim] ~= nil then
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   439
		ShowMission(unpack(goals[anim]))
12575
0c5ce463949b ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents: 12571
diff changeset
   440
	end
0c5ce463949b ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents: 12571
diff changeset
   441
	if anim == dialog01 then
12607
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   442
		AfterDialog01()
9494
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   443
	elseif anim == dialog02 or anim == dialog03 then
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   444
		startBattle()
12575
0c5ce463949b ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents: 12571
diff changeset
   445
	end
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   446
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   447
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   448
function AnimationSetup()
14509
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   449
	-- DIALOG 01 - Start, Captain Lime talks and explains stuff to hero
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   450
	AddSkipFunction(dialog01, Skipanim, {dialog01})
12607
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   451
	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 1000}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   452
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Somewhere on the Planet of Fruits a terrible war is about to begin ..."), 5000}})
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   453
	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("I was told that as the leader of the king's guard, no one knows this world better than you!"), SAY_SAY, 5000}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   454
	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("So, I kindly ask for your help."), SAY_SAY, 3000}})
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   455
	table.insert(dialog01, {func = AnimWait, args = {green1.gear, 2000}})
14509
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   456
	table.insert(dialog01, {func = AnimSay, args = {green1.gear, string.format(loc("You couldn't have come to a worse time, %s!"), hero.name), SAY_SAY, 3000}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   457
	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("The clan of the Red Strawberry wants to take over the dominion and overthrow King Pineapple."), SAY_SAY, 5000}})
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   458
	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("Under normal circumstances we could easily defeat them but we have kindly sent most of our men to the Kingdom of Sand to help with the annual dusting of the king's palace."), SAY_SAY, 8000}})
14509
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   459
	table.insert(dialog01, {func = AnimSay, args = {green1.gear, string.format(loc("However, the army of %s is about to attack any moment now."), teamC.name), SAY_SAY, 4000}})
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   460
	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("I would gladly help you if we won this battle but under these circumstances I'll only help you if you fight for our side."), SAY_SAY, 6000}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   461
	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("What do you say? Will you fight for us?"), SAY_SAY, 3000}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   462
	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
12575
0c5ce463949b ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents: 12571
diff changeset
   463
	table.insert(dialog01, {func = ShowMission, args = goals[dialog01]})
12607
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   464
	table.insert(dialog01, {func = AfterDialog01, args = {}})
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   465
	-- DIALOG 02 - Hero selects to fight
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   466
	AddSkipFunction(dialog02, Skipanim, {dialog02})
14509
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   467
	table.insert(dialog02, {func = AnimSay, args = {green1.gear, string.format(loc("You choose well, %s!"), hero.name), SAY_SAY, 3000}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   468
	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("I have only 3 hogs available and they are all cadets."), SAY_SAY, 4000}})
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   469
	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("As you are more experienced, I want you to lead them to battle."), SAY_SAY, 4000}})
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   470
	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("Of course, I will observe the battle and intervene if necessary."), SAY_SAY, 5000}})
9740
d159ddae0358 fixed user gain control of npc, rope cheat and overlapping bubbles in fruit01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9643
diff changeset
   471
	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 4500}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   472
	table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("No problem, Captain!"), SAY_SAY, 2000}})
9740
d159ddae0358 fixed user gain control of npc, rope cheat and overlapping bubbles in fruit01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9643
diff changeset
   473
	table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("The enemies aren't many anyway, it is going to be easy!"), SAY_SAY, 1}})
d159ddae0358 fixed user gain control of npc, rope cheat and overlapping bubbles in fruit01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9643
diff changeset
   474
	table.insert(dialog02, {func = AnimWait, args = {green1.gear, 9000}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   475
	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("Don't be foolish, son, there will be more."), SAY_SAY, 2000}})
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   476
	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("Try to be smart and eliminate them quickly. This way you might scare off the rest!"), SAY_SAY, 5000}})
9643
cddb5de11af9 fixed bug that didn't set TurnTimeLeft in first round if dialog not skipped
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   477
	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 5000}})
12575
0c5ce463949b ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents: 12571
diff changeset
   478
	table.insert(dialog02, {func = ShowMission, args = goals[dialog02]})
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   479
	table.insert(dialog02, {func = startBattle, args = {hero.gear}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   480
	-- DIALOG 03 - Hero selects to flee
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   481
	AddSkipFunction(dialog03, Skipanim, {dialog03})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   482
	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Too bad! Then you should really leave!"), SAY_SAY, 3000}})
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   483
	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Things are going to get messy around here."), SAY_SAY, 3000}})
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   484
	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Also, you should know that the only place where you can fly is the left-most part of this area."), SAY_SAY, 5000}})
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   485
	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("All the other places are protected by our flight-inhibiting weapons."), SAY_SAY, 4000}})
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   486
	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Now go and don't waste more of my time, you coward!"), SAY_SAY, 4000}})
9643
cddb5de11af9 fixed bug that didn't set TurnTimeLeft in first round if dialog not skipped
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   487
	table.insert(dialog03, {func = AnimWait, args = {hero.gear, 5000}})
12575
0c5ce463949b ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents: 12571
diff changeset
   488
	table.insert(dialog03, {func = ShowMission, args = goals[dialog03]})
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   489
	table.insert(dialog03, {func = startBattle, args = {hero.gear}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   490
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   491
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   492
------------- OTHER FUNCTIONS ---------------
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   493
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   494
function startBattle()
12607
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   495
	AnimSetInputMask(0xFFFFFFFF)
14509
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   496
	-- Hero weapons
9740
d159ddae0358 fixed user gain control of npc, rope cheat and overlapping bubbles in fruit01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9643
diff changeset
   497
	AddAmmo(hero.gear, amRope, 2)
d159ddae0358 fixed user gain control of npc, rope cheat and overlapping bubbles in fruit01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9643
diff changeset
   498
	AddAmmo(hero.gear, amBazooka, 3)
d159ddae0358 fixed user gain control of npc, rope cheat and overlapping bubbles in fruit01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9643
diff changeset
   499
	AddAmmo(hero.gear, amParachute, 1)
d159ddae0358 fixed user gain control of npc, rope cheat and overlapping bubbles in fruit01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9643
diff changeset
   500
	AddAmmo(hero.gear, amGrenade, 6)
d159ddae0358 fixed user gain control of npc, rope cheat and overlapping bubbles in fruit01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9643
diff changeset
   501
	AddAmmo(hero.gear, amDEagle, 4)
d159ddae0358 fixed user gain control of npc, rope cheat and overlapping bubbles in fruit01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9643
diff changeset
   502
	AddAmmo(hero.gear, amSkip, 100)
12580
ef71e032254f ASA, fruit01: Use 1 hog instead of 2 for Captain Lime
Wuzzy <almikes@aol.com>
parents: 12575
diff changeset
   503
	SetHogLevel(green1.gear, 1)
9643
cddb5de11af9 fixed bug that didn't set TurnTimeLeft in first round if dialog not skipped
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   504
	startBattleCalled = true
12514
d89dabfd07ce Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents: 12224
diff changeset
   505
	EndTurn(true)
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   506
end
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
   507
9518
549ca737206c custom stats in case of lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9516
diff changeset
   508
function gameLost()
549ca737206c custom stats in case of lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9516
diff changeset
   509
	if chooseToBattle then
14509
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   510
		SendStat(siGameResult, string.format(loc("%s lost, try again!"), teamB.name))
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   511
		SendStat(siCustomAchievement, loc("You have to eliminate all the visible enemies."))
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   512
		SendStat(siCustomAchievement, loc("5 additional enemies will be spawned during the game."))
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   513
		SendStat(siCustomAchievement, loc("You are in control of all the active ally units."))
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   514
		SendStat(siCustomAchievement, loc("The ally units share their ammo."))
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   515
		SendStat(siCustomAchievement, loc("Try to keep as many allies alive as possible."))
9518
549ca737206c custom stats in case of lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9516
diff changeset
   516
	else
14509
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14422
diff changeset
   517
		SendStat(siGameResult, string.format(loc("%s couldn't escape, try again!"), hero.name))
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   518
		SendStat(siCustomAchievement, loc("You have to get to the left-most land and remove any enemy hog from there."))
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   519
		SendStat(siCustomAchievement, loc("You will play every 3 turns."))
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   520
	end
12538
952afc3d2df2 Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents: 12514
diff changeset
   521
	sendSimpleTeamRankings({teamC.name, teamA.name, teamD.name, teamB.name})
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   522
	EndGame()
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   523
end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   524
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
   525
function getNextWave()
13655
45b325bb9bb1 Fix duplicate/confusing wave messages in ASA fruit01
Wuzzy <Wuzzy2@mail.ru>
parents: 13583
diff changeset
   526
	if GetHogTeamName(CurrentHedgehog) ~= teamC.name then
45b325bb9bb1 Fix duplicate/confusing wave messages in ASA fruit01
Wuzzy <Wuzzy2@mail.ru>
parents: 13583
diff changeset
   527
		return
45b325bb9bb1 Fix duplicate/confusing wave messages in ASA fruit01
Wuzzy <Wuzzy2@mail.ru>
parents: 13583
diff changeset
   528
	end
9494
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   529
	if TotalRounds == 4 then
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   530
		RestoreHog(yellowArmy[3].gear)
13655
45b325bb9bb1 Fix duplicate/confusing wave messages in ASA fruit01
Wuzzy <Wuzzy2@mail.ru>
parents: 13583
diff changeset
   531
		AnimCaption(hero.gear, string.format(loc("%s enters the battlefield"), yellowArmy[3].name), 5000)
9510
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   532
		if not chooseToBattle and not GetHealth(yellow1.gear) then
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   533
			SetGearPosition(yellowArmy[3].gear, yellow1.x, yellow1.y)
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   534
		end
14647
ab6be7d200b0 ASA fruit01: Add hog appear effect
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   535
		AnimOutOfNowhere(yellowArmy[3].gear)
9494
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   536
	elseif TotalRounds == 7 then
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   537
		RestoreHog(yellowArmy[4].gear)
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   538
		RestoreHog(yellowArmy[5].gear)
13655
45b325bb9bb1 Fix duplicate/confusing wave messages in ASA fruit01
Wuzzy <Wuzzy2@mail.ru>
parents: 13583
diff changeset
   539
		AnimCaption(hero.gear, string.format(loc("%s and %s enter the battlefield"), yellowArmy[4].name, yellowArmy[5].name), 5000)
9510
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   540
		if not chooseToBattle and not GetHealth(yellow1.gear) and not GetHealth(yellowArmy[3].gear) then
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   541
			SetGearPosition(yellowArmy[4].gear, yellow1.x, yellow1.y)
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   542
		end
14647
ab6be7d200b0 ASA fruit01: Add hog appear effect
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   543
		AnimOutOfNowhere(yellowArmy[4].gear)
ab6be7d200b0 ASA fruit01: Add hog appear effect
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   544
		AnimOutOfNowhere(yellowArmy[5].gear)
9494
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   545
	elseif TotalRounds == 10 then
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   546
		RestoreHog(yellowArmy[6].gear)
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   547
		RestoreHog(yellowArmy[7].gear)
13655
45b325bb9bb1 Fix duplicate/confusing wave messages in ASA fruit01
Wuzzy <Wuzzy2@mail.ru>
parents: 13583
diff changeset
   548
		AnimCaption(hero.gear, string.format(loc("%s and %s enter the battlefield"), yellowArmy[6].name, yellowArmy[7].name), 5000)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   549
		if not chooseToBattle and not GetHealth(yellow1.gear) and not GetHealth(yellowArmy[3].gear)
9510
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   550
				and not GetHealth(yellowArmy[4].gear) then
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   551
			SetGearPosition(yellowArmy[6].gear, yellow1.x, yellow1.y)
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   552
		end
14647
ab6be7d200b0 ASA fruit01: Add hog appear effect
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   553
		AnimOutOfNowhere(yellowArmy[6].gear)
ab6be7d200b0 ASA fruit01: Add hog appear effect
Wuzzy <Wuzzy2@mail.ru>
parents: 14509
diff changeset
   554
		AnimOutOfNowhere(yellowArmy[7].gear)
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
   555
	end
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
   556
end
9578
16139270448f save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   557
16139270448f save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   558
function saveVariables()
16139270448f save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   559
	saveCompletedStatus(2)
15106
84bab72a0b7f ASA fruit01: Save campaign variable about whether hero joined battle
Wuzzy <Wuzzy2@mail.ru>
parents: 15102
diff changeset
   560
	if chooseToBattle then
84bab72a0b7f ASA fruit01: Save campaign variable about whether hero joined battle
Wuzzy <Wuzzy2@mail.ru>
parents: 15102
diff changeset
   561
		SaveCampaignVar("Fruit01JoinedBattle", "true")
84bab72a0b7f ASA fruit01: Save campaign variable about whether hero joined battle
Wuzzy <Wuzzy2@mail.ru>
parents: 15102
diff changeset
   562
	else
84bab72a0b7f ASA fruit01: Save campaign variable about whether hero joined battle
Wuzzy <Wuzzy2@mail.ru>
parents: 15102
diff changeset
   563
		SaveCampaignVar("Fruit01JoinedBattle", "false")
84bab72a0b7f ASA fruit01: Save campaign variable about whether hero joined battle
Wuzzy <Wuzzy2@mail.ru>
parents: 15102
diff changeset
   564
	end
12567
459543ef9b1b ASA: Fix 2 important fruit planet mission unlocking bugs
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   565
	SaveCampaignVar("UnlockedMissions", "4")
459543ef9b1b ASA: Fix 2 important fruit planet mission unlocking bugs
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   566
	SaveCampaignVar("Mission1", "8")
459543ef9b1b ASA: Fix 2 important fruit planet mission unlocking bugs
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   567
	SaveCampaignVar("Mission2", "3")
459543ef9b1b ASA: Fix 2 important fruit planet mission unlocking bugs
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   568
	SaveCampaignVar("Mission3", "10")
459543ef9b1b ASA: Fix 2 important fruit planet mission unlocking bugs
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   569
	SaveCampaignVar("Mission4", "1")
9578
16139270448f save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   570
end
12607
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   571
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   572
12609
12d4886de2b1 ASA, fruit01: Change choice keys
Wuzzy <almikes@aol.com>
parents: 12608
diff changeset
   573
function onLJump()
12607
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   574
	if awaitingInput then
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   575
		PlaySound(sndPlaced)
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   576
		PlaySound(sndCoward, green1.gear)
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   577
		chooseToBattle = false
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   578
		heroSelect()
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   579
	end
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   580
end
12609
12d4886de2b1 ASA, fruit01: Change choice keys
Wuzzy <almikes@aol.com>
parents: 12608
diff changeset
   581
onHJump = onLJump
12607
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   582
12609
12d4886de2b1 ASA, fruit01: Change choice keys
Wuzzy <almikes@aol.com>
parents: 12608
diff changeset
   583
function onAttack()
12607
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   584
	if awaitingInput then
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   585
		PlaySound(sndPlaced)
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   586
		chooseToBattle = true
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   587
		heroSelect()
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   588
	end
9bdcd73a4021 ASA, fruit01: Improve mission texts and choice dialog handling
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   589
end