This file describes location event triggers: they will execute some code
when the player is at a certain location.
Each trigger has the following field:
	- Name :  is a unique name for the trigger. For non silent triggers such 
	as teleporters, this is this name that will be displayed on screen.
	- Silent : (1 by default) is a flag that tells the game not to display the
	trigger on screen when the player puts the mouse cursor over it
	- Trigger at label : indicates what map label the event trigger is located at
	- <Luacode> : contains the lua code to execute

There are different kind of triggers:

Map labels: gets triggered when tux walks over it, needs
	Trigger at label="foo"

	Optional:
	Teleported=1 makes the label work only if the player is teleported on it.
	Teleported=0 will only only trigger the label if player walks over it
	Silent=1 will hide the label that will show when you hover the map label ingame.


Enemy death events: is triggered when a marked character dies, needs
	Trigger on enemy death
	Enemy level=24
	Enemy dialog name="DeadGuy"

Level triggers: are executed when tux enters/exits, changes to  a level, needs
	Trigger changing level
	Exiting level=0

	Note: you can combine Exiting and Entering level to only have a the event trigger
	when tux moves from defined level A to defined level B, e.g.:
	Exiting level=24
	Entering level=70

Obstacle triggers: is executed when tux performs an actions with an obstacle
(opens a chest, beats a barrel, etc), needs:
	Trigger on obstacle
	Obstacle label="tamara-book-1"

..........................................
. For more parameters, check src/event.c .
..........................................



*** START OF EVENT ACTION AND EVENT TRIGGER FILE *** 

** Start of Mission Event Section **

##############
## Level 0 ##
##############

##############
## Level 01 ##
##############

* New event trigger *
Name=_"Skyscrapper Arena"
Trigger at label="1to25"
Silent=0
<LuaCode> teleport("25from1") </LuaCode>
* End of trigger *

* New event trigger *
Name="76 Rock Slide 1"
Silent=0
<LuaCode>
	play_sound("effects/Blast_Sound_0.ogg")
	add_obstacle(1, 89.5, 71.5, 37)
	dispatch_event("76 Rock Slide 2", 0.1)
</LuaCode>
* End of trigger *

* New event trigger *
Name="76 Rock Slide 2"
Silent=0
<LuaCode>
	add_obstacle(1, 89.5, 72.5, 37)
	dispatch_event("76 Rock Slide 3", 0.1)
</LuaCode>
* End of trigger *

* New event trigger *
Name="76 Rock Slide 3"
Silent=0
<LuaCode>
	add_obstacle(1, 89.5, 73.5, 37)
	dispatch_event("76 Rock Slide 4", 0.1)
</LuaCode>
* End of trigger *

* New event trigger *
Name="76 Rock Slide 4"
Silent=0
<LuaCode>
	add_obstacle(1, 89.5, 74.5, 37)
	dispatch_event("76 Rock Slide 5", 0.1)
</LuaCode>
* End of trigger *

* New event trigger *
Name="76 Rock Slide 5"
Silent=0
<LuaCode>
    teleport("76-SafeSpot") -- Double safe
	display_big_message(_"You are unable to return. The only way is forward.")
	display_big_message(_"RUMBLE! A earthquake happened!")
</LuaCode>
* End of trigger *


* New event trigger *
Name="Act2RockSlide01"
Trigger at label="Act2RockSlide01"
Silent=1
<LuaCode>
if (not act2_begin) then
	act2_begin = true
	dispatch_event("76 Rock Slide 1", 0.05)
end
</LuaCode>
* End of trigger *

* New event trigger *
Name="Act2RockSlide02"
Trigger at label="Act2RockSlide02"
Silent=1
<LuaCode>
if (not act2_begin) then
	act2_begin = true
	dispatch_event("76 Rock Slide 1", 0.05)
end
</LuaCode>
* End of trigger *

