share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit02.lua
author Wuzzy <Wuzzy2@mail.ru>
Mon, 03 Sep 2018 12:46:57 +0200
changeset 13755 110d6c1e817f
parent 13745 2bb7141496a9
child 14406 6c21bd8547dd
permissions -rw-r--r--
Lua: Rename globals: NoPointX→NO_CURSOR, cMaxTurnTime→MAX_TURN_TIME, cMaxHogHealth→MAX_HOG_HEALTH These globals did not exist in 0.9.24, so this change is safe.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     1
------------------- ABOUT ----------------------
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     2
--
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     3
-- In this adventure hero gets the lost part with
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     4
-- the help of the green bananas hogs.
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     5
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     6
HedgewarsScriptLoad("/Scripts/Locale.lua")
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     7
HedgewarsScriptLoad("/Scripts/Animate.lua")
9578
16139270448f save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
     8
HedgewarsScriptLoad("/Missions/Campaign/A_Space_Adventure/global_functions.lua")
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     9
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    10
----------------- VARIABLES --------------------
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    11
-- globals
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9554
diff changeset
    12
local missionName = loc("Getting to the device")
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    13
local inBattle = false
9529
e95aab9130d8 first dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9527
diff changeset
    14
local tookPartInBattle = false
9536
7456b28a3421 this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9534
diff changeset
    15
local previousHog = -1
9746
64abf9862562 fixed wrong saved positions, illegal crate destroying and killing cap.Lime early in fruit02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
    16
local permitCaptainLimeDeath = false
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    17
-- dialogs
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    18
local dialog01 = {}
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    19
local dialog02 = {}
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    20
local dialog03 = {}
9534
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
    21
local dialog04 = {}
12588
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
    22
local dialog05 = {}
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    23
-- mission objectives
12231
3ec0261e01f0 Display mines timer in all missions with non-default timer
Wuzzy <almikes@aol.com>
parents: 12229
diff changeset
    24
local minesTimeText = loc("Mines time: 0 seconds")
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    25
local goals = {
12430
f9cbb896967b Fix 3 more incorrect uses of loc() in scripts
Wuzzy <almikes@aol.com>
parents: 12231
diff changeset
    26
	[dialog01] = {missionName, loc("Exploring the tunnel"), loc("Search for the device with the help of the other hedgehogs ").."|"..loc("Hog Solo has to reach the last crates") .. "|" .. minesTimeText, 1, 4000},
12231
3ec0261e01f0 Display mines timer in all missions with non-default timer
Wuzzy <almikes@aol.com>
parents: 12229
diff changeset
    27
	[dialog02] = {missionName, loc("Exploring the tunnel"), loc("Explore the tunnel with the other hedgehogs and search for the device").."|"..loc("Hog Solo has to reach the last crates") .. "|" .. minesTimeText, 1, 4000},
3ec0261e01f0 Display mines timer in all missions with non-default timer
Wuzzy <almikes@aol.com>
parents: 12229
diff changeset
    28
	[dialog03] = {missionName, loc("Return to the Surface"), loc("Go to the surface!").."|"..loc("Attack Captain Lime before he attacks back").."|"..minesTimeText, 1, 4000},
3ec0261e01f0 Display mines timer in all missions with non-default timer
Wuzzy <almikes@aol.com>
parents: 12229
diff changeset
    29
	[dialog04] = {missionName, loc("Return to the Surface"), loc("Go to the surface!").."|"..loc("Attack the assassins before they attack back").."|"..minesTimeText, 1, 4000},
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    30
}
9542
d1ea2d1540f2 custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9540
diff changeset
    31
-- crates
12533
7b32e83aaf48 ASA, Getting to the device: Add fake crate for the device part with proper collect message
Wuzzy <almikes@aol.com>
parents: 12525
diff changeset
    32
local girderCrate = {name = amGirder, x = 1680, y = 1160}
7b32e83aaf48 ASA, Getting to the device: Add fake crate for the device part with proper collect message
Wuzzy <almikes@aol.com>
parents: 12525
diff changeset
    33
9552
90d69a2c1729 checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9550
diff changeset
    34
local eagleCrate = {name = amDEagle, x = 1680, y = 1650}
12533
7b32e83aaf48 ASA, Getting to the device: Add fake crate for the device part with proper collect message
Wuzzy <almikes@aol.com>
parents: 12525
diff changeset
    35
7b32e83aaf48 ASA, Getting to the device: Add fake crate for the device part with proper collect message
Wuzzy <almikes@aol.com>
parents: 12525
diff changeset
    36
local weaponCrate = { x = 1320, y = 1870}
7b32e83aaf48 ASA, Getting to the device: Add fake crate for the device part with proper collect message
Wuzzy <almikes@aol.com>
parents: 12525
diff changeset
    37
local deviceCrate = { gear = nil, x = 1360, y = 1870}
9552
90d69a2c1729 checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9550
diff changeset
    38
local ropeCrate = {name = amRope, x = 1400, y = 1870}
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    39
-- hogs
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    40
local hero = {}
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    41
local green1 = {}
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    42
local green2 = {}
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    43
local green3 = {}
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    44
-- teams
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    45
local teamA = {}
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    46
local teamB = {}
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    47
local teamC = {}
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    48
-- hedgehogs values
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9554
diff changeset
    49
hero.name = loc("Hog Solo")
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    50
hero.x = 1200
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    51
hero.y = 820
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    52
hero.dead = false
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9554
diff changeset
    53
green1.name = loc("Captain Lime")
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    54
green1.x = 1050
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    55
green1.y = 820
9538
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
    56
green1.dead = false
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9554
diff changeset
    57
green2.name = loc("Mister Pear")
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    58
green2.x = 1350
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    59
green2.y = 820
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9554
diff changeset
    60
