share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit02.lua
author Wuzzy <Wuzzy2@mail.ru>
Mon, 03 Jun 2019 15:37:32 +0200
changeset 15106 f9d57bade2a5
parent 15086 9f2374425744
permissions -rw-r--r--
ASA fruit02: Add workaround for incorrect weapon display on turn start
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
15086
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
    17
local fixedWind = false
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    18
-- dialogs
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    19
local dialog01 = {}
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    20
local dialog02 = {}
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    21
local dialog03 = {}
9534
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
    22
local dialog04 = {}
12583
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
    23
local dialog05 = {}
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    24
-- mission objectives
12226
3ec0261e01f0 Display mines timer in all missions with non-default timer
Wuzzy <almikes@aol.com>
parents: 12224
diff changeset
    25
local minesTimeText = loc("Mines time: 0 seconds")
14488
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
    26
local goals
9542
d1ea2d1540f2 custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9540
diff changeset
    27
-- crates
12528
7b32e83aaf48 ASA, Getting to the device: Add fake crate for the device part with proper collect message
Wuzzy <almikes@aol.com>
parents: 12520
diff changeset
    28
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: 12520
diff changeset
    29
9552
90d69a2c1729 checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9550
diff changeset
    30
local eagleCrate = {name = amDEagle, x = 1680, y = 1650}
12528
7b32e83aaf48 ASA, Getting to the device: Add fake crate for the device part with proper collect message
Wuzzy <almikes@aol.com>
parents: 12520
diff changeset
    31
7b32e83aaf48 ASA, Getting to the device: Add fake crate for the device part with proper collect message
Wuzzy <almikes@aol.com>
parents: 12520
diff changeset
    32
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: 12520
diff changeset
    33
local deviceCrate = { gear = nil, x = 1360, y = 1870}
9552
90d69a2c1729 checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9550
diff changeset
    34
local ropeCrate = {name = amRope, x = 1400, y = 1870}
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    35
-- hogs
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    36
local hero = {}
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    37
local green1 = {}
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    38
local green2 = {}
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    39
local green3 = {}
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    40
-- teams
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    41
local teamA = {}
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    42
local teamB = {}
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    43
local teamC = {}
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    44
-- hedgehogs values
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9554
diff changeset
    45
hero.name = loc("Hog Solo")
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    46
hero.x = 1200
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    47
hero.y = 820
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    48
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
    49
green1.name = loc("Captain Lime")
14488
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
    50
green1.hat = "war_desertofficer"
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    51
green1.x = 1050
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    52
green1.y = 820
9538
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
    53
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
    54
green2.name = loc("Mister Pear")
14488
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
    55
green2.hat = "war_britmedic"
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    56
green2.x = 1350
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    57
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
    58
green3.name = loc("Lady Mango")
14488
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
    59