* New event trigger *
Name="Act2RockSlide03"
Trigger at label="Act2RockSlide03"
Silent=1
<LuaCode>
if (not act2_begin) then
	act2_begin = true
	dispatch_event("76 Rock Slide 1", 0.05)
end
</LuaCode>
* End of trigger *

* New event trigger *
Name="Act2RockSlide04"
Trigger at label="Act2RockSlide04"
Silent=1
<LuaCode>
if (not act2_begin) then
	act2_begin = true
	dispatch_event("76 Rock Slide 1", 0.05)
end
</LuaCode>
* End of trigger *

##############
## Level 02 ##
##############

* New event trigger *
Name="Act2Transition"
Trigger at label="NewTuxStartGameSquare"
Silent=1
<LuaCode>
if (not act2_introbegin) then
	play_sound("effects/Blast_Sound_0.ogg")
	display_big_message(_"Your head spins. What happened?!")
	display_big_message(_"BOOM BOOOOOOM BOOOM")
    start_chat("Prologue")
	act2_introbegin = true
end
</LuaCode>
* End of trigger *

##############
## Level 03 ##
##############

* New event trigger *
Name=_"To Underground F1"
Trigger at label="RRFSecretArea"
Silent=0
<LuaCode>
	if (cmp_obstacle_state("RRF1AccessTrapdoor", "opened")) then
		display_big_message("STOP CHEATING!!") -- Shouldn't happen.
		kill_tux()
	end
</LuaCode>
* End of trigger *

* New event trigger *
Name=_"To Underground F2"
Trigger at label="78to79"
Silent=0
<LuaCode>
	if (cmp_obstacle_state("RRF2AccessTrapdoor", "opened")) then
		teleport("4fromX0")
	end
</LuaCode>
* End of trigger *

##############
## Level 04 ##
##############

* New event trigger *
Name=_"To Ground Level"
Trigger at label="4toX0"
Silent=0
<LuaCode>
		teleport("78from79")
</LuaCode>
* End of trigger *

* New event trigger *
Name=_"To Underground F3"
Trigger at label="4toX1"
Silent=0
<LuaCode>
		teleport("5fromX0")
</LuaCode>
* End of trigger *

##############
## Level 05 ##
##############

* New event trigger *
Name=_"To Underground F2"
Trigger at label="5toX0"
Silent=0
<LuaCode>
		teleport("4fromX1")
</LuaCode>
* End of trigger *

* New event trigger *
Name=_"To Underground F4"
Trigger at label="5toX1"
Silent=0
<LuaCode>
		teleport("6fromX0")
</LuaCode>
* End of trigger *

* New event trigger *
Name=_"To Factory via Shortcut"
Trigger at label="RRF3toRRF9"
Silent=0
<LuaCode>
		teleport("RRF9fromRRF3")
</LuaCode>
* End of trigger *

##############
## Level 06 ##
##############

* New event trigger *
Name=_"To Underground F3"
Trigger at label="6toX0"
Silent=0
<LuaCode>
		teleport("5fromX1")
</LuaCode>
* End of trigger *

* New event trigger *
Name=_"To Underground F5"
Trigger at label="6toX1"
Silent=0
<LuaCode>
		teleport("7fromX0")
</LuaCode>
* End of trigger *

##############
## Level 07 ##
##############

* New event trigger *
Name=_"To Underground F4"
Trigger at label="7toX0"
Silent=0
<LuaCode>
		teleport("6fromX1")
</LuaCode>
* End of trigger *

* New event trigger *
Name=_"To Underground F6"
Trigger at label="7toX1"
Silent=0
<LuaCode>
		teleport("8fromX0")
</LuaCode>
* End of trigger *

##############
## Level 08 ##
##############

* New event trigger *
Name=_"To Underground F5"
Trigger at label="8toX0"
Silent=0
<LuaCode>
		teleport("7fromX1")
</LuaCode>
* End of trigger *

* New event trigger *
Name=_"To Underground F7"
Trigger at label="8toX1"
Silent=0
<LuaCode>
		teleport("9fromX0")