green3.name = loc("Lady Mango")
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    61
green3.x = 1450
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    62
green3.y = 820
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    63
local redHedgehogs = {
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9554
diff changeset
    64
	{ name = loc("Poisonous Apple") },
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9554
diff changeset
    65
	{ name = loc("Dark Strawberry") },
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9554
diff changeset
    66
	{ name = loc("Watermelon Heart") },
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9554
diff changeset
    67
	{ name = loc("Deadly Grape") }
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    68
}
12578
a778c1bb032e ASA: Explain team abbreviations + update changelog
Wuzzy <almikes@aol.com>
parents: 12577
diff changeset
    69
-- Hog Solo and Green Bananas
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    70
teamA.name = loc("Hog Solo and GB")
13589
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
    71
teamA.color = -6
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
    72
-- Captain Lime will use a color which is almost the same as the color of teamA.
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
    73
-- It works, but it's a hack.
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
    74
-- Technically, this makes Captain Lime an enemy team in the mission but for the player
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
    75
-- it looks like an ally. This is because Camptain Lime starts friendly (story-wise),
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
    76
-- but might become your enemy during the course of this mission.
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
    77
-- TODO: For teamB, use same color of teamA when friendly, change color when evil
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    78
teamB.name = loc("Captain Lime")
9831
afa4e3e04cc5 typos correction
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9810
diff changeset
    79
teamC.name = loc("Fruit Assassins")
13589
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
    80
teamC.color = -1
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    81
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    82
function onGameInit()
9538
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
    83
	GameFlags = gfDisableWind
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    84
	Seed = 1
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    85
	TurnTime = 20000
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    86
	CaseFreq = 0
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    87
	MinesNum = 0
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    88
	MinesTime = 1
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    89
	Explosives = 0
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    90
	Delay = 3
12229
d62d6f8ebef1 Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents: 12093
diff changeset
    91
	-- Disable Sudden Death
d62d6f8ebef1 Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents: 12093
diff changeset
    92
	HealthDecrease = 0
d62d6f8ebef1 Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents: 12093
diff changeset
    93
	WaterRise = 0
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    94
	Map = "fruit02_map"
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    95
	Theme = "Fruit"
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9747
diff changeset
    96
9552
90d69a2c1729 checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9550
diff changeset
    97
	local health = 100
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9747
diff changeset
    98
13589
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
    99
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   100
	-- Fruit Assassins
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   101
	local assasinsHats = { "NinjaFull", "NinjaStraight", "NinjaTriangle" }
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   102
	AddTeam(teamC.name, teamC.color, "bp2", "Island", "Default", "cm_scout")
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   103
	for i=1,table.getn(redHedgehogs) do
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   104
		redHedgehogs[i].gear =  AddHog(redHedgehogs[i].name, 1, 100, assasinsHats[GetRandom(3)+1])
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   105
		AnimSetGearPosition(redHedgehogs[i].gear, 2010 + 50*i, 630)
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   106
	end
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   107
	local assassinsColor = div(GetClanColor(GetHogClan(redHedgehogs[1].gear)), 0x100)
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   108
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   109
	-- Hog Solo and Green Bananas
12592
0b27d8b4f8e7 Use Default voice in A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 12591
diff changeset
   110
	AddTeam(teamA.name, teamA.color, "Simple", "Island", "Default", "hedgehog")
9552
90d69a2c1729 checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9550
diff changeset
   111
	hero.gear = AddHog(hero.name, 0, health, "war_desertgrenadier1")
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   112
	AnimSetGearPosition(hero.gear, hero.x, hero.y)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9747
diff changeset
   113
	HogTurnLeft(hero.gear, true)
9629
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9587
diff changeset
   114
	green2.gear = AddHog(green2.name, 0, 100, "war_britmedic")
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   115
	AnimSetGearPosition(green2.gear, green2.x, green2.y)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   116
	HogTurnLeft(green2.gear, true)
9629
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9587
diff changeset
   117
	green3.gear = AddHog(green3.name, 0, 100, "hair_red")
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   118
	AnimSetGearPosition(green3.gear, green3.x, green3.y)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   119
	HogTurnLeft(green3.gear, true)
13589
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   120
	local heroColor = div(GetClanColor(GetHogClan(hero.gear)), 0x100)
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   121
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   122
	-- Captain Lime
13589
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   123
	-- Returns a color that is as close as possible to the color argument
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   124
	-- but does not equal color and otherCollision.
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   125
	local getSimilarColor = function(color, otherCollision)
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   126
		local goingUp = false
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   127
		local collision1 = color
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   128
		while(color == collision1 or color == otherCollision) do
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   129
			-- Try out colors by varying the blue color component until
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   130
			-- we don't collide with any of the 2 colors.
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   131
			if ((color % 0x100) > 0) and (not goingUp) then
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   132
				color = color - 0x1
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   133
			else
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   134
				goingUp = true
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   135
				color = color + 0x1
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   136
			end
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   137
		end
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   138
		return color
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   139
	end
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   140
	-- Captain Lime gets a fake color clore to hero's clan color.
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   141
	-- This is a hack, but it works. See explanation at top of file
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   142
	local cptnColor = getSimilarColor(heroColor, assassinsColor)
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13588
diff changeset
   143
	AddTeam(teamB.name, cptnColor, "Cherry", "Island", "Default", "congo-brazzaville")
12577
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12543
diff changeset
   144
	green1.gear= AddHog(green1.name, 0, 100, "war_desertofficer")
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12543
diff changeset
   145
	AnimSetGearPosition(green1.gear, green1.x, green1.y)
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   146
12093
1da37e2ba6fd Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
   147
	AnimInit(true)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9747
diff changeset
   148
	AnimationSetup()
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   149
end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   150
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   151
function onGameStart()
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   152
	AnimWait(hero.gear, 3000)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   153
	FollowGear(hero.gear)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9747