green3.hat = "hair_red"
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    60
green3.x = 1450
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    61
green3.y = 820
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    62
local redHedgehogs = {
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9554
diff changeset
    63
	{ 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
    64
	{ 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
    65
	{ 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
    66
	{ name = loc("Deadly Grape") }
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    67
}
12573
a778c1bb032e ASA: Explain team abbreviations + update changelog
Wuzzy <almikes@aol.com>
parents: 12572
diff changeset
    68
-- Hog Solo and Green Bananas
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    69
teamA.name = loc("Hog Solo and GB")
13584
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13583
diff changeset
    70
teamA.color = -6
14643
30d3e1d6aedf ASA fruit02: Change Captain Lime clan color when he turns evil
Wuzzy <Wuzzy2@mail.ru>
parents: 14500
diff changeset
    71
-- Captain Lime can use one of 2 clan colors:
30d3e1d6aedf ASA fruit02: Change Captain Lime clan color when he turns evil
Wuzzy <Wuzzy2@mail.ru>
parents: 14500
diff changeset
    72
-- One when being friendly (same as hero), and a different one when he turns evil.
30d3e1d6aedf ASA fruit02: Change Captain Lime clan color when he turns evil
Wuzzy <Wuzzy2@mail.ru>
parents: 14500
diff changeset
    73
-- Captain Lime be in his own clan.
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    74
teamB.name = loc("Captain Lime")
14643
30d3e1d6aedf ASA fruit02: Change Captain Lime clan color when he turns evil
Wuzzy <Wuzzy2@mail.ru>
parents: 14500
diff changeset
    75
teamB.colorNice = teamA.color
30d3e1d6aedf ASA fruit02: Change Captain Lime clan color when he turns evil
Wuzzy <Wuzzy2@mail.ru>
parents: 14500
diff changeset
    76
teamB.colorEvil = -5
9831
afa4e3e04cc5 typos correction
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9810
diff changeset
    77
teamC.name = loc("Fruit Assassins")
13584
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13583
diff changeset
    78
teamC.color = -1
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    79
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    80
function onGameInit()
9538
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
    81
	GameFlags = gfDisableWind
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    82
	Seed = 1
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    83
	TurnTime = 20000
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    84
	CaseFreq = 0
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    85
	MinesNum = 0
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    86
	MinesTime = 1
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    87
	Explosives = 0
12224
d62d6f8ebef1 Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents: 12088
diff changeset
    88
	-- Disable Sudden Death
d62d6f8ebef1 Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents: 12088
diff changeset
    89
	HealthDecrease = 0
d62d6f8ebef1 Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents: 12088
diff changeset
    90
	WaterRise = 0
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    91
	Map = "fruit02_map"
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    92
	Theme = "Fruit"
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9747
diff changeset
    93
9552
90d69a2c1729 checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9550
diff changeset
    94
	local health = 100
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9747
diff changeset
    95
13584
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13583
diff changeset
    96
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13583
diff changeset
    97
	-- Fruit Assassins
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13583
diff changeset
    98
	local assasinsHats = { "NinjaFull", "NinjaStraight", "NinjaTriangle" }
14932
ff4003a90ff8 Enable automatic voicepack language selection for all missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14898
diff changeset
    99
	teamC.name = AddTeam(teamC.name, teamC.color, "bp2", "Island", "Default_qau", "cm_scout")
13584
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13583
diff changeset
   100
	for i=1,table.getn(redHedgehogs) do
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13583
diff changeset
   101
		redHedgehogs[i].gear =  AddHog(redHedgehogs[i].name, 1, 100, assasinsHats[GetRandom(3)+1])
14488
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   102
		SetGearPosition(redHedgehogs[i].gear, 2010 + 50*i, 630)
13584
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13583
diff changeset
   103
	end
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13583
diff changeset
   104
	local assassinsColor = div(GetClanColor(GetHogClan(redHedgehogs[1].gear)), 0x100)
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13583
diff changeset
   105
14488
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   106
	-- Hero and Green Bananas
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   107
	teamA.name = AddMissionTeam(teamA.color)
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   108
	hero.gear = AddMissionHog(health)
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   109
	hero.name = GetHogName(hero.gear)
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   110
	SetHogTeamName(hero.gear, string.format(loc("%s and GB"), teamA.name))
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   111
	teamA.name = GetHogTeamName(hero.gear)
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   112
	SetGearPosition(hero.gear, hero.x, hero.y)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9747
diff changeset
   113
	HogTurnLeft(hero.gear, true)
14488
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   114
	local heroColor = div(GetClanColor(GetHogClan(hero.gear)), 0x100)
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   115
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   116
	-- companions
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   117
	-- Change companion identity if they have same name as hero
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   118
	-- to avoid confusion.
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   119
	if green2.name == hero.name then
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   120
		green2.name = loc("Green Hog Grape")
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   121
		green2.hat = "war_desertsapper1"
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   122
	elseif green3.name == hero.name then
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   123
		green3.name = loc("Green Hog Grape")
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   124
		green3.hat = "war_desertsapper1"
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   125
	end
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   126
	green2.gear = AddHog(green2.name, 0, 100, green2.hat)
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   127
	SetGearPosition(green2.gear, green2.x, green2.y)
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   128
	HogTurnLeft(green2.gear, true)
14488
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   129
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   130
	green3.gear = AddHog(green3.name, 0, 100, green3.hat)
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   131
	SetGearPosition(green3.gear, green3.x, green3.y)
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   132
	HogTurnLeft(green3.gear, true)
13584
53ca3a22da45 Make ASA fruit02 use of default clan colors
Wuzzy <Wuzzy2@mail.ru>
parents: 13583
diff changeset
   133
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   134
	-- Captain Lime
14643
30d3e1d6aedf ASA fruit02: Change Captain Lime clan color when he turns evil
Wuzzy <Wuzzy2@mail.ru>
parents: 14500
diff changeset
   135
        -- Spawn with his "true" evil color so a new clan is created for Captain Lime ...
14932
ff4003a90ff8 Enable automatic voicepack language selection for all missions
Wuzzy <Wuzzy2@mail.ru>
parents: 14898
diff changeset
   136
	teamB.name = AddTeam(teamB.name, teamB.colorEvil, "Cherry", "Island", "Default_qau", "congo-brazzaville")
14644
5fc5e4b79a5a Some polishing for ASA fruit02
Wuzzy <Wuzzy2@mail.ru>
parents: 14643
diff changeset
   137
	SetTeamPassive(teamB.name, true)
14643
30d3e1d6aedf ASA fruit02: Change Captain Lime clan color when he turns evil
Wuzzy <Wuzzy2@mail.ru>
parents: 14500
diff changeset
   138
	green1.gear = AddHog(green1.name, 0, 100, green1.hat)
30d3e1d6aedf ASA fruit02: Change Captain Lime clan color when he turns evil
Wuzzy <Wuzzy2@mail.ru>
parents: 14500
diff changeset
   139
	-- ... however, we immediately change the color to "nice mode".
30d3e1d6aedf ASA fruit02: Change Captain Lime clan color when he turns evil
Wuzzy <Wuzzy2@mail.ru>
parents: 14500
diff changeset
   140
	-- Captain Lime starts as (seemingly) friendly in this mission.
30d3e1d6aedf ASA fruit02: Change Captain Lime clan color when he turns evil
Wuzzy <Wuzzy2@mail.ru>
parents: 14500
diff changeset
   141
	SetClanColor(GetHogClan(green1.gear), teamB.colorNice)
14488
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   142
	SetGearPosition(green1.gear, green1.x, green1.y)
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   143
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   144
	-- Populate goals table
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   145
	goals = {
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   146
		[dialog01] = {missionName, loc("Exploring the tunnel"), loc("Search for the device with the help of the other hedgehogs.").."|"..string.format(loc("%s must collect the final crates."), hero.name) .. "|" .. minesTimeText, 1, 4000},
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   147
		[dialog02] = {missionName, loc("Exploring the tunnel"), loc("Explore the tunnel with the other hedgehogs and search for the device.").."|"..string.format(loc("%s must collect the final crates."), hero.name) .. "|" .. minesTimeText, 1, 4000},
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   148
		[dialog03] = {missionName, loc("Return to the Surface"), loc("Go to the surface!").."|"..loc("Attack Captain Lime before he attacks back.").."|"..minesTimeText, 1, 4000},
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   149
		[dialog04] = {missionName, loc("Return to the Surface"), loc("Go to the surface!").."|"..loc("Attack the assassins before they attack back.").."|"..minesTimeText, 1, 4000},
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   150
	}
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   151
12088
1da37e2ba6fd Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents: 12049
diff changeset
   152
	AnimInit(true)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9747
diff changeset
   153
	AnimationSetup()
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   154
end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   155
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   156
function onGameStart()
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   157
	AnimWait(hero.gear, 3000)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   158
	FollowGear(hero.gear)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9747
diff changeset
   159
9540
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   160
	if GetCampaignVar("Fruit01JoinedBattle") and GetCampaignVar("Fruit01JoinedBattle") == "true" then
9529
e95aab9130d8 first dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9527
diff changeset
   161
		tookPartInBattle = true
e95aab9130d8 first dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9527
diff changeset
   162
	end
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9747
diff changeset
   163
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   164
	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
12528
7b32e83aaf48 ASA, Getting to the device: Add fake crate for the device part with proper collect message
Wuzzy <almikes@aol.com>
parents: 12520
diff changeset
   165
	AddEvent(onDeviceCrates, {hero.gear}, deviceCrateEvent, {hero.gear}, 0)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9747
diff changeset
   166
14488
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   167
	-- Hero and Green Bananas weapons
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   168
	AddAmmo(hero.gear, amSwitch, 100)
9831
afa4e3e04cc5 typos correction
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9810
diff changeset
   169
	-- Assassins weapons
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   170
	AddAmmo(redHedgehogs[1].gear, amBazooka, 6)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   171
	AddAmmo(redHedgehogs[1].gear, amGrenade, 6)
9540
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   172
	AddAmmo(redHedgehogs[1].bot, amDEagle, 6)
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   173
	for i=1,table.getn(redHedgehogs) do
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   174
		HideHog(redHedgehogs[i].gear)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   175
	end
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9747
diff changeset
   176
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   177
	-- explosives
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   178
	-- I wanted to use FindPlace but doesn't accept height values...
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   179
	local x1 = 950
9538
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   180
	local x2 = 1306
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   181
	local y1 = 1210
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   182
	local y2 = 1620
15086
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   183
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   184
	-- barrel mania in the large hole
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   185
	local barrels = {
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   186
		{1290, 1618},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   187
		{1285, 1587},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   188
		{1287, 1556},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   189
		{1286, 1525},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   190
		{1247, 1637},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   191
		{1250, 1606},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   192
		{1249, 1575},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   193
		{1251, 1544},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   194
		{1206, 1646},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   195
		{1211, 1615},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   196
		{1209, 1584},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   197
		{1166, 1646},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   198
		{1168, 1615},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   199
		{1170, 1584},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   200
		{1125, 1637},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   201
		{1120, 1606},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   202
		{1128, 1575},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   203
		{1089, 1622},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   204
		{1084, 1591},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   205
		{1093, 1560},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   206
		{1044, 1596},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   207
		{1044, 1565},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   208
		{1005, 1554},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   209
		{1005, 1523},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   210
		{973, 1492},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   211
		{1062, 1534},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   212
		{1128, 1544},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   213
		{1168, 1553},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   214
		{1210, 1553},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   215
		{1097, 1529},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   216
		{1040, 1505},
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   217
	}
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   218
	for b=1, #barrels do
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   219
		local barrel = AddGear(barrels[b][1], barrels[b][2], gtExplosives, 0, 0, 0, 0)
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   220
		SetHealth(barrel, 21)
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   221
	end
15086
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   222
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   223
	-- single barrel at the right corner
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   224
	AddGear(3128, 1680, gtExplosives, 0, 0, 0, 0)
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
	--mines
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   227
	AddGear(3135, 1680, gtMine, 0, 0, 0, 0)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   228
	AddGear(3145, 1680, gtMine, 0, 0, 0, 0)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   229
	AddGear(3155, 1680, gtMine, 0, 0, 0, 0)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   230
	AddGear(3165, 1680, gtMine, 0, 0, 0, 0)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   231
	AddGear(3175, 1680, gtMine, 0, 0, 0, 0)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   232
	AddGear(3115, 1680, gtMine, 0, 0, 0, 0)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   233
	AddGear(3105, 1680, gtMine, 0, 0, 0, 0)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   234
	AddGear(3095, 1680, gtMine, 0, 0, 0, 0)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   235
	AddGear(3085, 1680, gtMine, 0, 0, 0, 0)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9747
diff changeset
   236
	AddGear(3075, 1680, gtMine, 0, 0, 0, 0)
9552
90d69a2c1729 checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9550
diff changeset
   237
12520
22f2a586b9ca Remove checkpoints in ASA: Getting to the device
Wuzzy <almikes@aol.com>
parents: 12514
diff changeset
   238
	AddAmmo(hero.gear, amFirePunch, 3)
22f2a586b9ca Remove checkpoints in ASA: Getting to the device
Wuzzy <almikes@aol.com>
parents: 12514
diff changeset
   239
	if tookPartInBattle then
22f2a586b9ca Remove checkpoints in ASA: Getting to the device
Wuzzy <almikes@aol.com>
parents: 12514
diff changeset
   240
		AddAnim(dialog01)
22f2a586b9ca Remove checkpoints in ASA: Getting to the device
Wuzzy <almikes@aol.com>
parents: 12514
diff changeset
   241
	else
22f2a586b9ca Remove checkpoints in ASA: Getting to the device
Wuzzy <almikes@aol.com>
parents: 12514
diff changeset
   242
		AddAnim(dialog02)
9552
90d69a2c1729 checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9550
diff changeset
   243
	end
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9747
diff changeset
   244
9552
90d69a2c1729 checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9550
diff changeset
   245
	-- place crates
12933
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12680
diff changeset
   246
	SpawnSupplyCrate(girderCrate.x, girderCrate.y, girderCrate.name)
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12680
diff changeset
   247
	SpawnSupplyCrate(eagleCrate.x, eagleCrate.y, eagleCrate.name)
12528
7b32e83aaf48 ASA, Getting to the device: Add fake crate for the device part with proper collect message
Wuzzy <almikes@aol.com>
parents: 12520
diff changeset
   248
	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: 12520
diff changeset
   249
	-- 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: 12520
diff changeset
   250
	-- 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: 12520
diff changeset
   251
	-- the device part.
9552
90d69a2c1729 checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9550
diff changeset
   252
90d69a2c1729 checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9550
diff changeset
   253
	if tookPartInBattle then
12933
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12680
diff changeset
   254
		SpawnSupplyCrate(weaponCrate.x, weaponCrate.y, amWatermelon)
9552
90d69a2c1729 checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9550
diff changeset
   255
	else
12933
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12680
diff changeset
   256
		SpawnSupplyCrate(weaponCrate.x, weaponCrate.y, amSniperRifle)
9548
38630665c9ab check point fixes
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9546
diff changeset
   257
	end
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9747
diff changeset
   258
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   259
	SendHealthStatsOff()
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
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   262
function onNewTurn()
9534
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   263
	if not inBattle and CurrentHedgehog == green1.gear then
14644
5fc5e4b79a5a Some polishing for ASA fruit02
Wuzzy <Wuzzy2@mail.ru>
parents: 14643
diff changeset
   264
		SkipTurn()
14496
8db03d9bc6e9 Reduce skipping craziness in ASA fruit02 a bit
Wuzzy <Wuzzy2@mail.ru>
parents: 14488
diff changeset
   265
	elseif (not inBattle) and GetHogTeamName(CurrentHedgehog) == teamA.name then
8db03d9bc6e9 Reduce skipping craziness in ASA fruit02 a bit
Wuzzy <Wuzzy2@mail.ru>
parents: 14488
diff changeset
   266
		if CurrentHedgehog ~= hero.gear then
15106
f9d57bade2a5 ASA fruit02: Add workaround for incorrect weapon display on turn start
Wuzzy <Wuzzy2@mail.ru>
parents: 15086
diff changeset
   267
			-- FIXME: This screw up the selected weapon caption, as
f9d57bade2a5 ASA fruit02: Add workaround for incorrect weapon display on turn start
Wuzzy <Wuzzy2@mail.ru>
parents: 15086
diff changeset
   268
			-- SwitchHog does not update the selected display caption
14644
5fc5e4b79a5a Some polishing for ASA fruit02
Wuzzy <Wuzzy2@mail.ru>
parents: 14643
diff changeset
   269
			AnimSwitchHog(hero.gear)
14496
8db03d9bc6e9 Reduce skipping craziness in ASA fruit02 a bit
Wuzzy <Wuzzy2@mail.ru>
parents: 14488
diff changeset
   270
		end
15106
f9d57bade2a5 ASA fruit02: Add workaround for incorrect weapon display on turn start
Wuzzy <Wuzzy2@mail.ru>
parents: 15086
diff changeset
   271
		-- Workaround: Add a caption that overwrites the displayed weapon display
f9d57bade2a5 ASA fruit02: Add workaround for incorrect weapon display on turn start
Wuzzy <Wuzzy2@mail.ru>
parents: 15086
diff changeset
   272
		AddCaption(loc("Let's go!"), capcolDefault, capgrpAmmoinfo)
14496
8db03d9bc6e9 Reduce skipping craziness in ASA fruit02 a bit
Wuzzy <Wuzzy2@mail.ru>
parents: 14488
diff changeset
   273
		SetTurnTimeLeft(MAX_TURN_TIME)
8db03d9bc6e9 Reduce skipping craziness in ASA fruit02 a bit
Wuzzy <Wuzzy2@mail.ru>
parents: 14488
diff changeset
   274
		wind()
9536
7456b28a3421 this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9534
diff changeset
   275
	elseif inBattle then
7456b28a3421 this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9534
diff changeset
   276
		if CurrentHedgehog == green1.gear and previousHog ~= hero.gear then
14644
5fc5e4b79a5a Some polishing for ASA fruit02
Wuzzy <Wuzzy2@mail.ru>
parents: 14643
diff changeset
   277
			SkipTurn()
9536
7456b28a3421 this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9534
diff changeset
   278
			return
9534
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   279
		end
9540
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   280
		for i=1,table.getn(redHedgehogs) do
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   281
			if CurrentHedgehog == redHedgehogs[i].gear and previousHog ~= hero.gear then
14644
5fc5e4b79a5a Some polishing for ASA fruit02
Wuzzy <Wuzzy2@mail.ru>
parents: 14643
diff changeset
   282
				SkipTurn()
9540
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   283
				return
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   284
			end
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   285
		end
13740
2bb7141496a9 Use SetTurnTimeLeft and SetReadyTimeLeft in all scripts
Wuzzy <Wuzzy2@mail.ru>
parents: 13584
diff changeset
   286
		SetTurnTimeLeft(20000)
9538
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   287
		wind()
9536
7456b28a3421 this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9534
diff changeset
   288
	else
12514
d89dabfd07ce Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents: 12513
diff changeset
   289
		EndTurn(true)
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   290
	end
9536
7456b28a3421 this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9534
diff changeset
   291
	previousHog = CurrentHedgehog
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   292
end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   293
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   294
function onGameTick()
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   295
	AnimUnWait()
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   296
	if ShowAnimation() == false then
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   297
		return
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   298
	end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   299
	ExecuteAfterAnimations()
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   300
	CheckEvents()
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   301
end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   302
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
   303
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
   304
	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
   305
		-- 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
   306
		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
   307
		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
   308
	end
15086
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   309
	if (not fixedWind) and CurrentHedgehog and GetY(CurrentHedgehog) > 1350 then
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   310
		fixedWind = true
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   311
		wind()
9747
abe0c8a2d573 adjusting the wind in fruit02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9746
diff changeset
   312
	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
   313
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
   314
15084
5ff651c926ef ASA fruit02: Delete sticky flames
Wuzzy <Wuzzy2@mail.ru>
parents: 15081
diff changeset
   315
function onGearAdd(gear)
15086
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   316
	-- Turn sticky flames to normal flames, to reduce the waiting time after blowing up the barrels
15084
5ff651c926ef ASA fruit02: Delete sticky flames
Wuzzy <Wuzzy2@mail.ru>
parents: 15081
diff changeset
   317
	if GetGearType(gear) == gtFlame and band(GetState(gear), gsttmpFlag) ~= 0 then
15086
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   318
		SetState(gear, band(GetState(gear), bnot(gsttmpFlag)))
15084
5ff651c926ef ASA fruit02: Delete sticky flames
Wuzzy <Wuzzy2@mail.ru>
parents: 15081
diff changeset
   319
	end
5ff651c926ef ASA fruit02: Delete sticky flames
Wuzzy <Wuzzy2@mail.ru>
parents: 15081
diff changeset
   320
end
5ff651c926ef ASA fruit02: Delete sticky flames
Wuzzy <Wuzzy2@mail.ru>
parents: 15081
diff changeset
   321
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   322
function onGearDelete(gear)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   323
	if gear == hero.gear then
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   324
		hero.dead = true
12572
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   325
	elseif gear == green1.gear then
9538
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   326
		green1.dead = true
12528
7b32e83aaf48 ASA, Getting to the device: Add fake crate for the device part with proper collect message
Wuzzy <almikes@aol.com>
parents: 12520
diff changeset
   327
	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: 12520
diff changeset
   328
		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: 12520
diff changeset
   329
			PlaySound(sndShotgunReload)
7b32e83aaf48 ASA, Getting to the device: Add fake crate for the device part with proper collect message
Wuzzy <almikes@aol.com>
parents: 12520
diff changeset
   330
			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: 12520
diff changeset
   331
			deviceCrate.collected = true
12584
46a10d3fa619 ASA, fruit02: Minor refactor
Wuzzy <almikes@aol.com>
parents: 12583
diff changeset
   332
			deviceCrate.collector = CurrentHedgehog
12528
7b32e83aaf48 ASA, Getting to the device: Add fake crate for the device part with proper collect message
Wuzzy <almikes@aol.com>
parents: 12520
diff changeset
   333
		end
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   334
	end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   335
end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   336
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
   337
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
   338
	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
   339
		-- 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
   340
		-- 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
   341
		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
   342
	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
   343
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
   344
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   345
function onAmmoStoreInit()
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   346
	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
   347
	SetAmmo(amGirder, 0, 0, 0, 2)
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   348
	SetAmmo(amRope, 0, 0, 0, 1)
11976
d5dabb71d6bf Add skip option to desert01, fruit02, moon01 in A Space Adventure
Wuzzy <almikes@aol.com>
parents: 11692
diff changeset
   349
	SetAmmo(amSkip, 9, 0, 0, 1)
9630
df942cfac4e6 add bonuses
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9629
diff changeset
   350
	if tonumber(getBonus(2)) == 1 then
df942cfac4e6 add bonuses
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9629
diff changeset
   351
		SetAmmo(amWatermelon, 0, 0, 0, 2)
df942cfac4e6 add bonuses
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9629
diff changeset
   352
		SetAmmo(amSniperRifle, 0, 0, 0, 2)
df942cfac4e6 add bonuses
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9629
diff changeset
   353
	else
df942cfac4e6 add bonuses
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9629
diff changeset
   354
		SetAmmo(amWatermelon, 0, 0, 0, 1)
df942cfac4e6 add bonuses
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9629
diff changeset
   355
		SetAmmo(amSniperRifle, 0, 0, 0, 1)
df942cfac4e6 add bonuses
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9629
diff changeset
   356
	end
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   357
end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   358
15002
3ed1cbd31754 Backed out changeset 4596357d002d (onPreciseLocal causes desyncs)
Wuzzy <Wuzzy2@mail.ru>
parents: 14932
diff changeset
   359
function onPrecise()
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   360
	if GameTime > 3000 then
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9747
diff changeset
   361
		SetAnimSkip(true)
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   362
	end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   363
end
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
-------------- EVENTS ------------------
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   366
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   367
function onHeroDeath(gear)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   368
	if hero.dead then
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   369
		return true
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   370
	end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   371
	return false
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   372
end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   373
9532
4fa58a49ace1 more dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9529
diff changeset
   374
function onDeviceCrates(gear)
12528
7b32e83aaf48 ASA, Getting to the device: Add fake crate for the device part with proper collect message
Wuzzy <almikes@aol.com>
parents: 12520
diff changeset
   375
	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
   376
		return true
4fa58a49ace1 more dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9529
diff changeset
   377
	end
4fa58a49ace1 more dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9529
diff changeset
   378
	return false
4fa58a49ace1 more dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9529
diff changeset
   379
end
4fa58a49ace1 more dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9529
diff changeset
   380
9534
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   381
function onSurface(gear)
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   382
	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
   383
		return true
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   384
	end
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   385
	return false
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   386
end
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   387
15081
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15002
diff changeset
   388
function onCaptainLimeDeath(gear)
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15002
diff changeset
   389
	if (not IsHogAlive(hero.gear)) or (not StoppedGear(hero.gear)) then
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15002
diff changeset
   390
		return false
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15002
diff changeset
   391
	end
9538
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   392
	if green1.dead then
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   393
		return true
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   394
	end
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   395
	return false
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   396
end
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   397
9540
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   398
function onRedTeamDeath(gear)
15081
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15002
diff changeset
   399
	if (not IsHogAlive(hero.gear)) or (not StoppedGear(hero.gear)) then
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15002
diff changeset
   400
		return false
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15002
diff changeset
   401
	end
9540
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   402
	local redDead = true
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   403
	for i=1,table.getn(redHedgehogs) do
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   404
		if GetHealth(redHedgehogs[i].gear) then
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   405
			redDead = false
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   406
			break
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   407
		end
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   408
	end
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   409
	return redDead
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   410
end
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   411
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   412
-------------- 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
   413
ended = false
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   414
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   415
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
   416
	if not ended then
14488
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   417
		SendStat(siGameResult, string.format(loc("%s lost, try again!"), hero.name))
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   418
		SendStat(siCustomAchievement, string.format(loc("To win the game, %s has to get the bottom crates and come back to the surface."), hero.name))
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   419
		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
   420
		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
   421
		if tookPartInBattle then
12538
952afc3d2df2 Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents: 12528
diff changeset
   422
			if permitCaptainLimeDeath then
14488
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   423
				SendStat(siCustomAchievement, string.format(loc("You'll have to eliminate %s at the end."), teamC.name))
12538
952afc3d2df2 Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents: 12528
diff changeset
   424
				sendSimpleTeamRankings({teamC.name, teamA.name})
952afc3d2df2 Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents: 12528
diff changeset
   425
			else
952afc3d2df2 Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents: 12528
diff changeset
   426
				sendSimpleTeamRankings({teamA.name})
952afc3d2df2 Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents: 12528
diff changeset
   427
			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
   428
		else
12538
952afc3d2df2 Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents: 12528
diff changeset
   429
			if permitCaptainLimeDeath then
12680
5a253f158071 Eliminate some possible spoilers in stats screen of ASA: fruit02
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   430
				SendStat(siCustomAchievement, loc("You'll have to eliminate Captain Lime at the end."))
12538
952afc3d2df2 Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents: 12528
diff changeset
   431
				sendSimpleTeamRankings({teamB.name, teamA.name})
952afc3d2df2 Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents: 12528
diff changeset
   432
			else
12680
5a253f158071 Eliminate some possible spoilers in stats screen of ASA: fruit02
Wuzzy <almikes@aol.com>
parents: 12587
diff changeset
   433
				SendStat(siCustomAchievement, loc("Don't eliminate Captain Lime before collecting the last crate!"))
12538
952afc3d2df2 Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents: 12528
diff changeset
   434
				sendSimpleTeamRankings({teamA.name})
952afc3d2df2 Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents: 12528
diff changeset
   435
			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
   436
		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
   437
		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
   438
		ended = true
9542
d1ea2d1540f2 custom stats
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9540
diff changeset
   439
	end
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   440
end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   441
12583
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   442
-- Device crate got taken
12528
7b32e83aaf48 ASA, Getting to the device: Add fake crate for the device part with proper collect message
Wuzzy <almikes@aol.com>
parents: 12520
diff changeset
   443
function deviceCrateEvent(gear)
12583
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   444
	-- Stop hedgehog
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   445
	SetGearMessage(deviceCrate.collector, 0)
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   446
	if deviceCrate.collector == hero.gear then
14488
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   447
		-- Hero collected the device crate
12583
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   448
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   449
		if not tookPartInBattle then
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   450
			-- Captain Lime turns evil
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   451
			AddAnim(dialog03)
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   452
		else
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   453
			-- Fruit Assassins attack
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   454
			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: 12582
diff changeset
   455
				RestoreHog(redHedgehogs[i].gear)
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   456
			end
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   457
			AddAnim(dialog04)
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   458
		end
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   459
		-- 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: 12582
diff changeset
   460
		permitCaptainLimeDeath = true
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   461
		AddAmmo(hero.gear, amSwitch, 0)
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   462
		AddEvent(onSurface, {hero.gear}, surface, {hero.gear}, 0)
9532
4fa58a49ace1 more dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9529
diff changeset
   463
	else
12583
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   464
		-- 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: 12582
diff changeset
   465
		-- How dumb!
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   466
		-- Player will lose for this.
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   467
		AnimationSetup05(deviceCrate.collector)
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   468
		AddAnim(dialog05)
9532
4fa58a49ace1 more dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9529
diff changeset
   469
	end
9534
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   470
end
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   471
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   472
function surface(gear)
9536
7456b28a3421 this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9534
diff changeset
   473
	previousHog = -1
9538
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   474
	if tookPartInBattle then
12583
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   475
		escapeHog(green1.gear)
9540
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   476
		AddEvent(onRedTeamDeath, {green1.gear}, redTeamDeath, {green1.gear}, 0)
9538
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   477
	else
12572
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   478
		SetHogLevel(green1.gear, 1)
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   479
		-- Equip Captain Lime with weapons
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   480
		AddAmmo(green1.gear, amBazooka, 6)
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   481
		AddAmmo(green1.gear, amGrenade, 6)
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   482
		AddAmmo(green1.gear, amDEagle, 2)
15081
3a561db2a71c ASA: Check if hero is still alive before claiming victory
Wuzzy <Wuzzy2@mail.ru>
parents: 15002
diff changeset
   483
		AddEvent(onCaptainLimeDeath, {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
   484
	end
12582
3016c64b5a7f ASA, fruit02: End turn when reaching surface
Wuzzy <almikes@aol.com>
parents: 12573
diff changeset
   485
	EndTurn(true)
12583
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   486
	escapeHog(green2.gear)
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   487
	escapeHog(green3.gear)
9534
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   488
	inBattle = true
9532
4fa58a49ace1 more dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9529
diff changeset
   489
end
4fa58a49ace1 more dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9529
diff changeset
   490
9538
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   491
function captainLimeDeath(gear)
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   492
	-- hero win in scenario of escape in 1st part
9578
16139270448f save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   493
	saveCompletedStatus(3)
9642
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9630
diff changeset
   494
	SendStat(siGameResult, loc("Congratulations, you won!"))
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   495
	SendStat(siCustomAchievement, loc("You retrieved the lost part."))
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   496
	SendStat(siCustomAchievement, loc("You defended yourself against Captain Lime."))
12538
952afc3d2df2 Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents: 12528
diff changeset
   497
	sendSimpleTeamRankings({teamA.name, teamB.name})
9538
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   498
	EndGame()
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   499
end
9540
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   500
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   501
function redTeamDeath(gear)
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   502
	-- hero win in battle scenario
9578
16139270448f save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
   503
	saveCompletedStatus(3)
9642
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9630
diff changeset
   504
	SendStat(siGameResult, loc("Congratulations, you won!"))
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   505
	SendStat(siCustomAchievement, loc("You retrieved the lost part."))
14500
dbf704b00762 Simplify some mission strings
Wuzzy <Wuzzy2@mail.ru>
parents: 14496
diff changeset
   506
	SendStat(siCustomAchievement, string.format(loc("You defended yourself against %s."), teamC.name))
12538
952afc3d2df2 Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents: 12528
diff changeset
   507
	sendSimpleTeamRankings({teamA.name, teamC.name})
9540
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   508
	EndGame()
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   509
end
92329918463f game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9538
diff changeset
   510
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   511
-------------- ANIMATIONS ------------------
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   512
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   513
function Skipanim(anim)
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   514
	if goals[anim] ~= nil then
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   515
		ShowMission(unpack(goals[anim]))
12572
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   516
	end
14644
5fc5e4b79a5a Some polishing for ASA fruit02
Wuzzy <Wuzzy2@mail.ru>
parents: 14643
diff changeset
   517
	if anim == dialog03 or anim == dialog04 then
5fc5e4b79a5a Some polishing for ASA fruit02
Wuzzy <Wuzzy2@mail.ru>
parents: 14643
diff changeset
   518
		spawnRopeCrate()
5fc5e4b79a5a Some polishing for ASA fruit02
Wuzzy <Wuzzy2@mail.ru>
parents: 14643
diff changeset
   519
	end
12572
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   520
	if anim == dialog03 then
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   521
		makeCptLimeEvil()
12583
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   522
	elseif anim == dialog05 then
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   523
		heroIsAStupidFool()
12572
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   524
	else
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   525
		EndTurn(true)
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   526
	end
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   527
end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   528
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   529
function AnimationSetup()
14488
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   530
	-- DIALOG 01 - Start, Captain Lime helps the hero because he took part in the battle
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   531
	AddSkipFunction(dialog01, Skipanim, {dialog01})
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   532
	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
14488
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   533
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, string.format(loc("Somewhere else on the planet of fruits, Captain Lime helps %s"), hero.name), 5000}})
9529
e95aab9130d8 first dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9527
diff changeset
   534
	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
   535
	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
   536
	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
   537
	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
   538
	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   539
	table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}})
