share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit01.lua
author Periklis Ntanasis <pntanasis@gmail.com>
Thu, 08 Aug 2013 18:24:40 +0300
branchspacecampaign
changeset 9490 b93448b75fa4
parent 9488 2e2bb48566ae
child 9492 1cbd49706334
permissions -rw-r--r--
fix bugs and some changes regarting the difficulty in desert02
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
}
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    27
-- hogs
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    28
local hero = {}
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    29
local yellow1 = {}
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    30
local yellow2 = {}
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    31
local yellow3 = {}
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    32
local green1 = {}
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    33
-- teams
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    34
local teamA = {}
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    35
local teamB = {}
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    36
local teamC = {}
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    37
-- hedgehogs values
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    38
hero.name = "Hog Solo"
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    39
hero.x = 3650
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    40
hero.y = 95
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    41
hero.dead = false
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
    42
green1.name = "Captain Lime"
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    43
green1.x = 3600
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    44
green1.y = 95
9490
b93448b75fa4 fix bugs and some changes regarting the difficulty in desert02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9488
diff changeset
    45
green2.name = "Mister Pear"
b93448b75fa4 fix bugs and some changes regarting the difficulty in desert02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9488
diff changeset
    46
green3.name = "Lady Mango"
b93448b75fa4 fix bugs and some changes regarting the difficulty in desert02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9488
diff changeset
    47
green4.name = "Green Hog Grape"
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    48
yellow1.name = "General Lemon"
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    49
yellow1.x = 1300
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    50
yellow1.y = 1500
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    51
teamA.name = loc("Hog Solo")
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    52
teamA.color = tonumber("38D61C",16) -- green  
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    53
teamB.name = loc("Green Bananas")
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    54
teamB.color = tonumber("38D61C",16) -- green
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    55
teamC.name = loc("Yellow Watermellons")
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    56
teamC.color = tonumber("DDFF00",16) -- yellow
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    57
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    58
function onGameInit()
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    59
	Seed = 1
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    60
	TurnTime = 20000
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    61
	CaseFreq = 0
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    62
	MinesNum = 0
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    63
	MinesTime = 1
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    64
	Explosives = 0
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    65
	Delay = 3
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    66
	HealthCaseAmount = 30
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    67
	Map = "fruit01_map"
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    68
	Theme = "Fruit"
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    69
	
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    70
	-- Hog Solo
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    71
	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
    72
	hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    73
	AnimSetGearPosition(hero.gear, hero.x, hero.y)
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    74
	HogTurnLeft(hero.gear, true)
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    75
	-- Green Bananas
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    76
	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
    77
	green1.gear = AddHog(green1.name, 0, 100, "war_desertgrenadier1")
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    78
	AnimSetGearPosition(green1.gear, green1.x, green1.y)
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    79
	-- Yellow Watermellons
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    80
	AddTeam(teamC.name, teamC.color, "Bone", "Island", "HillBilly", "cm_birdy")
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
    81
	yellow1.gear = AddHog(yellow1.name, 0, 100, "war_desertgrenadier1")
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    82
	AnimSetGearPosition(yellow1.gear, yellow1.x, yellow1.y)
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    83
	
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    84
	AnimInit()
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
    85
	AnimationSetup()	
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    86
end
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    87
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    88
function onGameStart()
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    89
	AnimWait(hero.gear, 3000)
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    90
	FollowGear(hero.gear)
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    91
	
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
    92
	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
    93
	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
    94
	
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
    95
	AddAnim(dialog01)
9486
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    96
	SendHealthStatsOff()
036fece2fb5f forgot to commit the new files :/
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    97
end
9488
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
    98
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
    99
function onGameTick()
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   100
	AnimUnWait()
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   101
	if ShowAnimation() == false then
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   102
		return
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   103
	end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   104
	ExecuteAfterAnimations()
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   105
	CheckEvents()
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   106
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   107
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   108
function onGearDelete(gear)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   109
	if gear == hero.gear then
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   110
		hero.dead = true
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   111
	end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   112
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   113
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   114
function onPrecise()
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   115
	if GameTime > 3000 then
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   116
		SetAnimSkip(true)   
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   117
	end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   118
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   119
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   120
-------------- EVENTS ------------------
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   121
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   122
function onHeroDeath(gear)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   123
	if hero.dead then
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   124
		return true
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   125
	end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   126
	return false
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   127
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   128
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   129
function onHeroSelect(gear)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   130
	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
   131
		return true
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   132
	end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   133
	return false
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   134
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   135
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   136
-------------- 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
   137
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   138
function heroDeath(gear)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   139
	SendStat('siGameResult', loc("Green Bananas lost, try again!")) --1
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   140
	SendStat('siCustomAchievement', loc("Tips...")) --11
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   141
	SendStat('siPlayerKills','1',teamC.name)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   142
	SendStat('siPlayerKills','0',teamA.name)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   143
	SendStat('siPlayerKills','0',teamB.name)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   144
	EndGame()
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   145
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   146
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   147
function heroSelect(gear)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   148
	FollowGear(hero.gear)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   149
	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
   150
		chooseToBattle = true
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   151
		AddAnim(dialog02)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   152
	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
   153
		AddAnim(dialog03)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   154
	end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   155
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   156
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   157
-------------- ANIMATIONS ------------------
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   158
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   159
function Skipanim(anim)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   160
	if goals[anim] ~= nil then
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   161
		ShowMission(unpack(goals[anim]))
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   162
    end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   163
    if anim == dialog01 then
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   164
		AnimSwitchHog(hero.gear)
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   165
    end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   166
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   167
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   168
function AnimationSetup()
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   169
	-- 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
   170
	AddSkipFunction(dialog01, Skipanim, {dialog01})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   171
	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
   172
	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
   173
	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
   174
	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
   175
	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
   176
	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
   177
	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
   178
	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
   179
	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
   180
	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
   181
	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
   182
	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
   183
	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
   184
	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
   185
	-- DIALOG 02 - Hero selects to fight	
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   186
	AddSkipFunction(dialog02, Skipanim, {dialog02})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   187
	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
   188
	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
   189
	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
   190
	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
   191
	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
   192
	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
   193
	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
   194
	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
   195
	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
   196
	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
   197
	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
   198
	-- DIALOG 03 - Hero selects to flee
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   199
	AddSkipFunction(dialog03, Skipanim, {dialog03})
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   200
	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
   201
	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
   202
	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
   203
	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
   204
	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
   205
	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
   206
	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
   207
end
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   208
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   209
------------- OTHER FUNCTIONS ---------------
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   210
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   211
function startBattle()
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   212
	
2e2bb48566ae dialogs, events for hero death and side choice
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9486
diff changeset
   213
end