diff changeset
   154
9540
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   155
	if GetCampaignVar("Fruit01JoinedBattle") and GetCampaignVar("Fruit01JoinedBattle") == "true" then
9529
e95aab9130d8 first dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9527
diff changeset
   156
		tookPartInBattle = true
e95aab9130d8 first dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9527
diff changeset
   157
	end
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9747
diff changeset
   158
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   159
	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
12533
7b32e83aaf48 ASA, Getting to the device: Add fake crate for the device part with proper collect message
Wuzzy <almikes@aol.com>
parents: 12525
diff changeset
   160
	AddEvent(onDeviceCrates, {hero.gear}, deviceCrateEvent, {hero.gear}, 0)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9747
diff changeset
   161
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   162
	-- Hog Solo and GB weapons
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   163
	AddAmmo(hero.gear, amSwitch, 100)
9831
afa4e3e04cc5 typos correction
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9810
diff changeset
   164
	-- Assassins weapons
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   165
	AddAmmo(redHedgehogs[1].gear, amBazooka, 6)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   166
	AddAmmo(redHedgehogs[1].gear, amGrenade, 6)
9540
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   167
	AddAmmo(redHedgehogs[1].bot, amDEagle, 6)
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   168
	for i=1,table.getn(redHedgehogs) do
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   169
		HideHog(redHedgehogs[i].gear)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   170
	end
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9747
diff changeset
   171
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   172
	-- explosives
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   173
	-- I wanted to use FindPlace but doesn't accept height values...
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   174
	local x1 = 950
9538
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   175
	local x2 = 1306
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   176
	local y1 = 1210
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   177
	local y2 = 1620
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   178
	while true do
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   179
		if y2<y1 then
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   180
			break
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   181
		end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   182
		if x2<x1 then
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   183
			x2 = 1305
9538
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   184
			y2 = y2 - 50
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   185
		end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   186
		if not TestRectForObstacle(x2+25, y2+25, x2-25, y2-25, true) then
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   187
			AddGear(x2, y2, gtExplosives, 0, 0, 0, 0)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   188
		end
9538
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   189
		x2 = x2 - 25
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   190
	end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   191
	AddGear(3128, 1680, gtExplosives, 0, 0, 0, 0)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9747
diff changeset
   192
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   193
	--mines
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   194
	AddGear(3135, 1680, gtMine, 0, 0, 0, 0)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   195
	AddGear(3145, 1680, gtMine, 0, 0, 0, 0)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   196
	AddGear(3155, 1680, gtMine, 0, 0, 0, 0)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   197
	AddGear(3165, 1680, gtMine, 0, 0, 0, 0)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   198
	AddGear(3175, 1680, gtMine, 0, 0, 0, 0)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   199
	AddGear(3115, 1680, gtMine, 0, 0, 0, 0)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   200
	AddGear(3105, 1680, gtMine, 0, 0, 0, 0)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   201
	AddGear(3095, 1680, gtMine, 0, 0, 0, 0)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   202
	AddGear(3085, 1680, gtMine, 0, 0, 0, 0)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9747
diff changeset
   203
	AddGear(3075, 1680, gtMine, 0, 0, 0, 0)
9552
90d69a2c1729 checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9550
diff changeset
   204
12525
22f2a586b9ca Remove checkpoints in ASA: Getting to the device
Wuzzy <almikes@aol.com>
parents: 12519
diff changeset
   205
	AddAmmo(hero.gear, amFirePunch, 3)
22f2a586b9ca Remove checkpoints in ASA: Getting to the device
Wuzzy <almikes@aol.com>
parents: 12519
diff changeset
   206
	if tookPartInBattle then
22f2a586b9ca Remove checkpoints in ASA: Getting to the device
Wuzzy <almikes@aol.com>
parents: 12519
diff changeset
   207
		AddAnim(dialog01)
22f2a586b9ca Remove checkpoints in ASA: Getting to the device
Wuzzy <almikes@aol.com>
parents: 12519
diff changeset
   208
	else
22f2a586b9ca Remove checkpoints in ASA: Getting to the device
Wuzzy <almikes@aol.com>
parents: 12519
diff changeset
   209
		AddAnim(dialog02)
9552
90d69a2c1729 checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9550
diff changeset
   210
	end
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9747
diff changeset
   211
9552
90d69a2c1729 checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9550
diff changeset
   212
	-- place crates
12938
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12685
diff changeset
   213
	SpawnSupplyCrate(girderCrate.x, girderCrate.y, girderCrate.name)
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12685
diff changeset
   214
	SpawnSupplyCrate(eagleCrate.x, eagleCrate.y, eagleCrate.name)
12533
7b32e83aaf48 ASA, Getting to the device: Add fake crate for the device part with proper collect message
Wuzzy <almikes@aol.com>
parents: 12525
diff changeset
   215
	deviceCrate.gear = SpawnFakeUtilityCrate(deviceCrate.x, deviceCrate.y, false, false) -- anti-gravity device
7b32e83aaf48 ASA, Getting to the device: Add fake crate for the device part with proper collect message
Wuzzy <almikes@aol.com>
parents: 12525
diff changeset
   216
	-- Rope crate is placed after device crate has been collected.
7b32e83aaf48 ASA, Getting to the device: Add fake crate for the device part with proper collect message
Wuzzy <almikes@aol.com>
parents: 12525
diff changeset
   217
	-- This is done so it is impossible the player can rope before getting
7b32e83aaf48 ASA, Getting to the device: Add fake crate for the device part with proper collect message
Wuzzy <almikes@aol.com>
parents: 12525
diff changeset
   218
	-- the device part.
9552
90d69a2c1729 checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9550
diff changeset
   219
90d69a2c1729 checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9550
diff changeset
   220
	if tookPartInBattle then