12572
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   540
	table.insert(dialog01, {func = ShowMission, args = goals[dialog01]})
14488
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   541
	-- DIALOG02 - Start, hero escaped from the previous battle
9529
e95aab9130d8 first dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9527
diff changeset
   542
	AddSkipFunction(dialog02, Skipanim, {dialog02})
e95aab9130d8 first dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9527
diff changeset
   543
	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 3000}})
14488
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   544
	table.insert(dialog02, {func = AnimCaption, args = {hero.gear, string.format(loc("Somewhere else on the planet of fruits, %s gets closer to the device"), hero.name), 5000}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   545
	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
   546
	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
   547
	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 8000}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   548
	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
   549
	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
   550
	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}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   551
	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
   552
	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
   553
	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 1800}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   554
	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
   555
	table.insert(dialog02, {func = AnimSwitchHog, args = {hero.gear}})
12572
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   556
	table.insert(dialog02, {func = ShowMission, args = goals[dialog02]})
9532
4fa58a49ace1 more dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9529
diff changeset
   557
	-- DIALOG03 - At crates, hero learns that Captain Lime is bad
4fa58a49ace1 more dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9529
diff changeset
   558
	AddSkipFunction(dialog03, Skipanim, {dialog03})
12583
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   559
	table.insert(dialog03, {func = AnimWait, args = {hero.gear, 2000}})
