share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/cosmos.lua
author Periklis Ntanasis <pntanasis@gmail.com>
Thu, 04 Jul 2013 01:36:49 +0300
branchspacecampaign
changeset 9310 1469147c110f
parent 9308 4bddcc1a1450
child 9326 689f591aa226
permissions -rw-r--r--
moon01 stab and finally moon01 map
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9258
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     1
------------------- ABOUT ----------------------
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     2
--
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     3
-- This map works as a menu for the hero hog to
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     4
-- navigate through planets. It portrays the hogs
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     5
-- planet and above the planets that he'll later
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     6
-- visit.
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     7
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     8
-- TODO
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
     9
-- Save and Load All Check Points
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    10
-- Save hero health
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    11
-- Decide and implement if hero will use gas bombs...
9266
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
    12
-- ofc add custom stats page
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
    13
-- PROBLEM : What if one makes a bad choice and wants to replay it map, how to reset?
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
    14
-- POSSIBLE SOLUTIONS: In game function keys, frontend button...
9258
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    15
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    16
HedgewarsScriptLoad("/Scripts/Locale.lua")
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    17
HedgewarsScriptLoad("/Scripts/Animate.lua")
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    18
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    19
----------------- VARIABLES --------------------
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    20
-- globals
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    21
local campaignName = loc("A Space Adventure")
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    22
local missionName = loc("Cosmos")
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    23
local timeForGuard1ToTurn = 1000 * 5 -- 5 sec
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    24
local timeForGuard1ToTurnLeft = timeForGuard1ToTurn
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    25
local saucerAcquired = false
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    26
local checkPointReached = 1 -- 1 is start of the game
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    27
-- dialogs
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    28
local dialog01 = {}
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    29
local dialog02 = {}
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    30
local dialog03 = {}
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    31
local dialog04 = {}
9266
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
    32
local dialog05 = {}
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
    33
local dialog06 = {}
9258
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    34
-- mission objectives
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    35
local goals = {
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    36
	[dialog01] = {missionName, loc("Getting ready"), loc("Go and collect the crate on top of the column").."|"..loc("Use the sleep gas bomb if the guards spot you!"), 1, 4500},
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    37
	[dialog02] = {missionName, loc("The adventure begins!"), loc("Use the saucer and fly to the moon").."|"..loc("Drive carefully as your fuels are limited"), 1, 4500},
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    38
	[dialog03] = {missionName, loc("An unexpected event!"), loc("Use the saucer and fly away or use the gas bomb to neutralize the guards").."|"..loc("Beware, any damage taken will stay until you take some medicine or visit moon"), 1, 7000}
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    39
}
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    40
-- crates
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    41
local saucerX = 3270
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    42
local saucerY = 1500
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    43
-- hogs
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    44
local hero = {}
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    45
local director = {}
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    46
local doctor = {}
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    47
local guard1 = {}
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    48
local guard2 = {}
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    49
-- teams
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    50
local teamA = {}
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    51
local teamB = {}
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    52
local teamC = {}
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    53
-- hedgehogs values
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    54
hero.name = loc("Hog Solo")
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    55
hero.x = 1450
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    56
hero.y = 1550
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    57
director.name = loc("H")
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    58
director.x = 1350
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    59
director.y = 1550
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    60
doctor.name = loc("Dr.Cornelius")
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    61
doctor.x = 1300
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    62
doctor.y = 1550
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    63
guard1.name = loc("Bob")
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    64
guard1.x = 3350
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    65
guard1.y = 1800
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    66
guard1.turn = false
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    67
guard1.keepTurning = true
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    68
guard2.name = loc("Sam")
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    69
guard2.x = 3400
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    70
guard2.y = 1800
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    71
teamA.name = loc("PAoTH")
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    72
teamA.color = tonumber("FF0000",16) -- red
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    73
teamB.name = loc("Guards")
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    74
teamB.color = tonumber("0033FF",16) -- blue
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    75
teamC.name = loc("Hog Solo")
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    76
teamC.color = tonumber("38D61C",16) -- green
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    77
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    78
-------------- LuaAPI EVENT HANDLERS ------------------
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    79
function onGameInit()
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    80
	Seed = 35
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    81
	GameFlags = gfSolidLand + gfDisableWind
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    82
	TurnTime = 40000
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    83
	CaseFreq = 0
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    84
	MinesNum = 0
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    85
	Explosives = 0
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    86
	Delay = 5
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    87
	Map = "cosmos_map" -- custom map included in file
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    88
	Theme = "Nature"
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    89
	-- I had originally hero in PAoTH team and changed it, may reconsider though
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    90
	-- PAoTH
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    91
	AddTeam(teamC.name, teamC.color, "Bone", "Island", "HillBilly", "cm_birdy")	
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    92
	hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    93
	AnimSetGearPosition(hero.gear, hero.x, hero.y)	
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    94
	HogTurnLeft(hero.gear, true)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    95
	AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "cm_birdy")	
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    96
	director.gear = AddHog(director.name, 0, 100, "hair_yellow")
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    97
	AnimSetGearPosition(director.gear, director.x, director.y)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    98
	doctor.gear = AddHog(doctor.name, 0, 100, "Glasses")
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
    99
	AnimSetGearPosition(doctor.gear, doctor.x, doctor.y)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   100
	-- Guards
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   101
	AddTeam(teamB.name, teamB.color, "Bone", "Island", "HillBilly", "cm_birdy")
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   102
	guard1.gear = AddHog(guard1.name, 1, 100, "policecap")
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   103
	AnimSetGearPosition(guard1.gear, guard1.x, guard1.y)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   104
	guard2.gear = AddHog(guard2.name, 1, 100, "policecap")
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   105
	AnimSetGearPosition(guard2.gear, guard2.x, guard2.y)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   106
	
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   107
	-- get the check point
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   108
	if tonumber(GetCampaignVar("CosmosCheckPoint")) then
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   109
		checkPointReached = tonumber(GetCampaignVar("CosmosCheckPoint"))
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   110
	end
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   111
	-- do checkpoint stuff needed before game starts
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   112
	if checkPointReached == 1 then
