share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit01.lua
author Wuzzy <almikes@aol.com>
Wed, 23 Nov 2016 23:54:55 +0100
changeset 12049 030464f34d47
parent 11692 68eddcdc9f26
child 12088 1da37e2ba6fd
permissions -rw-r--r--
Tweak flags used in all missions to fit more to the theme
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
9498
54bfc44f9554 fixed bug that make hog not able to move
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9496
diff changeset
    26
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
    27
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
    28
local startBattleCalled = false
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    29
-- dialogs
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    30
local dialog01 = {}
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
    31
local dialog02 = {}
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
    32
local dialog03 = {}
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    33
-- mission objectives
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    34
local goals = {
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
    35
	[dialog01] = {missionName, loc("Ready for Battle?"), loc("Walk left if you want to join Captain Lime or right if you want to decline his offer."), 1, 4000},
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
    36
	[dialog02] = {missionName, loc("Battle Starts Now!"), loc("You have chosen to fight! Lead the Green Bananas to battle and eliminate all the enemies!"), 1, 4000},
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
    37
	[dialog03] = {missionName, loc("Time to run!"), loc("You have chosen to flee ... Unfortunately, the only place where you can launch your saucer is the left-most place on the map."), 1, 4000},
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    38
}
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
    39
-- crates
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
    40
local crateWMX = 2170
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
    41
local crateWMY = 1950
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
    42
local health1X = 2680
9508
c23bff98e3d2 added crates
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9506
diff changeset
    43
local health1Y = 916
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    44
-- hogs
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    45
local hero = {}
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    46
local yellow1 = {}
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    47
local green1 = {}
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    48
local green2 = {}
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    49
local green3 = {}
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    50
local green4 = {}
9523
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
    51
local green5 = {}
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    52
-- teams
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    53
local teamA = {}
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    54
local teamB = {}
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    55
local teamC = {}
9523
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
    56
local teamD = {}
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    57
-- hedgehogs values
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9525
diff changeset
    58
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
    59
hero.x = 3350
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
    60
hero.y = 365
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    61
hero.dead = false
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9525
diff changeset
    62
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
    63
green1.x = 3300
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
    64
green1.y = 395
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
    65
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
    66
green2.name = loc("Mister Pear")
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    67
green2.x = 3600
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    68
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
    69
green3.name = loc("Lady Mango")
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    70
green3.x = 2170
9500
c9487f415fd3 some changes in the map, hog placing etc
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9498
diff changeset
    71
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
    72
green4.name = loc("Green Hog Grape")
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    73
green4.x = 2900
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    74
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
    75
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
    76
green5.x = 1350
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
    77
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
    78