9534
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   560
	table.insert(dialog03, {func = FollowGear, args = {hero.gear}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   561
	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
   562
	table.insert(dialog03, {func = AnimWait, args = {green1.gear, 4000}})
14488
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   563
	table.insert(dialog03, {func = AnimSay, args = {green1.gear, string.format(loc("This %s is so naive! I'm going to shoot this fool so I can keep that device for myself!"), hero.name), SAY_THINK, 4000}})
12572
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   564
	table.insert(dialog03, {func = ShowMission, args = goals[dialog03]})
14644
5fc5e4b79a5a Some polishing for ASA fruit02
Wuzzy <Wuzzy2@mail.ru>
parents: 14643
diff changeset
   565
	table.insert(dialog03, {func = spawnRopeCrate, args = {hero.gear}})
12572
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   566
	table.insert(dialog03, {func = makeCptLimeEvil, args = {hero.gear}})
9831
afa4e3e04cc5 typos correction
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9810
diff changeset
   567
	-- DIALOG04 - At crates, hero learns about the Assassins ambush
9534
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   568
	AddSkipFunction(dialog04, Skipanim, {dialog04})
12583
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   569
	table.insert(dialog04, {func = AnimWait, args = {hero.gear, 2000}})
9534
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   570
	table.insert(dialog04, {func = FollowGear, args = {hero.gear}})
11692
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 9831
diff changeset
   571
	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
   572
	table.insert(dialog04, {func = AnimWait, args = {redHedgehogs[1].gear, 4000}})
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   573
	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}})
