share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit01.lua
author Periklis Ntanasis <pntanasis@gmail.com>
Fri, 09 Aug 2013 23:30:33 +0300
branchspacecampaign
changeset 9496 ffab82d05785
parent 9494 e515962d7af4
child 9498 54bfc44f9554
permissions -rw-r--r--
events
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
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
     7
-- TODO: remove unwanted delay after first dialog
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
     8
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     9
HedgewarsScriptLoad("/Scripts/Locale.lua")
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    10
HedgewarsScriptLoad("/Scripts/Animate.lua")
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    11
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    12
----------------- VARIABLES --------------------
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    13
-- globals
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    14
local campaignName = loc("A Space Adventure")
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    15
local missionName = loc("Fruit planet, The War!")
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
    16
local chooseToBattle = false
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    17
-- dialogs
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    18
local dialog01 = {}
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
    19
local dialog02 = {}
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
    20
local dialog03 = {}
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    21
-- mission objectives
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    22
local goals = {
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
    23
	[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, 7000},
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
    24
	[dialog02] = {missionName, loc("Battle Starts Now!"), loc("You have choose to fight! Lead the Green Bananas to battle and try not to let them be killed"), 1, 7000},
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
    25
	[dialog03] = {missionName, loc("Ready for Battle?"), loc("You have choose to flee... Unfortunately the only place where you can launch your saucer is in the most left side of the map"), 1, 7000},
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    26
}
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
    27
-- crates
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
    28
local crateWMX = 2170
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
    29
local crateWMY = 1950
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
    30
local health1X = 2680
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
    31
local health1Y = 716
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    32
-- hogs
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    33
local hero = {}
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    34
local yellow1 = {}
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    35
local green1 = {}
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    36
local green2 = {}
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    37
local green3 = {}
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    38
local green4 = {}
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    39
-- teams
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    40
local teamA = {}
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    41
local teamB = {}
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    42
local teamC = {}
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    43
-- hedgehogs values
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    44
hero.name = "Hog Solo"
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    45
hero.x = 3650
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    46
hero.y = 95
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    47
hero.dead = false
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
    48
green1.name = "Captain Lime"
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    49
green1.x = 3600
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    50
green1.y = 95
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
    51
green1.dead = false
9490
b93448b75fa4 fix bugs and some changes regarting the difficulty in desert02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9488
diff changeset
    52
green2.name = "Mister Pear"
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    53
green2.x = 3600
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    54
green2.y = 1570
9490
b93448b75fa4 fix bugs and some changes regarting the difficulty in desert02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9488
diff changeset
    55
green3.name = "Lady Mango"
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    56
green3.x = 2170
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    57
green3.y = 680
9490
b93448b75fa4 fix bugs and some changes regarting the difficulty in desert02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9488
diff changeset
    58
green4.name = "Green Hog Grape"
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    59
green4.x = 2900
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    60
green4.y = 1650
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    61
yellow1.name = "General Lemon"
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    62
yellow1.x = 140
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    63
yellow1.y = 1980
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    64
local yellowArmy = {
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
    65
	{name = "Robert Yellow Apple", x = 710, y = 1780},
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
    66
	{name = "Summer Squash", x = 315 , y = 1960},
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
    67
	{name = "Tall Potato", x = 830 , y = 1748},
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
    68
	{name = "Yellow Pepper", x = 285 , y = 1960},
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
    69
	{name = "Corn", x = 1320 , y = 540},
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
    70
	{name = "Max Citrus", x = 1900 , y = 1700},
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
    71
	{name = "Naranja Jed", x = 960 , y = 316},
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    72
}
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    73
teamA.name = loc("Hog Solo")
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    74
teamA.color = tonumber("38D61C",16) -- green  
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    75
teamB.name = loc("Green Bananas")
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    76
teamB.color = tonumber("38D61C",16) -- green
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    77
teamC.name = loc("Yellow Watermellons")
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    78
teamC.color = tonumber("DDFF00",16) -- yellow
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    79
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    80
function onGameInit()
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    81
	Seed = 1
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    82
	TurnTime = 20000
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    83
	CaseFreq = 0
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    84
	MinesNum = 0
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    85
	MinesTime = 1
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    86
	Explosives = 0
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    87
	Delay = 3
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
    88
	HealthCaseAmount = 50
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    89
	Map = "fruit01_map"
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    90
	Theme = "Fruit"
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    91
	
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    92
	-- Hog Solo
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    93
	AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "cm_birdy")
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    94
	hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    95
	AnimSetGearPosition(hero.gear, hero.x, hero.y)
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    96
	HogTurnLeft(hero.gear, true)
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    97
	-- Green Bananas
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    98
	AddTeam(teamB.name, teamB.color, "Bone", "Island", "HillBilly", "cm_birdy")
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    99
	green1.gear = AddHog(green1.name, 0, 100, "war_desertgrenadier1")
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   100
	AnimSetGearPosition(green1.gear, green1.x, green1.y)
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   101
	green2.gear = AddHog(green2.name, 0, 100, "war_desertgrenadier1")
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   102
	AnimSetGearPosition(green2.gear, green2.x, green2.y)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   103
	HogTurnLeft(green2.gear, true)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   104
	green3.gear = AddHog(green3.name, 0, 100, "war_desertgrenadier1")
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   105
	AnimSetGearPosition(green3.gear, green3.x, green3.y)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   106
	HogTurnLeft(green3.gear, true)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   107
	green4.gear = AddHog(green4.name, 0, 100, "war_desertgrenadier1")
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   108
	AnimSetGearPosition(green4.gear, green4.x, green4.y)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   109
	HogTurnLeft(green4.gear, true)
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   110
	-- Yellow Watermellons
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   111
	AddTeam(teamC.name, teamC.color, "Bone", "Island", "HillBilly", "cm_birdy")
