share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert02.lua
author Wuzzy <Wuzzy2@mail.ru>
Tue, 10 Jul 2018 17:11:31 +0200
changeset 13467 4c47a480009b
parent 12592 0b27d8b4f8e7
child 13588 141cdfe0f3ca
permissions -rw-r--r--
Prevent manual hiding of some special mission panels
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9467
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     1
------------------- ABOUT ----------------------
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     2
--
9471
867f020b0621 seems ok, stats to be added
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9469
diff changeset
     3
-- Hero has to get to the surface as soon as possible.
867f020b0621 seems ok, stats to be added
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9469
diff changeset
     4
-- Tunnel is about to get flooded.
9467
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     5
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     6
HedgewarsScriptLoad("/Scripts/Locale.lua")
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     7
HedgewarsScriptLoad("/Scripts/Animate.lua")
9582
bf314b2258b3 less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
     8
HedgewarsScriptLoad("/Missions/Campaign/A_Space_Adventure/global_functions.lua")
9467
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     9
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    10
----------------- VARIABLES --------------------
483a73697535 desert sidwquest map and basic script
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: 9490
diff changeset
    12
local missionName = loc("Running for survival")
9474
c255f6c46e33 stats and minor corrections, difficulty adjustment
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9471
diff changeset
    13
local startChallenge = false
9467
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    14
-- dialogs
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    15
local dialog01 = {}
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    16
-- mission objectives
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    17
local goals = {
12232
5afbffc6725d Fix bad mission texts in A Space Adventure
Wuzzy <almikes@aol.com>
parents: 12231
diff changeset
    18
	[dialog01] = {missionName, loc("Getting ready"), loc("Use the rope to quickly get to the surface!") .. "|" .. loc("Mines time: 1 second"), 1, 4500},
9467
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    19
}
9490
b93448b75fa4 fix bugs and some changes regarting the difficulty in desert02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9484
diff changeset
    20
-- health crates
b93448b75fa4 fix bugs and some changes regarting the difficulty in desert02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9484
diff changeset
    21
healthX = 565
b93448b75fa4 fix bugs and some changes regarting the difficulty in desert02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9484
diff changeset
    22
health1Y = 1400
b93448b75fa4 fix bugs and some changes regarting the difficulty in desert02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9484
diff changeset
    23
health2Y = 850
9467
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    24
-- hogs
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    25
local hero = {}
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    26
-- teams
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    27
local teamA = {}
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    28
-- hedgehogs values
9574
da3d39667881 strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9490
diff changeset
    29
hero.name = loc("Hog Solo")
9467
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    30
hero.x = 1600
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    31
hero.y = 1950
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    32
hero.dead = false
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    33
teamA.name = loc("Hog Solo")
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    34
teamA.color = tonumber("38D61C",16) -- green
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    35
-- way points
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    36
local current waypoint = 1
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9645
diff changeset
    37
local waypoints = {
9467
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    38
	[1] = {x=1450, y=140},
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    39
	[2] = {x=990, y=580},
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    40
	[3] = {x=1650, y=950},
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    41
	[4] = {x=620, y=630},
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    42
	[5] = {x=1470, y=540},
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    43
	[6] = {x=1960, y=60},
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    44
	[7] = {x=1600, y=400},
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    45
	[8] = {x=240, y=940},
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    46
	[9] = {x=200, y=530},
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    47
	[10] = {x=1180, y=120},
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    48
	[11] = {x=1950, y=660},
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    49
	[12] = {x=1280, y=980},
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    50
	[13] = {x=590, y=1100},
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    51
	[14] = {x=20, y=620},
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    52
	[15] = {x=hero.x, y=hero.y}
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    53
}
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    54
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    55
-------------- LuaAPI EVENT HANDLERS ------------------
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    56
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    57
function onGameInit()
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    58
	GameFlags = gfOneClanMode
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    59
	Seed = 1
9474
c255f6c46e33 stats and minor corrections, difficulty adjustment
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9471
diff changeset
    60
	TurnTime = 8000
9467
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    61
	Delay = 2
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    62
	CaseFreq = 0
9490
b93448b75fa4 fix bugs and some changes regarting the difficulty in desert02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9484
diff changeset
    63
	HealthCaseAmount = 50
9471
867f020b0621 seems ok, stats to be added
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9469
diff changeset
    64
	MinesNum = 500
867f020b0621 seems ok, stats to be added
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9469
diff changeset
    65
	MinesTime = 1000
867f020b0621 seems ok, stats to be added
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9469
diff changeset
    66
	MineDudPercent = 75
9467
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    67
	Explosives = 0
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    68
	SuddenDeathTurns = 1
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    69
	WaterRise = 150
9490
b93448b75fa4 fix bugs and some changes regarting the difficulty in desert02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9484
diff changeset
    70
	HealthDecrease = 0
9467
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    71
	Map = "desert02_map"
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    72
	Theme = "Desert"
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9645
diff changeset
    73
9467
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    74
	-- Hog Solo