12572
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   574
	table.insert(dialog04, {func = ShowMission, args = goals[dialog04]})
14644
5fc5e4b79a5a Some polishing for ASA fruit02
Wuzzy <Wuzzy2@mail.ru>
parents: 14643
diff changeset
   575
	table.insert(dialog04, {func = spawnRopeCrate, args = {hero.gear}})
9534
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   576
	table.insert(dialog04, {func = goToThesurface, args = {hero.gear}})
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   577
end
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   578
12583
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   579
function AnimationSetup05(collector)
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   580
	-- 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: 12582
diff changeset
   581
	AddSkipFunction(dialog05, Skipanim, {dialog05})
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   582
	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: 12582
diff changeset
   583
	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: 12582
diff changeset
   584
	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: 12582
diff changeset
   585
	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: 12582
diff changeset
   586
	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: 12582
diff changeset
   587
	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: 12582
diff changeset
   588
	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: 12582
diff changeset
   589
	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: 12582
diff changeset
   590
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   591
end
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   592
9527
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   593
------------- OTHER FUNCTIONS ---------------
676fc574ff42 fruit planet part 2
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   594
12583
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   595
-- 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: 12582
diff changeset
   596
-- 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: 12582
diff changeset
   597
function escapeHog(gear)
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   598
	if GetHealth(gear) then
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   599
		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: 12582