9494
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   112
	yellow1.gear = AddHog(yellow1.name, 1, 100, "war_desertgrenadier1")
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   113
	AnimSetGearPosition(yellow1.gear, yellow1.x, yellow1.y)
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
   114
	-- the rest of the Yellow Watermellons
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
   115
	for i=1,7 do
9494
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   116
		yellowArmy[i].gear = AddHog(yellowArmy[i].name, 1, 100, "war_desertgrenadier1")
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
   117
		AnimSetGearPosition(yellowArmy[i].gear, yellowArmy[i].x, yellowArmy[i].y)
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
   118
	end
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
   119
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   120
	AnimInit()
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   121
	AnimationSetup()	
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   122
end
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   123
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   124
function onGameStart()
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   125
	AnimWait(hero.gear, 3000)
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   126
	FollowGear(hero.gear)
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   127
	
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   128
	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
   129
	AddEvent(onHeroSelect, {hero.gear}, heroSelect, {hero.gear}, 0)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   130
	
9494
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   131
	-- Hog Solo weapons
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   132
	AddAmmo(hero.gear, amRope, 2)
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   133
	AddAmmo(hero.gear, amBazooka, 3)
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   134
	AddAmmo(hero.gear, amParachute, 1)
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   135
	AddAmmo(hero.gear, amGrenade, 6)
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   136
	AddAmmo(hero.gear, amDEagle, 4)
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   137
	-- Green team weapons
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   138
	local greenTeam = {	green1, green2, green3, green4 }
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   139
	for i=1,4 do
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   140
		AddAmmo(greenTeam[i].gear, amBlowTorch, 1)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   141
		AddAmmo(greenTeam[i].gear, amRope, 1)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   142
		AddAmmo(greenTeam[i].gear, amBazooka, 4)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   143
		AddAmmo(greenTeam[i].gear, amGrenade, 3)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   144
		AddAmmo(greenTeam[i].gear, amFirePunch, 2)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   145
		AddAmmo(greenTeam[i].gear, amDrill, 1)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   146
	end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   147
	-- Yellow team weapons
9494
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   148
	AddAmmo(yellow1.gear, amBlowTorch, 1)
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   149
	AddAmmo(yellow1.gear, amRope, 1)
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   150
	AddAmmo(yellow1.gear, amBazooka, 3)
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   151
	AddAmmo(yellow1.gear, amGrenade, 1)
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   152
	AddAmmo(yellow1.gear, amFirePunch, 1)
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   153
	AddAmmo(yellow1.gear, amDrill, 1)
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   154
	for i=1,7 do
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   155
		AddAmmo(yellowArmy[i].gear, amBlowTorch, 1)
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   156
		AddAmmo(yellowArmy[i].gear, amRope, 1)
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   157
		AddAmmo(yellowArmy[i].gear, amBazooka, 3)
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   158
		AddAmmo(yellowArmy[i].gear, amGrenade, 3)