9266
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   113
		-- Start of the game
9258
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   114
	elseif checkPointReached == 2 then
9266
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   115
		-- Hero on the column, just took space ship unnoticed
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   116
		AnimSetGearPosition(hero.gear, saucerX, saucerY)
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   117
	elseif checkPointReached == 3 then
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   118
		-- Hero near column, without space ship unnoticed
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   119
	elseif checkPointReached == 4 then
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   120
		-- Hero visited moon for fuels
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   121
		AnimSetGearPosition(hero.gear, 1110, 850)
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   122
	elseif checkPointReached == 5 then
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   123
		-- Hero has visited a planet, he has plenty of fuels and can change planet
9258
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   124
	end
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   125
	
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   126
	AnimInit()
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   127
	AnimationSetup()
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   128
end
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   129
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   130
function onGameStart()
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   131
	-- wait for the first turn to start
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   132
	AnimWait(hero.gear, 3000)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   133
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   134
	FollowGear(hero.gear)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   135
	ShowMission(loc("A Space Adventure"), loc("Cosmos"), loc("Help Hog Solo to find all the parts of the anti-gravity device.")..
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   136
	"|"..loc("Travel to all the neighbor planets and collect all the pieces"), -amSkip, 0)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   137
	
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   138
	-- do checkpoint stuff needed after game starts
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   139
	if checkPointReached == 1 then	
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   140
		AddAnim(dialog01)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   141
		AddAmmo(hero.gear, amGasBomb, 5)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   142
		AddAmmo(hero.gear, amRope, 2)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   143
		-- Added for dev/debug purposes, remove before release
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   144
		AddAmmo(hero.gear, amJetpack, 2)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   145
		AddAmmo(guard1.gear, amDEagle, 2)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   146
		AddAmmo(guard2.gear, amDEagle, 2)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   147
		SpawnAmmoCrate(saucerX, saucerY, amJetpack)	
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   148
		-- EVENT HANDLERS
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   149
		AddEvent(onHeroBeforeTreePosition, {hero.gear}, heroBeforeTreePosition, {hero.gear}, 0)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   150
		AddEvent(onHeroAtSaucerPosition, {hero.gear}, heroAtSaucerPosition, {hero.gear}, 0)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   151
		AddEvent(onHeroOutOfGuardSight, {hero.gear}, heroOutOfGuardSight, {hero.gear}, 0)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   152
	elseif checkPointReached == 2 then
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   153
		AddAmmo(hero.gear, amJetpack, 1)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   154
		AddAnim(dialog02)