diff changeset
   600
		for i=1, 4 do
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   601
			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: 12582
diff changeset
   602
		end
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   603
		HideHog(gear)
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   604
	end
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   605
end
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   606
12572
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   607
function makeCptLimeEvil()
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   608
	-- Turn Captain Lime evil
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   609
	SetHogLevel(green1.gear, 1)
14644
5fc5e4b79a5a Some polishing for ASA fruit02
Wuzzy <Wuzzy2@mail.ru>
parents: 14643
diff changeset
   610
	SetTeamPassive(teamB.name, false)
14643
30d3e1d6aedf ASA fruit02: Change Captain Lime clan color when he turns evil
Wuzzy <Wuzzy2@mail.ru>
parents: 14500
diff changeset
   611
	-- ... and reveal his "true" evil color. Muhahaha!
30d3e1d6aedf ASA fruit02: Change Captain Lime clan color when he turns evil
Wuzzy <Wuzzy2@mail.ru>
parents: 14500
diff changeset
   612
	SetClanColor(GetHogClan(green1.gear), teamB.colorEvil)
12572
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   613
	EndTurn(true)
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   614
end
5358c4f23643 ASA fruit02: Refactor captain lime hog, use 1 gear only instead of 2
Wuzzy <almikes@aol.com>
parents: 12538
diff changeset
   615