</LuaCode>
* End of trigger *

##############
## Level 09 ##
##############

* New event trigger *
Name=_"To Underground F6"
Trigger at label="9toX0"
Silent=0
<LuaCode>
		teleport("8fromX1")
</LuaCode>
* End of trigger *

* New event trigger *
Name=_"To Underground F8"
Trigger at label="9toX1"
Silent=0
<LuaCode>
		teleport("10fromX0")
</LuaCode>
* End of trigger *

##############
## Level 10 ##
##############

* New event trigger *
Name=_"To Underground F7"
Trigger at label="10toX0"
Silent=0
<LuaCode>
		teleport("9fromX1")
</LuaCode>
* End of trigger *

* New event trigger *
Name=_"To Underground F9"
Trigger at label="10toX1"
Silent=0
<LuaCode>
		teleport("11fromX0")
</LuaCode>
* End of trigger *

##############
## Level 11 ##
##############

* New event trigger *
Name=_"To Underground F8"
Trigger at label="11toX0"
Silent=0
<LuaCode>
		teleport("10fromX1")
</LuaCode>
* End of trigger *

* New event trigger *
Name=_"To Underground F3"
Trigger at label="RRF9toRRF3"
Silent=0
<LuaCode>
		teleport("RRF3fromRRF9")
</LuaCode>
* End of trigger *

##############
## Level ?? ##
##############

* New event trigger *
Name=_"To Mainland via underground"
Trigger at label="96to98"
Silent=0
<LuaCode>
		teleport("98from96")
</LuaCode>
* End of trigger *

##############
## Level ?? ##
##############

* New event trigger *
Name=_"To Icy Summer Island"
Trigger at label="98to96"
Silent=0
<LuaCode>
		teleport("96from98")
</LuaCode>
* End of trigger *

##############
## Level 25 ##
##############
* New event trigger *
Name=_"Exit Arena"
Trigger at label="25to1"
Silent=0
<LuaCode> teleport("1from25") </LuaCode>
* End of trigger *

* New event trigger *
Name=_"Start New Wave"
Trigger at label="ArenaStartWaveSquare"
Silent=0
<LuaCode>
	if (arena_next_wave == nil) then
		return -- No next wave need to be teleported, stop now.
	end

	local waves
	if (arena_current_level == "expert") then
		-- Waves for expert event
		waves = {
			{420, 476, 476, 420, 420, 476, 476, 420, nil},
			{571, 516, 476, 476, 571, 516, 476, 476, nil},
			{603, nil, nil, 711, 603, nil, nil, 711, 999}
		}
	elseif (arena_current_level == "master") then
		-- Waves for master event
		waves = {
			{493, 493, 476, 476, 493, 493, 476, 476, nil},
			{598, 476, 476, 629, 598, 476, 476, 629, nil},
			{nil, 821, 615, 598, nil, 821, 615, 598, nil},
			{883, 742, 598, 249, 249, 742, 598, 883, nil},
			{751, 249, nil, 999, 751, 249, nil, 999, 999}
		}
	elseif (arena_current_level == "supreme") then
		-- Waves for supreme event
		waves = {
			{821, 821, 751, 711, 821, 821, 711, 751, nil},
			{571, 883, 834, 249, 571, 883, 834, 249, 999},
			{751, 598, 999, 249, 751, 598, 999, 249, nil},
			{999, 883, 615, 834, 999, 883, 615, 834, nil},
			{999, 249, 999, 476, 999, 249, 999, 476, 883},
			{999, 999, 999, 999, 999, 999, 999, 999, "GUN"}
		}
	end

	local bots = waves[arena_next_wave]
	arena_final_wave = arena_next_wave >= #waves
	arena_current_wave = arena_next_wave
	arena_next_wave = nil
	arena_left = false

	-- Close door before the first wave.
	if (arena_current_wave == 1) then
		change_obstacle_state("Arena-RingEntrance", "closed")
	end

	-- Initialize counter of bot.
	arena_remaining_bots = 0

	-- Teleport the bots into battlefield.
	for num,bot in pairs(bots) do
		create_droid("Arena-Teleport"..num, bot)
		arena_remaining_bots = arena_remaining_bots + 1
	end

	-- Display the number of the wave.
	if (not arena_final_wave) then
		display_big_message(_"Wave "..arena_current_wave)
	else
		display_big_message(_"Final Wave - Take care!")
	end