9494
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   159
		AddAmmo(yellowArmy[i].gear, amFirePunch, 1)
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   160
		AddAmmo(yellowArmy[i].gear, amDrill, 3)	
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   161
		AddAmmo(yellowArmy[i].gear, amBee, 1)	
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   162
		AddAmmo(yellowArmy[i].gear, amMortar, 2)	
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   163
		AddAmmo(yellowArmy[i].gear, amSniperRifle, 3)	
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   164
		AddAmmo(yellowArmy[i].gear, amDEagle, 2)	
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   165
		AddAmmo(yellowArmy[i].gear, amDynamite, 1)	
9494
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   166
		if i>2 then
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   167
			HideHog(yellowArmy[i].gear)
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   168
		end
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   169
	end
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   170
	
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   171
	AddAnim(dialog01)
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   172
	SendHealthStatsOff()
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   173
end
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   174
9494
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   175
function onNewTurn()
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   176
	if CurrentHedgehog == green1.gear then
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   177
		TotalRounds = TotalRounds - 1
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   178
		if GetHealth(green2.gear) then
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   179
			SwitchHog(green2.gear)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   180
		elseif GetHealth(green3.gear) then
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   181
			SwitchHog(green3.gear)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   182
		elseif GetHealth(green4.gear) then
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   183
			SwitchHog(green4.gear)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   184
		end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   185
	end
9494
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   186
	getNextWave()
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   187
end
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   188
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   189
function onGameTick()
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   190
	AnimUnWait()
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   191
	if ShowAnimation() == false then
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   192
		return
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   193
	end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   194
	ExecuteAfterAnimations()
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   195
	CheckEvents()
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   196
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   197
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   198
function onGearDelete(gear)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   199
	if gear == hero.gear then
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   200
		hero.dead = true
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   201
	elseif gear == green1.gear then
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   202
		green1.dead = true
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   203
	end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   204
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   205
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   206
function onPrecise()
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   207
	if GameTime > 3000 then
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   208
		SetAnimSkip(true)   
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   209
	end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   210
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   211
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   212
function onHogHide(gear)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   213
	for i=3,7 do
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   214
		if gear == yellowArmy[i].gear then
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   215
			yellowArmy[i].hidden = true
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   216
			break
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   217
		end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   218
	end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   219
end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   220
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   221
function onHogRestore(gear)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   222
	for i=3,7 do
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   223
		if gear == yellowArmy[i].gear then
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   224
			yellowArmy[i].hidden = false
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   225
			break
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   226
		end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   227
	end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   228
end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   229
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   230
-------------- EVENTS ------------------
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   231
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   232
function onHeroDeath(gear)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   233
	if hero.dead then
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   234
		return true
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   235
	end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   236
	return false
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   237
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   238
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   239
function onGreen1Death(gear)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   240
	if green1.dead then
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   241
		return true
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   242
	end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   243
	return false
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   244
end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   245
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   246
function onBattleWin(gear)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   247
	local win = true
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   248
	for i=1,7 do
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   249
		if i<3 then
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   250
			if GetHealth(yellowArmy[i].gear) then
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   251
				win = false
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   252
			end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   253
		else
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   254
			if GetHealth(yellowArmy[i].gear) and not yellowArmy[i].hidden then
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   255
				win = false
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   256
			end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   257
		end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   258
	end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   259
	if GetHealth(yellow1.gear) then
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   260
		win = false
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   261
	end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   262
	return win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   263
end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   264
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   265
function onHeroSelect(gear)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   266
	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
   267
		return true
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   268
	end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   269
	return false
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   270
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   271
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   272
-------------- OUTCOMES ------------------ I should really s/OUTCOMES/ACTIONS/
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   273
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   274
function heroDeath(gear)
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   275
	gameLost()
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   276
end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   277
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   278
function green1Death(gear)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   279
	gameLost()
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   280
end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   281
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   282
function battleWin(gear)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   283
	-- add stats
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   284
	EndGame()
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   285
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   286
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   287
function heroSelect(gear)
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   288
	TurnTimeLeft = 0
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   289
	FollowGear(hero.gear)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   290
	if GetX(hero.gear) < hero.x then
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   291
		chooseToBattle = true		
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   292
		AddEvent(onGreen1Death, {green1.gear}, green1Death, {green1.gear}, 0)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   293
		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
   294
		AddAnim(dialog02)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   295
	elseif GetX(hero.gear) > hero.x then
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   296
		AddAnim(dialog03)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   297
	end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   298
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   299
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   300
-------------- ANIMATIONS ------------------
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   301
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   302
function Skipanim(anim)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   303
	if goals[anim] ~= nil then
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   304
		ShowMission(unpack(goals[anim]))
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   305
    end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   306
    if anim == dialog01 then
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   307
		AnimSwitchHog(hero.gear)