14644
5fc5e4b79a5a Some polishing for ASA fruit02
Wuzzy <Wuzzy2@mail.ru>
parents: 14643
diff changeset
   616
function spawnRopeCrate()
5fc5e4b79a5a Some polishing for ASA fruit02
Wuzzy <Wuzzy2@mail.ru>
parents: 14643
diff changeset
   617
	-- should be spawned after the device part was gotten and the cut scene finished.
5fc5e4b79a5a Some polishing for ASA fruit02
Wuzzy <Wuzzy2@mail.ru>
parents: 14643
diff changeset
   618
	SpawnSupplyCrate(ropeCrate.x, ropeCrate.y, ropeCrate.name)
5fc5e4b79a5a Some polishing for ASA fruit02
Wuzzy <Wuzzy2@mail.ru>
parents: 14643
diff changeset
   619
end
5fc5e4b79a5a Some polishing for ASA fruit02
Wuzzy <Wuzzy2@mail.ru>
parents: 14643
diff changeset
   620
9534
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   621
function goToThesurface()
12514
d89dabfd07ce Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents: 12513
diff changeset
   622
	EndTurn(true)
9534
662edfec06be many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9532
diff changeset
   623
end
9538
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   624
12583
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   625
-- Player let wrong hog collect crate
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   626
function heroIsAStupidFool()
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   627
	if not ended then
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   628
		escapeHog(deviceCrate.collector)
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   629
		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: 12582