12592
0b27d8b4f8e7 Use Default voice in A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 12591
diff changeset
    75
	AddTeam(teamA.name, teamA.color, "Simple", "Island", "Default", "hedgewars")
9467
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    76
	hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    77
	AnimSetGearPosition(hero.gear, hero.x, hero.y)
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    78
	HogTurnLeft(hero.gear, true)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9645
diff changeset
    79
9582
bf314b2258b3 less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9574
diff changeset
    80
	initCheckpoint("desert02")
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9645
diff changeset
    81
12093
1da37e2ba6fd Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
    82
	AnimInit(true)
9490
b93448b75fa4 fix bugs and some changes regarting the difficulty in desert02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9484
diff changeset
    83
	AnimationSetup()
9467
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    84
end
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    85
12474
2041d1e98ab2 Allow skipping in two ASA missions
Wuzzy <almikes@aol.com>
parents: 12232
diff changeset
    86
function onAmmoStoreInit()
2041d1e98ab2 Allow skipping in two ASA missions
Wuzzy <almikes@aol.com>
parents: 12232
diff changeset
    87
	SetAmmo(amRope, 9, 0, 0, 0)
2041d1e98ab2 Allow skipping in two ASA missions
Wuzzy <almikes@aol.com>
parents: 12232
diff changeset
    88
	SetAmmo(amSkip, 9, 0, 0, 0)
2041d1e98ab2 Allow skipping in two ASA missions
Wuzzy <almikes@aol.com>
parents: 12232
diff changeset
    89
end
2041d1e98ab2 Allow skipping in two ASA missions
Wuzzy <almikes@aol.com>
parents: 12232
diff changeset
    90
9467
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    91
function onGameStart()
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    92
	AnimWait(hero.gear, 3000)
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    93
	FollowGear(hero.gear)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9645
diff changeset
    94
12580
0c5ce463949b ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents: 12544
diff changeset
    95
	ShowMission(unpack(goals[dialog01]))
0c5ce463949b ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents: 12544
diff changeset
    96
	HideMission()
0c5ce463949b ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents: 12544
diff changeset
    97
9467
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    98
	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
9471
867f020b0621 seems ok, stats to be added
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9469
diff changeset
    99
	AddEvent(onHeroSafe, {hero.gear}, heroSafe, {hero.gear}, 0)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9645
diff changeset
   100
9490
b93448b75fa4 fix bugs and some changes regarting the difficulty in desert02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9484
diff changeset
   101
	SpawnHealthCrate(healthX, health1Y)
b93448b75fa4 fix bugs and some changes regarting the difficulty in desert02
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9484
diff changeset
   102
	SpawnHealthCrate(healthX, health2Y)
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9645
diff changeset
   103
9467
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   104
	SendHealthStatsOff()
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   105
	AddAnim(dialog01)
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   106
end
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   107
9645
da7b4d8c181e autoselect weapon in time challenges
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   108
function onNewTurn()
10289
c3a77ff02a23 lua api: SetWeapon(ammoType)
sheepluva
parents: 9758
diff changeset
   109
	SetWeapon(amRope)
9645
da7b4d8c181e autoselect weapon in time challenges
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   110
end
da7b4d8c181e autoselect weapon in time challenges
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9642
diff changeset
   111
9467
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   112
function onGameTick()
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   113
	AnimUnWait()
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   114
	if ShowAnimation() == false then
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   115
		return
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   116
	end
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   117
	ExecuteAfterAnimations()
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   118
	CheckEvents()
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   119
end
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   120
12580
0c5ce463949b ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents: 12544
diff changeset
   121
function onGearAdd(gear)
0c5ce463949b ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents: 12544
diff changeset
   122
	if GetGearType(gear) == gtRope then
0c5ce463949b ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents: 12544
diff changeset
   123
		HideMission()
0c5ce463949b ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents: 12544
diff changeset
   124
	end
0c5ce463949b ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents: 12544
diff changeset
   125
end
0c5ce463949b ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents: 12544
diff changeset
   126
9467
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   127
function onGearDelete(gear)
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   128
	if gear == hero.gear then
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   129
		hero.dead = true
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   130
	end
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   131
end
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   132
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   133
function onPrecise()
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   134
	if GameTime > 3000 then
9758
3b8058b251b8 some more campaign string tweaks
sheepluva
parents: 9645
diff changeset
   135
		SetAnimSkip(true)
9467
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   136
	end
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   137
end
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   138
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   139
-------------- EVENTS ------------------
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   140
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   141
function onHeroDeath(gear)
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   142
	if hero.dead then
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   143
		return true
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   144
	end
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   145
	return false
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   146
end
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   147
9469
6896f9298b80 event for win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9467
diff changeset
   148
function onHeroSafe(gear)
9474
c255f6c46e33 stats and minor corrections, difficulty adjustment
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9471
diff changeset
   149
	if not hero.dead and GetY(hero.gear) < 170 and StoppedGear(hero.gear) then
9469
6896f9298b80 event for win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9467
diff changeset
   150
		return true
6896f9298b80 event for win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9467
diff changeset
   151
	end