12938
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12685
diff changeset
   221
		SpawnSupplyCrate(weaponCrate.x, weaponCrate.y, amWatermelon)
9552
90d69a2c1729 checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9550
diff changeset
   222
	else
12938
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12685
diff changeset
   223
		SpawnSupplyCrate(weaponCrate.x, weaponCrate.y, amSniperRifle)
9548
38630665c9ab check point fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9546
diff changeset
   224
	end
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9747
diff changeset
   225
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   226
	SendHealthStatsOff()
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   227
end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   228
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   229
function onNewTurn()
9534
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   230
	if not inBattle and CurrentHedgehog == green1.gear then
12519
d89dabfd07ce Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents: 12518
diff changeset
   231
		EndTurn(true)
9534
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   232
	elseif CurrentHedgehog == green2.gear or CurrentHedgehog == green3.gear then
12519
d89dabfd07ce Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents: 12518
diff changeset
   233
		EndTurn(true)
9536
7456b28a3421 this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9534
diff changeset
   234
	elseif inBattle then
7456b28a3421 this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9534
diff changeset
   235
		if CurrentHedgehog == green1.gear and previousHog ~= hero.gear then
12519
d89dabfd07ce Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents: 12518
diff changeset
   236
			EndTurn(true)
9536
7456b28a3421 this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9534
diff changeset
   237
			return
9534
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   238
		end
9540
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   239
		for i=1,table.getn(redHedgehogs) do
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   240
			if CurrentHedgehog == redHedgehogs[i].gear and previousHog ~= hero.gear then
12519
d89dabfd07ce Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents: 12518
diff changeset
   241
				EndTurn(true)
9540
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   242
				return
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   243
			end
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   244
		end
13745
2bb7141496a9 Use SetTurnTimeLeft and SetReadyTimeLeft in all scripts
Wuzzy <Wuzzy2@mail.ru>
parents: 13589
diff changeset
   245
		SetTurnTimeLeft(20000)
9538
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   246
		wind()
9540
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   247
	elseif not inBattle and CurrentHedgehog == hero.gear then
13755
110d6c1e817f Lua: Rename globals: NoPointX→NO_CURSOR, cMaxTurnTime→MAX_TURN_TIME, cMaxHogHealth→MAX_HOG_HEALTH
Wuzzy <Wuzzy2@mail.ru>
parents: 13745
diff changeset
   248
		SetTurnTimeLeft(MAX_TURN_TIME)
9538
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   249
		wind()
9536
7456b28a3421 this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9534
diff changeset
   250
	else
12519
d89dabfd07ce Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents: 12518
diff changeset
   251
		EndTurn(true)
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   252
	end
9536
7456b28a3421 this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9534
diff changeset
   253
	previousHog = CurrentHedgehog
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   254
end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   255
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   256
function onGameTick()
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   257
	AnimUnWait()
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   258
	if ShowAnimation() == false then
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   259
		return
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   260
	end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   261
	ExecuteAfterAnimations()
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   262
	CheckEvents()
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   263
end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   264
9746
64abf9862562 fixed wrong saved positions, illegal crate destroying and killing cap.Lime early in fruit02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   265
function onGameTick20()
64abf9862562 fixed wrong saved positions, illegal crate destroying and killing cap.Lime early in fruit02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   266
	if not permitCaptainLimeDeath and not GetHealth(green1.gear) then
64abf9862562 fixed wrong saved positions, illegal crate destroying and killing cap.Lime early in fruit02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   267
		-- game ends with the according stat messages
64abf9862562 fixed wrong saved positions, illegal crate destroying and killing cap.Lime early in fruit02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   268
		heroDeath()
64abf9862562 fixed wrong saved positions, illegal crate destroying and killing cap.Lime early in fruit02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   269
		permitCaptainLimeDeath = true
64abf9862562 fixed wrong saved positions, illegal crate destroying and killing cap.Lime early in fruit02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   270
	end
9747
abe0c8a2d573 adjusting the wind in fruit02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9746
diff changeset
   271
	if CurrentHedgehog and GetY(CurrentHedgehog) > 1350 then
abe0c8a2d573 adjusting the wind in fruit02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9746
diff changeset
   272
		SetWind(-40)
abe0c8a2d573 adjusting the wind in fruit02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9746
diff changeset
   273
	end
9746
64abf9862562 fixed wrong saved positions, illegal crate destroying and killing cap.Lime early in fruit02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   274
end
64abf9862562 fixed wrong saved positions, illegal crate destroying and killing cap.Lime early in fruit02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   275
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   276
function onGearDelete(gear)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   277
	if gear == hero.gear then
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   278
		hero.dead = true
12577
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12543
diff changeset
   279
	elseif gear == green1.gear then
9538
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   280
		green1.dead = true
12533
7b32e83aaf48 ASA, Getting to the device: Add fake crate for the device part with proper collect message
Wuzzy <almikes@aol.com>
parents: 12525
diff changeset
   281
	elseif gear == deviceCrate.gear then
7b32e83aaf48 ASA, Getting to the device: Add fake crate for the device part with proper collect message
Wuzzy <almikes@aol.com>
parents: 12525
diff changeset
   282
		if band(GetGearMessage(gear), gmDestroy) ~= 0 then
7b32e83aaf48 ASA, Getting to the device: Add fake crate for the device part with proper collect message
Wuzzy <almikes@aol.com>
parents: 12525
diff changeset
   283
			PlaySound(sndShotgunReload)