diff changeset
   630
		sendSimpleTeamRankings({teamA.name})
14488
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   631
		SendStat(siGameResult, string.format(loc("%s lost, try again!"), hero.name))
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   632
		SendStat(siCustomAchievement, string.format(loc("Oh no, the companions have betrayed %s and stole the anti-gravity device part!"), hero.name))
7bb7e5e54f70 Update ASA campaign to use player chosen team identity
Wuzzy <Wuzzy2@mail.ru>
parents: 14401
diff changeset
   633
		SendStat(siCustomAchievement, string.format(loc("Only %s can be trusted with the crate."), hero.name))
12583
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   634
		EndGame()
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   635
		ended = true
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   636
	end
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   637
end
da2bdc34bb1c ASA, fruit02: Fail mission if player let wrong hog collect device part
Wuzzy <almikes@aol.com>
parents: 12582
diff changeset
   638
9538
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   639
function wind()
15086
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   640
	if fixedWind then
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   641
		SetWind(10)
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   642
	else
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   643
		SetWind(GetRandom(201)-100)
9f2374425744 ASA fruit02: Use pre-selected barrel positions and fewer barrels
Wuzzy <Wuzzy2@mail.ru>
parents: 15084
diff changeset
   644
	end
9538
51596e01c5df scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9536
diff changeset
   645
end
9544
e247251fa751 position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9542
diff changeset
   646