</LuaCode>
* End of trigger *

* New event trigger *
Name="Arena Bot Killed"
Trigger on enemy death
Enemy level=25
Enemy faction="ms"
<LuaCode>
	if (arena_remaining_bots == nil) then
		return -- The counter of bot is disabled, stop now.
	else
		-- For each death, decrement the number of remaining bots.
		arena_remaining_bots = arena_remaining_bots - 1
	end

	if (arena_remaining_bots <= 0) then
		arena_remaining_bots = nil -- Delete the counter of bot

		-- If Tux haven't reached the final wave, ...
		if (not arena_final_wave) then
			arena_next_wave = arena_current_wave + 1
			display_big_message(_"All bots are killed! Go to center for next wave.")
		else
			arena_won = true
			display_big_message(_"All bots are killed! You won.")

			-- Open the door
			change_obstacle_state("Arena-RingEntrance", "opened")
		end
	end
</LuaCode>
* End of trigger *

* New event trigger *
Name="Arena Bot Hacked"
Trigger on enemy hack
Enemy level=25
Enemy faction="ms"
<LuaCode>
	if (arena_remaining_bots == nil) then
		return -- The counter of bot is disabled, stop now.
	else
		-- For each death, decrement the number of remaining bots.
		arena_remaining_bots = arena_remaining_bots - 1
	end

	if (arena_remaining_bots <= 0) then
		arena_remaining_bots = nil -- Delete the counter of bot

		-- If Tux haven't reached the final wave, ...
		if (not arena_final_wave) then
			arena_next_wave = arena_current_wave + 1
			display_big_message(_"All bots are killed! Go to center for next wave.")
		else
			arena_won = true
			display_big_message(_"All bots are killed! You won.")

			-- Open the doors
			change_obstacle_state("Arena-RingEntrance", "opened")
		end
	end
</LuaCode>
* End of trigger *


##############
##  Events  ##
##############

* New event trigger *
Name="75 Guard Turn Hostile"
Silent=0
<LuaCode>
	teleport_npc("75-KillTuxPos02", "ProgrammingChief")
	set_bot_destination("75-KillTuxPos02", "ProgrammingChief")
	dispatch_event("75 Colemak To Rescue", 1)
</LuaCode>
* End of trigger *

* New event trigger *
Name="75 Colemak To Rescue"
Silent=0
<LuaCode>
	-- Colemak awakes in state of confusion. After a while he decides talking to you is more important.
	create_droid("75-ColemakSpawn", "ARH", "self", "Colemak", "radar")
	set_bot_destination("75-ColemakSpawn", "Colemak")
	dispatch_event("75 Colemak To Rescue 2", 0.6)
</LuaCode>
* End of trigger *

* New event trigger *
Name="75 Colemak To Rescue 2"
Silent=0
<LuaCode>
	--drop_dead("ProgrammingChief") -- We can't use drop_dead here (TODO)
	--drop_dead("SecurityChief") -- We can't use drop_dead here (TODO) - also would do with a 0.2 pause between deathes
	set_bot_name(_"Colemak", "Colemak")
	set_rush_tux(1, "Colemak") -- 1: true
</LuaCode>
* End of trigger *



** End of Mission Event Section **
*** End of Mission File ***
(leave the above termination text in the file or we might get a segfault/corrupt file termination)
*** END OF EVENT ACTION AND EVENT TRIGGER FILE *** LEAVE THIS TERMINATOR IN HERE ***