7b32e83aaf48 ASA, Getting to the device: Add fake crate for the device part with proper collect message
Wuzzy <almikes@aol.com>
parents: 12525
diff changeset
   284
			AddCaption(loc("Anti-Gravity Device Part (+1)"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmostate)
7b32e83aaf48 ASA, Getting to the device: Add fake crate for the device part with proper collect message
Wuzzy <almikes@aol.com>
parents: 12525
diff changeset
   285
			deviceCrate.collected = true
12589
46a10d3fa619 ASA, fruit02: Minor refactor
Wuzzy <almikes@aol.com>
parents: 12588
diff changeset
   286
			deviceCrate.collector = CurrentHedgehog
12533
7b32e83aaf48 ASA, Getting to the device: Add fake crate for the device part with proper collect message
Wuzzy <almikes@aol.com>
parents: 12525
diff changeset
   287
			-- Spawn rope crate
12938
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12685
diff changeset
   288
			SpawnSupplyCrate(ropeCrate.x, ropeCrate.y, ropeCrate.name)
12533
7b32e83aaf48 ASA, Getting to the device: Add fake crate for the device part with proper collect message
Wuzzy <almikes@aol.com>
parents: 12525
diff changeset
   289
		end
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   290
	end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   291
end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   292
9746
64abf9862562 fixed wrong saved positions, illegal crate destroying and killing cap.Lime early in fruit02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   293
function onGearDamage(gear, damage)
64abf9862562 fixed wrong saved positions, illegal crate destroying and killing cap.Lime early in fruit02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   294
	if GetGearType(gear) == gtCase then
64abf9862562 fixed wrong saved positions, illegal crate destroying and killing cap.Lime early in fruit02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   295
		-- in this mode every crate is essential in order to complete the mission
64abf9862562 fixed wrong saved positions, illegal crate destroying and killing cap.Lime early in fruit02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   296
		-- destroying a crate ends the game
64abf9862562 fixed wrong saved positions, illegal crate destroying and killing cap.Lime early in fruit02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   297
		heroDeath()
64abf9862562 fixed wrong saved positions, illegal crate destroying and killing cap.Lime early in fruit02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   298
	end
64abf9862562 fixed wrong saved positions, illegal crate destroying and killing cap.Lime early in fruit02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   299
end
64abf9862562 fixed wrong saved positions, illegal crate destroying and killing cap.Lime early in fruit02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   300
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   301
function onAmmoStoreInit()
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   302
	SetAmmo(amDEagle, 0, 0, 0, 6)
9587
d6ddcafb1c56 fixed bug not displaying fuit02 after selecting fruitPlanet from cosmos
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9582
diff changeset
   303
	SetAmmo(amGirder, 0, 0, 0, 2)
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   304
	SetAmmo(amRope, 0, 0, 0, 1)
11981
d5dabb71d6bf Add skip option to desert01, fruit02, moon01 in A Space Adventure
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   305
	SetAmmo(amSkip, 9, 0, 0, 1)
9630
df942cfac4e6 add bonuses
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9629
diff changeset
   306
	if tonumber(getBonus(2)) == 1 then
df942cfac4e6 add bonuses
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9629
diff changeset
   307
		SetAmmo(amWatermelon, 0, 0, 0, 2)
df942cfac4e6 add bonuses
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9629
diff changeset
   308
		SetAmmo(amSniperRifle, 0, 0, 0, 2)
df942cfac4e6 add bonuses
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9629
diff changeset
   309
	else
df942cfac4e6 add bonuses
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9629
diff changeset
   310
		SetAmmo(amWatermelon, 0, 0, 0, 1)
df942cfac4e6 add bonuses
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9629
diff changeset
   311
		SetAmmo(amSniperRifle, 0, 0, 0, 1)
df942cfac4e6 add bonuses
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9629
diff changeset
   312
	end
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   313
end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   314
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   315
function onPrecise()
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   316
	if GameTime > 3000 then
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9747
diff changeset
   317
		SetAnimSkip(true)
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   318
	end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   319
end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   320
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   321
-------------- EVENTS ------------------
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   322
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   323
function onHeroDeath(gear)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   324
	if hero.dead then
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   325
		return true
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   326
	end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   327
	return false
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   328
end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   329
9532
4fa58a49ace1 more dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9529
diff changeset
   330
function onDeviceCrates(gear)
12533
7b32e83aaf48 ASA, Getting to the device: Add fake crate for the device part with proper collect message
Wuzzy <almikes@aol.com>
parents: 12525
diff changeset
   331
	if not hero.dead and deviceCrate.collected and StoppedGear(hero.gear) then
9532
4fa58a49ace1 more dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9529
diff changeset
   332
		return true
4fa58a49ace1 more dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9529
diff changeset
   333
	end
4fa58a49ace1 more dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9529
diff changeset
   334
	return false
4fa58a49ace1 more dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9529
diff changeset
   335
end
4fa58a49ace1 more dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9529
diff changeset
   336
9534
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   337
function onSurface(gear)
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   338
	if not hero.dead and GetY(hero.gear)<850 and  StoppedGear(hero.gear) then
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   339
		return true
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   340
	end
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   341
	return false
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   342
end
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   343
9538
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   344
function onGaptainLimeDeath(gear)
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   345
	if green1.dead then
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   346
		return true
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   347
	end
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   348
	return false
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   349
end
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   350
9540
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   351
function onRedTeamDeath(gear)
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   352
	local redDead = true
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   353
	for i=1,table.getn(redHedgehogs) do
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   354
		if GetHealth(redHedgehogs[i].gear) then
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   355
			redDead = false
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   356
			break
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   357
		end
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   358
	end
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   359
	return redDead
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   360
end
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   361
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   362
-------------- ACTIONS ------------------
9760
395ca7fe6362 It seems that at the current state it is necessary to protect sending stats/ending game from multiple execution,
sheepluva
parents: 9758
diff changeset
   363
ended = false
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   364
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   365
function heroDeath(gear)
9760
395ca7fe6362 It seems that at the current state it is necessary to protect sending stats/ending game from multiple execution,
sheepluva
parents: 9758
diff changeset
   366
	if not ended then
395ca7fe6362 It seems that at the current state it is necessary to protect sending stats/ending game from multiple execution,
sheepluva
parents: 9758
diff changeset
   367
		SendStat(siGameResult, loc("Hog Solo lost, try again!"))
11697
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   368
		SendStat(siCustomAchievement, loc("To win the game, Hog Solo has to get the bottom crates and come back to the surface."))
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   369
		SendStat(siCustomAchievement, loc("You can use the other 2 hogs to assist you."))
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   370
		SendStat(siCustomAchievement, loc("Do not destroy the crates!"))
9760
395ca7fe6362 It seems that at the current state it is necessary to protect sending stats/ending game from multiple execution,
sheepluva
parents: 9758
diff changeset
   371
		if tookPartInBattle then
12543
952afc3d2df2 Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents: 12533
diff changeset
   372
			if permitCaptainLimeDeath then
12685
5a253f158071 Eliminate some possible spoilers in stats screen of ASA: fruit02
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   373
				SendStat(siCustomAchievement, loc("You'll have to eliminate the Fruit Assassins at the end."))
12543
952afc3d2df2 Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents: 12533
diff changeset
   374
				sendSimpleTeamRankings({teamC.name, teamA.name})
952afc3d2df2 Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents: 12533
diff changeset
   375
			else
952afc3d2df2 Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents: 12533
diff changeset
   376
				sendSimpleTeamRankings({teamA.name})
952afc3d2df2 Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents: 12533
diff changeset
   377
			end
9760
395ca7fe6362 It seems that at the current state it is necessary to protect sending stats/ending game from multiple execution,
sheepluva
parents: 9758
diff changeset
   378
		else
12543
952afc3d2df2 Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents: 12533
diff changeset
   379
			if permitCaptainLimeDeath then
12685
5a253f158071 Eliminate some possible spoilers in stats screen of ASA: fruit02
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   380
				SendStat(siCustomAchievement, loc("You'll have to eliminate Captain Lime at the end."))
12543
952afc3d2df2 Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents: 12533
diff changeset
   381
				sendSimpleTeamRankings({teamB.name, teamA.name})
952afc3d2df2 Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents: 12533
diff changeset
   382
			else
12685
5a253f158071 Eliminate some possible spoilers in stats screen of ASA: fruit02
Wuzzy <almikes@aol.com>
parents: 12592
diff changeset
   383
				SendStat(siCustomAchievement, loc("Don't eliminate Captain Lime before collecting the last crate!"))
12543
952afc3d2df2 Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents: 12533
diff changeset
   384
				sendSimpleTeamRankings({teamA.name})
952afc3d2df2 Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents: 12533
diff changeset
   385
			end
9760
395ca7fe6362 It seems that at the current state it is necessary to protect sending stats/ending game from multiple execution,
sheepluva
parents: 9758
diff changeset
   386
		end
395ca7fe6362 It seems that at the current state it is necessary to protect sending stats/ending game from multiple execution,
sheepluva
parents: 9758
diff changeset
   387
		EndGame()
395ca7fe6362 It seems that at the current state it is necessary to protect sending stats/ending game from multiple execution,
sheepluva
parents: 9758
diff changeset
   388
		ended = true
9542
d1ea2d1540f2 custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9540
diff changeset
   389
	end
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   390
end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   391
12588
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   392
-- Device crate got taken
12533
7b32e83aaf48 ASA, Getting to the device: Add fake crate for the device part with proper collect message
Wuzzy <almikes@aol.com>
parents: 12525
diff changeset
   393
function deviceCrateEvent(gear)
12588
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   394
	-- Stop hedgehog
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   395
	SetGearMessage(deviceCrate.collector, 0)
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   396
	if deviceCrate.collector == hero.gear then
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   397
		-- Hog Solo collected the device crate
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   398
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   399
		if not tookPartInBattle then
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   400
			-- Captain Lime turns evil
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   401
			AddAnim(dialog03)
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   402
		else
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   403
			-- Fruit Assassins attack
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   404
			for i=1,table.getn(redHedgehogs) do
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   405
				RestoreHog(redHedgehogs[i].gear)
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   406
			end
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   407
			AddAnim(dialog04)
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   408
		end
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   409
		-- needs to be set to true for both plots
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   410
		permitCaptainLimeDeath = true
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   411
		AddAmmo(hero.gear, amSwitch, 0)
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   412
		AddEvent(onSurface, {hero.gear}, surface, {hero.gear}, 0)
9532
4fa58a49ace1 more dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9529
diff changeset
   413
	else
12588
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   414
		-- Player let the Green Bananas collect the crate.
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   415
		-- How dumb!
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   416
		-- Player will lose for this.
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   417
		AnimationSetup05(deviceCrate.collector)
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   418
		AddAnim(dialog05)
9532
4fa58a49ace1 more dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9529
diff changeset
   419
	end
9534
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   420
end
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   421
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   422
function surface(gear)
9536
7456b28a3421 this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9534
diff changeset
   423
	previousHog = -1
9538
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   424
	if tookPartInBattle then
12588
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   425
		escapeHog(green1.gear)
9540
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   426
		AddEvent(onRedTeamDeath, {green1.gear}, redTeamDeath, {green1.gear}, 0)
9538
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   427
	else
12577
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12543
diff changeset
   428
		SetHogLevel(green1.gear, 1)
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12543
diff changeset
   429
		-- Equip Captain Lime with weapons
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12543
diff changeset
   430
		AddAmmo(green1.gear, amBazooka, 6)
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12543
diff changeset
   431
		AddAmmo(green1.gear, amGrenade, 6)
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12543
diff changeset
   432
		AddAmmo(green1.gear, amDEagle, 2)
9538
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   433
		AddEvent(onGaptainLimeDeath, {green1.gear}, captainLimeDeath, {green1.gear}, 0)
9536
7456b28a3421 this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9534
diff changeset
   434
	end
12587
3016c64b5a7f ASA, fruit02: End turn when reaching surface
Wuzzy <almikes@aol.com>
parents: 12578
diff changeset
   435
	EndTurn(true)
12588
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   436
	escapeHog(green2.gear)
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   437
	escapeHog(green3.gear)
9534
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   438
	inBattle = true
9532
4fa58a49ace1 more dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9529
diff changeset
   439
end
4fa58a49ace1 more dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9529
diff changeset
   440
9538
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   441
function captainLimeDeath(gear)
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   442
	-- hero win in scenario of escape in 1st part
9578
16139270448f save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   443
	saveCompletedStatus(3)
9642
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9630
diff changeset
   444
	SendStat(siGameResult, loc("Congratulations, you won!"))
11697
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   445
	SendStat(siCustomAchievement, loc("You retrieved the lost part."))
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   446
	SendStat(siCustomAchievement, loc("You defended yourself against Captain Lime."))
12543
952afc3d2df2 Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents: 12533
diff changeset
   447
	sendSimpleTeamRankings({teamA.name, teamB.name})
9538
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   448
	EndGame()
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   449
end
9540
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   450
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   451
function redTeamDeath(gear)
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   452
	-- hero win in battle scenario
9578
16139270448f save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   453
	saveCompletedStatus(3)
9642
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9630
diff changeset
   454
	SendStat(siGameResult, loc("Congratulations, you won!"))
11697
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   455
	SendStat(siCustomAchievement, loc("You retrieved the lost part."))
12577
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12543
diff changeset
   456
	SendStat(siCustomAchievement, loc("You defended yourself against the Fruit Assassins."))
12543
952afc3d2df2 Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents: 12533
diff changeset
   457
	sendSimpleTeamRankings({teamA.name, teamC.name})
9540
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   458
	EndGame()
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   459
end
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   460
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   461
-------------- ANIMATIONS ------------------
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   462
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   463
function Skipanim(anim)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   464
	if goals[anim] ~= nil then
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   465
		ShowMission(unpack(goals[anim]))
12577
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12543
diff changeset
   466
	end
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12543
diff changeset
   467
	if anim == dialog03 then
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12543
diff changeset
   468
		makeCptLimeEvil()
12588
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   469
	elseif anim == dialog05 then
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   470
		heroIsAStupidFool()
12577
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12543
diff changeset
   471
	else
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12543
diff changeset
   472
		EndTurn(true)
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12543
diff changeset
   473
	end
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   474
end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   475
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   476
function AnimationSetup()
9529
e95aab9130d8 first dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9527
diff changeset
   477
	-- DIALOG 01 - Start, Captain Lime helps Hog Solo because he took part in the battle
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   478
	AddSkipFunction(dialog01, Skipanim, {dialog01})
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   479
	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
11697
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   480
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Somewhere else on the planet of fruits, Captain Lime helps Hog Solo"), 5000}})
9529
e95aab9130d8 first dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9527
diff changeset
   481
	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("You fought bravely and you helped us win this battle!"), SAY_SAY, 5000}})
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9554
diff changeset
   482
	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("So, as promised I have brought you where I think that the device you are looking for is hidden."), SAY_SAY, 7000}})
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9747
diff changeset
   483
	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("I know that your resources are low due to the battle but I'll send two of my best hogs to assist you."), SAY_SAY, 7000}})