9266
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   155
	elseif checkPointReached == 3 then
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   156
		-- Hero near column, without space ship unnoticed
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   157
	elseif checkPointReached == 4 then
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   158
		-- Hero visited moon for fuels
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   159
		AddAnim(dialog05)
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   160
	elseif checkPointReached == 5 then
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   161
		-- Hero has visited a planet, he has plenty of fuels and can change planet
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   162
	end
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   163
	-- always check for landings
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   164
	if GetCampaignVar("Planet") ~= "moon" then
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   165
		AddEvent(onMoonLanding, {hero.gear}, moonLanding, {hero.gear}, 0)
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   166
	end
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   167
	if GetCampaignVar("Planet") ~= "desertPlanet" then
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   168
		AddEvent(onDesertPlanetLanding, {hero.gear}, desertPlanetLanding, {hero.gear}, 0)
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   169
	end	
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   170
	if GetCampaignVar("Planet") ~= "fruitPlanet" then
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   171
		AddEvent(onFruitPlanetLanding, {hero.gear}, fruitPlanetLanding, {hero.gear}, 0)
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   172
	end
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   173
	if GetCampaignVar("Planet") ~= "icePlanet" then
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   174
		AddEvent(onIcePlanetLanding, {hero.gear}, icePlanetLanding, {hero.gear}, 0)
9258
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   175
	end
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   176
end
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   177
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   178
function onGameTick()
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   179
	-- maybe alert this to avoid timeForGuard1ToTurnLeft overflow
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   180
	if timeForGuard1ToTurnLeft == 0 and guard1.keepTurning then
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   181
		guard1.turn = not guard1.turn
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   182
		HogTurnLeft(guard1.gear, guard1.turn)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   183
		timeForGuard1ToTurnLeft = timeForGuard1ToTurn
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   184
	end
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   185
	timeForGuard1ToTurnLeft = timeForGuard1ToTurnLeft - 1
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   186
	AnimUnWait()
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   187
	if ShowAnimation() == false then
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   188
		return
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   189
	end
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   190
	ExecuteAfterAnimations()
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   191
	CheckEvents()
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   192
end
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   193
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   194
function onPrecise()
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   195
	if GameTime > 3000 then
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   196
		SetAnimSkip(true)   
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   197
	end
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   198
end
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   199
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   200
function onAmmoStoreInit()
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   201
	SetAmmo(amJetpack, 0, 0, 0, 1)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   202
end
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   203
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   204
function onNewTurn()
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   205
	if CurrentHedgehog == director.gear or CurrentHedgehog == doctor.gear then
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   206
		TurnTimeLeft = 0
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   207
	end
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   208
	if guard1.keepTurning then
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   209
		AnimSwitchHog(hero.gear)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   210
		TurnTimeLeft = -1
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   211
	end
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   212
end
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   213
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   214
-------------- EVENTS ------------------
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   215
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   216
function onHeroBeforeTreePosition(gear)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   217
	if GetX(gear) > 2444 then
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   218
		return true
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   219
	end
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   220
	return false
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   221
end
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   222
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   223
function onHeroAtSaucerPosition(gear)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   224
	if GetX(gear) >= saucerX-32 and GetX(gear) <= saucerX+32 and GetY(gear) >= saucerY-32 and GetY(gear) <= saucerY+32 then
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   225
		saucerAcquired = true
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   226
	end
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   227
	if saucerAcquired and StoppedGear(gear) then
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   228
		return true
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   229
	end
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   230
	return false
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   231
end
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   232
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   233
function onHeroOutOfGuardSight(gear)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   234
	if GetX(gear) < 3100 and GetY(gear) > saucerY-25 and StoppedGear(gear) and not guard1.keepTurning then
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   235
		return true
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   236
	end
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   237
	return false
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   238
end
9266
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   239
--
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   240
function onMoonLanding(gear)
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   241
	if GetX(gear) > 1010 and GetX(gear) < 1220  and GetY(gear) < 1300 and StoppedGear(gear) then
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   242
		return true
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   243
	end
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   244
	return false
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   245
end
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   246
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   247
function onFruitPlanetLanding(gear)
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   248
	if GetX(gear) > 2240 and GetX(gear) < 2540  and GetY(gear) < 1100 and StoppedGear(gear) then
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   249
		return true
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   250
	end
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   251
	return false
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   252
end
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   253
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   254
function onDesertPlanetLanding(gear)
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   255
	if GetX(gear) > 3568 and GetX(gear) < 4052  and GetY(gear) < 500 and StoppedGear(gear) then
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   256
		return true
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   257
	end
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   258
	return false
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   259
end
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   260
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   261
function onIcePlanetLanding(gear)
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   262
	if GetX(gear) > 1330 and GetX(gear) < 1650  and GetY(gear) < 500 and StoppedGear(gear) then
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   263
		return true
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   264
	end
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   265
	return false
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   266
end
9258
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   267
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   268
-------------- OUTCOMES ------------------
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   269
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   270
function heroBeforeTreePosition(gear)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   271
	AnimSay(gear,loc("Now I have to climb the trees"), SAY_SAY, 4000)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   272
	AnimCaption(hero.gear, loc("Use the rope to get to the crate"),  4000)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   273