yellow1.name = loc("General Lemon")
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    79
yellow1.x = 140
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    80
yellow1.y = 1980
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    81
local yellowArmy = {
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9525
diff changeset
    82
	{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
    83
	{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
    84
	{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
    85
	{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
    86
	{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
    87
	{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
    88
	{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
    89
}
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    90
teamA.name = loc("Hog Solo")
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
    91
teamA.color = tonumber("38D61C",16) -- green
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    92
teamB.name = loc("Green Bananas")
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    93
teamB.color = tonumber("38D61C",16) -- green
9508
c23bff98e3d2 added crates
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9506
diff changeset
    94
teamC.name = loc("Yellow Watermelons")
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    95
teamC.color = tonumber("DDFF00",16) -- yellow
9523
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
    96
teamD.name = loc("Captain Lime")
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
    97
teamD.color = tonumber("38D61C",16) -- green
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    98
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    99
function onGameInit()
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   100
	Seed = 1
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   101
	TurnTime = 20000
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   102
	CaseFreq = 0
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   103
	MinesNum = 0
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   104
	MinesTime = 1
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   105
	Explosives = 0
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   106
	Delay = 3
9502
6aebf7a3b655 changed rounds till suden death
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9500
diff changeset
   107
	SuddenDeathTurns = 100
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   108
	HealthCaseAmount = 50
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   109
	Map = "fruit01_map"
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   110
	Theme = "Fruit"
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   111
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   112
	-- Hog Solo
12049
030464f34d47 Tweak flags used in all missions to fit more to the theme
Wuzzy <almikes@aol.com>
parents: 11692
diff changeset
   113
	AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "hedgewars")
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   114
	hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   115
	AnimSetGearPosition(hero.gear, hero.x, hero.y)
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   116
	HogTurnLeft(hero.gear, true)
9523
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
   117
	-- Captain Lime
12049
030464f34d47 Tweak flags used in all missions to fit more to the theme
Wuzzy <almikes@aol.com>
parents: 11692
diff changeset
   118
	AddTeam(teamD.name, teamD.color, "Bone", "Island", "HillBilly", "congo-brazzaville")
9629
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9626
diff changeset
   119
	green1.bot = AddHog(green1.name, 1, 200, "war_desertofficer")
9523
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
   120
	AnimSetGearPosition(green1.bot, green1.x, green1.y)
9629
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9626
diff changeset
   121
	green1.human =  AddHog(green1.name, 0, 200, "war_desertofficer")
9523
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
   122
	AnimSetGearPosition(green1.human, green1.x, green1.y)
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
   123
	green1.gear = green1.human
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   124
	-- Green Bananas
12049
030464f34d47 Tweak flags used in all missions to fit more to the theme
Wuzzy <almikes@aol.com>
parents: 11692
diff changeset
   125
	AddTeam(teamB.name, teamB.color, "Bone", "Island", "HillBilly", "congo-brazzaville")
9629
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9626
diff changeset
   126
	green2.gear = AddHog(green2.name, 0, 100, "war_britmedic")
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   127
	AnimSetGearPosition(green2.gear, green2.x, green2.y)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   128
	HogTurnLeft(green2.gear, true)
9629
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9626
diff changeset
   129
	green3.gear = AddHog(green3.name, 0, 100, "hair_red")
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   130
	AnimSetGearPosition(green3.gear, green3.x, green3.y)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   131
	HogTurnLeft(green3.gear, true)
9629
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9626
diff changeset
   132
	green4.gear = AddHog(green4.name, 0, 100, "war_desertsapper1")
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   133
	AnimSetGearPosition(green4.gear, green4.x, green4.y)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   134
	HogTurnLeft(green4.gear, true)
9629
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9626
diff changeset
   135
	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
   136
	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
   137
	HogTurnLeft(green5.gear, true)
9508
c23bff98e3d2 added crates
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9506
diff changeset
   138
	-- Yellow Watermelons
12049
030464f34d47 Tweak flags used in all missions to fit more to the theme
Wuzzy <almikes@aol.com>
parents: 11692
diff changeset
   139
	AddTeam(teamC.name, teamC.color, "Bone", "Island", "HillBilly", "cm_mog")
9629
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9626
diff changeset
   140
	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
   141
	AnimSetGearPosition(yellow1.gear, yellow1.x, yellow1.y)
9508
c23bff98e3d2 added crates
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9506
diff changeset
   142
	-- the rest of the Yellow Watermelons
9629
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9626
diff changeset
   143
	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
   144
	for i=1,7 do
9810
54c0fdec4600 changing math functions that may cause desyncs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9758
diff changeset
   145
		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
   146
		AnimSetGearPosition(yellowArmy[i].gear, yellowArmy[i].x, yellowArmy[i].y)
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
   147
	end
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   148
9582
bf314b2258b3 less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9578
diff changeset
   149
	initCheckpoint("fruit01")
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
   150
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   151
	AnimInit()
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   152
	AnimationSetup()
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   153
end
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   154
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   155
function onGameStart()
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   156
	AnimWait(hero.gear, 3000)
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   157
	FollowGear(hero.gear)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   158
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   159
	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   160
	AddEvent(onHeroSelect, {hero.gear}, heroSelect, {hero.gear}, 0)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   161
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   162
	-- Green team weapons
9523
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
   163
	local greenArmy = { green1, green2 }
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
   164
	for i=1,2 do
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
   165
		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
   166
		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
   167
		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
   168
		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
   169
		AddAmmo(greenArmy[i].gear, amFirePunch, 2)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   170
		AddAmmo(greenArmy[i].gear, amDrill, 3)
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   171
		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
   172
		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
   173
	end
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   174
	-- Yellow team weapons
9494
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   175
	AddAmmo(yellow1.gear, amBlowTorch, 1)
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   176
	AddAmmo(yellow1.gear, amRope, 1)
9500
c9487f415fd3 some changes in the map, hog placing etc
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9498
diff changeset
   177
	AddAmmo(yellow1.gear, amBazooka, 10)
c9487f415fd3 some changes in the map, hog placing etc
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9498
diff changeset
   178
	AddAmmo(yellow1.gear, amGrenade, 10)
c9487f415fd3 some changes in the map, hog placing etc
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9498
diff changeset
   179
	AddAmmo(yellow1.gear, amFirePunch, 5)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   180
	AddAmmo(yellow1.gear, amDrill, 3)
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   181
	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
   182
	AddAmmo(yellow1.gear, amMortar, 3)
9500
c9487f415fd3 some changes in the map, hog placing etc
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9498
diff changeset
   183
	AddAmmo(yellow1.gear, amDEagle, 4)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   184
	AddAmmo(yellow1.gear, amDynamite, 1)
9500
c9487f415fd3 some changes in the map, hog placing etc
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9498
diff changeset
   185
	AddAmmo(yellow1.gear, amSwitch, 100)
c9487f415fd3 some changes in the map, hog placing etc
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9498
diff changeset
   186
	for i=3,7 do
c9487f415fd3 some changes in the map, hog placing etc
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9498
diff changeset
   187
		HideHog(yellowArmy[i].gear)
9494
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   188
	end
9523
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
   189
	HideHog(green1.bot)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   190
9508
c23bff98e3d2 added crates
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9506
diff changeset
   191
	-- crates
c23bff98e3d2 added crates
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9506
diff changeset
   192
	SpawnHealthCrate(health1X, health1Y)
c23bff98e3d2 added crates
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9506
diff changeset
   193
	SpawnAmmoCrate(crateWMX, crateWMY, amWatermelon)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   194
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   195
	AddAnim(dialog01)
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   196
	SendHealthStatsOff()
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   197
end
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   198
9494
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   199
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
   200
	if 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
   201
		TurnTimeLeft = 0
cddb5de11af9 fixed bug that didn't set TurnTimeLeft in first round if dialog not skipped
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   202
	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
   203
		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
   204
	elseif not heroPlayedFirstTurn and CurrentHedgehog == green1.gear then
d159ddae0358 fixed user gain control of npc, rope cheat and overlapping bubbles in fruit01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9643
diff changeset
   205
		TurnTimeLeft = 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
   206
	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
   207
		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
   208
			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
   209
				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
   210
				AnimSwitchHog(previousHog)
cddb5de11af9 fixed bug that didn't set TurnTimeLeft in first round if dialog not skipped
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   211
				TurnTimeLeft = 0
cddb5de11af9 fixed bug that didn't set TurnTimeLeft in first round if dialog not skipped
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   212
			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
   213
			previousHog = CurrentHedgehog
9510
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   214
		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
   215
		getNextWave()
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   216
	end
9494
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   217
end
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   218
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   219
function onGameTick()
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   220
	AnimUnWait()
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   221
	if ShowAnimation() == false then
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   222
		return
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   223
	end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   224
	ExecuteAfterAnimations()
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   225
	CheckEvents()
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   226
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   227
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   228
function onGearDelete(gear)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   229
	if gear == hero.gear then
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   230
		hero.dead = true
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   231
	elseif gear == green1.gear then
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   232
		green1.dead = true
9488
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
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   235
9508
c23bff98e3d2 added crates
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9506
diff changeset
   236
function onAmmoStoreInit()
c23bff98e3d2 added crates
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9506
diff changeset
   237
	SetAmmo(amWatermelon, 0, 0, 0, 1)
c23bff98e3d2 added crates
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9506
diff changeset
   238
end
c23bff98e3d2 added crates
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9506
diff changeset
   239
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   240
function onPrecise()
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   241
	if GameTime > 3000 then
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   242
		SetAnimSkip(true)
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   243
	end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   244
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   245
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   246
function onHogHide(gear)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   247
	for i=3,7 do
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   248
		if gear == yellowArmy[i].gear then
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   249
			yellowArmy[i].hidden = true
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   250
			break
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   251
		end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   252
	end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   253
end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   254
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   255
function onHogRestore(gear)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   256
	for i=3,7 do
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   257
		if gear == yellowArmy[i].gear then
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   258
			yellowArmy[i].hidden = false
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   259
			break
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   260
		end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   261
	end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   262
end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   263
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   264
-------------- EVENTS ------------------
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   265
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   266
function onHeroDeath(gear)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   267
	if hero.dead then
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   268
		return true
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   269
	end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   270
	return false
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   271
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   272
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   273
function onGreen1Death(gear)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   274
	if green1.dead then
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   275
		return true
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   276
	end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   277
	return false
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   278
end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   279
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   280
function onBattleWin(gear)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   281
	local win = true
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   282
	for i=1,7 do
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   283
		if i<3 then
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   284
			if GetHealth(yellowArmy[i].gear) then
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   285
				win = false
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   286
			end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   287
		else
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   288
			if GetHealth(yellowArmy[i].gear) and not yellowArmy[i].hidden then
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   289
				win = false
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   290
			end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   291
		end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   292
	end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   293
	if GetHealth(yellow1.gear) then
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   294
		win = false
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   295
	end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   296
	return win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   297
end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   298
9504
cdba61cfba93 event for escape win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9502
diff changeset
   299
function onEscapeWin(gear)
9510
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   300
	local escape = false
9506
adc05ca2cb10 some fixes to the map and the events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9504
diff changeset
   301
	if not hero.dead and GetX(hero.gear) < 170 and GetY(hero.gear) > 1980 and StoppedGear(hero.gear) then
9510
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   302
		escape = true
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   303
		local yellowTeam = { yellow1, unpack(yellowArmy) }
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   304
		for i=1,8 do
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   305
			if not yellowTeam[i].hidden and GetHealth(yellowTeam[i].gear) and GetX(yellowTeam[i].gear) < 170 then
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   306
				escape = false
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   307
				break
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   308
			end
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   309
		end
9504
cdba61cfba93 event for escape win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9502
diff changeset
   310
	end
9510
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   311
	return escape
9504
cdba61cfba93 event for escape win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9502
diff changeset
   312
end
cdba61cfba93 event for escape win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9502
diff changeset
   313
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   314
function onHeroSelect(gear)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   315
	if GetX(hero.gear) ~= hero.x then
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   316
		return true
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   317
	end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   318
	return false
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   319
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   320
9639
6b2ae2eaf1b2 remove unnecessary comments
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9629
diff changeset
   321
-------------- ACTIONS ------------------
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   322
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   323
function heroDeath(gear)
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   324
	gameLost()
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   325
end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   326
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   327
function green1Death(gear)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   328
	gameLost()
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   329
end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   330
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   331
function battleWin(gear)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   332
	-- add stats
9578
16139270448f save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   333
	saveVariables()
9642
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9639
diff changeset
   334
	SendStat(siGameResult, loc("Green Bananas won!"))
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   335
	SendStat(siCustomAchievement, loc("You have eliminated all visible enemy hedgehogs!"))
9642
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9639
diff changeset
   336
	SendStat(siPlayerKills,'1',teamA.name)
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9639
diff changeset
   337
	SendStat(siPlayerKills,'1',teamB.name)
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9639
diff changeset
   338
	SendStat(siPlayerKills,'0',teamC.name)
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   339
	EndGame()
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   340
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   341
9504
cdba61cfba93 event for escape win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9502
diff changeset
   342
function escapeWin(gear)
cdba61cfba93 event for escape win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9502
diff changeset
   343
	-- add stats
9578
16139270448f save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   344
	saveVariables()
9642
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9639
diff changeset
   345
	SendStat(siGameResult, loc("Hog Solo escaped successfully!"))
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   346
	SendStat(siCustomAchievement, loc("You have reached the take-off area successfully!"))
9642
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9639
diff changeset
   347
	SendStat(siPlayerKills,'1',teamA.name)
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9639
diff changeset
   348
	SendStat(siPlayerKills,'0',teamB.name)
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9639
diff changeset
   349
	SendStat(siPlayerKills,'0',teamC.name)
9504
cdba61cfba93 event for escape win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9502
diff changeset
   350
	EndGame()
cdba61cfba93 event for escape win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9502
diff changeset
   351
end
cdba61cfba93 event for escape win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9502
diff changeset
   352
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   353
function heroSelect(gear)
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   354
	TurnTimeLeft = 0
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   355
	FollowGear(hero.gear)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   356
	if GetX(hero.gear) < hero.x then
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   357
		chooseToBattle = true
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   358
		AddEvent(onGreen1Death, {green1.gear}, green1Death, {green1.gear}, 0)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   359
		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
   360
		AddAnim(dialog02)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   361
	elseif GetX(hero.gear) > hero.x then
9506
adc05ca2cb10 some fixes to the map and the events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9504
diff changeset
   362
		HogTurnLeft(hero.gear, true)
9510
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   363
		AddAmmo(green1.gear, amSwitch, 100)
9504
cdba61cfba93 event for escape win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9502
diff changeset
   364
		AddEvent(onEscapeWin, {hero.gear}, escapeWin, {hero.gear}, 0)
9525
8bcfb3a9f92b small fix and image/description
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9523
diff changeset
   365
		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
   366
		for i=1,4 do
9504
cdba61cfba93 event for escape win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9502
diff changeset
   367
			SetHogLevel(greenTeam[i].gear, 1)
cdba61cfba93 event for escape win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9502
diff changeset
   368
		end
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   369
		AddAnim(dialog03)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   370
	end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   371
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   372
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   373
-------------- ANIMATIONS ------------------
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   374
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   375
function Skipanim(anim)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   376
	if goals[anim] ~= nil then
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   377
		ShowMission(unpack(goals[anim]))
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   378
    end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   379
    if anim == dialog01 then
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   380
		AnimSwitchHog(hero.gear)
9494
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   381
	elseif anim == dialog02 or anim == dialog03 then
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   382
		startBattle()
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   383
    end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   384
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   385
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   386
function AnimationSetup()
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   387
	-- DIALOG 01 - Start, Captain Lime talks explains to Hog Solo
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   388
	AddSkipFunction(dialog01, Skipanim, {dialog01})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   389
	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   390
	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
   391
	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
   392
	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
   393
	table.insert(dialog01, {func = AnimWait, args = {green1.gear, 2000}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   394
	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("You couldn't have come to a worse time, Hog Solo!"), SAY_SAY, 3000}})
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   395
	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
   396
	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}})
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   397
	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("However, the army of Yellow Watermelons is about to attack any moment now."), SAY_SAY, 4000}})
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   398
	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
   399
	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
   400
	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   401
	table.insert(dialog01, {func = ShowMission, args = {missionName, loc("Ready for Battle?"), loc("Walk left if you want to join Captain Lime or right if you want to decline his offer."), 1, 7000}})
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   402
	table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}})
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   403
	-- 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
   404
	AddSkipFunction(dialog02, Skipanim, {dialog02})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   405
	table.insert(dialog02, {func = AnimWait, args = {green1.gear, 3000}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   406
	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("You choose well, Hog Solo!"), SAY_SAY, 3000}})
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   407
	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
   408
	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
   409
	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
   410
	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
   411
	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
   412
	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
   413
	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
   414
	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
   415
	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
   416
	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 5000}})
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   417
	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
   418
	-- DIALOG 03 - Hero selects to flee
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   419
	AddSkipFunction(dialog03, Skipanim, {dialog03})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   420
	table.insert(dialog03, {func = AnimWait, args = {green1.gear, 3000}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   421
	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
   422
	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
   423
	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
   424
	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
   425
	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
   426
	table.insert(dialog03, {func = AnimWait, args = {hero.gear, 5000}})
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   427
	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
   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
------------- OTHER FUNCTIONS ---------------
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   431
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   432
function startBattle()
9740
d159ddae0358 fixed user gain control of npc, rope cheat and overlapping bubbles in fruit01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9643
diff changeset
   433
	-- Hog Solo weapons
d159ddae0358 fixed user gain control of npc, rope cheat and overlapping bubbles in fruit01
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9643
diff changeset
   434
	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
   435
	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
   436
	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
   437
	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
   438
	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
   439
	AddAmmo(hero.gear, amSkip, 100)
9523
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
   440
	RestoreHog(green1.bot)
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
   441
	DeleteGear(green1.human)
dd6c61b81c78 changes regarding the difficulty and AI demo brake error
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9520
diff changeset
   442
	green1.gear = green1.bot
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
   443
	startBattleCalled = true
cddb5de11af9 fixed bug that didn't set TurnTimeLeft in first round if dialog not skipped
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   444
	TurnTimeLeft = 0
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   445
end
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
   446
9518
549ca737206c custom stats in case of lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9516
diff changeset
   447
function gameLost()
549ca737206c custom stats in case of lose
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9516
diff changeset
   448
	if chooseToBattle then
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   449
		SendStat(siGameResult, loc("The Green Bananas lost, try again!"))
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   450
		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
   451
		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
   452
		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
   453
		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
   454
		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
   455
	else
9642
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9639
diff changeset
   456
		SendStat(siGameResult, loc("Hog Solo couldn't escape, try again!"))
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   457
		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
   458
		SendStat(siCustomAchievement, loc("You will play every 3 turns."))
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   459
		SendStat(siCustomAchievement, loc("Green hogs won't intentionally hurt you."))
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   460
	end
9642
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9639
diff changeset
   461
	SendStat(siPlayerKills,'1',teamC.name)
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9639
diff changeset
   462
	SendStat(siPlayerKills,'0',teamA.name)
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9639
diff changeset
   463
	SendStat(siPlayerKills,'0',teamB.name)
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   464
	EndGame()
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   465
end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   466
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
   467
function getNextWave()
9494
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   468
	if TotalRounds == 4 then
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   469
		RestoreHog(yellowArmy[3].gear)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   470
		AnimCaption(hero.gear, loc("Next wave in 3 turns"), 5000)
9510
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   471
		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
   472
			SetGearPosition(yellowArmy[3].gear, yellow1.x, yellow1.y)
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   473
		end
9494
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   474
	elseif TotalRounds == 7 then
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   475
		RestoreHog(yellowArmy[4].gear)
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   476
		RestoreHog(yellowArmy[5].gear)
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   477
		AnimCaption(hero.gear, loc("Last wave in 3 turns"), 5000)
9510
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   478
		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
   479
			SetGearPosition(yellowArmy[4].gear, yellow1.x, yellow1.y)
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   480
		end
9494
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   481
	elseif TotalRounds == 10 then
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   482
		RestoreHog(yellowArmy[6].gear)
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   483
		RestoreHog(yellowArmy[7].gear)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9740
diff changeset
   484
		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
   485
				and not GetHealth(yellowArmy[4].gear) then
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   486
			SetGearPosition(yellowArmy[6].gear, yellow1.x, yellow1.y)
e7481fac10c4 change regarding the difficulty in escape
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9508
diff changeset
   487
		end
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
   488
	end
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
   489
end
9578
16139270448f save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   490
16139270448f save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   491
function saveVariables()
16139270448f save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   492
	saveCompletedStatus(2)
16139270448f save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   493
	SaveCampaignVar("UnlockedMissions", "3")
16139270448f save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   494
	SaveCampaignVar("Mission1", "3")
16139270448f save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   495
	SaveCampaignVar("Mission2", "8")
16139270448f save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   496
	SaveCampaignVar("Mission3", "1")
16139270448f save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   497
end