9529
e95aab9130d8 first dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9527
diff changeset
   484
	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("Good luck!"), SAY_SAY, 2000}})
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   485
	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   486
	table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}})
12577
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12543
diff changeset
   487
	table.insert(dialog01, {func = ShowMission, args = goals[dialog01]})
9529
e95aab9130d8 first dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9527
diff changeset
   488
	-- DIALOG02 - Start, Hog Solo escaped from the previous battle
e95aab9130d8 first dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9527
diff changeset
   489
	AddSkipFunction(dialog02, Skipanim, {dialog02})
e95aab9130d8 first dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9527
diff changeset
   490
	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 3000}})
11697
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   491
	table.insert(dialog02, {func = AnimCaption, args = {hero.gear, loc("Somewhere else on the planet of fruits Hog Solo gets closer to the device"), 5000}})
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   492
	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("You are the one who fled! So, you are alive."), SAY_SAY, 4000}})
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   493
	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("I'm still low on hogs. If you are not afraid I could use a set of extra hands."), SAY_SAY, 4000}})
9529
e95aab9130d8 first dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9527
diff changeset
   494
	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 8000}})
11697
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   495
	table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("I am sorry but I was looking for a device that may be hidden somewhere around here."), SAY_SAY, 4500}})
9529
e95aab9130d8 first dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9527
diff changeset
   496
	table.insert(dialog02, {func = AnimWait, args = {green1.gear, 12500}})
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9554
diff changeset
   497
	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("Many long forgotten things can be found in the same tunnels that we are about to explore!"), SAY_SAY, 7000}})