end
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   274
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   275
function heroAtSaucerPosition(gear)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   276
	TurnTimeLeft = 0
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   277
	-- save check point	
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   278
	SaveCampaignVar("CosmosCheckPoint", "2")
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   279
	AddAnim(dialog02)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   280
	-- check if he was spotted by the guard
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   281
	if guard1.turn then
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   282
		guard1.keepTurning = false
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   283
		AddAnim(dialog03)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   284
	end	
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   285
end
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   286
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   287
function heroOutOfGuardSight(gear)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   288
	guard1.keepTurning = true
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   289
	AddAnim(dialog04)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   290
end
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   291
9266
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   292
function moonLanding(gear)
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   293
	WriteLnToConsole("MOON LANDING, HOORAY!")
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   294
	AnimCaption(hero.gear,loc("Welcome to the moon!"))
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   295
	SaveCampaignVar("CosmosCheckPoint", "4")
9310
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
   296
	SaveCampaignVar("UnlockedMissions", "2")	
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
   297
	SaveCampaignVar("Mission1", "2")
1469147c110f moon01 stab and finally moon01 map
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9308
diff changeset
   298
	SaveCampaignVar("Mission2", "1")
9266
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   299
	EndGame()
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   300
end
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   301
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   302
function fruitPlanetLanding(gear)
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   303
	if checkPointReached < 5 then
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   304
		AddAnim(dialog06)
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   305
	end
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   306
end
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   307
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   308
function desertPlanetLanding(gear)
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   309
	if checkPointReached < 5 then
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   310
		AddAnim(dialog06)
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   311
	end
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   312
end
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   313
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   314
function icePlanetLanding(gear)
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   315
	if checkPointReached < 5 then
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   316
		AddAnim(dialog06)
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   317
	end
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   318
end
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   319
9258
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   320
-------------- ANIMATIONS ------------------
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   321
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   322
function Skipanim(anim)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   323
	if goals[anim] ~= nil then
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   324
		ShowMission(unpack(goals[anim]))
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   325
    end
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   326
    if CurrentHedgehog ~= hero.gear and anim ~= dialog03 then
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   327
		AnimSwitchHog(hero.gear)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   328
	elseif anim == dialog03 then
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   329
		startCombat()
9266
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   330
	elseif anim == dialog05 or anim == dialog06 then
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   331
		EndGame()