9494
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   308
	elseif anim == dialog02 or anim == dialog03 then
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   309
		startBattle()
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   310
    end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   311
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   312
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   313
function AnimationSetup()
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   314
	-- 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
   315
	AddSkipFunction(dialog01, Skipanim, {dialog01})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   316
	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   317
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Somewhere in the planet of fruits a terrible war is about to begin..."), 5000}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   318
	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}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   319
	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("So, I kindly ask for your help."), SAY_SAY, 3000}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   320
	table.insert(dialog01, {func = AnimWait, args = {green1.gear, 2000}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   321
	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("You couldn't have come to a worse time Hog Solo!"), SAY_SAY, 3000}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   322
	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("The clan of the Red Strawberry wants to take over the dominion and overthrone king Pineapple."), SAY_SAY, 5000}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   323
	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 to the annual dusting of the king's palace."), SAY_SAY, 8000}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   324
	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("However the army of Yellow Watermellons is about to attack any moment now."), SAY_SAY, 4000}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   325
	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
   326
	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
   327
	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   328
	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}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   329
	table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   330
	-- DIALOG 02 - Hero selects to fight	
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   331
	AddSkipFunction(dialog02, Skipanim, {dialog02})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   332
	table.insert(dialog02, {func = AnimWait, args = {green1.gear, 3000}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   333
	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("You choose well Hog Solo!"), SAY_SAY, 3000}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   334
	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("I have only 3 hogs available and they are all cadets"), SAY_SAY, 4000}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   335
	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("As more experienced I want you to lead them to the battle"), SAY_SAY, 4000}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   336
	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("I of cource will observe the battle and intervene if necessary"), SAY_SAY, 5000}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   337
	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 5000}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   338
	table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("No problem Captain! The enemies aren't many anyway, it is going to be easy!"), SAY_SAY, 5000}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   339
	table.insert(dialog02, {func = AnimWait, args = {green1.gear, 5000}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   340
	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("Don't be fool son, they'll be more"), SAY_SAY, 3000}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   341
	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("Try to be smart and eliminate them quickly. This way you might scare the rest!"), SAY_SAY, 5000}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   342
	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
   343
	-- DIALOG 03 - Hero selects to flee
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   344
	AddSkipFunction(dialog03, Skipanim, {dialog03})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   345
	table.insert(dialog03, {func = AnimWait, args = {green1.gear, 3000}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   346
	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Too bad... Then you should really leave!"), SAY_SAY, 3000}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   347
	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Things are going to get messy around here"), SAY_SAY, 3000}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   348
	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Also, you should know that the only place that you can fly would be the most left one"), SAY_SAY, 5000}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   349
	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("All the other places are protected by our anti flying weapons"), SAY_SAY, 4000}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   350
	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Now go and don't waste more of my time you coward..."), SAY_SAY, 4000}})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   351
	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
   352
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   353
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   354
------------- OTHER FUNCTIONS ---------------
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   355
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   356
function startBattle()
9494
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   357
	AnimSwitchHog(yellow1.gear)
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   358
	TurnTimeLeft = 0
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   359
end
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
   360
9496
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   361
function gameLost()	
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   362
	SendStat('siGameResult', loc("Green Bananas lost, try again!")) --1
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   363
	SendStat('siCustomAchievement', loc("Tips...")) --11
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   364
	SendStat('siPlayerKills','1',teamC.name)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   365
	SendStat('siPlayerKills','0',teamA.name)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   366
	SendStat('siPlayerKills','0',teamB.name)
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   367
	EndGame()
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   368
end
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9494
diff changeset
   369
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
   370
function getNextWave()
9494
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   371
	if TotalRounds == 4 then
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   372
		RestoreHog(yellowArmy[3].gear)
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   373
		AnimCaption(hero.gear, loc("Next wave in 3 turns"), 5000)
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   374
	elseif TotalRounds == 7 then
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   375
		RestoreHog(yellowArmy[4].gear)
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   376
		RestoreHog(yellowArmy[5].gear)
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   377
		AnimCaption(hero.gear, loc("Last wave in 3 turns"), 5000)
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   378
	elseif TotalRounds == 10 then
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   379
		RestoreHog(yellowArmy[6].gear)
e515962d7af4 hide hogs and spawn them per waves
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9492
diff changeset
   380
		RestoreHog(yellowArmy[7].gear)
9492
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
   381
	end
1cbd49706334 added newly created hogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
   382
end