11697
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   498
	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("If you help us you can keep the device if you find it but we'll keep everything else."), SAY_SAY, 7000}})
9529
e95aab9130d8 first dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9527
diff changeset
   499
	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("What do you say? Are you in?"), SAY_SAY, 3000}})
e95aab9130d8 first dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9527
diff changeset
   500
	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 1800}})
11697
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   501
	table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("Okay then!"), SAY_SAY, 2000}})
9529
e95aab9130d8 first dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9527
diff changeset
   502
	table.insert(dialog02, {func = AnimSwitchHog, args = {hero.gear}})
12577
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12543
diff changeset
   503
	table.insert(dialog02, {func = ShowMission, args = goals[dialog02]})
9532
4fa58a49ace1 more dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9529
diff changeset
   504
	-- DIALOG03 - At crates, hero learns that Captain Lime is bad
4fa58a49ace1 more dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9529
diff changeset
   505
	AddSkipFunction(dialog03, Skipanim, {dialog03})
12588
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   506
	table.insert(dialog03, {func = AnimWait, args = {hero.gear, 2000}})
9534
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   507
	table.insert(dialog03, {func = FollowGear, args = {hero.gear}})
11697
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   508
	table.insert(dialog03, {func = AnimSay, args = {hero.gear, loc("Hooray! I've found it, now I have to get back to Captain Lime!"), SAY_SAY, 4000}})