6896f9298b80 event for win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9467
diff changeset
   152
	return false
6896f9298b80 event for win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9467
diff changeset
   153
end
6896f9298b80 event for win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9467
diff changeset
   154
9639
6b2ae2eaf1b2 remove unnecessary comments
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9582
diff changeset
   155
-------------- ACTIONS ------------------
9467
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   156
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   157
function heroDeath(gear)
9642
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9639
diff changeset
   158
	SendStat(siGameResult, loc("Hog Solo lost, try again!"))
11697
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10289
diff changeset
   159
	SendStat(siCustomAchievement, loc("To win the game you have to go to the surface."))
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10289
diff changeset
   160
	SendStat(siCustomAchievement, loc("Most mines are not active."))
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10289
diff changeset
   161
	SendStat(siCustomAchievement, loc("From the second turn and beyond the water rises."))
12544
19192a3cb674 Use correct kill counts for the remaining ASA missions as well
Wuzzy <almikes@aol.com>
parents: 12519
diff changeset
   162
	sendSimpleTeamRankings({teamA.name})
9471
867f020b0621 seems ok, stats to be added
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9469
diff changeset
   163
	EndGame()
9467
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   164
end
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   165
9469
6896f9298b80 event for win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9467
diff changeset
   166
function heroSafe(gear)
9642
8a691e0f117a use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9639
diff changeset
   167
	SendStat(siGameResult, loc("Congratulations, you won!"))
11697
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10289
diff changeset
   168
	SendStat(siCustomAchievement, loc("You have escaped successfully."))
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10289
diff changeset
   169
	SendStat(siCustomAchievement, string.format(loc("Your escape took you %d turns."), TotalRounds))
11895
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   170
	local record = tonumber(GetCampaignVar("FastestMineEscape"))
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   171
	if record ~= nil and TotalRounds >= record then
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   172
		SendStat(siCustomAchievement, string.format(loc("Your fastest escape so far: %d turns"), record))
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   173
	end
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   174
	if record == nil or TotalRounds < record then
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   175
		SaveCampaignVar("FastestMineEscape", tostring(TotalRounds))
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   176
		if record ~= nil then
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   177
			SendStat(siCustomAchievement, loc("This is a new personal best, congratulations!"))
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   178
		end
712e20a3d895 Save some records in campaign vars: Hard flying, Running for survival
Wuzzy <almikes@aol.com>
parents: 11697
diff changeset
   179
	end
12544
19192a3cb674 Use correct kill counts for the remaining ASA missions as well
Wuzzy <almikes@aol.com>
parents: 12519
diff changeset
   180
	sendSimpleTeamRankings({teamA.name})
11957
63988f36debf Save mission success for A Space Adventure missions
Wuzzy <almikes@aol.com>
parents: 11895
diff changeset
   181
	SaveCampaignVar("Mission7Won", "true")
11970
72be38f6d0c0 Complete space campaign's spacetrip mission if all main+side missions are completed
Wuzzy <almikes@aol.com>
parents: 11957
diff changeset
   182
	checkAllMissionsCompleted()
9469
6896f9298b80 event for win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9467
diff changeset
   183
	EndGame()
6896f9298b80 event for win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9467
diff changeset
   184
end
6896f9298b80 event for win
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9467
diff changeset
   185
9467
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   186
-------------- ANIMATIONS ------------------
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   187
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   188
function Skipanim(anim)
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   189
	if goals[anim] ~= nil then
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   190
		ShowMission(unpack(goals[anim]))
12580
0c5ce463949b ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents: 12544
diff changeset
   191
	end
9474
c255f6c46e33 stats and minor corrections, difficulty adjustment
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9471
diff changeset
   192
	challengeStart()
9467
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   193
end
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   194
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   195
function AnimationSetup()
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   196
	-- DIALOG 01 - Start
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   197
	AddSkipFunction(dialog01, Skipanim, {dialog01})
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   198
	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
11697
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10289
diff changeset
   199
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Many meters below the surface ..."), 5000}})
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10289
diff changeset
   200
	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("The tunnel is about to get flooded!"), SAY_THINK, 4000}})
68eddcdc9f26 Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents: 10289
diff changeset
   201
	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("I have to reach the surface as quickly as I can."), SAY_THINK, 4000}})
9467
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   202
	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
12580
0c5ce463949b ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents: 12544
diff changeset
   203
	table.insert(dialog01, {func = ShowMission, args = goals[dialog01]})
9467
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   204
	table.insert(dialog01, {func = challengeStart, args = {hero.gear}})
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   205
end
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   206
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   207
------------------ Other Functions -------------------
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   208
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   209
function challengeStart()
9474
c255f6c46e33 stats and minor corrections, difficulty adjustment
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9471
diff changeset
   210
	startChallenge = true
12519
d89dabfd07ce Use EndTurn to replace TurnTimeLeft=0 in ASA campaign (fixes #225)
Wuzzy <almikes@aol.com>
parents: 12474
diff changeset
   211
	EndTurn(true)
9467
483a73697535 desert sidwquest map and basic script
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   212
end