9258
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   332
	end
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   333
end
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   334
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   335
function AnimationSetup()
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   336
	-- DIALOG 01 - Start
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   337
	AddSkipFunction(dialog01, Skipanim, {dialog01})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   338
	table.insert(dialog01, {func = AnimWait, args = {doctor.gear, 3000}})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   339
	--table.insert(dialog01, {func = AnimWait, args = {hero.gear, 2500}, skipFunc = Skipanim, skipArgs = dialog01})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   340
	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Near secret base 17 of PAoTH in the rural Hogland..."),  4000}})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   341
	table.insert(dialog01, {func = AnimSay, args = {director.gear, loc("So Hog Solo, here we are..."), SAY_SAY, 2000}})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   342
	table.insert(dialog01, {func = AnimSay, args = {director.gear, loc("Behind these trees on the East there is secret base 17"), SAY_SAY, 4000}})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   343
	table.insert(dialog01, {func = AnimSay, args = {director.gear, loc("You have to continue alone from now on."), SAY_SAY, 3000}})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   344
	table.insert(dialog01, {func = AnimSay, args = {director.gear, loc("Be careful, the future of Hogera is in your hands!"), SAY_SAY, 7200}})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   345
	table.insert(dialog01, {func = AnimSay, args = {doctor.gear, loc("We'll use our communicators to contact you"), SAY_SAY, 2600}})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   346
	table.insert(dialog01, {func = AnimSay, args = {doctor.gear, loc("In am also entrusting you with a rope and a sleep gas bomb"), SAY_SAY, 5000}})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   347
	table.insert(dialog01, {func = AnimSay, args = {doctor.gear, loc("You may find them handy"), SAY_SAY, 2300}})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   348
	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Thank you Dr.Cornelius"), SAY_SAY, 1600}})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   349
	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("I'll make good use of them"), SAY_SAY, 4500}})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   350
	table.insert(dialog01, {func = AnimSay, args = {director.gear, loc("It would be wiser to steal the space ship while PAoTH guards are taking a brake!"), SAY_SAY, 7000}})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   351
	table.insert(dialog01, {func = AnimSay, args = {director.gear, loc("Remember! Many will seek the anti-gravity device! Now go, hurry up!"), SAY_SAY, 4000}})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   352
	table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   353
	-- DIALOG 02 - Hero got the saucer
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   354
	AddSkipFunction(dialog02, Skipanim, {dialog02})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   355
	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 500}})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   356
	table.insert(dialog02, {func = AnimCaption, args = {hero.gear, loc("CheckPoint reached!"),  4000}})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   357
	table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("Got the saucer!"), SAY_SHOUT, 2000}})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   358
	table.insert(dialog02, {func = AnimSay, args = {director.gear, loc("Nice!"), SAY_SHOUT, 1000}})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   359
	table.insert(dialog02, {func = AnimSay, args = {director.gear, loc("Now use it and go to the moon PAoTH station to get more fuels!"), SAY_SHOUT, 5000}})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   360
    table.insert(dialog02, {func = AnimGearWait, args = {hero.gear, 500}})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   361
    -- DIALOG 03 - Hero got spotted by guard
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   362
	AddSkipFunction(dialog03, Skipanim, {dialog03})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   363
	table.insert(dialog03, {func = AnimWait, args = {guard1.gear, 4000}})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   364
	table.insert(dialog03, {func = AnimCaption, args = {guard1.gear, loc("Prepare to battle or flee!"),  4000}})	
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   365
	table.insert(dialog03, {func = AnimSay, args = {guard1.gear, loc("Hey").." "..guard2.name.."! "..loc("Look, someone is stealing the saucer!"), SAY_SHOUT, 4000}})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   366
	table.insert(dialog03, {func = AnimSay, args = {guard2.gear, loc("I'll get him!"), SAY_SAY, 4000}})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   367
	table.insert(dialog03, {func = startCombat, args = {guard1.gear}})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   368
	-- DIALOG 04 - Hero out of sight
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   369
	AddSkipFunction(dialog04, Skipanim, {dialog04})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   370
	table.insert(dialog04, {func = AnimCaption, args = {guard1.gear, loc("You are out of danger, time to go to the moon!"),  4000}})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   371
	table.insert(dialog04, {func = AnimSay, args = {guard1.gear, loc("I guess we lost him!"), SAY_SAY, 3000}})
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   372
	table.insert(dialog04, {func = AnimSay, args = {guard2.gear, loc("We should better report this and continue our watch!"), SAY_SAY, 5000}})
9266
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   373
	table.insert(dialog04, {func = AnimSwitchHog, args = {hero.gear}})
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   374
	-- DIALOG 05 - Hero returned from moon without fuels
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   375
	AddSkipFunction(dialog05, Skipanim, {dialog05})
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   376
	table.insert(dialog05, {func = AnimSay, args = {hero.gear, loc("I guess I can't go far without fuels!"), SAY_THINK, 6000}})
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   377
	table.insert(dialog05, {func = AnimSay, args = {hero.gear, loc("Go to go back"), SAY_THINK, 2000}})
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   378
	table.insert(dialog05, {func = EndGame, args = {hero.gear}})
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   379
	-- DIALOG 06 - Landing on wrong planet or on earth if not enough fuels
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   380
	AddSkipFunction(dialog06, Skipanim, {dialog06})
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   381
	table.insert(dialog06, {func = AnimCaption, args = {hero.gear, loc("You have to try again!"),  5000}})
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   382
	table.insert(dialog06, {func = AnimSay, args = {hero.gear, loc("Hm... Now I run out of fuels..."), SAY_THINK, 3000}})
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   383
	table.insert(dialog06, {func = EndGame, args = {hero.gear}})
9258
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   384
end
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   385
9266
199c1f066aad added landing event handlers for cosmos.lua
Periklis Ntanasis <pntanasis@gmail.com>
parents: 9258
diff changeset
   386
------------------- custom "animation" functions --------------------------
9258
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   387
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   388
function startCombat()
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   389
	-- use this so guard2 will gain control
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   390
	AnimSwitchHog(hero.gear)
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   391
	TurnTimeLeft = 0
5c760ed50b3d first commit, added cosmos(menu) map and lua script with some functionality
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff changeset
   392
end