9532
4fa58a49ace1 more dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9529
diff changeset
   509
	table.insert(dialog03, {func = AnimWait, args = {green1.gear, 4000}})
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9747
diff changeset
   510
	table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("This Hog Solo is so naive! When he returns I'll shoot him and keep that device for myself!"), SAY_THINK, 4000}})
12577
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12543
diff changeset
   511
	table.insert(dialog03, {func = ShowMission, args = goals[dialog03]})
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12543
diff changeset
   512
	table.insert(dialog03, {func = makeCptLimeEvil, args = {hero.gear}})
9831
afa4e3e04cc5 typos correction
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9810
diff changeset
   513
	-- DIALOG04 - At crates, hero learns about the Assassins ambush
9534
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   514
	AddSkipFunction(dialog04, Skipanim, {dialog04})
12588
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   515
	table.insert(dialog04, {func = AnimWait, args = {hero.gear, 2000}})
9534
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   516
	table.insert(dialog04, {func = FollowGear, args = {hero.gear}})
11697
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   517
	table.insert(dialog04, {func = AnimSay, args = {hero.gear, loc("Hooray! I've found it, now I have to get back to Captain Lime!"), SAY_SAY, 4000}})
9534
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   518
	table.insert(dialog04, {func = AnimWait, args = {redHedgehogs[1].gear, 4000}})
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   519
	table.insert(dialog04, {func = AnimSay, args = {redHedgehogs[1].gear, loc("We have spotted the enemy! We'll attack when the enemies start gathering!"), SAY_THINK, 4000}})
12577
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12543
diff changeset
   520
	table.insert(dialog04, {func = ShowMission, args = goals[dialog04]})
9534
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   521
	table.insert(dialog04, {func = goToThesurface, args = {hero.gear}})
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   522
end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   523
12588
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   524
function AnimationSetup05(collector)
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   525
	-- DIALOG05 - A member or the green bananas collected the target crate and steals it. Player loses
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   526
	AddSkipFunction(dialog05, Skipanim, {dialog05})
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   527
	table.insert(dialog05, {func = AnimWait, args = {collector, 2000}})
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   528
	table.insert(dialog05, {func = FollowGear, args = {collector}})
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   529
	table.insert(dialog05, {func = AnimSay, args = {collector, loc("Oh yes! I got the device part! Now it belongs to me alone."), SAY_SAY, 4000}})
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   530
	table.insert(dialog05, {func = AnimWait, args = {collector, 3000}})
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   531
	table.insert(dialog05, {func = AnimSay, args = {hero.gear, loc("Hey! I was supposed to collect it!"), SAY_SHOUT, 3000}})
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   532
	table.insert(dialog05, {func = AnimWait, args = {hero.gear, 3000}})
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   533
	table.insert(dialog05, {func = AnimSay, args = {collector, loc("I don't care. It's worth a fortune! Good bye, you idiot!"), SAY_SAY, 5000}})
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   534
	table.insert(dialog05, {func = heroIsAStupidFool, args = {collector}})
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   535
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   536
end
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   537
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   538
------------- OTHER FUNCTIONS ---------------
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   539
12588
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   540
-- Hide hog and create a simple escaping effect, if hog exists.
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   541
-- No-op is hog does not exist
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   542
function escapeHog(gear)
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   543
	if GetHealth(gear) then
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   544
		AddVisualGear(GetX(gear), GetY(gear), vgtSmokeWhite, 0, false)
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   545
		for i=1, 4 do
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   546
			AddVisualGear(GetX(gear)-16+math.random(32), GetY(gear)-16+math.random(32), vgtSmokeWhite, 0, false)
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   547
		end
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   548
		HideHog(gear)
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   549
	end
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   550
end
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   551
12577
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12543
diff changeset
   552
function makeCptLimeEvil()
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12543
diff changeset
   553
	-- Turn Captain Lime evil
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12543
diff changeset
   554
	SetHogLevel(green1.gear, 1)
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12543
diff changeset
   555
	EndTurn(true)
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12543
diff changeset
   556
end
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12543
diff changeset
   557
9534
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   558
function goToThesurface()
12519
d89dabfd07ce Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents: 12518
diff changeset
   559
	EndTurn(true)
9534
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   560
end
9538
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   561
12588
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   562
-- Player let wrong hog collect crate
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   563
function heroIsAStupidFool()
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   564
	if not ended then
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   565
		escapeHog(deviceCrate.collector)
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   566
		AddCaption(loc("The device part has been stolen!"))
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   567
		sendSimpleTeamRankings({teamA.name})
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   568
		SendStat(siGameResult, loc("Hog Solo lost, try again!"))
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   569
		SendStat(siCustomAchievement, loc("Oh no, the Green Bananas have betrayed Hog Solo and stole the anti-gravity device part!"))
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   570
		SendStat(siCustomAchievement, loc("Only Hog Solo can be trusted with the crate."))
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   571
		EndGame()
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   572
		ended = true
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   573
	end
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   574
end
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   575
9538
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   576
function wind()
9810
54c0fdec4600 changing math functions that may cause desyncs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9782
diff changeset
   577
	SetWind(GetRandom(201)-100)
9538
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   578
end
9544
e247251fa751 position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9542
diff changeset
   579