; Made by Silver for RoT
;
; I'm reserving scenes 5000 to 5199 for this file. 
; The idea is to create everything related for the Gunslinger class in this file. 
;

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; PLAYER SPOILER WARNING
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; There is nothing wrong with reading through the quest files in this system, 
; but for the best play-through experience, just create your first gunslinger without
; reading anything in this file. Trust me, you'll enjoy the class better when 
; everything comes as a surprise. You'll likely want to make a second character 
; anyway since you can't explore everything the first time. 
;
; Nothing beats a first time play experience and I'll do my best to make sure you 
; won't miss out on any quests. Having that said, enjoy! :-)
;
; Note for world developers: you might be particularly interested in scene 5100 and
; 5101 since those involve the set up of the terminal and circuit board.
; 
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
;
;
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; TODO
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; 
; From scene 1189 (RoT's protector):
; 	1: There were a few rumours that he was still alive and that he found one of the secret laboratories that weren't destroyed.
;	1: The rumours go that he found a stealth suit in there making him invisible for Silver.
;
; 
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; Access levels
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; x Clouds (purple) = level 1 access
; x Electricity (medium green) = level 2 access
; x Unnamed terrain (gray) = level 3 access
; x add belt items that can handle these different terrains
; 
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; MAPS
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
;   35, "stasisbunker.jpg", "stasisbunker", "Bunker 3", 0
;   37, "researchlab.jpg","researchlab", "Abandoned Research Lab", 0
;   38, "militaryfacility.jpg", "militaryresearchfacility", "Military Research Facility", 0
; 	39, "militaryfacility2.jpg", "militaryfacilitybunker", "Military Research Bunker", 0
; 	40, "bunker9.jpg", "bunker9", "Bunker 9", 0
; 
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; TIMELINE
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; Year	Description
;
;  875	Estimated year Samuel Raven was born
;  883	Estimated year Devil was born
;  884	Estimated year Atsumori was born
;  884	Zander Pearson was born
;  896	Carlos was born
;  901	Yuku was born
;  917	Devil stole Samuel Raven's research and delivered it to Doctor Melchior
;  917	Gunslinger hunted Devil down
;  917	Doctor Melchior discovered the Devil particle
;  918	Doctor Melchior started his research on nightmares
;  918	Gunslinger went into stasis 
;  919	Devil achieved immortality
;  920	Samuel Raven discovered the God particle
;  920	Atsumori and Samuel Raven achieved immortality
;  920	The creation of the first nightmare was a success
;  924	The nightmares escaped from the research lab, killing Doctor Kristinson at age 34
;  926	The last nightmares were thought to be exterminated
;  926	Daemonium awoke Devil
;  927	The nuclear bomb exploded, the first RoT war followed
;  927	Silver started hunting Daemonium
;  927	Yuku and Carlos entered stasis
;  927	The first nightmares appeared in the military research bunker
;  928	Zander Pearson was killed at the age of 44
;  939	Daemonium betrayed the nightmares and broke the truce
;  948	Doctor Melchior died
;  955	Silver dismantled Daemonium's mutant army. 
;  983	Atsumori cleared the brewing trouble in Bunker 9.
; 1023	Mainframe burned out, all Gunslinger details were lost to history
; 1043	Silver stopped hunting Daemonium after 116 years (160 years ago)
; 1203	The Gunslinger awakens
; 1203	The second (current) RoT war takes place
; 
;
; 
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; QUESTS
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; CLINIC:
; x Get medical supplies from a storage room (this is closed off until the power is restored) (local quest)
; x Get medical supplies from RoT (world quest)
; x Introduction to health (and mana) restoring batteries and resurrection modules (local quest)
; x Uncovering advanced technology to health/mana/life restoring technology
; x Investigate why the stasis pods failed (deal with a sort of zombies) (local quest, level 20+)
; 
; TELEPORT TECHNOLOGY:
; x Introduction to teleport technology (explain one-time usage and nuclear power cell for infinite/ mythical teleports) (local quest)
; x Receiving the location of the Ancient Bunker from Paul van Doorn once the hero visited the bunker from Kagoshima (world quest)
; x Gathering materials to receive a mythical teleport for free (world quest)
; x add teleport to ancient bunker in teleport script
;
; THE SHOP:
; x Introduction to weapons and how to improve weapons (give a first basic weapon)
; x Gathering materials to improve weapons (world map)
; x Improve weapons (local quest, level 20+)
; 
; COMMAND CENTER:
; - Protect the base from invaders/ pillagers/ looters (heavy fighting) (level 99+ quest)
; x Choose between the Empire and Rebel army, make contact with one of these sides on behalf of the Base Commander
; 	x Follow up quests (This will no longer be included)
; x Choose between Atsu and Devil (after RoT war)
; - Lead a decisive battle against the side not choosen
; - Hack the mainframe to uncover hidden access to other parts of the base (local quest)
; x Activate the hidden parts of the base by upgrading the power core to its full potential (world quest, requires visiting other bunkers)
; 
; POWER CORE:
; x Restore power to the base, temporary fix (local quest)
; x Restore power to the base, more permanent fix (world quest) (scene 5006 @repairedPowerCore it's mentioned that a more permanent fix is required, including a new circuit board and its reprogramming).
; x Empower the base to open up all functions (world quest, requires visiting other bunkers and piecing a code together)
; x Clean up the flooded floors by fixing a pump (local quest)
; 
; MESS HALL:
; x stock the mess hall with new food & drinks (world quest)
; x preparing food will give a +5 seed item for stamina and other stats (world quest, limited before level 99, unlimited at level 99+)
;  
; WORLD QUESTS:
; x Discover five lost bunkers
; 	x Each bunker contains unique materials, and a unique code
;	x Not all areas are immediately accessible in each bunker, forcing heroes to return at a later time to uncover all secrets
; 	x bunkers should have unique look & feel
; 	x bunkers should explain more about the old world
; x learn why the gunslingers put the nightmares in unknown hell and how this relates to atsu and devil 
;	x Atsu and Devil were originally gunslingers, but with very advanced gene therapy that made them practically immortal. They gave Dae and Silver the same sort of treatment. RoT's protector was the chief scientist who oversaw this process. He stopped applying it after gaining immortality himself and vowed to never interfere again. However, Devil stole the research. (Reskin RoT's protector to wear a white lab coat.)
;	x fight a nightmare as part of this quest
; x scene 3 (kempto), give gunslingers a quest or hint for the mythical teleport (QS0020.txt).
; x the nightmares abducted people from the broken stasis pods in bunker 3 - to become like them - 
;
; - How did magic come into the world? How does it related to the exploded nuke? It would be good to make this one of the bunker quests.
;
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; SCENES
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; TIER 1 - WAKING UP IN BUNKER 3
; 5001 - Awakening - Introduction to RoT and Gunslinger class
; 5002 - Clinic - Meet Doctor Adlington, healing scene, and medical supply quests
; 5003 - Entrance to Ancient Bunker, allows the player to leave to Kagoshima
; 5004 - Entrance to Ancient Bunker, this scene is on Kagoshima world map
; 5005 - Command Center
; 5006 - Power Core, the power in the base is down and needs to be restored, it'll be a temporary fix until a more permanent fix is in place.
; 5007 - Broken Pods, several pods had power failures, resulting in the deaths of citizens
; 5008 - Mess hall 
; 5009 - Passage, the floors are flooded and combined with electricity this makes for a dangerous passage through these halls 
; 5010 - The Shop, introduction to weapon fixing, creating and reparing weapons will happen here.
; 5011 - Clinic supplies, part of the clinic quest
; 5012 - Teleporter - teleporter quest 
; 5013 - Power core omputer 
; 5014 - Terminal (CUT scene)
; 5015 - nuke
; 5016 - Power Core switch board
; 5017 - Call script: summon Doc Adlington
; 5018 - Gun range (CUT scene)
; 5019 - PP coin exchange
; 5020 - Server room
; 5021 - Switch board (CUT scene for 5020)
; 5022 - Drone shooting for Nishka/ Caeran (CUT scene for 5012)
; 5023 - Hardcore challenge 3 enter scene (5353 is the actual challenge)
; 5024 - Entrance to the Nightmare cave
; 5025 - Hidden service hatch
; 
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; TIER 2 - ABANDONED RESEARCH LAB (level 20 - 30)
; 5031 - Entrance on Kagoshima to Abandoned Research Lab
; 5032 - Entrance to research lab
; 5033 - Power core - restore power to the base
; QUEST 1 - gaining data on auto resurrect
; 5034 - Clinic - abandoned, but with interesting items to discover (bunkermedclinic2)
; 5035 - Research terminal - give the ability to download research material on a disk (deusex02)
; 5036 - supply room that has an external drive, but you need to repair it in order to use it (bunkerstorage)
; 5037 - workshop to repair broken external drive (need 2 new items, broken external drive (2167) and external drive (2168)) (bunkermesshall)
; 5038 - supply room 2, contains other supplies that you need to create the auto resurrect item. (bunkerstorage03)
; QUEST 2
; 5039 - access a terminal to create a level 2 access pass (2161) (deusex04)
; 5040 - check the terminal in the security office to view CUT scenes with security footage (deusex03)
; 5041 - security footage
; 5042 - security footage
; 5043 - security footage
; QUEST 3 
; 5044 - destroy the growing vats or leave the growing vats alone (bunkergrowthvats) 
; 5045 - destroy the young nightmare queen or offer her mercy (find a new gun as a quest reward (2504)) (bunkerredalert)
; OTHER
; 5046 (bedroom 1) - 5053 (bedroom 8) - Check the different personnel rooms (different tokens for each room, 8 rooms in total)
; left = 1, 2, 5, 6 right = 3, 4, 7, 8 (remove the 8 tokens when all rooms are done and replace it with a single token)
; 5054 - check the base commander room (bunkerbedcommander)
; 5055 - teleporter, introduction to teleporter network (bunker02)
; 5056 - portal point, you can teleport to here and back from there to the teleporter (bunkercenter)
; 5057 - dream in commander's quarters
; 5058 - cut scene fuse board power core repair
; 5059 - locked room in clinic abandoned research lab
; 5060 - terminal scene create access card (scene 5039)
; 5061 - terminal scene medical terminal (scene 5035)
; 5062 - random nightmare fight scene
; 5063 - random nightmare fight scene
; 5064 - special loot scene (requires access level 3)
; 5065 - command (requires access level 3)
; 5066 - first hardcore challenge set up 
;
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; TIER 3 - MILITARY RESEARCH FACILITY (level 40 - 50) (5200 - 5223)
; 
; 5200 - teleport scene from green arakaki to military research facility
; 5201 - teleport scene from military research facility to arakaki
;
; QUEST 1 - improve the CPR unit & download schematics for stamina gene enhancement
; 5202 - Clinic
; 5203 - Clinic supply room
; 5204 - Clinic terminal
; QUEST 2 - mix liquors into a new recipe (have several outcomes, bring the final recipe to Chris)
; 5205 - Mess hall (Maybe a secret recipe for Chris?)
; QUEST 3 - restore base power
; 5206 - power plant (requires a new circuit board from the supply room)
; 5207 - terminal - (maybe to reset the base defenses?)
; 5208 - actual terminal scene
; 5209 - cut scene fuse board power core repair
; 'QUEST' 4 - find random stuff
; 5210 - bed room #1 
; 5211 - bed room #2
; 5212 - bed room #3
; QUEST 5 - Save one of two pod inhabitants
; 5213 - stasis pods (functional)
; 5214 - broken stasis pods #1
; 5215 - broken stasis pods #2
; 5216 - teleporter
; 5217 - Command center
; 5218 - Elevator that goes down to scene 5230 (map 38, link 0)
; 5219 - Portal point
; QUEST 6 - reset the teleporter and defeat the end boss 
; 5220 - End boss
; 5221 - storage room #1
; 5222 - storage room #2
; 5223 - fight scene MRF (scene 2)
;  
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; TIER 4 - MILITARY RESEARCH BUNKER (level 60 - 70) (5230 - 5259)
; 
; 5230 - elevator that goes up to to scene 5218
; 5231 - terminal scene set up that holds links to 5232 - 5237 (deusex02)
;        this includes a login terminal, a circuit board to click on, and a terminal computer that shows the cut scenes
; 5232 - circuit board scene to hack the circuit board for the terminal (normal mode)
; 5233 - FLASHBACK CUT scene 4 will show Silver dismantling Daemonium's research project.
; 5234 - terminal scene that holds dae's diary's
; 5235 - FLASHBACK CUT scene 1 will show how the nightmares accept him as a reject since he's also fighting the gunslingers
; 5236 - FLASHBACK CUT scene 2 will show dae plotting against the nightmares and continuing research started by Doctor Melchior
; 5237 - FLASHBACK CUT scene 3 will show 1 mutant attacking the nightmares to exterminate them and betray them, it'll also show that the nightmares are bad guys too (nightmares HATE gunslingers)
; 5238 - Final fight (Final fight, bunker01)
; 5239 - mutant growth vats (Growth vats, bunkergrowthvats)
; 5240 - commander's bed room (rest & recovery point) (Commander's Bedroom, bunkerbedcommander)		
; 5241 - Portal point end boss (Portal point, bunker02)
; 5242 - Nightmare infestation (Nightmare infestation, bunkerhallway)
; 5243 - Storage room 1
; 5244 - Storage room 2
; 5245 - Trashed bedroom
; 5246 - Mess hall
; 
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; TIER 5 - BUNKER 9 (level 80 - 90) - (5260 - 5299)
;
; 5260 - kill improved drones from Nishka and Caeran (cut scene in bunker 3)
; 5261 - Center teleporter (power on/off)
; 5262 - Power core (power on/off)
; 5263 - Switch board scene (4 scenes moved into 1)
; 5264 - Terminal (power on/off)
; 5265 - Terminal CUT scene 
; 5266 - Storage room
; 5267 - Clinic (power on/off)
; 5268 - Terminal CUT scene
; 5269 - Hatchery - Nightmare hatchling catching CUT scene
; 5270 - Clinic storage room (links from 5267)
; 5271 - Bedroom (safe)
; 5272 - Bedroom (with monsters)
; 5273 - Stasis pods 
; 5274 - Mess hall (bunkermesshall)
; 5275 - Greenery (bunkergreenery)
; 5276 - Blocked area (bunkerstorage02)
; 5277 - Final encounter (bunkertoilets)
; 5278 - Final encounter - fight scene
; 5279 - Teleporter east
;
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; TIER 6 BUNKER 3 Basement + Bunker 9 east side + unknown hell (level 99+) - not yet implemented
; 
; 
; 
; Why is part of the base blocked off? Do humans still live there?
; What is their story?
; Reroute the teleporter to Bunker 9 to that teleporter at level 99 with a token 
;    and with the option to teleport to the west side of the bunker, the teleporter 
;    there can never teleport to anywhere else though.
; 
; 
; summon John Wick is a quest reward for this tier.
; 
; - How did magic come into the world? How does it related to the exploded nuke? It would be good to make this one of the bunker quests.
;
; - create the nightmare challenge, based on previous interactions with nightmares
; - players will either get summon john wick or summon nightmare
; 
; - Travel to unknown hell (3rd version of the map) to put the nightmares back in their void after clearing the nightmare cave below bunker 3.
; - Alternatively, help the nightmares escape to another dimension that is friendlier to them.
; - This latter will be possible due to having helped nightmares before, the summon john wick/ nightmare spell will depend on previous storyline conclusions and the final conclusion.
; 
;
; Remodel unknown hell to show dead souls in an isolated area with a link (dead link)
; These represent people who were banned
; increase the map size of UH and have part of the story play here
; add a special return scene since teleporter won't work here
; 
;
; Meet Charley Kissinger in this bunker, he'll die a heroic death here. (Only if the hero saw him waking up though.)
; 
; VERY IMPORTANT, ENABLE TELEPORTING OUT AT THE TELEPORTER!!
; The teleporter must be able to call scene 1205
; 
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; GENERAL
; 5095 - end of the RoT war conclusion for gunslingers
; 5096 - Set up scene 'shoot the drones!'
; 5097 - Set up scene military research facility
; 5098 - Set up scene abandoned research lab
; 5099 - General set scene up minigames
; 5100 - Set up scene for the circuit board repairing
; 5101 - Set up scene for terminal hacking
; 5102 - Set up scene for fuse repairing
; 5110 - First circuit board mini game (bunker 3)
; 5111 - cut scene circuit board power core repair (abandoned research lab)
; 5112 - circuit board power plant (military research facility)
; 5113 - circuit board upgrade (bunker 3)
; 5114 - circuit board repair (bunker 9)
; 
;
; HARDCORE CHALLENGES
; 5350 - hardcore challenge set up
; 5351 - first hardcore challenge, defeat 4 Nightmares
; 5352 - second hardcore challenge, hack a keypad
; 5353 - third hardcore challenge, fix a circuit board
; 5354 - fourth hardcore challenge, shoot the drones down
;
; GUNSLINGER PROMOTION VIDEO
; 5355 - CUT scene with the gunslinger promotion footage
; 5356 - circuit board
; 5357 - shoot 3 drones
; 5358 - hack a terminal with a virus upload
; 5359 - announce the skinning contest
;
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; TOKENS
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; Tokens are removed from this file, tokens.txt features the most up to date tokens.
;
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; OTHER 
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; x Implement random chance for a gunslinger to say something before fight scene. (Cheesy quotes, 5% chance)
; delete notes below before publishing version:
; expert gunslinger requirements, T857, also hidden high score in military research facility that's challenging to get.	
; 
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; NEW MIDIS
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; get more western midis, for example the good, the bad, and the ugly
;
; bewitched
; angel
; star-trek-voyager
; dirty-dancing-time-of-my-life
; james-bond
; titanic-my-heart-will-go-on
; everything-is-awesome
; coolio-gangstas-paradise
; queen-Bohemian-Rhapsody
; mgs-encounter
; bio-victory
; goldensun-victory-fanfare
; mgs2-maintheme
; mgs-callingtothenight
; apocalyptica-farewell
; apocalyptica-quutamo
; apocalyptica-faraway
; apocalyptica-betrayal
; apocalyptica-Hope
; apocalyptica-Path (great battle music)
; apocalyptica-Heat
; apocalyptica-LifeBurns
; apocalyptica-Harmageddon
; apocalyptica-Romance
; dragonborn-theme
; sons-of-skyrim 
; skyrim-secunda (good for exploring a bunker)
; born-to-be-wild
; western
; country-Love1
; country-Love2
; aliceCooper_Poison
; daddy-sang-bass		(Johnny Cash)
; I-walk-the-line		(Johnny Cash)
; ring-of-fire			(Johnny Cash)
; sunday-morning-coming-down 		(Johnny Cash)
; silent-night			
; brahms-lullaby
; alabama-born-country
; bomfunk-freestyler
; Norther-A-Fallen-Star   (very quick beat, perfect for a shooting scene)
; MelC-northern-star
; MelC-I-turn-to-you
; MelC-never-be-the-same-again
; a-foggy-day (slow relaxing jazz whiskey song)
; be-happy (jazz whiskey song)
; as-time-goes-by (jazz whiskey song)
; sweet-whiskey-lies (whiskey song, not jazz)
; whiskey-in-the-jar
; Phoenix_Wright_-_Godot
; 
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; MINI GAMES
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; x Fix circuit boards to repair equipment/ hack computers/ bypass security
; x Hack computers
; x Fix fuses (very simple mini game)
; x Shoot targets at the gun range
;
;
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; IMPORTANT FOR IMPLEMENTING FIGHTS
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
;	Before FIGHT (direct quote call):
;	CALL 5199@continueBeforeGunslingerFight
; 
;	After FIGHT:
;	CALL 984@rewardMissionPP	
;	CALL 5198@gunslingerCPRAndAfterFightQuotes
;
;	To call after fight quote directly:
;	CALL 5199@continueAfterGunslingerFight
;
; 	To call CPR directly:
;	CALL 5198@checkCPR
;
;	For drink quotes:
;@eventHostGive
;	CALL 5199@continueGunslingerDrink
;	END	
;
; MOVE 8, 80, 95
; 
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; SCENES
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  


SCENE 5001, bunkerstasispods,SCENE,"Awakening",0,0,0

	MUSIC	xfilestrancemix

	ACTOR 1,	"Paul van Doorn", monster032, 4, 30, 80
	
	CALL 5097@addGunslinger
	MOVE 8, 60, 95
	
	IF T798, @continue ;add future quest tokens here
	HOST_GIVE T652
	HOST_GIVE T475
	SET proxbetaActorMX, "50"
	SET proxbetaActor, "normalcharrightvraagteken"
	SET blade, "0"
	SET fan00x,"-950"
	
	CALL 984@setUpBagSlots
	
	1: Good, you're awake.
	1: For a moment I thought you wouldn't make it.
	H: Where am I? What is going on here?
	1: Mm... You may have suffered some brain damage, although it is most likely temporary amnesia.
	1: Let me fill you in on the details, and then we will take it from there.
	
	SET temp, "285"

	1: You've been asleep for #<temp> years, #<num.serverTimeMonth> months, and #<num.serverTimeDay> days.
	1: You're in #<str.mapName>. There are other bunkers out there, but I don't know what their status is. 
	1: We lost contact with them long ago. 
	1: While you were asleep, the world has drastically changed.
	
	SUB temp, "9"
	
	H: What happened?
	1: War, a terrible war broke out #<temp> years ago, which led to an apocalypse. 
	1: It led to the destruction of our cities, our people, even our technology.
	1: Very little remains these days of what once used to be.
	1: In fact, that is one of the things I want you to investigate.
	
	H: Is it really that bad?
	1: Oh yes, you have no idea.
	1: After the apocalypse and the loss of most of our technology, the world returned to a medieval state.
	1: It's all swords, clubs, and bows these days. Even slavery is common practice again.
	1: How is your gun arm?
	
	WAIT 1.0
	N: You flex your arm and notice your reflexes are still up to par.
	WAIT 1.0
	
	H: I'd say pretty good.
	1: Excellent, unfortunately, I can't give you a gun.
	1: We need all the weapons we have to defend this base, nor can I spare you any ammo.
	1: However, you'll be able to delve into old bases and see if you can regain lost technology.
	1: You'll likely also find useful items with which you can make new weapons and tech.
	1: I know that there are several bunkers out there with highly experimental technology.
	1: One of the applications was to give your heart an automatic shock, if it ever stopped for some reason.
	1: We were also developing powerful weapons, but I have no idea what became of those.
	
	H: Why did I sleep in the stasis pod in the first place?
	1: You don't remember? Oh boy, this may be worse than I thought...
	1: I'll be honest, I don't know specifically why you went into stasis.
	1: The government at the time deemed it necessary to save you and others, but for what purpose we don't know.
	1: Unfortunately, most of the others didn't make it, their stasis pods failed for various reasons.
	1: You're not alone, though, there are others like you out there.
	1: About 200 years ago, our mainframe crashed during a power outage.
	1: We lost the details of everybody in the stasis pods that day.
	1: This happened long before I was born though. I don't know anything more about that then what I just said.
	
	H: Is there anything else I need to know before I head out?
	1: Yes, the main faction is the Empire. Emperor Shinzobi leads it with an iron fist.
	1: However, there is a rebel group active under the leadership of Warlord Keithuso.
	1: I suggest you investigate the empire first. 
	1: Allying ourselves with one of these factions can greatly help our cause.
	
	H: I'll look into this. That's it then?
	1: Actually, one last thing, and this is pretty big.
	H: Bigger than the apocalypse?
	1: Yes, actually it is.
	1: Mankind has discovered a force they call magic. It allows them to cast complicated spells with effects.
	H: Magic? Like in the fantasy stories?
	1: Yes, magic. Although our affinity with this magic is minor, we do have some aptitude to cast spells as well.
	1: I would appreciate it if you could see what you can learn about this force.
	1: Any details you uncover could be of great aid to us.
	
	H: Very well. It seems like I have my work cut out for me.	
	1: Yes, you have indeed. You should talk to some other people.
	1: They can provide you with more information about what you face out there.
	1: We're running short on people in this base and your help would be appreciated.
	HOST_GIVE T798
	HOST_GIVE T1106	
	HOST_GIVE I771
	1: Visit the Teleporter when you're ready to leave.
	1: Nishka could use a hand with getting the teleporter up and running again.
	1: Once it works, she'll teleport you to Elliair.
	1: It's a city that facilitates training with the inhabitants of this world.
	1: I need you to live among them, get to know them and see what they're about.
	1: We need to know if we can trust them or not.
	1: Good luck, %1.
	WAIT 5.0
	GOTO EXIT	

@continue
	; Tokens here for story advancement.

; inform paul about ARL and show different outcomes for the growth vats/ queen
; investigate the broken stasis pods and discover nightmares being active there (this depends on what tokens the player gathered in ARL)	


	IF T925, @comeBackLater
	IF V60+T922+T923-T925, @reportToSamuelRaven
	IF T922+T923, @comeBackLater
	IF T922-T923, @foughtWithDaemonium
	IF T889, @investigateMRFFailed
	IF T887|T888, @investigateMRFFinished
	IF T882, @investigateMRFContinued
	IF T872+T873+V40, @investigateMRF	
	IF T872+T873-T875, @kagoshimaUpdate	
	IF T872+T873, @comeBackLater
	IF T871-T872, @nightmareAtBrokenPods
	IF V20+I2161, @investigatedARL
	IF T810-T830, @informPaulAboutNightmare
	
	IF T826, @noMoreWakingUp
	IF T825, @wakeUpMadisonHarper
	IF T824, @wakeUpCharleyKissinger
	IF T823, @wakeUpKimFreestone
	IF T822, @wakeUpRobinSalvatore

@wakeUpSamRammstein	
	ACTOR 2, "Sam Rammstein", gun006, 1, 58, 90
	FACE 2, 0
	POSE 1, 4
	
	1: In fact, that is one of the things I want you to investigate.	
	2: I see, it's that bad, huh?
	1: Oh yes, you have no idea.
	1: After the apocalypse and the loss of most of our technology, the world returned to a medieval state.
	1: It's all swords, clubs, and bows these days. Even slavery is common practice again.
	2: Interesting, then again, my father foresaw that happening.
	1: Right, I-, I'm afraid he passed away twenty-four years after you entered stasis.
	2: That was to be expected after sleeping for such a long time.
	1: How is your gun arm?

	WAIT 1.0
	N: Sam flexes their arm and notices that their reflexes are still up to par.
	WAIT 1.0
	
	2: It's still fine.
	1: Excellent, unfortunately, I can't give you a gun.
	1: We need all the weapons we have to defend this base, nor can I spare you any ammo.
	2: Really? I recall us having enough guns and ammo to start a world war and still have surplus.
	2: I did the inventory myself.
	1: Ah, eh, well, maybe you could have a gun, I guess.
	1: Oh, hi %1.
	1: Sam Rammstein just woke up from stasis as well. 
	FACE 2, 2
	2: It's a pleasure to meet you, %1.
	H: The pleasure is mine.
	H: How is your memory?
	2: A little fuzzy, as if I'm still half asleep, but I remember most things.
	1: Yes, well, anyway, what did you want to tell me %1?
	
	IF -T804, @notYetRepairedPowerCore
	H: The power is up and running again.
	
@notYetRepairedPowerCore
	H: I figured I'd check in with you.
	1: Ah okay, please come back later, I may have something else for you to do.
	2: /a streches their body.
	2: If that was all, I'll be on my way. 
	2: I better familiarize myself with this brave new world we find ourselves in.
	WAIT 2.0
	MOVE 2, 120, 95
	1: Wait, I still have more to tell you.
	2: Don't worry, I'll figure it out!
	2: I'm a %C63, remember? It's what we do.
	1: /a facepalms.
	HOST_GIVE T822
	1: Well, I suppose I'll start waking up somebody else.
	MOVE 1, -20, 95
	END
	
@wakeUpRobinSalvatore
	ACTOR 2, "Robin Salvatore", pet006, 1, 58, 90
	FACE 2, 0

	1: Any details you uncover could be of great aid to us.
	2: Alright, I'll get right on top of it. 
	2: I always had a knack for intelligence gathering.
	1: Yes, you did indeed. You should talk to some other people first before you leave.
	1: They can provide you with more information about what you face out there.
	1: Visit Nishka at the Teleporter when you're ready to leave.
	1: Ah, %1, I was just getting Robin up to speed.
	
	FACE 2, 2
	2: Welcome, %1, I understood you woke up a couple of hours before I did?
	H: Yeah, I've been running around to do some chores.
	2: I should probably do that too. 
	2: So, Nishka first, eh?
	1: Once the teleporter works, yes.
	IF T814, @teleporterIsFixed 
	H: The teleporter is still broken, but we're working on getting everything operational again.

@teleporterIsFixed	
	2: Ah cool, I can't wait to get out of this dumphole and smell some fresh air.
	2: Elliair was a very small settlement in my time, I understood it grew larger now.
	2: I can't wait to see it.
	2: I'll be on my way now.
	1: Wait, I didn't tell you everything yet!
	MOVE 2, 120, 95
	2: No worries, I'll grab a couple of guns from the Shop on the way out!
	1: We're out of guns!
	2: Nonsense, we're %C63s, guns are in our blood!
	1: /a sighs.
	1: This is not how I pictured my day to go...
	1: Anything I can help you with, %1?
	H: Not right now, I was just checking up on you.
	HOST_GIVE T823
	1: Well, I'm going to grab an early lunch and then see about waking up somebody else.
	WAIT 2.0
	MOVE 1, -20, 95
	END
	
@informPaulAboutNightmare
	FACE 1, 0
	WAIT 0.0
	FACE 1, 1
	1: I-, I heard something disturbing...
	1: Doctor Adlington told me that you fought with a %M1700?
	H: Yes, that's right.
	H: It jumped out of a box in the storage room where we keep the supplies for the clinic.
	H: I think it was looking for something, I found the %I2165 on the %M1700. 
	1: Shit, that makes it even worse.
	1: %M640s are highly intelligent creatures.
	1: They're also our sworn enemies. 
	1: Our people went through great trouble ages ago to lock them away in Unknown Hell.
	1: It looks like some managed to escape, somehow.
	1: Do me a favor, if you come across any %M640s, then kill them immediately.
	1: While you are out there in the world, see if you can also find the source of this infestation.
	1: From what the Doc described after her autopsy on the corpse, this was a young one, less than two decades old.
	1: I fear that there might be a hive of them somewhere.
	1: We must crush this infestation as soon as we can.
	HOST_GIVE T830
	H: I'll see what I can do.
	END
	
@wakeUpKimFreestone
	ACTOR 2, "Kim Freestone", monster058, 1, 58, 90
	SEL 2
	POSE 1, 4
	FACE 2, 0
	
	1: Let me fill you in on the details, and then we will take it from there.
	
	SET temp,	#<num.serverTimeYear>
	SUB temp, "1655"

	1: You've been asleep for #<temp> years, #<num.serverTimeMonth> months, and #<num.serverTimeDay> days.
	1: You're in #<str.mapName>. There are other bunkers out there, but I don't know what their status is. 
	2: Oh shit... 
	2: I have such a bad hangover, it feels as if my head is exploding.
	MOVE 2, 50, 80
	
	1: Eh, yeah, that happens sometimes.
	1: Ahem, anyway, we lost contact with them long ago. 
	2: Oh geez, Paul, really, just shut up, you're making my ears bleed.
	1: /a whispers: Err, well, while you were asleep, the world has drastically changed.
	2: What's that? Speak up man, I can't hear you!
	1: ! While you were asleep the world has drastically changed!
	2: Fuck this shit, I'm outta here, I'm gonna find me a doctor.
	MOVE 2, 120, 95, 3
	1: Wait!
	1: Ugh, why do I even bother.
	1: Oh hi, %1, how are things going?
	H: I'm doing good.
	1: I wish I could say the same.
	HOST_GIVE T824
	1: I need a drink, I wonder if the Mess Hall is open.
	MOVE 1, -30, 80
	END

@wakeUpCharleyKissinger
	ACTOR 2, "Charley Kissinger", monster039, 1, 58, 90
	SEL 2
	POSE 1, 4
	FACE 2, 0	
	2: Sir, awaiting orders, sir!
	1: Right, I can work with this.
	1: You've been asleep for almost 400 years.
	1: You're in #<str.mapName>. There are other bunkers out there, but I don't know what their status is. 
	1: We lost contact with them long ago. 
	2: Understood, sir!
	2: I'll move out immediately to restore contact with the other bunkers.
	1: Wait, what?
	MOVE 2, 120, 90, 2
	1: No, wait!
	2: Don't worry, sir, I won't let you down!
	HOST_GIVE T825

	1: Oh, hello %1.
	1: It seems like you've just met one of your very eager fellow stasis occupants.
	H: Yes, he's one of our finest.
	1: Really?
	H: I have no fucking clue, I only just met the guy.
	1: Great...
	1: Well, I suppose I'll go take a nap or something.
	WAIT 2.0
	MOVE 1, -20, 90
	END	

@wakeUpMadisonHarper	
	ACTOR 2, "Madison Harper", monster044, 4, 58, 90
	SEL 2
	POSE 4, 3
	FACE 2, 0

	2: Why did I sleep in this stasis pod?
	1: You don't remember?
	2: No clue.
	MOVE 2, 50, 80

	1: I'll be honest, I don't know specifically why you went into stasis either.
	1: The government at the time deemed in necessary to save you and others, but for what purpose we don't know.
	MOVE 2, 40, 80
	
	1: Unfortunately, most of the others didn't make it, their stasis pods failed for various reasons.
	1: You're not alone, though, there are others like you out there.
	MOVE 2, 35, 80

	1: Some of these people were scientists while others were soldiers.
	1: ...
	1: What are you doing, moving up so close to me like that?
	2: Well, I wasn't so sure before, but now I am.
	1: About what?
	2: You forgot to zip up your pants.
	2: People can see everything you have hanging there.
	1: !!
	1: Oh my god! 
	1: That's it, I'm out of here!
	WAIT 2.0
	MOVE 1, -20, 90, 2
	WAIT 3.0
	FACE 2, 2
	2: /a shrugs.
	2: Really, I thought he knew...
	2: It's a miracle he didn't feel any sort of draft.
	H: Yeah, ahem...
	H: You're a weird one, aren't you?
	2: Not weird, just very perceptive.
	2: Anyway, it's a pleasure to meet you, the name is Madison, Madison Harper.
	H: I'm %1.
	H: So, why are you still staring like that?
	2: I think you left your zipper open too...
	H: Okay, I'm getting the heck out of here!
	MOVE H, 180, 80, 2
	WAIT 3.0
	2: I wonder why people feel uncomfortable to be around me?
	HOST_GIVE T826
	2: You'd think they like to know that sort of information.
	WAIT 4.0
	GOTO EXIT

@noMoreWakingUp
	IF T925, @promotedToBlueCard
	IF T875-V40, @noNewAssignmentYet
	1: Do you have anything new to report?
	H: Not at the moment, no.
	1: Alright, let me know when the situation changes.
	END
	
@noNewAssignmentYet
	1: I don't have any new assignments for you yet.
	1: Return to me once you're level 40 and then we can discuss the next steps.
	H: Alright, I'll see you then.
	END	
	
@investigatedARL
	IF T873, @comeBackLater
	WAIT 2.0
	H: I've just returned from the abandoned research lab.
	1: Really, what did you find?
	IF -T863-T864-T868-T869-T870, @nothingAccomplishedARL

	H: I discovered growth vats.
	1: Growth vats?
	1: What was growing in them?
	H: %M1700s, it confirms that the %M1701s are back in our world and that the one I found in bunker 3 wasn't an incident.
	1: My god, what did you do to them?
	IF T864, @letGrowthVatsContinueARL
	
	H: I shut them down of course and I killed all those %M1700 bastards.
	H: They won't be bothering us anymore, nor will they be able to grow new ones.
	1: Excellent, you did great.
	IF T866|T867, @protectedTeleportARL
	GOTO @noPasswordARL	

@continueARL2
	1: So, what else did you accomplish?
	IF T868|T870, @nightmareQueenLivesARL
	H: I killed the %M1702.
	H: Whatever %M1701s are left will have no leadership left.
	1: That's great news!
	1: You've done us all a great service.
	GOTO @rewardARL

@nightmareQueenLivesARL
	IF T870, @talkedToNightmareQueenARL
	H: I discovered a %M1702, but the bitch proved too strong to kill.
	1: That's terrible news.
	1: I'll inform the others.
	GOTO @rewardARL

@talkedToNightmareQueenARL
	H: I met a %M1702 and I had an interesting talk with her.
	1: You-, you didn't kill her?
	H: It turned out that they are highly intelligent creatures.
	H: Know your enemy better than you know yourself, right?
	H: I hope that by showing her mercy that they'll leave us alone.
	H: Maybe there is place for both of us in this world.
	1: I highly doubt it, but what's done is done.
	GOTO @rewardARL	

@letGrowthVatsContinueARL
	H: I rerouted the power so that they could continue to operate.
	1: You did what!?
	H: I know that %M1700s are dangerous, but I can always go back to shut them down, right?
	H: In the meantime, we can run our investigations on them to determine if they will somehow be useful to us.
	1: That-, that makes somewhat sense, I suppose.
	1: Still, I think you are underestimating the dangers of %M1700s.
	IF T866|T867, @protectedTeleportARL
	H: Mm, maybe so.
	
@noPasswordARL	
	H: I guess I should have put a password on the teleporter there before setting it to our location.
	1: ! You did not even password protect that teleporter?
	1: I need to get on top of this right away.
	IF T868|T869|T870, @continueARL

@investigateARLmore	
	1: You better head back there and see what else you can do.
	1: I have a feeling that you're not done yet.
	H: Alright, I'll do just that then.
	MOVE 1, -20, 90
	END	
	
@protectedTeleportARL	
	IF T866, @passwordProtectedARL
	H: I have a good handle on it.
	H: I set the teleporter to local destinations only.
	H: There is no way that they'll be able to invade us through the teleporter.
	1: That's a relief yes.
	IF T868|T869|T870, @continueARL
	GOTO @investigateARLmore	
	
@passwordProtectedARL
	H: I think I have a good handle on it.
	H: I set a password before routing the destination of the teleporter to bunker 3.
	H: It'll take them a long time before they figure that one out.
	H: We have a teleporter added back in the network for now.
	1: It's a good thing that you took precautions, yes.
	1: In theory, they may be able to invade us, but at least it's not an immediate concern.
	IF T868|T869|T870, @continueARL	
	GOTO @investigateARLmore	
	
@continueARL	
	H: I have more to tell.
	GOTO @continueARL2
	
@nothingAccomplishedARL
	H: Well, I made this fancy %I2161, but I have not really done all that much beyond that.
	1: Well get your ass out there then!
	1: We need more information of what is there.
	H: Yes, sir!
	END
	
@rewardARL
	1: A reward is in order for the information that you've given me.
	WAIT 2.0
	HOST_GIVE I2553
	HOST_GIVE I2583
	HOST_GIVE I2613
	HOST_GIVE T873
	N: You received a %I2553, %I2583, and a %I2613.
	WAIT 2.0
	H: Still no gun, eh?
	1: Nope, we're all out of those.
	H: Ahuh...
	1: Really, we are!	
	IF T871, @nightmareAtBrokenPods
	END
	
@nightmareAtBrokenPods
	IF V20+I2161-T873, @investigatedARL
	H: There was a %M1701 at the broken pods east of here.
	1: Wait what!?
	1: Nightmares are in our base?
	H: Yes and no, he claimed that he took those who slept away to join them.
	H: Just what exactly is going on here?
	1: /a sighs.
	1: I'm afraid my ancestors, the people you grew up with, made some questionable decisions in the past.
	1: The %M1701s are the result of those decisions.
	1: Doc Adlington may know more details, all I know is that %M1701s are our sworn enemies.
	1: It's the %C63s that managed capture them and who used our teleporter technology to send them to Unknown Hell.
	1: However, that nuclear bomb and its following electromagnetic magnetic pulse disabled our ability to send all of them away.
	1: Those that we couldn't expel were hunted down and exterminated.
	1: It seems like various %M1701s managed to escape.
	1: Perhaps you'll discover more information in other bunkers.
	HOST_GIVE T872
	H: Maybe so, but at least I know a bit about what's going on now.
	END
	
@kagoshimaUpdate
	1: What did you learn about the situation out there?
	H: Well, the Emperor is a royal prick and Warlord Keithuso is a cheapskate idiot.
	H: No matter who we ally with, we're screwed regardless.
	1: I see.
	1: I suppose it doesn't really matter then which side we join.
	1: Use your best judgement and we'll go with whatever choice you make.
	H: Alright, I'll do just that.
	H: Besides, we have more important matters at hand with the return of the Nightmares.
	HOST_GIVE T875
	GOTO @noNewAssignmentYet

@comeBackLater	
	IF T826, @noMoreWakingUp
	IF -T822, @wakeUpSamRammstein	
	IF -T823, @wakeUpRobinSalvatore
	IF -T824, @wakeUpKimFreestone
	IF -T825, @wakeUpCharleyKissinger
	IF -T826, @wakeUpMadisonHarper
	GOTO @noMoreWakingUp ;this goto should never be triggered, but is implemented as a failsafe.	
	
@investigateMRF	
	1: I heard some exciting news from Nishka, apparently there is a military research facility out there.
	1: If it's the one that I think it is, then we have an incredibly opportunity to learn more about our past.
	1: Bunker 3 wasn't the only place where people entered stasis.
	1: The military research facility had some our best specialists enter stasis so we could wake them up again in our time of need.
	1: They might even have back ups of our records, you should check it out.
	1: Also, you may even find %C64s in stasis there, if you do then wake them up.
	H: %C64s and not just %C63s?
	1: That's right, only the best %C63s are promoted to %C64.
	1: Samuel Raven approves them himself. 
	H: Interesting, well, I suppose I could look into it.
	H: It'll be interesting to see more of us running around.
	1: The people there should have been awakened a long time ago.
	1: There is a good chance that most, if not all, stasis pods failed by now.
	H: A search and rescue mission, eh?
	HOST_GIVE T882
	H: I'll do my best.	
	END
	
@investigateMRFContinued
	1: Did you find any %C64s?
	H: I haven't gotten around to it yet.
	1: Well, they're not getting any younger.
	END
	
@investigateMRFFinished
	1: Welcome back, %1, did you find any of our people in stasis in that military research facility?
	H: Yes, I did.
	8: Howdy, Paul.
	8: On the way back I heard that you've been a real hard ass when it came to handing out guns.
	8: What the heck is up with that, eh?
	1: Ah, eh-, well, you see the thing is...
	8: Oh come on, man, you better get %1 something good fast!
	1: Alright, alright!
	GOTO @giveMRFReward	
	
@investigateMRFFailed	
	1: Welcome back, %1, did you find any of our people in stasis in that military research facility?
	H: Yes, I did.
	1: Well, where are they?
	IF T917, @investigateMRFNoPartner
	H: Eh, well, I did my best, but unfortunately the last two remaining %C64s both died.
	1: ...
	1: THEY DID WHAT!?
	1: Oh #<g.man>, this is terrible news...
	1: Well, thank you for letting me know, I suppose.
	1: Here is 1,000 GP for your efforts.
	HOST_GIVE G1000
	HOST_GIVE T922
	IF T914|T915, @foughtWithDaemonium
	END

@investigateMRFNoPartner	
	H: I don't have the faintest clue, to be honest.
	H: We hang out for a while, but when the suggestion came that we should partner up, I decided that I rather work alone.
	1: I see, so there is an %C64 running alone out there.
	1: I would have prefered if you brought anyone new to me, but I suppose this works.
	GOTO @giveMRFReward
	
@giveMRFReward	
	1: Here is a %I2507 for your efforts.
	HOST_GIVE I2507
	HOST_GIVE T922
	H: Tsk, tsk, Paul, really, a weapon, from you?
	1: /a blushes.
	1: Ah, eh-, yeah, I figured that since you did such a great job for us that I could part with a weapon.
	8: Bloody hell, how could you have left a %C without a gun for such a long time?
	H: I suppose miracles do happen.
	1: Ahem, yeah.
	IF T914|T915, @foughtWithDaemonium
	END
	
@foughtWithDaemonium
	1: Did anything else happen while you were in the military research facility?
	H: Yes, I've fought with Daemonium.
	1: Damn, he's still alive?
	1: This is bad, this is very bad...
	IF -T914, @skipWinCommentDaemonium
	H: Well, yes, and no.
	H: I kicked his ass!
	8: Yeah, he ran with his tail between his legs after we were done with him.

@skipWinCommentDaemonium	
	IF -T915, @skipLoseCommentDaemonium
	H: Worse yet, he kicked my ass.
	H: That dude is stronger than I thought.
	8: Yeah, it was pretty bad.
	
@skipLoseCommentDaemonium	
	1: I want you to keep your eyes open for further activity from Daemonium.
	1: If he's still around, then likely so is Devil.
	1: Is there anything else to report?
	H: Well, there were no signs of %M1701s there, I didn't see a single one.
	H: I did run into various security bots and drones though.
	1: Mm, I suppose that's good news.
	1: From what I've learned there is a bunker below the facility you visited.
	8: Aye, I can confirm that, Daemonium is probably hiding there.
	1: I want you to investigate it once you're strong enough.
	H: Alright, will do.
	HOST_GIVE T923
	END 
	
@reportToSamuelRaven
	IF -T2162, @noBlueAccessCard
	1: Commander Raven requested your presence in the Commander center.
	1: You can enter that now after you equiped your %I2162.
	H: Is there anything that I should be concerned about?
	1: Probably not, but to be honest, I wouldn't know.
	1: Your clearance level is higher than mine now, I only have a %I2161.
	1: Commander Raven will handle your missions from now on.
	H: Alright, thank you for the information, Paul.
	IF T887|T888, @reportToSamuelRavenActor
	END
	
@reportToSamuelRavenActor
	8: Commander Raven, eh?
	8: I wonder if he's related to a Commander I knew from back in the day.
	END	

@noBlueAccessCard
	1: You need to get in action quickly, %1.
	1: You should have finished helping Erick by now with restoring the circuit board for bunker 3.
	1: Other missions are waiting for you, but you can't do them until you did these first.
	H: I've been slacking off yeah, I suppose it's time to earn my stay.
	END
		
@promotedToBlueCard
	1: You've come a long way, %1.
	1: I'm glad that I woke you up, you've helped us all a lot in short period of time.
	H: It's good to be awake again.
	IF T887|T888, @promotedToBlueCardActor
	END

@promotedToBlueCardActor
	8: Yes, I agree, it's good to be awake again.
	8: Although in my case, I owe it all to you, %1.
	H: I'm glad that I did, though.
	H: So far, it's been a wonderful adventure with you on my side.
	END
		
	
	
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  	
; Token 800 - You met Doctor Adlington.

SCENE 5002, bunkermedclinic2, 	SCENE,	"Clinic",	0, 0, 0

	ACTOR 0, "Keypad", stealth2, 8, 56, 54	
	ACTOR 1,	"Doc Adlington", gun001, 1, 10, 95
	POSE 1, 4	
	
	CALL 5097@addGunslinger
	
	IF DEAD+T819, @giveCPR
	
	IF T803, @powerIsOn
	COLOR 21
	
@powerIsOn		

	IF T810, @returnedAfterSupplyQuest	; start future quests at this label
	IF I2165-T807, @introduction
	IF I2165, @returnedWithSupplies
	IF T807-T803, @noPowerYet
	IF T807+T803-T808, @powerIsFixed
	IF T808-I2165, @noSuppliesYet

@introduction	
	1: Welcome to my clinic %1.
	1: I see that you recovered well from stasis.
	1: How are you feeling?
	H: My memories are still fuzzy.
	1: Mm... it is most likely temporary amnesia.
	1: However, I would like to see you again if this persists for more than a few days.
	1: In general, if you ever find yourself in medical need, then please visit me. 
		
	HOST_GIVE T807
	
	IF T803, @powerIsFixed
	IF I2165, @returnedWithSupplies
	1: Unfortunately, however, I will not be able to do much for you while the power is still out.
	1: I hope I can borrow some of your time once the power is restored.
	END

@powerIsFixed	
	IF -T806, @visitXanderFirst
	1: Can you help me for a few minutes?
	1: I need some supplies from the storage room. 
	1: However, I heard some weird noises coming from there.
	1: Could you check it out for me? (Yes/No)
	ASK 300
	IF YES, @accepted
	
	1: Alright, I suppose you want something in return then?
	1: What if I offer you thousand gold pieces for your time? (Yes/No)
	ASK 300
	IF YES, @accepted
	
	1: Geez, you are really driving a tough bargain are you not?
	1: Well, let me put it this way:
	1: Either you get me my supplies, or you will never receive any healing from me.
	1: I need those supplies for a reason.
	1: Is that enough motivation to accept the task? (Yes/No)
	ASK 300
	IF YES, @accepted
	
	1: Alright, suit yourself. 
	1: I will find a more courageous #<g.man> to help me out.
	1: Should you change your mind, the access code is to open the door is '605'.
	HOST_GIVE T809
	END
	
@visitXanderFirst
	1: I could use your help greatly, %1, however, you should visit Xander Quickshot at The Shop first.
	1: I believe he has something for you that you will find very useful.
	END
	
@accepted
	HOST_GIVE T808
	1: Great! 
	1: The access code to open the door is '605', you can right click the Keypad to enter it.
	1: Good luck!
	END
	
@noPowerYet
	1: Welcome back %1.
	1: Can you see if you can fix the power?
	1: The clinic won't run without it.
	END

@noSuppliesYet 
	1: Please collect the supplies for me, they are in the storage room.
	1: Just right-click on the keypad and enter code '605' to enter it.
	END

@returnedWithSupplies
	IF -T809, @returnedWithSupplies2
	1: You decided to help me after all huh?
	1: You are a wise #<g.man> after all.
	
@returnedWithSupplies2	
	1: Thank you, that is just what I need.
	1: Did you figure out what the source of the noise was?
	H: Yes, I killed a %M1700.
	1: A what!?
	1: Shit, do not tell me that they infiltrated the base.
	1: This is bad, very bad. 
	1: I will have to discuss this with Paul later.
	
	HOST_TAKE I2165
	HOST_GIVE T810
	
	N: Doctor Adlington takes the supplies of your hands.
	WAIT 1.0
	
	1: Anyway, here is your reward.
	
	HOST_GIVE G1000
	N: You received 1,000 gold pieces.
	WAIT 1.0
	
	1: I hope that you will put that money to good use.
	1: By the way, did you know that there are other bunkers out there?
	H: Oh?
	1: They are most likely abandoned, but I know that some of these places have advanced healing technology.
	1: I would like you to investigate these bunkers once you are stronger.
	1: I am sure I will be able to make something useful for you.
	H: Useful how?
	1: Well, for example, I might be able to stimulate your body's regeneration after a fight. 
	1: I may also be to give your heart an automatic shock if a monster gets the better off you, bringing you back from death itself.
	H: That sounds useful.
	1: It certainly would be.
	1: Our people had awesome technology once, it is up to us to uncover their heritage and to honor their legacy.
	1: Also, if you find more supplies in the world out there, then please throw them into the Supply box.
	1: I will reimburse you partially for the useful items and I will give everything back that I cannot use.
	HOST_GIVE T810
	SET valueGivenToDocAdlington, "0"
	1: The supplies might be primitive, but I am running low and I will take all that I can get.
	1: I can give you a %I2166 once you gave me enough items.
	H: What does a %I2166 do?
	1: It enhances any of your abilities, you get to choose which ones.
	1: You can only carry one of them with you at a time though, so make sure you use it as soon as you get it.
	H: So, about that healing you promised before?
	1: Huh, what? Oh, just click on me if you need healing.
	END
	
@returnedAfterSupplyQuest
	IF T810+T812, @skipSupplyBox
	ACTOR 2,  "Supply box", gun005, 2, 67, 98
	
@skipSupplyBox
	IF -T812, @doNotSellCures
	OFFER 3, 4, 6, 7, 9, 10, 11, 14, 981
@doNotSellCures

	IF T985+T974, @bunker9FinishedQuests
	IF T974, @bunker9Hatchlingsrewarded
	IF T973, @bunker9CaughtHatchlings
	IF T980-T985, @bunker9UpgradeAutoCPR
	IF T972, @bunker9HatchlingProgress
	IF V80+T947, @bunker9Start
	IF T947, @investigateMRFBunkerFinished
	IF T943, @investigateMRFBunkerReturn
	IF T937, @investigateMRFBunkerContinued
	IF V60+T903, @investigateMRFBunker
	IF T903, @returnAutoCPRUpgradeMK2
	IF T902, @finishedAutoCPRUpgradeMK2
 	IF T897, @investigateMilitaryResearchFacilityFinished
	IF T883, @investigateMilitaryResearchFacilityContinued
	IF T850+T874+V40, @investigateMilitaryResearchFacility	
	IF T874, @noNewAssignmentYet	
	IF T850+T871, @nightmareAtBrokenPods
	IF T850, @noNewAssignmentYet
	IF T849-T850+T17, @receiveRewardInvestigateAbandonedResearchLab
	IF T849, @successInvestigateAbandonedResearchLab
	IF T848, @returnInvestigateAbandonedResearchLab
	IF V20-T848, @investigateAbandonedResearchLab
	1: I am afraid I do not have a new job for you yet.
	COMPARE #<valueGivenToDocAdlington>, "0"
	IF> @end
	1: However, I do have a request.
	1: If you find medicine or potions out there, can you throw them into the supply box?
	1: I will make sure to make it worth your time.
	1: Once you gave me enough items, I will give you a %I2166.
	1: Of course, I will reimburse most of your costs, plus I wll give back any items I cannot use.
	END		
	
@eventActorGive2
	IF T812, @returnGivenItem
	COMPARE #<item.class>, "2"
	IF> @returnGivenItem
	COMPARE #<item.id>, "39"
	IF> @returnGivenItem
	SET temp2, "num.item#<item.id>"
	COMPARE *#<temp2>, "2"
	IF< @dontGiveAllItems
	N: Give all #<item.name>s?	
	MENU "Yes, give all #<item.name>s I have=@giveAllItems", "No, only this item=@dontGiveAllItems"
	
@dontGiveAllItems		
	1: Thank you, this #<item.name> will be useful.
	ADD valueGivenToDocAdlington, #<item.price>
	SET temp, #<item.price>

@givePartialRefund	
	MUL temp, 80
	DIV temp, 100
	HOST_GIVE G#<temp>
	N: You received #<temp> GP.
	COMPARE #<valueGivenToDocAdlington>, "100000"
	IF>= @giveGeneEnhancement
	SET temp, "100000"
	SUB temp, #<valueGivenToDocAdlington>
	1: I need #<temp> GP worth of items more before I can give you that %I2166.
	END
	
@giveAllItems
	SET temp2, "num.item#<item.id>"
	SET temp, "*#<temp2>"
	ADD temp, "1"
	SET temp3, #<temp>
	MUL temp, #<item.price>
	HOST_TAKE I#<item.id>.*#<temp2>
	ADD valueGivenToDocAdlington, #<temp>
	1: Thank you for your generous donation of these #<temp3> %I#<item.id>s.
	GOTO @givePartialRefund	
	
@returnGivenItem
	EJECT T172
	1: I am afraid I cannot use a #<item.name>, I will return it to your inventory.
	HOST_GIVE I#<item.id>
	END
	
@giveGeneEnhancement
	1: Wow, you have given me quite a bit of items now.
	1: I will keep up my end of the bargain, here is the %I2166 that I promised.
	HOST_GIVE T812
	HOST_GIVE I2166
	N: You received a %I2166.
	WAIT 1.0
	1: You do not have to give me more items now, the supplies are stocked thanks to your help.
	1: I will also sell you cures and %I981s now that my supplies are stocked.
	OFFER 3, 4, 6, 7, 9, 10, 11, 14, 981
	END
		
@eventActorClick1
	IF -T810, @noHeal
	COMPARE #<num.hostHP>, #<num.hostMaxHP>
	IF= @checkMPHeal
	1: Mm? Oh, here you go.
	N: Doctor Adlington injects you with a syringe.
	WAIT 0.2
	HOST_GIVE L#<num.hostMaxHP>
	HOST_GIVE M#<num.hostMaxMP>	
	WAIT 0.2
	N: You feel much better already.
	IF R5+T823, @robinVisits
	END
	
@eventActorClick0
	IF -T803, @powerKeypadIsDown
	MENU "Enter pincode=@enterPincode", "Cancel=@cancel"
	END	
	
@enterPincode
	0: Enter pincode [XXX]:
	ASK 300
	COMPARE #<lastAsk>, "605"
	IF= @accessGranted
	SOUND voice\attempt_failed
	0: Attempt failed.
	1: The correct access code is '605'.
	END
	
@cancel
	END
	
@powerKeypadIsDown
	1: You will not be able to do anything with the keypad while the power is down.
	END
	
@accessGranted
	SOUND voice\access_granted
	0: Access granted.
	WAIT 3.0
	GOTO SCENE 5011	

@noHeal
	IF DEAD, @giveCPR
	1: I am afraid I cannot heal you until I have more supplies in stock.
	1: However, if you have a real emergency, you can always camp anywhere in #<str.mapName> and I'll see about fixing you up.
	END
	
@checkMPHeal
	COMPARE #<num.hostMP>, #<num.hostMaxMP>
	IF= @perfectHealth
	1: You're looking a little pale, I should give you a blood transfusion.
	HOST_GIVE M#<num.hostMaxMP>	
	WAIT 2.0
	N: You feel much better already.
	END
	
@perfectHealth
	1: You appear to be in perfect health.
	END
		
@giveCPR
	1: Oh my...
	1: You need immediate CPR!
	WAIT 2.0
	SOUND tesla_charge
	WAIT 3.0
	1: Clear!
	WAIT 1.0
	SOUND tesla_shot
	WAIT 2.0
	HOST_GIVE L1
	IF T819, @healFull
	GOTO @noHeal
	
@healFull
	1: Now drop your pants and bend over!
	H: Wait, what!?
	WAIT 3.0
	N: Doctor Adlington injects you with a syringe.
	WAIT 0.2
	HOST_GIVE H#<num.hostMaxHP>
	HOST_GIVE M#<num.hostMaxMP>	
	WAIT 2.0
	N: You feel much better already.
	WAIT 1.0
	H: Gee, thanks Doc, a shot in my arm would have been fine too.
	1: Yes, it would have.
	1: However, now that you felt the embarrassment of almost dying, you will hopefully restrain from doing so in the future!
	END
	
@end
	END
	
@robinVisits
	ACTOR 3, "Robin Salvatore", pet006, 1, 120, 98
	FACE 3, 0
	MOVE 3, 72,98
	3: Doc, I could use your help!
	1: What seems to be the problem?
	3: I've got a banging headache, that's what.
	1: Mm...
	1: /a checks Robin's medical file.
	1: You seem to love your liquor.
	1: Maybe you should stop drinking alcohol for several days and drink water instead.
	3: Awww, Doc, that'll kill me!
	1: No it will not, but your liver will thank you.
	1: Now get going, I have actual patients to attent to.
	3: Geez...
	MOVE 3, 120, 98
	END
	
@investigateAbandonedResearchLab
	1: Welcome back, %1.
	1: I see you have grown much stronger.
	1: Maybe you can help me out.
	1: I overheard Nishka and Caeran discussing an abandoned research lab that is close-by.
	1: I would like you to investigate the medical applications that they possess.
	1: I found several notes from a long deceased predecessor of mine, Doctor Melchior.
	1: It is likely that his last name was also his login name.
	1: He mentioned in his notes that there might a schematic for an %I2660 in that lab.
	H: I suppose you want me to find it for you?
	1: If you could, then yes please.
	1: If I can study it and put it together, then I will make one for you too.
	1: I am certain that it will come in handy during your adventures.
	1: So, what do you say, do want to help out? (Yes/No)
	ASK 300
	IF YES, @acceptInvestigateAbandonedResearchLab
	1: Pity, but come back to me if you change your mind.
	END

@acceptInvestigateAbandonedResearchLab	
	1: Good, I was hoping you would.
	HOST_GIVE T848
	1: Once you find the schematics bring them back to me.
	END
	
@returnInvestigateAbandonedResearchLab	
	1: Did you find what we are looking for?
	H: Not yet, do you have any idea where it might be?
	1: Look for a terminal in a lab, my bet is that if it is anywhere, then it will be on there.
	1: You will probably need an external drive to download the information on.
	1: Unfortunately, I do not possess such a device, but you might find one in the abandoned research lab.
	1: They probably had a lot of them.
	H: Alright, I'll check it out.
	H: Thank you for the tips.
	1: You are welcome, good luck.
	END

@successInvestigateAbandonedResearchLab
	1: So, did you succeed?
	H: Of course I did, I'm a %C after all.
	1: Wonderful, please let me see.
	N: Doctor Adlington downloads the data from your %I2168 who then studies the schematics it contains.
	HOST_GIVE T17
	WAIT 4.0
	1: Very interesting, I think I can make this work.
	1: You can keep the %I2168, by the way. 
	1: You can likely use it again in the future.
	
	IF T852|T853|T854, @additionalDownloadARL

@setTimeBasicCPR	
	SET timeNow, #<num.timeNow>
	ADD timeNow, 300
	1: Come back in five minutes from now and I should have a working %I2660 for you.
	H: Alright, I'll see you in five minutes then.
	END

@additionalDownloadARL
	H: That's not all the data that I obtained though.
	1: Oh?
	IF -T852, @skipGeneStrength
	1: Let me take a look...
	WAIT 4.0
	1: This is amazing!
	1: You have recovered the formula for %I2171.
	1: I will start working on this right away. 
	1: It will be ready when I also have the %I2660 ready for you.
	
@skipGeneStrength	
	IF -T853, @skipExperimentalDataARL
	1: What is this, I see you downloaded experimental research data?
	1: This is simply wonderful, I can study this for a long time to come.
	1: It will be a big boost to my research.
	1: Here, please take this.
	WAIT 2.0
	N: Doctor Adlington gave you 25,000 GP.
	HOST_GIVE G25000
	WAIT 2.0
	
@skipExperimentalDataARL	
	IF -T854, @setTimeBasicCPR

	1: What is this, anatomy files?
	1: Oh... I see... 
	1: Mm, interesting...
	1: I am not sure why you brought me these naughty magazines, but I suppose that they will be useful.
	H: I'm sure they will be, Doc.
	H: So, are they worth anything?
	1: Ah, I suppose I could give you some money for them.
	WAIT 2.0
	N: Doctor Adlington gave you 30,000 GP.
	HOST_GIVE G30000
	WAIT 2.0	
	SET timeNow, #<num.timeNow>
	ADD timeNow, 600
	1: Come back in ten minutes from now and I should have a working %I2660 for you.
	H: Alright, I'll see you in ten minutes then.
	MOVE 1, -20, 95
	1: I eh-, I better study everything you brought me.
	H: Enjoy yourself, Doc.
	END		

@receiveRewardInvestigateAbandonedResearchLab
	COMPARE #<timeNow>, #<num.timeNow>
	IF> @bePatientARL
	1: I finished the %I2660 for you!
	
	IF -T854, @skipMagazineComment
	H: You sure took your sweet time, Doc.
	1: Ahem, yes, well, I did have to study all the data that you brought me.
	H: Ahuh, I'm sure you 'studied' it.
	1: Let me give you your reward already!
	
@skipMagazineComment	
	WAIT 2.0
	HOST_GIVE I2660
	HOST_GIVE T850
	HOST_TAKE T17
	N: You received an %I2660.
	WAIT 2.0
	H: Thank you, Doc, much appreciated.
	1: Keep in mind that you need to equip this device and that it only works right after combat.
	1: It will not do anything for you if camp.
	1: It also has about 50%% fail rate.
	1: I know that it is not much, but I promise you that we can do more research about these devices later.
	1: I am sure that we will be able to find upgrades for you.
	H: Alright, good to know.
	
	IF -T852, @skipReceiveStrengthGene 
	1: The %I2171 is also ready.
	1: Here you go.
	N: You received a %I2171.
	HOST_GIVE I2171
	WAIT 2.0
	1: I would not be surprised if there is more related research out there, it would serve you well to look for it.
	H: I'll keep that in mind.
	
@skipReceiveStrengthGene 	
	1: Please come back to me once you have more experience, the next facility will likely hold items of even greater interest to us.
	END

@bePatientARL
	1: Have a little patience, please.
	1: The time is not up yet.
	1: I am working as fast as I can.
	H: Okay, okay, I'll be back later.
	WAIT 3.0
	GOTO EXIT
 
@noNewAssignmentYet	
	IF T868-T871, @heardNoiseAtBrokenPods
	IF T869-T871, @heardNoiseAtBrokenPods
	IF T870-T871, @heardNoiseAtBrokenPods
	IF -T868-T869-T870, @finishARLFirst
	1: I am afraid that it is too early to discuss a new assignment with you.
	1: You need to be level 40 before you can handle the challenges up ahead.
	END
	
@finishARLFirst
	1: It would appear there are still areas left for you to explore in the abandoned research lab.
	1: Have you tried using the teleporter in the lab to teleport to a local location already?
	END
	
@heardNoiseAtBrokenPods
	1: I was checking the south of the base earlier today, and I heard some noises coming from the broken pods.
	1: I did not trust what I heard, maybe you can check it out?
	H: I'll have a look when I have a moment to spare, it was probably nothing, Doc.
	1: Right, you had better be careful, though.
	END
	
@nightmareAtBrokenPods
	H: So, Doc...
	H: What happened to the broken pods in the south?
	1: The power went down for unknown reasons.
	1: First, I thought it was due to the power surge from the teleporter, but something else is going on there.
	H: You can say that again, a %M1701 talked with me there.
	1: A %M1701!?
	H: Yes, he told me that the people who slept there were supposed to become %M1701s?
	1: That-, that is partially true I suppose.
	1: Back in the day, and I'm talking over two-hundred years ago, we uncovered research from Doctor Melchior.
	1: It told us of experiments to create a super soldier.
	1: My predecessors were not sure if he was ever successful or not.
	1: However, since we were losing the fight against the remaining %M1701s, our people grew desperate.
	1: In order to fight a monster, you had to become a monster.
	1: Samuel Raven ultimately deemed the project too dangerous, though, and he abandoned it.
	1: Instead, the brave %C63s who volunteered for the project remained in stasis.
	1: The idea was to wake them up like you and have them assist us in our time of need.
	H: Mm, I see.
	H: Was I supposed to become a %M1701?
	1: You were in a different group, we lost records about 200 years ago when our mainframe crashed during a power outage.
	1: If such information is known, then it is not stored on this base.
	1: You might be able to find this information in a back up elsewhere, though.
	H: Alright, well, thank you for the information, Doc.	
	HOST_GIVE T874
	1: Please let me know if you discover more about your origins.
	END
	
@investigateMilitaryResearchFacility
	1: Caeran told me about the ping in the teleporter network!
	1: The military research facility may hold a lot of useful technology for us.
	1: I could likely upgrade your %I2660 into an %I2661.
	1: Can you search for schematics for me?
	H: Sure thing, Doc.
	H: If I go there any way then a little extra snooping around won't hurt.
	1: I've wiped your %I2168 clean, you should be able to store 10 GB of data on it again.
	SET discSpace, 10
	HOST_GIVE T883
	END	
	
@investigateMilitaryResearchFacilityContinued
	1: Did you find any schematics yet?
	H: I'm still working on it, Doc.
	1: Alright, I will show some patience.
	IF -T854, @end
	H: Ahuh... you're probably just hoping that I find more dirty magazines again, eh?
	1: /a blushes.
	1: A lady never tells.
	END
	
@investigateMilitaryResearchFacilityFinished
	1: Welcome back, %1, did you find any new schematics?
	H: I sure did, I found the schematics for an %I2661.
	1: Alright, please give me the %I2168 and I will download everything you gathered.
	N: You hand over the %I2168.
	WAIT 3.0
	SET waitTime, #<num.timeNow>
	
	IF -T898, @skipMRFdownloadStamina
	1: That is most interesting, I see you found research about %I2173.
	1: I will prepare this item for you while I upgrade your %I2660.
	ADD waitTime, "10"
	
@skipMRFdownloadStamina	
	IF -T899, @skipMRFdownloadResearch
	1: This is wonderful, you found incredibly valuable information about experimental research.
	1: I will study this later, but the leads in here seem very promising.
	1: Here is a little extra for your efforts.
	N: Doc Adlington gave you 25,000 GP!
	HOST_GIVE G25000
	WAIT 2.0
	H: Thanks, Doc, I'm sure that I can put this money to good use.
	ADD waitTime, "20"

@skipMRFdownloadResearch
	IF -T900, @skipMRFdownloadSmut
	1: Oh, oh my... 
	1: I see you downloaded a classic movie as well, huh?
	8: Oh crap, you downloaded my tape? 
	1: "A steamy night in Maku's Tunner" was well known back in the day for its ah, ahem...
	H: Spill the beans, Doc, what was it known for?
	1: Well, let me put it this way, if you ever wondered about how the reproduction of human works, then this movie will answer all your questions and more.
	8: That's one way of putting it, yeah.
	8: All the good memories...
	1: I eh-, I need some extra time to eh-, ahem, research this.
	H: Sure Doc, take your time.
	8: Make sure you check scene 2, I did a hot number with Lola there.
	8: /a winks.
	1: Yes, thank you, I will give you a reward for this find too, of course.
	N: Doc Adlington gave you 40,000 GP!
	HOST_GIVE G40000
	WAIT 2.0
	8: That's a lot more money than they paid me to star in that movie.
	ADD waitTime, "300"
	
@skipMRFdownloadSmut
	1: I need to take your %I2660 already, it will be hard to upgrade it otherwise.
	N: You give the %I2660 to Doc Adlington.
	HOST_TAKE I2660
	WAIT 2.0
	ADD waitTime, "300"
	SET temp, #<waitTime>
	SUB temp, #<num.timeNow>
	DIV temp, "60"
	ADD temp, "1"
	1: Please come back to me in #<temp> minutes, I should have everything ready for you then.
	HOST_GIVE T902
	1: I will get started right away.
	MOVE 1, -20, 90	
	END

@finishedAutoCPRUpgradeMK2
	COMPARE #<waitTime>, #<num.timeNow>
	IF> @notYetReadyCPRUpgradeMK2
	1: Great, I just finished upgrading your %I2661.
	IF -T900, @skipMRFSmutComment
	H: You sure took your sweet time, Doc. 
	H: I assume you enjoyed the movie?
	1: /a blushes.
	1: It was... inspiring.
	1: I saw things I did not think possible, you people from the past sure knew a lot about making babies.
	8: That we did, Lola was one flexible gal alright.

@skipMRFSmutComment
	1: Your %I2661 is ready.
	N: Doc Adlington gave you the %I2661.
	WAIT 2.0
	HOST_GIVE I2661
	HOST_GIVE T903
	1: Do not forget to equip it, it will not do you much good else.	
	IF -T898, @end
	1: I also have the %I2173 for you that I promised.
	1: It would be best if you use it immediately.
	N: Doc Adlington gave you the %I2173.
	HOST_GIVE I2173
	WAIT 2.0
	H: Thanks, Doc, it's much appreciated.
	8: Nice, I only had one of those in my life, but that was all I needed to keep going forever.
	END

@notYetReadyCPRUpgradeMK2
	1: You need to be more patient, %1, your %I2661 is not yet ready.
	END

@returnAutoCPRUpgradeMK2	
	1: I do not have a new assignment for you yet.
	END
	
@investigateMRFBunker
	1: Rumor has it that you will investigate the bunker from the military research facility soon, is this true? (Yes/No)
	ASK 300
	IF -YES, @investigateMRFBunkerNo
	1: That is good to hear.
	1: I was hoping if you could look around for more data when you are there.
	H: Sure, no problem.
	H: I'll let you know if I find anything of interest.
	HOST_GIVE T937
	1: Good, I appreciate it.
	END
	
@investigateMRFBunkerContinued
	1: Have you found anything yet?
	H: No, I'm still working on it, do you have any tips maybe?
	1: Mm, I am afraid that my knowledge of the place is very limited.
	1: The best place to search for data remains terminals, so look for those.
	H: Alright, I'll try that. 
	8: I know there was a terminal in the north east part of that bunker, but I was only down there on rare occasions.
	END
	
@investigateMRFBunkerNo
	1: Oh, in that case never mind.
	END
	
@investigateMRFBunkerReturn
	1: You are back? 
	8: Yes we are, Doc.
	1: That is wonderful!
	1: Did you find any new CPR schematics?
	H: I sure did, Doc.
	1: Great, let me see.
	N: You hand the %I2168 to Doc Adlington.
	WAIT 2.0
	1: Mm, mm... oh, this is good news indeed.
	1: I merely have to give your %I2166 a software update.
	1: I can handle that while we take a look at the other data you discovered.
	H: Sure thing, Doc.
	IF -T944-T945, @investigateMRFBunkerNoOtherData
	IF -T944, @skipDexterityUpgrade
	1: Oh, what is this?
	1: You have discovered a way to improve the dexterity genes?
	1: I will start the machine to mix this gene enhancement immediately, it should be ready soon.

@skipDexterityUpgrade	
	IF -T945, @skipMutantResearchDataDownloaded
	1: Oh my, I see you have discovered highly experimental genetic research from Doctor Melchior?
	1: These-, these mutants... they are true abominations, a crime against nature!
	1: Still, perhaps we can use these to our advantage, mm...
	1: I will keep them in mind.
	H: You're not planning on anything foolish I hope, Doc?
	1: Foolish? 
	1: No of course not, do not be ridiculous!
	1: We may be able to benefit greatly from such soldiers.
	1: I will continue this research to see what else we can discover and how I can improve them.
	H: Eh-, okay, I guess.
	8: Damn, Doc, please don't do anything crazy!
	1: Ahem, where are my manners, here, take these gold coins as a reward.
	WAIT 2.0
	HOST_GIVE G50000
	N: You received 50,000 GP.
	WAIT 2.0
	
@skipMutantResearchDataDownloaded
	IF -T946, @skipMutantResearchDataDeleted
	1: Mm, nothing else?
	H: Well, there were files about highly experimental genetic research from Doctor Melchior involving mutants.
	H: However, I deemed that research too dangerous for anyone to possess, and thus I deleted it.
	1: You did what!?
	1: The information I could have learned...
	H: Doc, chill, these monsters were dangerous abominations and a crime against nature.
	H: The world is better off without them.
	1: /a sighs.
	1: I suppose you are right.
	COMPARE #<g.num>, "3"
	IF= @mutantResearchBinary
	8: Damn right #<g.he> is.
	GOTO @skipMutantResearchDataDeleted

@mutantResearchBinary
	8: Damn right they are.

@skipMutantResearchDataDeleted
	GOTO @investigateMRFBunkerReward

@investigateMRFBunkerReward
	1: Ah, the software update is ready.
	1: Here you go.
	HOST_TAKE I2661
	HOST_GIVE I2662
	HOST_GIVE T947
	IF -T944, @skipGivingDexterityReward
	1: Your %I2175 is also ready.
	HOST_GIVE I2175
	N: You received a %I2175.	
	
@skipGivingDexterityReward
	1: Please return once you are level 80, I may have a new lead for you where you can find the schematics for an %I2663.
	H: Alright, I'll keep that in mind.
	END	

@investigateMRFBunkerNoOtherData
	1: Mm, pity, there does not appear to be any other data on the %I2168?
	H: Well, we can't be lucky all the time, I'm afraid.
	1: Yes, I suppose so.
	GOTO @investigateMRFBunkerReward

@investigateMRFBunkerFinished
	1: I hope everything is going well, I do not have any new requests for you until you reach level 80.
	END
	
@bunker9Start
	IF -T971, @bunker9StartNotYet
	1: Hello, %1, I was hoping you would stop by.
	H: Anything I can do for you, Doc?
	1: Yes, there is. 
	1: You will visit Bunker 9 soon, right?
	H: That is the idea, yes.
	1: I have a request for you.
	1: According to the archives I have access to, Bunker 9 was a testing ground for many experiments. 
	1: One in particular holds my interest.
	H: What can I can do for you, Doc?
	1: The experiment that I am most interested in involves %M1700s.
	1: I was hoping you can catch as many as possible for my studies.
	H: Mm, it sounds dangerous.
	1: I can assure you that you will be well-rewarded.
	1: You might even enjoy the process. 
	H: I suppose I could give it a try.
	1: Great!
	1: I will give you 50 %I984s, simply throw them to the %M1700s to catch them.
	WAIT 2.0
	HOST_GIVE I984.50
	HOST_GIVE T972	
	SET discSpace, "10"
	N: You received 50 %I984s.
	WAIT 2.0
	1: You will have an easier time catching them when you aim well.
	1: Return the %I985s to me once you are done.
	1: If you happen to come across other data, then please make a copy of that for me too.
	H: Sure, I know the drill.
	END	

@bunker9StartNotYet
	1: Please visit me once you had a moment to catch up with Commander Raven.
	H: Sure thing, Doc.
	END
	
@bunker9HatchlingProgress
	1: Did you catch any %M1700s already?
	H: No, I'm still working on it. 
	H: Do you have a clue of where I might find them?
	1: I believe the feeding grounds were in the south west part of the base, you should try your luck there.
	H: Alright, I'll give it a shot.
	END
	
@bunker9CaughtHatchlings
	1: Welcome back, %1.
	1: I assume that your mission was successful?
	IF -I985, @bunker9CaughtHatchlingsNoSuccess
	H: Yes, I caught #<num.item985> of them.
	1: Excellent, can you put them in the storage room? 
	1: The access code is '605'.
	H: Yes, ma'am.
	IF T980-T985, @bunker9UpgradeAutoCPR
	END
	
@bunker9CaughtHatchlingsNoSuccess
	H: Well, I did my best, but I didn't catch any %M1700.
	1: Not even one?
	H: Nope, not a single one.
	1: /a sighs.
	1: You better try again then.
	HOST_TAKE I984.#<num.item984>
	HOST_GIVE I984.30
	HOST_TAKE T973
	1: Return to Bunker 9 and try to catch at least one this time.
	H: Yes, ma'am!
	IF T980-T985, @bunker9UpgradeAutoCPR
	END
	
@bunker9Hatchlingsrewarded
	1: You have caught various beautiful specimens.
	1: I will let you know if I require more %M1700s in the future.
	IF T980-T985, @bunker9UpgradeAutoCPR
	END
	
@bunker9UpgradeAutoCPR	
	1: Did you manage to download the schematics for the %I2663?
	H: I sure did, Doc.
	8: Yeah, downloading those files is becoming a routine by now.
	1: Very well, please show me what you have.
	WAIT 2.0
	N: You hand over your %I2168 to Doctor Adlington.
	WAIT 2.0	
	1: Yes, the schematics are there indeed.
	1: I will update the software on your %I2662, it will only take a minute.
	
	IF -T982, @skipBunker9AgilityEnhancement
	1: Interesting, you have downloaded research about agility enhancements?
	H: Yes, I thought you would be interested in it.
	1: Indeed I am, I will upload this information to my computer immediately.
	1: I should have a %I2174 ready for you in a few moments.
	
@skipBunker9AgilityEnhancement	
	IF -T981, @skipBunker9ClassifiedResearchData
	1: Interesting, I see that you also obtained classified research data.
	1: I will look into these files later.
	
@skipBunker9ClassifiedResearchData
	IF -T983, @skipBunker9ExperimentData
	1: Mm, what is this?
	1: You have downloaded data about the experiments they performed in bunker 9?
	H: Yes, I have encountered %M1716s there, I believe that this research is about them. 
	IF -T979, @skipBunker9ExperimentData
	1: I wonder who created those creatures and why?
	H: I found a journal from Doctor Walker on the medical terminal.
	H: He created the %M1716s to combat the growing threat of the %M1701s.
	H: As with the %M1701s, he used %C63s in his research to transform them into %M1716s.
	H: They're very strong creatures with four arms and pure muscle.
	1: That sounds quite horrible indeed.
	1: It would appear that our ancestors had a hard time learning from their mistakes.
	1: Perhaps it would be better if I delete all these experimental research files.
	1: I do not want to be tempted, nor see a successor of mine, continue this line of research.
	HOST_GIVE T986
	H: Yes, I think that is for the best.
	IF T981+T983+T853+T899+T945, @finalRewardExperimentalData
	IF T981+T983+T853+T899+T946, @finalRewardExperimentalData	
	
@skipBunker9ExperimentData
	IF -T984, @skipBunker9RomanceNovels
	1: Oh my...
	1: Is this what I think it is?
	H: I figured you would appreciate the fine literature of days long gone.
	1: Yes, I-, I will definitely delve into this once I have a couple of spare hours.
	1: I am a big fan of this kind of work.
	1: Naturally, I shall not let this go unrewarded.
	IF T984+T854+T900, @finalRewardEroticWorks
	WAIT 2.0
	HOST_GIVE G75000
	N: Doc Adlington gave you 75,000 GP.
	WAIT 2.0	
	
@skipBunker9RomanceNovels
	1: It would appear that the software update for your %I2663 is ready.
	1: Here you go.
	HOST_TAKE I2662
	HOST_GIVE I2663
	HOST_GIVE T985
	SET discSpace, "10"
	WAIT 2.0
	H: Thank you, Doc, this will be a great help.	
	
	IF -T982, @end
	1: The %I2174 is ready as well.
	HOST_GIVE I2174
	WAIT 2.0
	N: You received a %I2174.
	WAIT 2.0
	1: I will let you know when I have something new for you to look into.
	END
	
@finalRewardEroticWorks
	1: Since you have given me the naughty magazines, the movie 'A steamy night in Maku's Tunner', and now these romance novels, I will give you something that I have been working on for a long time.
	1: Please, take this %I2169.
	HOST_GIVE I2169
	HOST_GIVE T987
	WAIT 2.0
	N: You received an %I2169.
	GOTO @skipBunker9RomanceNovels

@finalRewardExperimentalData
	1: All that research did lead to one wonderful item, however.
	1: I have discovered a way to boost a %I2166's performance.
	1: I will give you both and then you can judge the difference between them yourself.
	HOST_GIVE I2166
	HOST_GIVE I2169
	WAIT 2.0
	N: You received a %I2166 and an %I2169.
	WAIT 2.0
	H: Wow, thank you, Doc.
	GOTO @skipBunker9ExperimentData

@bunker9FinishedQuests
	1: It is good to see you again, %1.
	1: I hope life is treating you well.
	H: It's quite alright, Doc, thank you.
	8: Just as long as we have you to patch us up.
	END
	
	
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  


SCENE 5003,	bunkerentrance,		SCENE,	"Entrance", 	0, 0, 0

	IF -V10, @unauthorized
	GOTO LINK 0, 9, 0
	
	END 
@unauthorized
	N: The doors are locked. 
	N: You will have to find another way to leave the bunker.	
	END
	

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; This scene teleports gunslingers to the ancient bunker
;

SCENE 5004, bunkerhidden,	SCENE,	"Bunker entrance", 	0, 0, 0

	CALL 5097@addGunslinger

	ACTOR 1, "Keypad", stealth2, 8, 54, 59

	SET temp, "0"
	SET temp2, "0"
	IF T887|T888, @actorComment
	END
	
@actorComment
	8: It's good to be home again.
	MOVE 8, 70, 90
	END
	
@eventActorAttack1
@eventActorSpell1
	COMPARE #<temp>, 0
	IF> @finalWarning
	ADD temp, 1
	1: *Bzzzt* Hey stop that!
	1: We don't have infinite parts to repair these things.
	1: Try right clicking on the Keypad instead to enter the code.
	1: Do that again and we'll activate the base defenses.
	END

@eventActorClick1
	IF DEAD, @died
	IF -T118, @enterPincode
	COMPARE #<temp2>, "1"
	IF= @menu2
	MENU "Enter pincode=@enterPincode", "Open hack tool=@openHackTool", "Cancel=@cancel"
	END
	
@eventActorClick13
	CALL 5101@requestHelp
	END
	
@eventActorClick14
	CALL 5101@hackToolMenu
	END		
	
@finalWarning
	COMPARE #<temp>, 2
	IF>= @activateBaseDefenses
	ADD temp, 1
	1: Base defenses are activated.
	1: Last warning!
	END
	
@activateBaseDefenses
	SOUND laser-cannon
	WAIT 7.0
	SOUND explbld1
	TAKE H#<num.hostMaxHP>
	WAIT 4.0
	1: You were warned.
	END

@unauthorizedAccess
	1: *Bzzt*
	1: There is nothing of interest for you here, %C.
	1: You better take your leave now.
	END
	
@menu2
	MENU "Enter pincode=@enterPincode", "Cancel=@cancel"
	END
	
@enterPincode
	1: Enter pincode [XXX]:
	ASK 300
	IF -T118, @unauthorizedAccess
	COMPARE #<lastAsk>, #<bunker3Password>
	IF= @accessGranted
	SOUND voice\attempt_failed
	1: Attempt failed.
	1: Access denied.
	END

@accessGranted
	IF -T118, @unauthorizedAccess
	SOUND voice\access_granted
	1: Access granted.
	1: Welcome home, %1.
	WAIT 3.0
	EJECT C63+T819|C64+T819
	GOTO LINK 35, 2, 0

@openHackTool
	SET temp2, "1"
	SET sceneReturn, #<scene.id>
	SET passwordScene, #<bunker3Password>
	CALL 5099@setUpHackToolAndHelp
	END

@cancel
	END

@died
	N: You cannot do anything while you are dead.
	END
	
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  

SCENE 5005, bunkerredalert, SCENE, "Command center" , 0, 0, 0
	

	CALL 5097@addGunslinger		

	IF -V60, @nothingHere

	ACTOR 1, "Samuel Raven", monster002, 4, 20, 85
	ACTOR 2, "Terminal", circuitbuttonsdown, 1, 79, 85
	
	IF V99-T1206, @receiveEndGameGear

	IF T1220, @bunker9Concluded
	IF T997|T998, @bunker9Finished
	IF T971, @bunker9Continued
	IF V80+T927, @startBunker9
	IF T927, @completedBunker
	IF T966, @finishedBunker
	IF T936, @downloadedSecurityFiles
	IF T925, @returnFromBunker
	
	ACTOR 1, "RoT's Protector", monster002, 4, 20, 85
	
	1: Welcome, %1, and congratulations on your promotion.
	HOST_GIVE T1209
	HOST_TAKE I2161
	H: Eh, what the heck?
	IF -T924, @skipMajorSurprise
	H: You're Samuel Raven, *the* Samuel Raven!
	ACTOR 1, "Samuel Raven", monster002, 4, 20, 85	
	H: I read about you in the medical file of the military research facility, but I didn't expect you to be our commander.
	1: That is correct.
	GOTO @continueIntroduction	
	
@skipMajorSurprise	
	H: You're-, you're-...
	1: Yes, the 'Protector of RoT'.
	1: But how-, why? Who are you really?
	1: My true name, is Samuel Raven, or Commander Raven.
	
@continueIntroduction		
	8: Damn, I didn't see that one coming.
	ACTOR 1, "Samuel Raven", monster002, 4, 20, 85
	1: You probably have questions, so let's hear it.
	H: Well, I thought you're monitoring the world and watching out for good and evil deeds and such?
	1: That is correct and I do so from this station.
	H: Does this mean that you're immortal?
	1: You are correct again.
	1: After Devil stole our experimental research, Atsumori and I restored a back up.
	1: We found several flaws in the original formula and improved upon that.
	1: The original formula combined the Devil element that Doctor Melchior discovered with a highly experimental gene therapy that he stole from me.
	1: Devil became immortal, but also mentally unstable.
	1: You may recall how you were the one hunting Devil down after he stole that research.
	H: Yes, he ended up killing my entire team and wounding my shoulder.
	1: Indeed, he always was a gifted %C63. 
	8: I met him once before he betrayed us, he was quicker and more precise with a gun than any other %C63 that I saw in my days.
	8: Devil was a legend.
	IF -T887-T888, @skipReaction
	1: Indeed he was, I thought of him as my son.

@skipReaction
	1: His betrayal still pains me every day.
	8: Unfortunately, it is what it is.
	H: So where do we go from here?
	1: I'm certain that Devil and Daemonium are up to no good.
	1: I don't know where Devil is, but you have a good lead on Daemonium. 
	1: I want you to check out the bunker below the military research facility.
	1: However, in order to gain access there, you'll have to retrieve the access code from that abandoned research lab.
	1: There are access code files that you can download in the command center of the research lab.
	1: You'll need to upload that to the command center in the military research facility to unlock the elevator. 
	1: Without unlocking the elevator you won't be able to go down.
	1: Most likely, you will also be able to activate a portal point down there.
	1: Once that is active, you can teleport with the teleporter from the military research facility into the bunker.
	1: Do your best to arrest Daemonium and bring him in for justice.
	1: Should that fail, kill him, he's too dangerous to let him run free.
	H: Very well, go to the research lab to retrieve the access code files, then activate the elevator, go down, and arrest or kill Daemonium.
	8: We'll take care of it for you, sir.
	1: Great, I'm glad I can count on you.
	HOST_GIVE T925
	END
	
@nothingHere
	IF T887|T888, @nothingHereActor
	N: There is nothing here yet, please come back at level 60.
	WAIT 3.0
	GOTO EXIT
	
@nothingHereActor
	8: I don't think we're supposed to be here already.
	8: You should go back here once you're level 60.
	WAIT 3.0
	GOTO EXIT
	
@returnFromBunker
	1: Is everything going well?
	H: We're on it, but could you repeat the steps one more time?
	1: Certainly, first visit the command center in the abandoned research lab.
	1: Download the access code files there.
	1: Use this access code files in the command center of the military research facility to gain access to the elevator.
	1: It may be necessary to activate a portal point down there, if you do, then use the teleporter top floor to teleport into the bunker.
	1: Arrest Daemonium and bring him in for justice or kill him if he resists.
	H: Alright, thank you.
	8: Let's kick some Daemonium ass now!
	END
	
@downloadedSecurityFiles
	1: Is everything going well?
	H: I've downloaded the access code files from the abandoned research lab's command center.
	1: Good, just upload these files to the computer in the command center of the military research facility and you should gain access to the elevator.
	1: Once you're in the military research bunker, see if you can find Daemonium.
	1: Arrest him and bring him in for justice or kill him if he resists.
	H: Alright, sir.
	END
	
@finishedBunker
	H: I've returned from the military research bunker.
	1: How did it go, I see you didn't bring Daemonium with you?
	IF -T961, @skipDaemoniumWon
	H: Unfortunately, Daemonium proved harder to defeat than I had imagined.
	H: He escaped and I failed the mission.
	
@skipDaemoniumWon
	IF -T962, @skipDaemoniumLost
	H: I thought I had taken Daemonium down, but just when I wanted to arrest him, the bastard managed to get away.
	8: The only thing that coward is good at is fleeing.
	
@skipDaemoniumLost	
	1: /a sighs.
	1: It is unfortunate indeed, but we may get another opportunity to arrest or kill him.
	1: What else did you accomplish?
	IF -T949-T950, @skipSecurityFootage
	H: I discovered that Daemonium was responsible for creating horribly mutated creatures.
	
@skipSecurityFootage	
	H: I've shut down the growth vats that created %M1706s.
	H: There won't be any new ones in the future now.
	1: That's a relief at least.

	IF -T951, @skipSecurityFootageSilver
	H: I also saw that Silver infiltrated the military research bunker at some point in the past.
	H: He caused the %M1706s to become infertile, disloyal to Daemonium, and stick to only the bunker.
	H: He probably saved the world from a terrible fate, if those %M1706s escaped, we'd have been in trouble.
	1: Thank goodness that he did, yes.
	
@skipSecurityFootageSilver
	IF -T945, @skipMutantResearchDownload
	H: I've downloaded Daemonium's research files about the mutants, we might be able to make use of that some day.
	1: I'd like to have a copy of that data myself.
	1: Undoubtedly, it was based on my research originally.
	WAIT 2.0
	N: You give Samuel a copy of the research data.
	WAIT 2.0
	1: Thank you, I'm sure that this will be useful.
	
@skipMutantResearchDownload	
	IF -T946, @skipMutantResearchDestroyed
	H: I found research files about how Daemonium created the %M1706s.
	1: Excellent, can you give me a copy of these files?
	H: No.
	H: I deemed this research too dangerous and I have destroyed all the information.
	H: Those %M1706s are abominations and nobody should know how they were created.
	1: Mm, I can respect that decision.
	1: Still, I'd have loved to find out if it was based on my research.
	
@skipMutantResearchDestroyed	
	H: I've also met a %M1711.
	1: What happened?
	IF -T963, @skipNegotiatedTruce
	H: I've negotiated a truce with her, as long as we stay out of that bunker, they will leave us alone.
	H: I consider them a minor threat compared to Daemonium.
	1: Mm, I suppose so.
	GOTO @finishedBunkerFinal

@skipNegotiatedTruce
	IF -T964, @skipKilledNightmareQueen
	H: I've killed her, of course.
	H: The less %M1701s that remain, the better it is.
	1: Good, and yes, I agree with you.
	1: At least that's one less thing we need to worry about.
	GOTO @finishedBunkerFinal

@skipKilledNightmareQueen
	IF -T965, @finishedBunkerFinal
	H: I've tried to kill her, but I failed.
	H: She proved to be too big a challenge.
	1: Damn, let's hope that this won't cause us a lot of trouble in the future.
	GOTO @finishedBunkerFinal

@finishedBunkerFinal
	1: Thank you for your report.
	HOST_GIVE T927
	1: I don't have anything new for you right now, but please return to me once you're level 80.
	H: Aye, sir.
	END

@completedBunker
	1: I don't have any new assignments for you yet, but return to me once you are level 80.
	H: Very well, sir.
	END

@receiveEndGameGear
	LOCK 1
	EJECT T172
	
	1: You have done well for yourself, %1.
	1: I think you are almost ready for the final confrontation.
	H: It's been a long and tough journey. 
	IF -C64, @skipExpertGunslingerComment
	H: Especially becoming an %C was a real challenge.
	
@skipExpertGunslingerComment
	1: Yes, it was, but you have done well.
	1: I want to give you all the gear you need to continue your journey.
	1: You'll find that various items have the same capabilities, but this is to allow you to select the gear that you feel most comfortable to use.
	1: In addition, Doc Adlington has created a %I2664 for you to use.
	1: I'm also promoting you to our highest access level and I will give you a %I2688.
	1: Plus, I think my %I2687 will help you better than it will help me.
	H: Thank you, sir, I appreciate it very much.
	WAIT 2.0
	
	HOST_TAKE I2663
	HOST_GIVE I2664
	HOST_GIVE I2680
	HOST_GIVE I2681
	HOST_GIVE I2682
	HOST_GIVE I2683
	HOST_GIVE I2684
	HOST_GIVE I2685
	HOST_GIVE I2686
	HOST_GIVE I2687
	HOST_GIVE I2688
	HOST_GIVE I2689
	HOST_GIVE I2690
	HOST_GIVE I2691
	HOST_GIVE I2692
	HOST_TAKE I2163
	HOST_GIVE T1206
	N: You received the best %C63 gear from Samuel Raven.
	WAIT 2.0
	
	1: Once you are fully dressed, people will think twice before they mess with you.
	1: You represent the best our people have to offer and I want you to know that I'm proud of what you accomplished.
	H: Thank you, sir, the honor is mine.
	1: Now go out there and show them what you are made of.	
	END
	
@startBunker9
	1: Good, you're here.
	1: A situation has developed after your last adventure in the military research bunker.
	H: Oh?
	H: What happened?
	8: I wouldn't be surprised if it's about Daemonium being up to no good again.
	1: I received an alert from one of the security consoles in Bunker 9. 
	1: Recently, I noticed more activity happening in that base.
	1: I'm afraid that trouble is brewing there.
	H: Do you think it could be related to Daemonium or Devil?
	1: That is a possibility yes, but it could also be something else.
	1: Something inside there shut down the camera feeds, I'm literally blind when it comes to Bunker 9.
	8: It has to be somebody who has knowledge of how our equipment works then, or who had enough time to study it.
	1: When a similar situation occured 220 years ago, Atsumori handled it for me.
	1: Unfortunately, I have no clue where he is now.
	1: I've lost contact with him over a hundred years ago.
	1: I did manage to contact his aid, Silver, however.
	1: Silver said that he would look into it, but I've lost contact with him as well now.
	1: Something inside there is blocking my signals.
	1: Your mission is to investigate what is going on there, reactivate base security, and to restore the camera feeds.
	IF T970, @bunker9NishkaTalk
	1: Please talk to Nishka, she can enable the access you need to the teleporter from Bunker 9.
	1: Nishka and Caeran will probably want you to test their upgraded drones first, though.
	1: They're eager to see some test results.
	H: That's good to know.
	GOTO @bunker9NishkaTalkSkip

@bunker9NishkaTalk	
	1: Nishka told me that she has already enabled your teleporter access to Bunker 9.
	1: You can leave at your convenience.
	
@bunker9NishkaTalkSkip
	H: Alright, I suppose I better prepare the mission.
	1: Oh, and before I forget, here is your %I2163.
	1: You've earned your promotion. 
	WAIT 2.0
	HOST_GIVE I2163
	HOST_GIVE T1210
	HOST_GIVE T971
	HOST_TAKE I2162
	WAIT 2.0
	H: Thank you!
	8: Congratulations once more, %1, it's well-earned.
	1: You're now one of the highest-ranking %C63s in the base.
	END
	
@bunker9Continued
	1: I hope the mission is going well?
	H: I'm still working on it, but I don't have any results yet.
	1: Very well, please get to it as soon as possible, though.
	1: My gut tells me something is very wrong there.
	END
	
@bunker9Finished	
	1: I heard that you returned, how did your mission go?
	H: I've met up with Silver and we have dealt with the %M1716s.
	IF -T992, @bunker9NoSecurityCameras 
	1: I noticed that the camera feeds came back online, thank you for taking care of that.
	H: You're welcome.
	H: I discovered that Atsumori had permanently enabled the force field around bunker 9 as well as the %M1717s.
	H: Daemonium tried to mess with the system, but he wasn't able to do any real damage to it, apart from taking the cameras offline.
	1: That's good to know.
	1: Did you run into Daemonium?
	H: No, he was gone by the time I arrived.
	1: I understood that you took care of the %M1700s and messed up the %M1716s' fertilizers as well?
	H: Yes, on top of that, I've also restored power to the base and thinned their numbers.
	IF -T995, @skipKilledOzzy
	H: I also took care of Ozzy, a blind %M1716 who was selling liquor to the %M1716s.
	1: Mm, let's hope that this won't cause trouble down the line.
	1: %I976s kept them preoccupied and relaxed.
	1: They might go look for other forms of entertainment now and attempt to figure out how the teleporter works.
	H: Oh, I didn't think of that.
	8: There is nothing we can do about it now, I guess.
	
@skipKilledOzzy
	IF -T997, @skipMadeBunker9Truce
	H: And last, but not least, I formed a truce with the %M1718, I don't think we'll see more of them again.
	1: That's great news indeed!
	1: It'll be one less thing we need to worry about.

@skipMadeBunker9Truce
	IF -T998, @skipMadeBunker9War
	H: And last, but not least, I killed the %M1718, so they'll be needing a new king now.
	1: /a facepalms.
	1: You killed their king?
	1: I know that he's an idiot, but that was also his best asset.
	1: He single-handedly prevented the %M1716s from becoming more intelligent.
	H: Oh, crap.
	H: I suppose it doesn't help that the other %M1716s vowed to take vengeance.
	1: Shit, no that's terrible indeed.
	1: We need to prepare for a total war with the %M1716s.
	1: There is nothing we can do about it now, let's make preparations and hope for the best.
	
@skipMadeBunker9War	
	HOST_GIVE T1220
	H: That's the end of my report.
	1: Alright, please return to me once you're level 99.
	1: I can give you your new equipment then.
	1: Something tells me that you'll need it.
	END
	
@bunker9NoSecurityCameras
	1: That's good to hear, however, I only had one specific mission for you.
	H: Eh, which was...?
	1: Get the security cameras up and running again!
	H: Oh, right, yeah, I forgot about that.
	H: Where should I do that? 
	1: There is a terminal south east of the teleporter.
	1: You can use login name 'anderson' and password 'doubletime' to login that terminal.
	HOST_GIVE T990
	N: The login name and password were uploaded to your Quest Diary.
	1: Please take care of it immediately, it's very important that I see what's going on in there.
	H: Sure thing, boss.
	8: We'll handle it right away, chief.
	END
	
@bunker9Concluded
	1: It's good to see you again, %1, however, I don't have a new mission for you yet.
	WAIT 2.0
	N: You have reached the end of the %C63 content, more content will follow in the next update.
	END
	
@eventActorClick2
	1: %1, you don't have permission to touch that terminal.
	1: You'd better leave it alone.
	END	
	

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  

SCENE 5006, bunkerenergycore2, SCENE, "Power core" , 0, 0, 0

	ACTOR 1,	"Erick Finkers", monster019, 1, 25, 95	
	POSE 1, 4, 6
	
	CALL 5097@addGunslinger
	
	IF T978, @fixedBunker9PowerCore
	IF V80+T931, @questBunker9
	IF T931, @questFindPocketWatchRepaired
	IF T930, @questFindPocketWatchCompleted
	IF T929, @questFindPocketWatchReturn
	IF T928, @questFindPocketWatchHints
	IF T920+V60, @questFindPocketWatch
	IF T920, @returnedAfterNewCircuitBoardQuest 
	IF T919, @newCircuitBoardQuestCompleted
	IF T912, @newCircuitBoardQuestInProgressContinued
	IF T881, @newCircuitBoardQuestInProgress
	IF V40, @newCircuitBoardQuest
	IF V20, @needNewCircuitBoard

	IF T806, @receivedRewardFromXander
	IF T804, @notYetReceivedRewardFromXander
	IF T803, @repairedPowerCore
	
	COLOR 21
	BKGND bunkerenergycore

	IF T802, @repairConsole 
	IF T800+T801, @repairingPowerCore

	SET visited5006, 1

	1: Hey there, %1, right?
	1: You came at just the right time!
	IF -I2164, @notYetVisitedNishka
	
	H: Yes, Nishka told me how she blew a fuse when she turned on the teleporter.
	1: That's right yes.

@continueIntroduction	
	1: The teleporter asked a lot more power than we had anticipated.
	1: We were very excited when she almost had it up and running, but it seems like we cheered too early.
	1: It's alright though, accidents happen and Nishka is a great engineer.
	1: Anyway, a little north of here is a computer.
	1: Can you login and determine which fuse was blown?
	1: We'll be able to turn the power back on once it's replaced.
	H: Sure, I'll go take a look.
	1: Great!
	1: You'll need %I2160 to enter the computer room.
	1: You can have mine though, I'll make a new one for myself once the power is restored.
	HOST_GIVE I2160
	HOST_GIVE T800
	HOST_GIVE T1207
	WAIT 2.0
	N: You received a %I2160.
	1: This card will allow you access to other places in the bunker as well.
	1: Make sure you equip it or it won't do you much good.
	1: You can always type '/terrain' if you ever wonder why you can't access an area.
	1: The colors will show what is going on, purple is level 1 access, green is level 2.
	1: You'll need a higher clearance card to access other restricted areas though.
	1: However, I'm sure that you'll earn those soon enough if you prove yourself.
	H: So, what's the password?
	H: I mean, I need to login, right?
	1: Ah, yeah, right!
	1: The user name is 'engineer' and the password is 'gunsNroses' and err, a number between ten and twenty.	
	1: I forgot what it was exactly, sorry...
	1: I believe you came from a generation that was great at hacking, though?
	H: Mm, now that you mention it...
	H: I do recall breaking into computers and systems with relative ease.
	H: I had a good hacking tool that assisted me.
	1: You can probably teach me a thing or two about that!
	1: However, should hacking fail, then I have a little help for you.
	
	HOST_GIVE T801
	HOST_GIVE I975.2
	WAIT 2.0
	N: You received 2 %I975s.
	WAIT 1.0
	1: You can use these to attack the terminal and retrieve the password that way.
	N: (If you already know how terminals work, then you can skip the rest of the scene.)
	
	H: It sounds like less fun, but I suppose that could work.
	1: Well, a little heads up, these %I975s are expensive and hard to come by. 
	1: You'll only want to use them as a last resort if nothing else works.
	H: I'll keep that mind.
	1: Eh, another thing...
	1: The computer locks up after five failed attempts.
	1: However, if you reopen the terminal then you can try again, the password probably had a minor reset though.
	1: It tends to change the last number when reopen the terminal, which is part of why I can't recall the exact password.
	H: /a sighs.
	H: It sounds like I have my work cut out for me.
	1: You'll have to click on the blinking cursor on the screen before you can input a command.
	1: You can always type 'help' whenever the terminal asks for input.
	1: That will bring up the help menu too.
	1: Come back to me if you need more help with that computer.	
	1: Good luck!
	END

@notYetVisitedNishka
	H: Oh, what's going on? 
	H: Why are the lights out?
	1: Eh, Nishka had a little accident when trying to repair the teleporter.
	GOTO @continueIntroduction
	
@repairingPowerCore
	
	COMPARE #<visited5006>, 3
	IF> @repairingPowerCoreExtraHelp

	1: How are the repairs coming along?
	H: I'm still working on it. 
	H: What was I supposed to do again?
	1: Go to the Power core computer north of here and right click on Terminal #1.
	1: Terminal #1 is the one on the right.
	1: Clicking on it will open the terminal. 
	1: Then figure out the password for user name 'engineer', the first part of the password is 'gunsNroses1'.
	1: However, I can't remember the last digit, which can be anything from 0 to 9.
	1: Your best bet is probably to use the hack tool to retrieve the password.
	1: Once you managed to login, you need to run the 'power_management.exe' program.
	1: That program will tell you which fuse is offline.
	1: When you have that information, return to me.
	1: I'll let you into the terminal then where you can fix the fuse. 
	1: Return to me if you continue to have problems.
	H: Alright, thank you.
	1: You're welcome, good luck.
	ADD visited5006, 1
	END
	
@repairingPowerCoreExtraHelp
	1: Still having trouble, eh?
	H: Yeah, the bloody terminal keeps locking me out.
	1: Mm... I may have something else you could try.
	1: I usually don't do this, but it sounds like you could use a little extra help.
	1: Try logging in with user name 'admin' and password 'admin'.
	1: It should allow you access to passwords.txt.
	1: You can find the password for the engineer account in there.
	1: Make sure to access the Help function in the terminal to see how you can use the different commands.
	H: Alright, thanks.
	1: Good luck.
	END
	
@repairConsole
	IF I2164, @readyToRepairConsole
	1: So, you got the password?
	H: Yup, I did. 
	1: Oh, I see you don't have a %I2164 yet?
	1: You'll need one if you're going to make any repairs.
	1: I believe Nishka has a spare one.
	1: She's west of here at the Teleporter.
	END	
	
@readyToRepairConsole
	ACTOR 2, "Switch board", staticactors, 1, 75, 90
	
	1: So, you know which fuse burned through and you have a %I2164.
	IF I978, @skipGivingGoodFuse
	1: The only thing missing now is a %I978, but I have one of those for you.
	HOST_GIVE I978
	N: You received a %I978.
	WAIT 2.0
	
@skipGivingGoodFuse	
	1: I'd say that you're ready to replace the fuse and repair that console.	
	1: Right click on the switch board to open the console.
	END

@eventActorClick2
	SET scene, #<scene.id>
	GOTO SCENE 5016
	
@repairedPowerCore
	1: Excellent job!
	1: The power is back online, yeehaa!
	HOST_GIVE T804
	1: I'm afraid that it's not a permanent fix though.
	1: We're running on recycled spare parts. 
	1: Truth be told, we're living on borrowed time, what we really need is a complete replacement for our circuit board.
	1: However, that's a worry for another time.
	1: Visit Xander Quickshot in The Shop to our west and he'll give you a reward for your troubles.
	END
	
@notYetReceivedRewardFromXander
	1: Don't forget to visit Xander to get your reward.
	1: You can find him at The Shop west of here.
	END

@receivedRewardFromXander
	1: Do you like your new gun?
	IF -T820, @noGunRangeYet
	H: I sure do, it shoots like a charm!
	1: Nice, I think Xander gave you one of the best we have in stock.
	1: He was getting antsy for not being able to shoot at the gun range.
	1: Ever since you fixed the lights for him, you made a friend for life.
	END

@noGunRangeYet
	H: I don't know, I haven't tried the gun range yet.
	1: You really should!
	1: Nothing is more relaxing than shooting a couple of bullet holes in those flying targets.
	1: Xander is always eager to take people there, it's his baby.
	END
	
@needNewCircuitBoard
	1: If you come across a new circuit board somewhere, then please bring it here.
	1: We need to completely overhaul the current one to keep the power running.
	H: I'll let you know when I find something.
	END
		
@newCircuitBoardQuest	
	1: Hi %1, I'm glad you didn't forget about me.
	1: Caeran told me how he and Nishka pinged a military research facility.
	1: Can you look around there for a %I2176? (Yes/No)
	ASK 300
	IF -YES, @newCircuitBoardQuestNotAccepted
	
	HOST_GIVE T881
	1: I was hoping you would. 
	1: %I2176 is great for distributing power like what we need in #<str.mapName>.
	1: I'll need you to install it and update the settings as well once you found one.
	1: Of course, I'll make it worth your trouble.
	H: Alright, I'll see what I can find.
	END

@newCircuitBoardQuestNotAccepted	
	1: Well, I'm afraid that without a replacement we'll soon be living in the dark.
	1: It'll also kill all the %C63s still in stasis.
	1: Paul has done his best to revive as many people as possible, but we can only support so many people before we run out of resources here.
	1: Come back to me if you change your mind.
	WAIT 3.0
	GOTO EXIT
	
@newCircuitBoardQuestInProgress
	1: Did you find a %I2176 already?
	H: No, sorry, I'm still working on it.
	1: The sooner you find one, the better it'll be.
	END

@newCircuitBoardQuestInProgressContinued
	1: Did you find a %I2176 already? 
	H: Yes, I have it right here.
	8: It wasn't easy, but we got the job done, sir.
	1: Excellent!
	1: Well, there is no time like the present, we better install that thing right away.
	1: I need you to wire two high voltage nodes on the left and right side of the board.
	1: Below that I need one low voltage node on the left and right, and below that one should be a regular node.
	1: The top should have two encrypted data nodes while the bottom should have two security nodes.
	1: All nodes need to be enabled.
	H: Alright, that doesn't sound too hard.
	WAIT 2.0
	SOUND turn-power-off
	BKGND bunkerenergycore
	WAIT 3.0
	GOTO SCENE 5113
	
@newCircuitBoardQuestCompleted
	BKGND bunkerenergycore
	1: Yes, you've done it!
	1: Let's turn the power back on.	
	SOUND turn-power-on
	BKGND bunkerenergycore2	
	WAIT 3.0
	1: Yup, everything checks out just fine.
	1: I'm so happy I could kiss you right now.
	1: With these updates we'll keep the power core running for at least another thousand years.
	H: A thousand years, eh?
	8: Damn, that's a long time.
	1: Yes, this stuff is build to last, our old circuit board was a remodeled %I2177 though.
	1: It was a good board, but it was meant for security applications and not for rerouting power.
	1: I hope that we'll be able to create new boards before this one runs out, but with a thousand years to go we should be fine.
	8: Our technology never ceases to amaze me.
	1: Naturally, this effort won't go unrewarded.
	1: While you were busy, I had a chat with the Commander himself, Samuel Raven.
	1: He agreed with me that you have earned a %I2162 if you could pull this off.
	IF V60, @skipLowLevelCommentBlueBadge
	1: I know that you won't be able to use it just yet, but it gives you something to look forward to.
	
@skipLowLevelCommentBlueBadge
	H: Thank you, sir, it's much appreciated!
	WAIT 2.0
	N: You received a %I2162.
	HOST_GIVE I2162
	HOST_GIVE T920
	WAIT 2.0
	1: You're welcome, %1.
	1: If you keep this up, then I'll end saluting you instead!
	8: Congratulations, %1, it's well earned.
	END
	
@returnedAfterNewCircuitBoardQuest 
	1: I don't have anything to do for you until level 60, %1, but feel free to hang around.
	IF T887|T888, @returnedAfterNewCircuitBoardQuestActor
	END	
	
@returnedAfterNewCircuitBoardQuestActor
	WAIT 10
	8: Okay, this hanging out is boring, can we do something more exiciting now?
	H: Like shooting stuff up?
	8: Hell yeah!
	1: Oh no you won't, not at my power core!
	WAIT 3.0
	GOTO EXIT
	
@questFindPocketWatch	
	1: It's good to see you again, %1.
	1: Say, I could use your help. 
	1: I tried fixing a switch board west of the base yesterday, but I messed some stuff up, and I couldn't get it to work.
	1: Can you maybe take a look and see if you can get it to work? (Yes/No)
	ASK 300 
	IF -YES, @questFindPocketWatchRefuse
	1: Great, I'm glad to hear so.
	1: I also lost my %I2642 there and I'd appreciate it if you could look for it.
	1: I heard a pretty bad crunchy sound, so I have little hope that it's still in one piece, but you never know, right?
	H: I can always take a look for you, so what do I need to do?
	1: It's simple, you need to switch the six switches in the correct order to turn the power back on.
	1: If you flip one in the wrong order then it'll give you a minor shock and you need to start over again.
	1: I believe the second switch in the top row needs to be flipped first, and then the one below it. 
	1: After that the one left or right of it, and then the one above it.
	1: I burned my fingers so badly and was cursing so loudly yesterday that I forgot about the others.
	1: Thankfully, Doc patched me up, but that took the rest of my midday.
	1: Anyway, good luck.
	HOST_GIVE T928
	IF T887|T888, @questFindPocketWatchActor
	END
	
@questFindPocketWatchActor
	8: I hope that %I2642 didn't break, it'd be a real shame. 
	SET item.id, "2642"
	1: For sure, the item cost me #<item.price> GP, it wasn't exactly cheap.
	H: Oh wow, you can say that again yeah.
	END

@questFindPocketWatchRefuse
	1: Damn, well, let me know if you change your mind.
	1: I also lost my %I2642 there and I was hoping you could look for that as well.
	END
	
@questFindPocketWatchHints
	1: Back so soon?
	H: Yeah, I'm having issues figuring it out.
	1: Ah, well, you need to flip the switch in the middle of the top row first, then the one below it.
	1: After that it was either left or right one of the bottom row, followed by the one above that.
	1: After that you only have two remaining buttons, it shouldn't be too hard to figure it out then.
	H: Alright, I'll give it a try.
	END
	
@questFindPocketWatchReturn
	1: Sweet, judging the power read outs you managed to flip the switches in the correct order!
	H: Not only that, I also found a %I2183.
	N: Erick takes a look at the %I2183.
	WAIT 3.0
	1: Eh-, you can keep it.
	IF I980, @skipGivingSpareParts
	1: In fact, here you can have these %I980 too.
	HOST_GIVE I980

@skipGivingSpareParts
	1: Maybe you can try to repair it at that workshop you found in the abandoned research lab?
	1: You'll need %I980 to do so.
	H: Mm, I suppose it's worth a shot.
	HOST_GIVE T930
	8: It's delicate work, but I'm sure we'll manage, %1.
	END
	
@questFindPocketWatchCompleted
	1: Back so soon? 
	1: I thought you'd give repairing it at the workshop in the abandoned research lab a try.
	H: I will, I just haven't gotten around to it yet.
	8: Yeah, it's not as if we don't have other things to do as well.
	END

@questFindPocketWatchRepaired
	1: My, my, it looks like you pulled it off, you repaired that %I2183 and turned it into a %I2642 again!
	H: It wasn't easy, but I'm proud to wear it.
	1: As you should, as you should. 
	1: I hope it'll give you the same joy that it once gave me.
	END
	
@questBunker9
	IF -T971, @questBunker9NoTipYet
	1: I heard that you're going to Bunker 9?
	H: Yeah, it looks like I will.
	1: I'm sure Samuel gave you some tips already, but he doesn't know a lot about the power cores.
	1: Bunker 9 is one of our oldest bunkers. 
	1: It's younger than Bunker 3, but only by a few years.
	1: Our people used to run top secret experiments there.
	1: The base also needed a lot of power and it had a weird experimental system to keep the power core running and cooled at the same time.
	H: Oh? 
	H: What does that mean?
	1: To keep the power core from overloading, it rotated between different switch boards each with its own cooling system.
	1: The system had various fail safes to prevent disaster.
	1: What this effectively means is, if you end up replacing the circuit board in that power core, then you need to be very careful about the order that you boot up the system again.
	1: You need to turn the switches on in a specific order. 
	1: If you fail to do so, then you'll get shocked at the very least and cause a meltdown at worst.
	1: A meltdown means you instantly destroy the base and contaminate the surrounding area for hundreds, if not thousands, of years to come.
	H: That sounds bad.
	8: Bad?
	8: Try terrible, we need to prevent that from happening!
	1: Yeah, it's not something you want to be responsible for, so please don't mess up the start up procedure.
	1: Unfortunately, you'll have to figure out the correct procedure once you're there.
	1: All I can tell you is that there are four switches surrounding the power core and that you need to turn on each switch just once.
	H: Very well, I'll try to prevent a nuclear disaster.
	1: That's all I'm asking for, good luck, %1.
	END	

@questBunker9NoTipYet
	1: I hope everything is going okay for you. 
	H: Things are working out so far.
	1: Alright, that's good to know.
	1: Hey, if you ever need some tips about the other bunkers out there, then come to me.
	1: I've been reading up on ancient logs lately so I can contribute my part to your missions.
	8: It's always useful to have good intel on what we can expect.
	END
	
@fixedBunker9PowerCore
	1: I hope that power core in Bunker 9 didn't give you too many issues.
	H: Let's just say that it was a shocking experience to get the damned thing up and running again.
	1: Say no more, I feel your pain.
	8: The hair on the back of my neck is still standing straight from all the static electricity.
	END
	

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  

SCENE 5007, bunkerbrokenpods, SCENE, "Broken pods" , 0, 0, 0

	MUSIC #silence
	
	IF T871, @nothingLeft
	IF -T868+-T869+-T870, @nothingHere
	
	N: Only silence initially greets you when you investigate the broken pods.
	WAIT 4.0
	SOUND attroarvampire1
	ACTOR 1, "Nightmare", elemental012, 6, -10, 90
	POSE 6, 7
	MOVE 1, 20, 90
	1: Hold your guns, %C.
	1: Not all is as it appears.
	
	IF T870, @talkedToQueen
	IF -T869, @failedToKillQueen
	1: You have killed our queen.
	IF -T864, @skipHavingSavedYoungOnes
	1: However, you have also spared the life of our young ones.
	1: Still,
	
@skipHavingSavedYoungOnes
	1: You know little of the truth and we do not trust you.
	1: Once you learn the truth you might change your mind.
	1: We took those who were here.
	1: Those who were supposed to become us.
	1: Seek the truth before you seek us again.	
	GOTO @end
	
@talkedToQueen
	1: Our queen talked to us.
	
	IF -T864, @skipHavingSavedYoungOnes1
	1: You spared the life of our young ones.
	
@skipHavingSavedYoungOnes1	
	1: You have earned a small degree of her trust.
	1: We have taken those who were here.
	1: Those who were supposed to become us.
	1: Be careful who you trust.
	GOTO @end
	
@failedToKillQueen
	1: You failed to kill our queen, she has a message for you.
	1: We took those who slept here.
	1: Their bodies belong to us.
	1: They were supposed to turn into us. 
	
	IF -T864, @skipHavingSavedYoungOnes2
	1: You have earned a small degree of our trust for letting our young ones live in the growth vats.
	
@skipHavingSavedYoungOnes2	
	1: Leave us alone and we will leave you alone.
	GOTO @end

@end	
	HOST_GIVE T871
	WAIT 2.0
	MOVE 1, -20, 90
	H: Wait, I have questions!
	1: Answers will come later.
	H: Great...
	END
	
@nothingLeft
	N: There is nothing here.
	END
	
@nothingHere
	ACTOR 1,	"Doc Adlington", gun001, 1, -10, 90
	POSE 1, 4
	MOVE 1, 20, 90
	1: I see you have come to investigate the broken statis pods as well, %1?
	H: Yes, do you have any inkling what this could have caused?
	1: I need to investigate it further, but it may have to do with that %M1700 that you encountered before.
	1: This may sound strange, but I believe you will find more answers in the abandoned research facility.
	H: I suppose I could get back to investigating everything there is to see there first.
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  

SCENE 5008, bunkermesshall, SCENE, "Mess hall" , 0, 0, 0

	CALL 5097@addGunslinger

	ACTOR 1, "Chris Robbinson", monster024, 1, 35, 86
	ACTOR 20, "Jukebox", staticactors, 14, 79, 71
	
	IF V80+T1204-T1205, @gunslingerPromotion
	
	IF -T804, @skipJukebox
	CALL @playRandom
	
@skipJukebox		
	IF -T804, @powerIsDown
	OFFER	976, 977  

@continueAfterPowerFixCheck

	IF T818, @return ; start return quests from this @label
	IF T817, @memoryRecall
	IF T816-T810, @helpDocFirst
	IF T816+T804, @powerIsFixed
	IF T816, @alreadyMetChris
	
	1: Hey there, %1, word travels fast around here.
	1: I heard you woke up, it's great to see a new face.
	1: I'm Chris, %0.
	1: From what I understood my great-great-great-great... and so on... grandfather, Harry Robbinson, knew you.
	1: I understood that he was a great bartender.
	1: Unfortunately, I didn't inherit his talents.
	1: Heck, I probably don't even look like him.
	H: Eh, I'm sorry, I don't remember him.
	1: Oh...
	1: I hoped you could tell me more about my family.
	HOST_GIVE T816
	IF T804, @powerIsFixed
	1: Ah well, it's good getting to know you anyway!
	1: Hey, do you happen to know when the lights will be back on?
	1: I can't sell any liquor while the power doesn't work.
	H: We're working on it, I'm afraid you'll have to be patient.
	1: Alright, come back to me once the power works again.
	END
	
@eventActorClick20
	IF -T804, @noPowerNoMusic
	CALL @startMusic
	END

@noPowerNoMusic
	N: You need to fix the power first before you can listen to any songs on the jukebox.
	END
	
@startMusic
	SEL 20
	' Select a song to play.
	MENU "Country Love 1=@playMusic1", "Country Love 2=@playMusic2", "The Fragrance of Dark Colored Coffee=@playMusic3", "Alabama Born Country=@playMusic4", "Daddy Sang Bass - Johnny Cash=@playMusic5", "I Walk The Line - Johnny Cash=@playMusic6", "Ring Of Fire - Johnny Cash=@playMusic7", "A Foggy Day=@playMusic8", "Be Happy=@playMusic9", "As Time Goes By=@playMusic10", "Sweet Whiskey Lies=@playMusic11", "Whiskey In The Jar=@playMusic12",  "Play a random song=@playRandom", "Cancel=@end"
	END
	
@playRandom
	SET temp, %R11
	GOTO @playMusic#<temp>
	RETURN
	
@playMusic1	
	' Playing 'Country Love 1'.
	MUSIC country-Love1
	RETURN
	
@playMusic2	
	' Playing 'Country Love 2'.
	MUSIC country-Love2
	RETURN
	
@playMusic3
	' Playing 'The Fragrance of Dark Colored Coffee'.
	MUSIC Phoenix_Wright_-_Godot
	RETURN
	
@playMusic4	
	' Playing 'Alabama Born Country'.
	MUSIC alabama-born-country
	RETURN
	
@playMusic5	
	' Playing 'Daddy Sang Bass by Johnny Cash'.
	MUSIC daddy-sang-bass
	RETURN
	
@playMusic6	
	' Playing 'I Walk The Line by Johnny Cash'.
	MUSIC I-walk-the-line
	RETURN
	
@playMusic7	
	' Playing 'Ring Of Fire by Johnny Cash'.
	MUSIC ring-of-fire
	RETURN
	
@playMusic8	
	' Playing 'A Foggy Day'.
	MUSIC a-foggy-day
	RETURN
	
@playMusic9
	' Playing 'Be Happy'.
	MUSIC be-happy
	RETURN
	
@playMusic10	
	' Playing 'As Time Goes By'.
	MUSIC as-time-goes-by
	RETURN

@playMusic11	
	' Playing 'Sweet Whiskey Lies'.
	MUSIC sweet-whiskey-lies
	RETURN
	
@end
	END
	
@powerIsDown
	COLOR 21
	GOTO @continueAfterPowerFixCheck
	
@alreadyMetChris
	1: Welcome back, %1.
	1: I'd love to share a drink with you, but with the power still out it's not exactly a great mood.
	H: I agree, I'll come back later.
	END

@helpDocFirst
	OFFER 0
	1: I'd love to offer you a drink, but you should help Doc Adlington to the north east first.
	1: She can't help any of my patrons who drank too much without supplies.
	1: I'm keeping the bar closed until then to prevent any problems.
	END
	
@powerIsFixed
	IF -T810, @helpDocFirst
	1: Hey, what if I give you a %I977, maybe that'll bring back some memories?
	H: We could always try.
	1: Alright, here you go, drink up.
	HOST_GIVE I977
	HOST_GIVE T817
	N: You received a %I977, drink it to see if it jars any memories.
	END
	
@memoryRecall
	1: Well, do you have any memories of my great grandfather yet?
	1: You should drink a %I977 to help your memory.
	END
	
@eventHostGive
	COMPARE #<item.id>, "977"
	IF= @drinkAGlassOfWhiskey
	COMPARE #<item.id>, "976"
	IF= @drinkQuotes
	N: Try drinking a %I977 instead.
	END		
	
@drinkQuotes
	CALL 5199@gunslingerDrinkGoodStuff
	END 
	
@drinkAGlassOfWhiskey
	H: That hits the spot!

	IF T828, @completedAlcoholCollecting
	IF T827-T828, @howIsAlcoholCollectingGoing
	IF T818-T827, @requestToCollectAllKnownAlcohol

	1: /a gives you a hopeful look.
	H: Mm, your great grandfather... Harry Robbinson, right?
	1: Yes, that's him! 
	1: What can you tell me about him!?	
	N: You twirl your glass and take another sip. 
	MOVE 20, -79, 71, 1
	SOUND flashback
	MUSIC a-foggy-day
	FX 1
	WAIT 3.0
	BKGND bar2
	FX 0
	H: I recall a day when I got back from a mission. 
	H: We had to hunt down a traitor who had stolen some critical tech from us.
	H: Commander Raven, the big boss, had put me and a team of specialists in charge of recovering the tech.
	H: We also had to hunt down the bastard that stole it.
	H: The mission was a total bust, though. 
	H: Whoever that guy was, he had some serious skills.
	H: He shot all my buddies one by one and wounded my shoulder.
	H: Later I heard he was one of the best %C63s ever, but that his power got to him and he went rogue.
	H: The Doc fixed me up good, but it was your granddaddy who really helped me out.
	H: Your old man poured me one of the finest cocktails known to mankind.
	H: It sure hit the sweet spot.
	H: Good Ol' Harry had a gift for liquor and he was an expert mixologist.
	H: It made me forget about all my troubles and instead I focused on the future.
	H: Harry saved more men and women with his skills than I dare to count. 
	H: This drink you poured me brought me right back to sitting at the bar with him, sharing my stories and listening to his worldy advice while he cleaned a glass or two.
	H: Well, that's the story of me and your old man.
	SOUND flashback
	FX 1
	WAIT 3.0
	BKGND bunkermesshall
	FX 0
	MOVE 20, 79, 71, 1
	1: Oh, wow... 
	1: I never knew.
	1: Please, let me give you a little extra to help you out.
	HOST_GIVE T818
	HOST_GIVE I976
	HOST_GIVE I977.2
	N: You received 2 %I977 and 1 %I976.
	WAIT 1.0
	
@requestToCollectAllKnownAlcohol	
	1: Hey, can you do me a favor? 
	H: Name it.
	1: I want to become an expert mixologist like my great grandfather.
	1: Can you collect all known alcohol in the world for me? (Yes/No)
	ASK 300
	IF YES, @acceptMission
	1: Oh, well, if you ever change your mind, just drink a %I977 and we'll talk again.
	END	
	
@acceptMission	
	1: Sweet!
	HOST_GIVE T827
	1: I'll be sure to make it worth your while!
	1: In the meantime, have a drink on me.
	HOST_GIVE I977
	N: You received a %I977.
	END
	
@howIsAlcoholCollectingGoing
	MUSIC foggy-day
	IF I103+I104+I105+I106+I107+I108+I109+I110+I119+I124, @hasAllAlcohol
	1: How is the alcohol collecting going?
	H: I don't have everything yet that you asked for.
	H: Do you have any idea where I could get it?
	1: I heard there is place called 'Lefty' in Maku's Tunner to the east of us that sells a lot of good stuff.
	1: Maybe you can check there?
	H: I suppose I could do that. 
	H: I'll get back to it soon.
	END

@hasAllAlcohol
	1: Awesome, it seems like you have it all!
	WAIT 2.0
	HOST_TAKE I103
	HOST_TAKE I104
	HOST_TAKE I105
	HOST_TAKE I106
	HOST_TAKE I107
	HOST_TAKE I108
	HOST_TAKE I109
	HOST_TAKE I110
	HOST_TAKE I119
	HOST_TAKE I124
	N: Chris takes all the requested alcohol off your hands.
	WAIT 2.0
	1: Let's see...
	N: Chris investigates the different types of alcohol.
	WAIT 3.0
	N: He starts mixing and matching the different liquors together in a single blend.
	WAIT 4.0
	1: /a takes a sip.
	SOUND hitpainmale1
	WAIT 3.0
	1: It's horrible!
	1: I don't know how my great grandfather did it, but good lord, that stuff was awful!
	1: Still, I'm intrigued.
	1: I'll keep trying until I have something that works.
	1: I promised you a reward though and I'll make good on my word.
	1: Here you go, 10 %I976s. 
	HOST_GIVE I976.10
	HOST_GIVE T828
	N: You receive 10 %I976s.
	WAIT 2.0
	1: I'm sure you'll put these to good use.
	H: I definitely will, thank you, good sir.
	END
	
@completedAlcoholCollecting
	1: I hope you can find me some new recipes in the future.
	END	
	
@return
	IF T827-T828, @howIsAlcoholCollectingGoing

	ACTOR 2, "Sandra Bosbes", pet002, 4, 69,71, 8
	FACE 2, 0
	ACTOR 3, "Yuri Zandstra", a63, 4, 75, 93, 9
	FACE 3, 0
	ACTOR 4, "Sharon van den Berg", pet008, 1, 47, 69, 7

	IF T911-T918, @foundRecipeWhiskeySour
	
	1: Welcome back, %1.
	1: As you can see, folks are returning now that the power is restored.
	3: /a burps.
	SOUND burp2
	3: Excuse me.
	4: I could use another %I977.
	1: Coming right up!
	2: I should probably head to my bunk soon, but it's nice to have some R&R.
	END
	
@foundRecipeWhiskeySour
	H: Chris, I just returned from the military research facility.
	1: Oh, did you find anything?
	H: Yes, it's one of the greatest finds in recent history!
	H: I found a recipe for pouring a %I2181.
	1: Really!?
	1: Please let me have it.
	N: You hand over the recipe for pouring a %I2181.
	WAIT 2.0
	1: /a reads the recipe.
	WAIT 3.0
	1: Well, as luck would have it, I have all the ingredients right here!
	1: Just give me a moment.
	SOUND cocktail-shaking
	WAIT 4.0
	SOUND pouring-whiskey
	WAIT 2.5
	1: There you go!
	N: You received a %I2181.
	HOST_GIVE I2181
	HOST_GIVE T918
	WAIT 2.0
	H: Thank you, cheers!
	IF T887|T888, @meetActor
	END
	
@meetActor
	IF -T887, @skipYuku
	SET temp, "Yuku"
	SET temp2, "she"

@skipYuku
	IF -T888, @skipCarlos
	SET temp, "Carlos"
	SET temp2, "he"
	
@skipCarlos	
	H: During my mission, I also extracted #<temp> from a stasis pod, #<temp2> knew Harry from back in the day.
	1: No way!
	8: Yes way!
	8: And boy do I have some stories to tell about good old Harry...
	WAIT 3.0
	N: You realize that #<temp> will probably take several hours of catching up with Chris.
	N: You quietly leave the mess hall.
	WAIT 5.0
	GOTO EXIT
	
@gunslingerPromotion
	MUSIC CelesMix

	ACTOR 0, "Paul van Doorn",  monster032, 	4,  66, 98	
	ACTOR 1, "Samuel Raven",	monster002, 	4,  29, 75
	ACTOR 2, "Chris Robbinson", monster024, 	1,  76, 90
	ACTOR 3, "Nishka", 			gun003, 		4,  33, 87	
	ACTOR 4, "Caeran", 			monster035, 	1,  37, 87
	ACTOR 5, "Xander Quickshot",gun011, 		1,  39, 64
	ACTOR 6, "Erick Finkers", 	monster019, 	1,  54, 90	
	ACTOR 7, "Doc Adlington", 	gun001, 		1,  88, 81
	MOVE  8, 									    45, 91, 1	;ACTOR 8 = Yuku or Carlos
	ACTOR 9, "Sandra Bosbes", 	pet002, 		4,  69, 71, 8
	ACTOR 10, "Yuri Zandstra", 	a63, 			4,  56, 69, 9
	ACTOR 11, "Sharon van den Berg",pet008, 	1,  50, 69, 7
	ACTOR 12, "Brandon Havik", 	gun002, 		4,  81, 95
	
	SEL 3
	POSE 1, 4
	SEL 4
	POSE 1, 4
	SEL 5
	POSE 1, 2
	SEL 6
	POSE 1, 4
	SEL 7
	POSE 1, 4
	SEL 9
	POSE 1, 4
	SEL 10
	POSE 1, 4
	SEL 11
	POSE 1, 4
	SEL 12
	POSE 1, 4
	
	CALL @faceHost
	
	4: There you are, you sure kept us waiting.
	WAIT 2.0	
	1: I am proud to announce that we welcome a new %C64 in our midst today.
	1: Becoming an %C64 is a great achievement that only few accomplish.
	1: %1 has proven #<g.his> bravery, intelligence, wits, and deadly accuracy.
	1: You have shown that you are trustworthy, loyal, and will go above and beyond the call of duty.
	1: I am honored to count you as a member of my team.
	6: Speech, speech!
	1: Is there anything you'd like to say?
	ASK 300
	IF NO, @promotionShy	
	STRSTR #<lastAsk>, "thank"
	IF> @promotionThank
	STRSTR #<lastAsk>, "easy"
	IF> @promotionEasy
	STRSTR #<lastAsk>, "glad"
	IF> @promotionHappy
	STRSTR #<lastAsk>, "happy"
	IF> @promotionHappy
	STRSTR #<lastAsk>, "..."
	IF>	@promotionShy
	STRSTR #<lastAsk>, "feel honor"
	IF> @promotionHonor
	
	5: That's well spoken.
	6: Yeah, I feel the same way.
	8: Way to go, %1!
	
	CALL @faceHost
	
@promotionContinue	
	1: %1, I hereby promote you %C64.
	WAIT 2
	SET num.hostClass, "64"
	HOST_GIVE T1205
	SOUND applause
	2: Woohoo!
	5: There is a new %C64 in town and #<g.his> name is %1.
	8: Heck yeah!
	0: You've exceeded my expectations, %1.
	6: I'm damn proud of you, kid.
	7: Very well done, %1, congratulations.
	3: Simply awesome and well deserved.
	CALL @faceHost	
	SEL 12
	' Very impressive, I wish I was as skilled as you are.
	4: Way to go, %1!
	9: Nice, I'm proud of you.
	1: You have done well, %1, congratulations with this major achievement.
	SEL 10
	' Very nice!	
	SEL 11
	' You're incredible.
	2: It's party time now!
	2: First round is on the house!
	SOUND cocktail-shaking
	HOST_GIVE I976
	N: You received an %I976.
	WAIT 1.0
	SOUND drinkahh
	WAIT 1.5
	SOUND burp2
	8: Woohoo, party time!
	END	
	
@faceHost
	FACE 0, 2
	FACE 1, 2
	FACE 2, 2
	FACE 3, 2
	FACE 4, 2
	FACE 5, 2
	FACE 6, 2
	FACE 7, 2
	FACE 8, 2
	FACE 9, 2
	FACE 10, 2
	FACE 11, 2
	FACE 12, 2
	RETURN
	
@promotionShy	
	3: No need to feel shy, %1, you've done great.
	5: Hell yeah, I knew we could count on you the first time I saw you!
	8: I'll always have your back, %1.
	GOTO @promotionContinue
	
@promotionThank
	7: It is us who should be thanking you instead, %1.
	6: You have done us a great favor and you should be proud of your accomplishments.
	8: I am probably the most grateful of us all, without you I'd be dead.
	GOTO @promotionContinue
	
@promotionEasy
	5: Hell, if you think this was easy, then maybe I should make the gun range more difficult.
	8: I for one am glad to fight by your side, %1.
	4: It didn't look so easy to me, but I suppose it just shows how talented you are.
	GOTO @promotionContinue
	
@promotionHappy
	0: You've earned it all by yourself, %1, you have every right to be happy about that.
	2: I think I speak for all of us that we're happy that you've made it as well.
	8: I'll gladly back you up any day of the week.
	GOTO @promotionContinue
	
@promotionHonor
	6: Believe me, the honor is all ours.
	8: You've worked blood, sweat, and tears for this, I'm honored to know you.
	7: You have made great contributions to our small group, %1.
	GOTO @promotionContinue
	

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; The floors are initially flooded in this scene, the hero will have to fix this.

SCENE 5009, bunkerflooded02, SCENE, "Passage" , 0, 0, 0


	IF T815, @shortCircuitRepaired

	; set fx manually so that once it's cleared the fx can be set to 0
	FX 	2
	SOUND	 high-voltage-discharge
	
	IF -I2164, @skipSwitchSetUp
	CALL 5099@setUpSwitch
	
	MOVE 14, 90, 85, 1
	MOVE 15, 90, 45, 1
	MOVE 16, 90, 25, 1
	
	ACTOR 1, "", staticactors, 1, 30, 70
	ACTOR 2, "", staticactors, 2, 50, 70
	ACTOR 3, "", staticactors, 3, 70, 70 
	
	SET powerFixed, 0
	SET floorFlooded, 1
	SET plumpingFixed, 0	

@skipSwitchSetUp	
	SET tempHP, #<num.hostMaxHP>
	DIV tempHP, 4
	ADD tempHP, 1
	WAIT 3.0

	COMPARE #<num.hostY>, "70"
	IF< @skipShock

	N: You receive an electric shock for standing in the water!
	TAKE	H#<tempHP>
	IF ALIVE, @skipShock
	N: The electric shock killed you.
	GOTO @died

@skipShock
	IF -I2164, @hasNoToolbox		
	N: The floor is flooded and a short circuit is causing a dangerous situation.
	END

@shortCircuitRepaired
	END	
	
@eventActorClick1
	IF T815, @shortCircuitRepaired
	IF DEAD, @died
	
	COMPARE #<power>, "1"
	IF= @getShock

	COMPARE #<floorFlooded>, "1"
	IF= @powerFixBreaksAgain
	
	COMPARE #<powerFixed>, "1"
	IF= @alreadyFixedPower
	
	SET powerFixed, "1"
	N: You repair the short circuit.
	WAIT 2.0
	END

@eventActorClick2
	IF T815, @shortCircuitRepaired
	IF DEAD, @died
	
	COMPARE #<power>, "1"
	IF= @getShock
	
	COMPARE #<plumpingFixed>, "0"
	IF= @plumpingNotFixed
	
	COMPARE #<floorFlooded>, "0"
	IF= @alreadyMoppedFloor
	
	SET floorFlooded, "0"
	N: You mop the floor.
	FX 0
	WAIT 2.0
	END
	
@eventActorClick3
	IF T815, @shortCircuitRepaired
	IF DEAD, @died
	
	COMPARE #<power>, "1"
	IF= @getShock
	
	COMPARE #<plumpingFixed>, "1"
	IF= @alreadyFixedPlumping
	
	SET plumpingFixed, "1"
	N: You fix the plumbing.
	WAIT 2.0
	END	

@getShock
	N: You received a shock!
	TAKE H#<tempHP>
	SOUND tesla_shot
	WAIT 2.0
	IF DEAD, @died
	END
	
@powerFixBreaksAgain	
	N: You repair the short circuit.
	WAIT 3.0
	N: However, it immediately breaks again.
	WAIT 2.0
	END

@plumpingNotFixed
	N: You mop the floor.
	FX 0
	WAIT 3.0
	N: However, it immediately floods again.
	WAIT 2.0
	FX 2
	END
	
@alreadyFixedPower
	N: You already repaired the short circuit.
	WAIT 1.0
	END
	
@alreadyMoppedFloor
	N: You already mopped the floor.
	WAIT 1.0
	END
	
@alreadyFixedPlumping
	N: You already fixed the plumping.
	WAIT 1.0
	END	
	
@eventActorClick14
	N: ------
	N: HELP
	N: ------	
	N: Choose the correct order to fix the short circuit.
	N: You can right click an icon to interact with it.
	N: Do not forget to turn the power back on once you are done.
	END	

@eventActorClick15
	IF T815, @shortCircuitRepaired	
	IF DEAD, @died
	
	CALL 5099@changeThePower
	
	COMPARE #<power>, "0"
	IF= @soundSilence
	
	COMPARE #<powerFixed>, "1"
	IF= @finish
	
	SOUND high-voltage-discharge	
	END
	
@soundSilence	
	SOUND type
	END
	
@finish
	N: You successfully repaired the short circuit and restored power to the base!
	HOST_GIVE T815
	HOST_GIVE I2644
	WAIT 2.0
	N: You found a %I2644!
	END

@died
	N: You cannot do anything while you are dead.
	END
	
@hasNoToolbox
	N: You lack the right tools to repair the short circuit.
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  

SCENE 5010, bunkershop, SCENE, "The shop" , 0, 0, 0

	MUSIC	james-bond
	
	ACTOR 1,	"Xander Quickshot", gun011, 1, 35, 80
	SEL 1
	POSE 1, 2
	ACTOR 2, 	"Go to the gun range", staticactors, 5, 20, 98
	
	CALL 5097@addGunslinger
	
	IF T806, @openShop
	IF T804, @repairedPowerCore 
	
	COLOR 21
	
	IF T805, @welcomeBack
	
	1: Welcome to the last bastion of civilization, %1.
	1: I'm %0, your local arms dealer.
	1: Guns, drugs, rock & roll, we have it all!
	1: Well, apart from the drugs I suppose... 
	1: That supply ran out over a hundred years ago.
	H: That's probably a good thing. 
	H: I still have a hangover from waking up from stasis.
	1: Ahem, yeah, none of that matters anyway right now.
	1: As you may have noticed, the lights are out.
	1: This is a big problem.
	1: Without power I can't operate my shop or the gun range.
	HOST_GIVE T805
	1: I suggest you talk to Nishka up north and to Erick east of us about finding a fix for this.
	END

@welcomeBack
	1: Hi %1, did you fix the power yet? 
	1: Nothing works right now...
	1: It'll be fun to shoot some targets once the lights are back on, but right now it's just too dangerous.
	1: Nishka is north of us and Erick is to our east.
	END

@repairedPowerCore
	IF T805, @skipMeetingToken
	1: Hi %1, I'm %0, pleasure to make your acquaintance.
	HOST_GIVE T805
	
@skipMeetingToken
	1: Great, you got the power working again!
	1: Did Paul give you that whole 'Can't give you a gun or ammo' blabla speech?
	H: Yes, he did when I still had a hangover from stasis.
	1: The bastard, that's one nasty way to wake up.
	1: Well, tough luck for him. 
	1: You've proven youself to be a valuable asset.
	1: Besides, you're a %C, what good are you without a gun, right?
	HOST_GIVE T806
	; set the highScoreGunRange here to prevent overwriting it by accident later
	SET highScoreGunRange, 0
	
	IF -GS, @regularRewardPowerCore
	
	1: Since you're one of them golden #<g.boys>, I have a special weapon for ya.
	HOST_GIVE I2501
	WAIT 2.0
	N: You received a %I2501.
	WAIT 2.0
	1: She's stronger than a regular %I2500.
	1: Put it to good use, eh?	
	GOTO @openShopFirstTime
	
@regularRewardPowerCore
	HOST_GIVE I2500
	WAIT 2.0
	N: You received a %I2500.
	WAIT 2.0
	1: She's a relic, but packs one hellavu punch!
	GOTO @openShopFirstTime
	
@openShopFirstTime
	OFFER 2502
	1: While you're here, you might as well stock up.
	1: You won't find guns out there very easily.
	1: I have a feeling that it'll be a while before we see each other again once you leave.
	1: I update my shop regularly with new items, check back with me later.
	1: In addition, during level 1 - 16 you have to find for yourself in the outside world and use whatever you can find.
	1: However, all that crappy equipment out there turns useless to you once you hit level 17. 
	1: You won't be able to use items that are for level 17+, but instead you can buy here whatever you may need.
	1: Also, if you click on that target behind me then I'll bring you to the gun range so you can practice shooting.
	END
	
@openShop
	IF V25+T820-T1208, @giveHintRedAccessCard
	IF T820, @skipGunRangeTip
	1: Don't forget, you can enter the gun range by clicking on that big target behind me.
	
@skipGunRangeTip	
	SET temp, #<num.hostAge>
	MOD temp, "12"
	COMPARE #<temp>, "0"
	IF= @offerVirusAndEMP
	
	IF I975.4, @skipOfferFuse
	SET temp, #<num.hostAge>
	MOD temp, "16"
	COMPARE #<temp>, "0"
	IF= @offerFuse
	
@skipOfferFuse
	
	IF V20-I2640-T893, @offerPocketWatchLvl20
	
	IF T966-T967, @weaponRewardMRFBunker
	
	IF V90, @offerLvl90Gear
	IF V80, @offerLvl80Gear
	IF V70, @offerLvl70Gear
	IF V60, @offerLvl60Gear
	IF V50, @offerLvl50Gear
	IF V40, @offerLvl40Gear
	IF V30, @offerLvl30Gear
	
	IF V20+T839-T843-I978, @offerFuse
	IF I2161-I2504, @offerLevel30Weapon	
	IF V15, @skipLevel10Weapon
	1: While you're here, you might as well stock up.
	OFFER 2502	
	END

@offerVirusAndEMP
	OFFER 975, 982	
	1: I have a couple of %I975s and %I982s for sale.
	END
	
@offerFuse
	OFFER 978
	1: I found a couple of %I978s that may come in handy, they're for sale.
	END
	
@offerPocketWatchLvl20
	OFFER 2640
	1: You know, for the right price you can have my %I2640.
	1: It belonged to my grandfather and it's still in working condition, but I think it'll be more useful to you.
	1: Once you hit level 40 you can revision it to a %I2641 at the workshop in the abandoned research lab.
	1: You'll need %I980 and 40,000 GP to do so.
	END
	
@skipLevel10Weapon
	IF R25, @offerSlaveTrainers
	OFFER 2503, 2551, 2552, 2581, 2582, 2611, 2612
	1: I have some clothes in stock that might suit you, plus you'll want to check the %I2503.
	END
	
@offerSlaveTrainers	
	OFFER 28, 734, 773, 774, 775 
	1: I have several Slave Trainers and some %I28 for sale.
	END
	
@offerLevel30Weapon
	1: I have one %I2504 for sale. 
	1: You better make sure you buy it before somebody else does.
	OFFER 2504
	END
	
@offerLvl30Gear
	OFFER 2505, 2554, 2561, 2584, 2585, 2614, 2615 
	1: I have new items for sale.
	END
	
@offerLvl40Gear
	OFFER 2506, 2586, 2616
	1: You'll definitely want to check out this gear.
	1: I'm afraid my stock is limited today, but you can probably scavenge some new gear in that military research facility.
	IF I2164+T887|I2164+T888, @offerLvl40GearActor
	IF I2641, @end	
	1: Don't forget that you can also upgrade your %I2640 now in the abandoned research lab.
	END
	
@offerLvl40GearActor
	IF I2587, @offerLvl40GearActor2
	8: So, this is The Shop, eh?
	END
	
@offerLvl40GearActor2
	8: You bet ya that we did!
	8: So, this is The Shop, eh?
	8: Xander, you've gained a customer for life with me, I'll be stocking up regularly on supplies here.
	1: Hot damn, an %C64 visiting my shop, I feel honored!
	END
	
@offerLvl50Gear
	OFFER 2556, 2563, 2588, 2589, 2618, 2619
	1: I have several new items for sale, which I think you can appreciate.	
	IF I2641, @end
	1: Don't forget that you can also upgrade your %I2640 now in the abandoned research lab.	
	END
	
@offerLvl60Gear
	OFFER 2508, 2509, 2510, 2590, 2620
	1: Unfortunately, my item supply is limited, but take a look at what I have.	
	1: However, I'm selling various weapons.
	1: It's fun to experiment with the different types.
	END	

@offerLvl70Gear
	OFFER 2558, 2562, 2593, 2594, 2622, 2623
	1: You might enjoy the new items I have for sale.
	END	

@offerLvl80Gear
	OFFER 2595, 2624
	1: I could only find some shoes and body armor that will fit you.
	IF I2511|I2512|I2513, @lvl80WeaponTip
	END	

@lvl80WeaponTip
	1: Don't forget, you can upgrade your weapon to a Mark 2 at the workshop in the research lab. 
	1: You'll need two %I980 for each weapon that you upgrade.
	END

@offerLvl90Gear
	OFFER 2560, 2565, 2597, 2598, 2626, 2627, 2517, 2518, 2519, 2520, 2521, 2522
	1: This is the best stuff you can buy.
	IF -T1206, @endGearTip
	END		
	
@endGearTip
	1: Make sure that you visit Samuel in the Command Center once you reach level 99 to receive the best gear available.
	END
	
@weaponRewardMRFBunker
	1: Nice, I see you've returned from your mission.
	H: Yeah, it wasn't easy, but we got it all done!
	8: You should have seen the mutants that we've killed, truly gruesome creatures.
	1: That's amazing!
	1: Better yet though, I see you also found the schematics for three different weapons. 
	1: What kind of battles did you fight while you were in that bunker?
	H: Let's see...
	
	SET temp, 0
	
	IF -T957, @skipweaponRewardMonsters1 
	H: I've killed all the %M1706s in Storage room #1.	
	ADD temp, 1
	
@skipweaponRewardMonsters1 	
	IF -T958, @skipweaponRewardMonsters2
	H: I've exterminated all the %M1706s in Storage room #2.
	ADD temp, 1
	
@skipweaponRewardMonsters2	
	IF -T959, @skipweaponRewardMonsters3
	H: I've taken care of the %M1706s in a bedroom that they trashed.
	ADD temp, 1

@skipweaponRewardMonsters3
	IF -T960, @skipweaponRewardMonsters4
	ADD temp, 2
	H: I've also taken care of all the %M1710s that were holding up in the mess hall.
	
@skipweaponRewardMonsters4
	H: Finally, I took care of all the %M1706s that were guarding the growth vats and all of the %M1710s that infested a room.

	COMPARE #<temp>, "0"
	IF= @noAdditionalRewardMRFBunker
	COMPARE #<temp>, "1"
	IF=	@RewardMRFBunker0Extra	
	COMPARE #<temp>, "2"
	IF=	@RewardMRFBunker1Extra
	COMPARE #<temp>, "5"
	IF=	@RewardMRFBunker2Extra	
	GOTO @RewardMRFBunker1Extra
	
@noAdditionalRewardMRFBunker
	H: Well, I've killed the bare minimum number of %M1713s and %M1714s that I had to kill and then left.
	1: I see, well, still, you've helped us by taking care of those growth vats.
	1: I can give you a %I983 for that.
	HOST_GIVE I983
	HOST_GIVE T967
	WAIT 2.0
	N: You received a %I983.
	GOTO @weaponRewardMRFBunkerFinish

@RewardMRFBunker0Extra	
	1: That's all? 
	1: I'm afraid that's too little to give you an additional %I983, but still, you've earned one of them for your efforts.
	HOST_GIVE I983
	HOST_GIVE T967
	WAIT 2.0
	N: You received a %I983.
	GOTO @weaponRewardMRFBunkerFinish
	
@RewardMRFBunker1Extra	
	1: Nice, you've done well.
	1: Alright, I'll give you an extra %I983 for the effort that you've put in.
	HOST_GIVE I983.2
	HOST_GIVE T967
	WAIT 2.0
	N: You received two %I983s.
	GOTO @weaponRewardMRFBunkerFinish	

@RewardMRFBunker2Extra		
	1: Hot damn, you really went all out on those bastards.
	1: You've definitely earned two additional %I983s on top of the one that I was already going to give you.
	HOST_GIVE I983.3
	HOST_GIVE T967
	WAIT 2.0
	N: You received three %I983s.
	GOTO @weaponRewardMRFBunkerFinish
	
@weaponRewardMRFBunkerFinish	
	H: What can I do with a %I983?
	1: You can create a weapon out of them at the workshop in the research lab if you also bring two %I980. 
	H: What kind of weapons can I make from these schematics?
	WAIT 2.0
	N: Xander Quickshot puts on his glasses and studies the schematics for a while.
	WAIT 4.0
	1: You can make the %I2511, a %I2512, or a %I2513. 
	1: The %I2511 is an energy based sniper rifle that became famous when an %C64 killed three men with a single shot.
	1: The %I2512 disrupts local quantum fields and blasts atoms apart, it's a particularly nasty way to die.
	1: Finally, the %I2513 is a handgun that replicates its own ammo, ideal if you're more a fan of our traditional weaponry.
	1: All guns do the same amount of damage regardless.
	1: However, the best part is that with these schematics you can upgrade those weapons to a mark 2 version at the workshop once you become level 80.
	H: Nice, that sounds great, but what if I ran out of %I980?
	1: You can always scavenge some extra from the %M1703s in the military research facility.
	1: Just enable those bots at the terminal if you disabled them before.
	1: Good luck, %1.
	H: Thanks.
	END
	
@giveHintRedAccessCard
	1: You know, if you had a %I2161, I can authorize you to buy a better weapon too.
	1: Maybe you can dive into that abandoned research lab I heard people talking about.
	1: I bet there will be a terminal there where you can create a new access card.
	GOTO @skipGunRangeTip

@eventActorAttack2
@eventActorClick2
	IF -T804, @powerIsOut		
	IF T820, @skipExplanation 	
	1: Since it's your first time there, I'll give you some pointers first.
	1: The objective is to score as many points as possible within 60 seconds.
	1: The countdown begins once you push the 'START'.
	1: The target will randomly change locations.
	1: The more accurate you hit it in the center, the more points you earn.
	1: You can earn two, three, or five points per shot, unless you miss, of course.
	1: Don't forget to equip your gun, you can only shoot with ranged weapons. 
	1: You'll come back to here when you press the EXIT button.
	1: Click the HELP button if anything is unclear.
	
@skipExplanation	
	1: Have fun!
	GOTO SCENE 5018
	END

@powerIsOut
	1: I love your enthusiasm, but you'll need to fix the power first before I can take you to the gun range.
	1: It's not safe to shoot in the dark. 
	1: We don't want to end up killing one of our own, do we?
	END

@end
	END

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  

SCENE 5011, bunkerstorage03, SCENE, "Clinic supplies" , 0, 0, 0

	IF T973-T974, @rewardHatchlingQuest
	IF T810, @finished
	
	ACTOR 1,  "", gun005, 2, 10, 60 
	ACTOR 2,  "", gun005, 2, 20, 80
	ACTOR 3,  "", gun005, 2, 25, 70
	ACTOR 4,  "", gun005, 2, 40, 70
	ACTOR 5,  "", gun005, 2, 50, 80
	ACTOR 6,  "", gun005, 2, 35, 85
	
	SET temp, %R6
	SET temp2, 6
	WAIT 2.0
		
	IF -T804, @noDocExplanation
	
	N: There are several boxes before you. 
	N: Doctor Adlington did not mention which one contains the supplies that she needs.
	N: You can investigate a box by right clicking on it.	
	END
	
@eventActorClick1
	SET actor, 	1
	SET x, 10
	SET y, 60
	GOTO @checkSuccess

@eventActorClick2
	SET actor, 	2
	SET x, 20
	SET y, 80
	GOTO @checkSuccess

@eventActorClick3
	SET actor, 	3
	SET x, 25
	SET y, 70
	GOTO @checkSuccess

@eventActorClick4
	SET actor, 	4
	SET x, 40
	SET y, 70
	GOTO @checkSuccess

@eventActorClick5
	SET actor, 	5
	SET x, 50
	SET y, 80
	GOTO @checkSuccess

@eventActorClick6
	SET actor, 	6
	SET x, 35
	SET y, 85
	GOTO @checkSuccess

@checkSuccess
	IF I2165, @finished
	COMPARE #<actor>, #<temp>
	IF= @findSupplies
	COMPARE #<temp2>, "1"
	IF< @findSupplies
	SUB temp2, "1"
	IF R10, @randomReward
	N: This box is empty.
	WAIT 2.0
	END

@randomReward
	SET temp3, 8
	COMPARE #<temp3>, 8
	IF!= @S11
	ADD temp3, %R6
	N: You found a %I#<temp3>!
	HOST_GIVE I#<temp3>
	WAIT 2.0
	END

@S11
	HOST_GIVE T172
	EJECT T172
	GOTO LINK 99, 0, 1

@findSupplies
	N: You find the supplies, but also hear a disturbing snarling sound.
	SOUND attroarvampire1
	BKGND check1
	WAIT 1.0
	MOVE 1, -50, -50, 1
	MOVE 2, -50, -50, 1
	MOVE 3, -50, -50, 1
	MOVE 4, -50, -50, 1
	MOVE 5, -50, -50, 1
	MOVE 6, -50, -50, 1
	BKGND bunkerstorage03
	WAIT 0.2
	BKGND check1
	SOUND explbld1
	WAIT 1.0
	N: A %M1700 jumps out of the box!
	CALL 5199@continueBeforeGunslingerFight
	WAIT 3.0
	FIGHT2 1700.#<x>.#<y>
	CALL 5198@gunslingerCPRAndDirectDrinkQuotes 
	BKGND	bunkerstorage03
	ACTOR 11,  "", gun005, 2, 10, 60, 1
	ACTOR 12,  "", gun005, 2, 20, 80, 1
	ACTOR 13,  "", gun005, 2, 25, 70, 1
	ACTOR 14,  "", gun005, 2, 40, 70, 1
	ACTOR 15,  "", gun005, 2, 50, 80, 1
	ACTOR 16,  "", gun005, 2, 35, 85, 1
	IF ALIVE, @questReward
	N: Right before you died, you snatched the supplies from the %M1700.
	
@questReward
	N: You received 2 %Z1s
	HOST_GIVE Z1.2
	N: You found the %I2165!	
	HOST_GIVE I2165
	WAIT 2.0
	N: Time to get out of here!
	WAIT 3.0
	GOTO SCENE 5002

@finished
	N: There is nothing of interest here.
	END

@noDocExplanation
	N: You see several boxes with medical supplies before you.
	N: Maybe Doctor Adlington could use this?
	END

@rewardHatchlingQuest
	
	CALL 5097@addGunslinger
	
	ACTOR 7,	"Doc Adlington", gun001, 1, 10, 85
	ACTOR 9, "Freezer", circuitbuttons, 9, 22, 47 
	
	MOVE 7, 15, 50
	7: Just click on the freezer here to store the %M1700s.	
	END
	
@eventActorClick9
	IF -I985, @noHatchlings
	COMPARE #<num.item985>, "5"
	IF< @hatchlingReward1
	COMPARE #<num.item985>, "10"
	IF< @hatchlingReward2
	COMPARE #<num.item985>, "15"
	IF< @hatchlingReward3
	GOTO hatchlingReward4
	
@hatchlingReward1
	CALL @takeI985	
	7: I hoped that you would have caught more %M1700s, but I suppose it will have to do.
	7: As a reward I will give you %I2564. 
	HOST_GIVE I2564
	WAIT 2.0
	N: You received %I2564.
	GOTO @freezeHatchlings

@hatchlingReward2
	CALL @takeI985	
	7: You have done a decent a job at catching these %M1700s.
	7: As a reward I will give you one %I975 and %I2564. 
	HOST_GIVE I975
	HOST_GIVE I2564
	WAIT 2.0
	N: You received one %I975 and %I2564.
	GOTO @freezeHatchlings

@hatchlingReward3
	CALL @takeI985	
	7: You have done a great job at catching all these %M1700s.
	7: As a reward, I will give you a %I2166 and %I2564.
	HOST_GIVE I2166
	HOST_GIVE I2564
	WAIT 2.0
	N: You received a %I2166 and %I2564.
	GOTO @freezeHatchlings
	
@hatchlingReward4
	CALL @takeI985	
	7: You have done an asthonising job at catching all these %M1700s.
	7: As a reward, I will give you a %I975, %I2166, and %I2564.
	HOST_GIVE I975
	HOST_GIVE I2166
	HOST_GIVE I2564
	WAIT 2.0
	N: You received a %I975, %I2166, and %I2564.
	GOTO @freezeHatchlings	
	
@freezeHatchlings
	WAIT 2.0
	N: You watch how Doc Adlington pushes various buttons.
	WAIT 2.0
	SOUND turn-power-off
	7: There we go, instantly frozen and perfectly preserved %M1700s.
	7: They will be a great aid to my research.
	H: Eh, Doc, doesn't that kill them?
	7: Yes, that is the idea. 
	7: What is your point?
	H: Eh, something about an oath like 'do no harm'? 
	7: I was not the one who put them in the freezer, was I?
	8: /a facepalms.
	8: That wasn't what %1 meant, Doc.
	H: Never mind, let's forget about it.
	7: Good, then let us return to the Clinic. 
	WAIT 3.0
	GOTO SCENE 5002

@takeI985
	HOST_TAKE I984.#<num.item984>
	HOST_TAKE I985.#<num.item985>
	HOST_GIVE T974	
	RETURN

@noHatchlings
	N: You have somehow lost your %M1700s.
	N: Do the quest again.
	HOST_TAKE T973
	HOST_TAKE I984.#<num.item984>
	HOST_GIVE I984.30
	WAIT 3.0
	GOTO EXIT


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  

SCENE 5012, bunkerstorage, SCENE, "Teleporter" , 0, 0, 0

	MUSIC born-to-be-wild

	ACTOR 1,	"Nishka", gun003, 4, 15, 90	
	ACTOR 2,	"Teleporter", gun005, 1, 50, 95
	ACTOR 3, 	"Caeran", monster035, 1, -32, 82
	SEL 3
	POSE 1, 4
	ACTOR 4, 	"Kayla", kitty3, 2, -25,82
	SEL 4
	POSE 2, 4
	
	CALL 5097@addGunslinger
	
	IF -T813, @dontTeleportCaeranIn
	MOVE 3, 32, 82, 1
	MOVE 4, 25, 82, 1
	
@dontTeleportCaeranIn

	IF T997|T998, @bunker9QuestFinished
	IF T970, @bunker9QuestStarted
	IF T969, @returnAfterRejectBunker9Quest
	IF T968, @droneTestLevel80Continued
	IF V80+T935, @droneTestLevel80
	IF T935, @droneTestCompleted
	IF T934, @droneTestNewItem
	IF T933, @droneTestNewQuest
	IF T932, @droneTestContinue
	IF V60+T921, @droneTest 
	IF T921, @militaryResearchFacilityRewarded
	IF T910, @militaryResearchFacilityCompleted
	IF T880, @militaryResearchFacilityInProgress
	IF V40+T847, @readyForMilitaryResearchFacility
	IF T847, @notYetReadyForMilitaryResearchFacility
	IF T846+I980.5+I2170, @completedMissionAbandonedResearchLab
	IF T846, @missionAbandonedResearchLabHelp
	IF T821+V20, @investigateAbandonedResearchLab
	IF -T819+T821, @readyForElliairCheck	
	IF -V20+T821, @notYetHighEnoughForAbandonedResearchLab
	IF T814, @repairedTeleportcircuitBoard
	IF T813, @repairingTeleporterCircuitBoard
	IF T804, @powerCoreRepaired

	COLOR 21
	
	IF I2164, @return
	STRCMP #<nishka>, "1"
	IF= @askAgain
	
	1: Welcome %1, it's good to see a new face around here!
	1: Or well, an old face I guess, but new to me. 
	1: It'll probably take you some time to get used to all this, but in the meantime, I could use your help.
	1: The power of the base went out and I'm afraid that it was my fault.
	
	IF I2160, @visitedErick	
	1: I was booting up this ancient beast here, when a surge protector overloaded and blew a fuse.
	
@continue	
	1: It nearly killed you too, it's good thing your pod ran on a different power group.
	1: I'm afraid that pods in another room weren't as lucky.
	1: We'll put this relic on its own group in the future.
	1: Heck, the thing is almost as old as you are!
	1: Anyway, can you help Erick at the Power core to get things up and running again? (Yes/No)
	ASK 300
	IF YES, @continue2
	1: Well, you won't be able to go anywhere until we have the power working again.
	
@askAgain	
	1: So, can you help Erick out? (Yes/No)
	ASK 300
	IF YES, @continue2
	1: Well, talk to me when you change your mind.
	SET Nishka, "1"
	END
	
@eventActorAttack2
@eventActorClick2
@eventActorSpell2
	IF V15+T819, @fullTeleport
	IF T814+T818+T820+T810+T819+T821, @teleportToElliair
	IF T813-T814, @openCircuitBoard
	SOUND tesla_charge
	WAIT 1.5
	SOUND tesla_shot
	
	SET tempHP, #<num.hostMaxHP>
	DIV tempHP, 4
	SET tempMP, #<num.hostMaxMP>
	DIV tempMP, 4
	
	HOST_TAKE H#<tempHP>
	HOST_TAKE M#<tempMP>
	WAIT 2.0
	IF DEAD, @died
	1: Don't touch that! 
	1: Do you want to blow us up?
	END
	
@eventActorClick4
	SOUND purr
	4: /a purrs.
	END
	
@eventActorAttack4
	SET temp, #<num.hostMaxHP>
	DIV temp, 2
	ADD temp, 1
	SET temp2, #<num.hostMaxMP>
	DIV temp2, 2
	ADD temp2, 1
	SOUND cathiss
	4: Grrrr!
	SEL 4
	POSE 1
	MOVE 4, #<num.hostX>, #<num.hostY>, 4
	WAIT 0.5
	POSE 3
	HOST_TAKE H#<temp>
	HOST_TAKE M#<temp2>	
	SOUND catAttack
	WAIT 0.2
	POSE 1
	MOVE 4, 25,82, 4
	FACE 4, 2
	WAIT 2.0
	1: Don't hurt my cat!
	4: It's time you leave.
	WAIT 3.0
	GOTO EXIT
	
@eventActorSpell4
	SOUND 
	SOUND cathiss2
	4: /a hisses.
	1: Hey, don't do that, leave my cat alone!
	END	
	
@eventActorGive4
	SOUND meow
	4: /a meows.
	END	
	
@continue2	
	1: Great, thank you.
	1: You'll probably need a toolbox, but luckily for you, I have a spare one.
	
	WAIT 1.0
	N: You received a %I2164.
	HOST_GIVE	I2164
	1: While you help Erick, I'll see what I can do about this piece of junk.
	WAIT 3.0
	
	MOVE 1, 42, 86, 2
	WAIT 0.5
	
	SEL 1
	POSE 2
	WAIT 0.2
	POSE 4
	1: /a punches the teleporter.
	
	SOUND tesla_charge
	WAIT 1.5
	SOUND tesla_shot
	WAIT 0.5
	POSE 3
	WAIT 0.2
	POSE 4
	1: Ah shit, that hurt!
	You probably don't want to do that yourself.
	END

@visitedErick
	H: Yes, Erick told me. 
	H: You tried to start the teleporter, but something went wrong?
	1: Yes, that's correct. 
	1: A surge protector overloaded and blew a fuse.
	GOTO @continue
	
@return
	1: Please help Erick at the Power Core, it's to our east.
	1: Without power we won't be able to fix the teleporter.
	END

@powerCoreRepaired
	1: I see you got the power running again, great job!
	MOVE 3, -10, 98, 1
	MOVE 3, 20, 98
	H: Thanks, that %I2164 came in handy. 

	1: Good, I'm glad to hear it.
	1: In fact, you may keep the %I2164.
		
	MOVE 3, 32, 82
	H: Thank you.	
	1: If you ever delve into abandoned bunkers, then you'll probably need it to repair circuit boards and such.	
	3: Hello %1, I'm %0, Nishka's husband.
	3: You did a great job fixing the power grid, it's a big help to us all.
	
	FACE 3, 0
	3: Nishka, the base commander was wondering what the estimated time is to get the teleporter up and running again?
	3: There are several important intelligence missions that he planned.
	1: Well, I was hoping %1 could lend us a hand with this damned teleporter.
	1: #<g.He> seems to have a knack for this sort of thing.
	
	FACE 3,1
	3: What do you say, %1, are you up for the challenge?
	H: Do I really have a choice?
	1: Not if you ever want to breath some fresh air, no.
	3: /a chuckles.
	H: Well, let's get this show on the road then.
	1: Alright, just right click on the teleporter to open the circuit board.
	1: Right now, all the nodes are set to default voltage, but I have a feeling that four of them are set wrong.
	1: Two nodes should be high voltage nodes and two other nodes are regular data nodes, in other words unencrypted data nodes.
	1: I think half the nodes are also burned through, you'll have to enable those.
	H: Mm, that sounds complicated.
	1: Nah, you'll do fine. 
	1: You can always press the HELP button for more information or hints.
	HOST_GIVE T813
	H: Alright, I'll give it a shot.
	1: Oh, a word of warning, you'll want to analyze that you have all nodes correct before turning the power back on.
	1: You'll probably receive a static shock if you don't.
	1: Should you happen to die, then just camp anywhere in the bunker.
	1: Doc Adlington will typically come running to you right away.
	H: Yikes, well that's good to know.
	END

@repairingTeleporterCircuitBoard
	3: Having trouble figuring out the circuits?
	H: Yeah, a little.
	1: You could try enabling the dark yellow nodes first.
	1: If they're bright yellow when the power is on, then they're active.
	1: If they're dark yellow when the power is on, then they're disabled.
	1: This works the same for the other colors too.
	1: Once you updated those nodes, it is pretty much a game of elemination.
	3: You can click on the magnifying glass to run the Analyze command.
	3: It will tell you if you were successful with correcting the node.
	3: It should either be one less or one more correct node that you found.
	3: Analyzing works while the power is off.
	1: Don't forget to turn the power back on once you corrected all the nodes.
	1: I hope that this helps you some.
	1: Right click on the teleporter to open the circuit board again.
	1: Good luck!
	H: Thank you.
	3: I'm sure you'll do fine.
	END

@repairedTeleportcircuitBoard
	1: Great, it looks like you fixed the circuit board!
	1: Let's see...
	1: /a punches some buttons.
	SOUND tesla_charge
	WAIT 2.0
	IF -T815, @floodedPassage
	1: Yup, it's up and running again!
	1: You know, despite its age, teleporters are still one of the most advanced technology that our people developed.
	3: Our people even made a portable minitiature version called %I736.
	3: Unfortunately, it drained the battery so quickly that you could only use it once.
	3: Later they developed an Infinite Teleport, although the locals call it a %I737.
	3: It's powered by a small nuclear cell and never runs out of juice.	
	1: Once you have some more experience I'll have a quest for you to investigate an abandoned bunker.
	1: I believe you can retrieve various pieces of interesting technology there.
	3: You'll probably make Doc happy as well, she's been dying to go there and explore those ruins.
	1: Anyway, it's something for you to keep in mind.
	HOST_GIVE T821
	1: In the meantime, you're free to use the teleporter any time now. 
	1: Currently it is set to Elliair, but next time you return, I should have other locations up and running too.

@readyForElliairCheck	
	1: Are you ready to leave? (Yes/No)
	ASK 300
	IF YES, @goToElliar	
	1: Alright, come back when you are ready.
	END	

@floodedPassage
	SOUND tesla_shot
	WAIT 2.0
	1: Ah crap, something is still wrong.
	3: I believe there is a short circuit somewhere else on the base. 
	1: Can you look into that for me?
	H: Sure, do you have any idea where I should look?
	3: Mm...
	3: /a checks a pad.
	3: The short circuit is somewhere in the south part of the base. 
	3: Maybe the Power core terminal can help you out.
	3: The diagnostics program should give you more information.
	1: You should take your %I2164 with you.
	H: /a nods.
	H: I'll look into it.
	END	

@goToElliar	
	IF T820+T818+T810+I2502, @readyToGoToElliair
	IF T820, @skipGunRangeCheck
	1: You should visit Xander Quickshot south of here and to enter the gun range and fire a couple of shots.
	1: It's a good idea to get some practice before you leave.
	
@skipGunRangeCheck

	IF I2502, @skipBuyBlackGuard
	1: You should buy %I2502 from Xander at The Shop before you leave.
	1: You'll be without a gun otherwise and you won't be able to return here until you've passed Neither Lands.
@skipBuyBlackGuard	

	IF T818, @skipMessHallCheck
	1: Wait, you haven't even met Chris yet?
	1: You really should! 
	3: Yeah, the guy has some kind of hero worship for you because you knew his great-great-great ... and so on grandfather.
	1: He's south of us, share a drink with him when you have a spare moment.

@skipMessHallCheck
	IF T810, @skipMedicalSuppliesCheck
	1: Doc Adlington could use your help retrieving supplies.
	1: She's to the far east of here.
	
@skipMedicalSuppliesCheck
	1: It seems like you've met everybody else.
	END
	
@readyToGoToElliair	
	1: Yes, it seems like you are.	
	1: Before I forget, I'm supposed to give you the access code to the bunker. 
	
	SET bunker3password, %r899
	ADD bunker3password, 100
	
	1: The code to enter the base is #<bunker3Password>. 
	HOST_GIVE T819	

	1: I have uploaded it to your Quest Diary, you can always find it back there.
	1: The city Maku's Tunner is to our east, but for now I'll send you to Elliair.
	3: Before I let you leave %1, I have one more final gift from Nishka and myself.
	3: I scavenged some items from the base and I think you can put these to good use.
	HOST_GIVE I2550
	HOST_GIVE I2580
	HOST_GIVE I2610
	WAIT 2.0
	N: Caeran gave you a %I2550, %I2580, and an %I2610.
	WAIT 2.0
	3: Good luck, %1. I have a feeling that you'll need it.	
	H: Thanks, I'll do my best not to let you all down.
	1: /a punches some buttons.
	1: Alright, here we go!
	1: Three...
	WAIT 1.0
	1: Two...
	WAIT 1.0
	1: One...
	GOTO @teleportToElliair

@teleportToElliair
	SOUND tesla_charge
	WAIT 3.0	
	GOTO LINK 14, 18, 0
	
@fullTeleport
	SOUND tesla_charge
	WAIT 3.0	
	GOTO SCENE 1205
	
@openCircuitBoard
	GOTO SCENE 5110

@died
	1: Look at what you did!
	1: Damn it, don't die on me, %1, don't die!

@attemptToResurrect	
	SOUND tesla_charge
	WAIT 1.5
	1: Live #<g.man>, live!
	SOUND tesla_shot
	HOST_TAKE M#<num.hostMaxMP>
	IF R33, @resurrect
	GOTO @attemptToResurrect

@resurrect	
	HOST_GIVE L#<num.hostMaxHP>
	WAIT 2.0
	1: Oh wait, it worked already.
	1: Pfew, you really scared me for a moment.
	END	
	
@notYetHighEnoughForAbandonedResearchLab
	1: I'm afraid you're not yet high enough to help me out %1.
	3: You should come back once you hit level twenty.
	3: Nishka has some ideas about how we can tie this teleporter back into a global network of teleporters.
	1: That's right, this one is just the beginning.
	1: I know there are more of these buggers out there.
	1: We just need to find them and reprogram them.
	END
	
@investigateAbandonedResearchLab 
	1: Great, you're here and not a moment too soon!
	1: I've been pinging the network to see if we would get a hit back and guess what...
	1: We did!
	3: I've done some research. 
	3: The signal originates from an abandoned research lab that is south of Maku's Tunner, hidden among the trees.
	1: I think we can build a %I737 for you if you can gather the five necessary %I980. 
	3: Don't forget the %I2170, you'll need one of those if you're going to power a %I737.
	1: That's right, we'll need a %I2170 too.
	1: So, what do you say, are you up for the task? (Yes/No)
	IF I980.5+I2170, @alreadyCompletedMissionAbandonedResearchLab
	ASK 300
	IF YES, @acceptMissionMythicalTeleport
	1: Well, come back to us when you're ready.
	END

@acceptMissionMythicalTeleport	
	HOST_GIVE T846
	1: Great, this is so exciting.
	3: We haven't had a working teleport network for over two hundred years.
	3: It'll be awesome to see the network operational again!
	1: Please try to fix any teleporter you come across in your journeys.
	1: Once they're fixed they'll be added to the teleporter network and you can go there immediately when you teleport.
	H: That's good to know, I'll see what I can do.
	END
	
@continueMissionAbandonedResearchLab
	1: How is your quest going?
	3: Remember, we need 1 %I2170 and 5 %I980.
	3: You should be able to find both in the abandoned research lab to the south of Maku's Tunner.
	END
	
@alreadyCompletedMissionAbandonedResearchLab
	H: Well, actually, I've already gone there and I have gathered the necessary parts.
	HOST_GIVE T846
	1: You're amazing!
	GOTO @completedMissionAbandonedResearchLab
	
@completedMissionAbandonedResearchLab
	3: Great, let me have a look at those %I980.
	HOST_TAKE I980.5
	N: You hand over the 5 %I980.
	WAIT 4.0
	3: Mm, they look good. 
	3: I think we can make it work, Nishka.
	1: Nice, I'd like to take a look at that %I2170.
	HOST_TAKE I2170
	N: You give Nishka the %I2170.
	SOUND toolbox-workshop
	WAIT 4.0	
	1: Let's see...
	N: Nishka inspects the items you gave her.
	WAIT 2.0
	1: If I combine this with that...
	SOUND wheelnutairgun
	WAIT 3.0
	1: Then add a couple of bolts...
	N: You watch as Nishka handily puts several parts together.
	WAIT 2.0
	1: The %I2170 next...
	WAIT 2.0
	1: Yes, there we go! 
	1: It's ready, your very own %I737!
	N: Nishka hands you the %I737.
	HOST_GIVE I737
	HOST_GIVE T414
	HOST_GIVE T847
	WAIT 2.0
	3: Just a piece of advice...
	3: DON'T drop it!
	3: That thing runs on a small fusion core that holds enough energy to blow up a small city.
	H: Oh wow, and they hand these things to the locals as if they're candy?
	1: I doubt there are that many working examples still around, but yeah, it's pretty bad that our technology is out there.
	1: Anyway, good luck!
	H: Thank you, I'm sure that it will come in handy.
	END
	
@missionAbandonedResearchLabHelp
	3: How are things going?
	1: You should be able to find 5 %I980 and a %I2170 in the abandoned research base.
	1: Maybe you should check the vault in the Clinic?
	1: They likely stored it in a secure place.
	END
	
@notYetReadyForMilitaryResearchFacility	
	3: Come back later to us, I'm sure we'll have another job waiting for you.
	1: I can think of a couple of things that we could use your help with, yes.
	END
	
@readyForMilitaryResearchFacility
	1: Welcome back, %1.
	1: You arrived just in time, we received a ping from Arakaki.
	
	IF -T841, @notYetDiscoveredMRF
	
	3: We have notes of a military research facility there, but nobody has been there in several hundred years.
	3: Could you investigate it for us? (Yes/No)
	ASK 300
	IF -YES, @didNotAcceptMilitaryResearchFacilityMission
	
	1: Awesome, I knew you were up for a new adventure.
	H: It is the way, I mean, I'm a %C, right?
	1: Yup, you are.
	1: Could you look into what kind of technology they have there?
	1: It might turn out that there's nothing of interest.
	1: However, we might also learn of lost technology that we can attempt to reverse engineer.
	H: Sure thing, I'll look into it.
	
	IF T876, @skipSettingMRFPassword
	SET mrfPassword, %R899
	ADD mrfPassword, 100
	HOST_GIVE T876
	
	3: Thank you, the security code to enter that base is '#<mrfPassword>'.
	3: I've taken the liberty of uploading it to your Quest Diary too.
	H: Alright, it shouldn't be hard to enter it then.

@skipSettingMRFPassword
	HOST_GIVE T880
	1: You may want to make sure you're stocked up on supplies though.
	1: It can be very dangerous in there.
	3: Good luck, %1.
	END
	
@didNotAcceptMilitaryResearchFacilityMission	
	3: Pity, but come back to us if you change your mind.
	END	
	
@notYetDiscoveredMRF
	3: There is a military research facility in Arakaki, but it seems like you haven't discovered its exact location yet?
	3: You should visit the abandoned research lab again.
	3: I believe there is a map in the Commander's Quarters that you should study.
	1: Return to us once you found the location, we can discuss more then.
	END
	
@militaryResearchFacilityInProgress
	1: Did you find anything of interest already?
	H: Not yet, I'm working on it.
	END
	
@militaryResearchFacilityCompleted	
	3: Did you find anything of interest in the military research facility, %1?
	H: Actually, I did.
	WAIT 2.0
	N: You give Nishka the %I2182.
	HOST_TAKE I2182
	WAIT 3.0
	1: Woa, sweet!
	1: I'd love to take that thing apart and study it.
	3: Yeah, if we can duplicate the parts and its coding, then maybe we can upgrade the security of Bunker 3.
	1: This is so awesome.
	8: Hehe, you techie nerds are all the same, no matter the era.	
	8: It wasn't any different in my time.
	HOST
	IF -I975.20, @MRFRewardTrojanHorse
	IF -I978.10, @MRFRewardGoodFuse
	IF -I982.10, @MRFRewardEMPGrenade
	1: I'm not really sure what to give you, but I hope you accept this money.
	WAIT 2.0
	N: You received 50,000 GP.
	HOST_GIVE G50000
	HOST_GIVE T921
	END
	
@MRFRewardTrojanHorse
	1: I hope you'll have some use of these %I975.
	WAIT 2.0
	N: You received 4 %I975s.
	HOST_GIVE I975.4
	HOST_GIVE T921
	END

@MRFRewardGoodFuse
	1: I hope you'll have some use of these %I978.
	WAIT 2.0
	N: You received 10 %I978s.
	HOST_GIVE I978.10
	HOST_GIVE T921
	END
	
@MRFRewardEMPGrenade
	1: I hope you'll have some use of these %I982s.
	WAIT 2.0
	N: You received 30 %I982s.
	HOST_GIVE I982.30
	HOST_GIVE T921
	END

@militaryResearchFacilityRewarded
	1: Welcome back, %1.
	3: We don't have a new mission for you yet, but we'll keep you posted once we do.
	H: Alright, sounds good.
	8: You know, we never did get to explore the bunker below the military research facility.
	8: You'll need a %I2162 or higher clearance to access it.
	END

@droneTest 
	3: Ah good, you're here, %1.
	3: We were hoping you'd visit us again.
	1: We've studied that drone you brought back long and hard.
	1: I think we have a working solution, but we need somebody who can give it a real try.
	1: What do you say, are you up for shooting down some more drones? (Yes/No)
	ASK 300
	IF -YES, @droneTestReject
	1: Great!
	1: We'll take you right there.
	WAIT 3.0
	GOTO SCENE 5022	
	
@droneTestReject
	8: Party pooper, shooting that stuff down is fun!
	1: Well, you know where to find us if you change your mind.
	END

@droneTestContinue	
	1: Well, that went dramatic, for us that is.
	3: Yeah, we monitored your progress closely, but damn, you shot them out the air as if they were floating balloons.
	3: We need better tech to get this to work.
	1: You're heading out on a new adventure soon, aren't you, %1?
	H: Yes, I will be.
	1: Can you look around for interesting tech? 
	1: We need better targeting optics in particular.
	3: It's too bad we don't have an android here, we could have disassembled it for spare parts.
	1: That'd be sweet, yes. 
	1: Anyway, please look around and let us know if you find something.
	HOST_GIVE T933
	H: I will, let's hope that I'll find something good.
	END
	
@droneTestNewQuest	
	H: Do you have an idea where I could look for new items?
	IF -I2162, @droneTestNewQuestNotYet
	1: Mm, you could try the abandoned research lab, you have access to new areas with your %I2162.
	1: Otherwise I would recommend the bunker below the military research facility.
	H: Alright, I'll try those places.
	END
	
@droneTestNewQuestNotYet
	1: Mm, you'll need a %I2162, but once you have that you can go to the abandoned research lab.
	1: There should be other areas there that you can explore.
	1: Once you have the %I2162, you can also check the bunker below the military research facility.
	H: Alright, it sounds like I need to get that %I2162 then.
	1: You should visit Erick and help him fix the switch board for bunker 3.
	END
	
@droneTestNewItem
	H: Look at what I have for you, an %I2184!
	8: It's even mostly intact, but it did suffer some minor damage.
	1: Wow, that is amazing!
	CALL @setRewardDroneTesting
	3: This will definitely help our research, thank you, %1.
	1: Here, you can have this pair of %I#<item> for your efforts.
	WAIT 2.0
	HOST_TAKE I2184
	HOST_GIVE I#<item>
	HOST_GIVE T935
	N: Nishka took the %I2184 from you and gave you a pair of %I#<item> in return.
	WAIT 2.0
	1: We'll get started on making upgrades immediately, the next version should be much harder to defeat.
	3: It would help us a lot if you could give them another test run once they're done.
	H: I'm looking forward to it already.
	8: So am I!
	END	

@setRewardDroneTesting
	COMPARE #<g.num>, "2"
	IF< @setDroneTestMale
	IF= @setDroneTestFemale
	IF> @setDroneTestNonBinair
	N: ERROR: contact Silver with error code #<scene.id>.
	RETURN

@setDroneTestMale
	SET item, "2592"
	RETURN
	
@setDroneTestFemale
	SET item, "2591"
	RETURN
	
@setDroneTestNonBinair
	SET item, "2599"
	RETURN

@droneTestCompleted
	1: We're still working on those upgrades.
	1: Please come back once you hit level 80, they should be ready then.
	END
	
@droneTestLevel80	
	1: Great, you made it back and just in time too!
	3: We just finished upgrading the drones that you fought before.
	3: They should give you a real challenge this time.
	3: Are you ready to test them?
	8: Well, I sure am!
	8: Are you too, %1?
	ASK 300
	IF -YES, @droneTestLevel80No
	1: Great, good luck!
	WAIT 3.0
	GOTO SCENE 5260	
	
@droneTestLevel80No
	1: Awww, #<g.man>, we were really hoping you could jump right into it.
	1: Well hurry up with whatever is that you need to do first and then get back here.
	1: Those drones don't shoot themselves out of the air.
	3: Thank goodness they don't know, talk about bad design.
	END
	
@droneTestLevel80Continued
	3: Damn, you've beaten them!
	1: It looks like we still have more work to do.
	1: I guess you didn't know this, but I have a younger sister named Carmen. 
	1: She and her husband, Silver, visited us years ago. 
	1: Silver gave me this %I2643 back then and told me that a gifted #<g.man> would one day aid us in saving the world.
	I don't truly know if you are that #<g.man>, but considering all that you've done for us, I want you to have this %I2643.
	WAIT 2.0
	
	N: You received a %I2643.
	HOST_GIVE I2643
	HOST_GIVE T969

	3: Yeah, I think you're the right person for this gift.
	H: Oh wow, you know Silver?
	H: In fact, he's your brother-in-law?
	1: Yes, that's right, he's family. 
	
@returnAfterRejectBunker9Quest
	1: Silver visits us on occasion, but I'm worried that something happened to him.
	1: He usually keeps in touch with us, but we haven't heard from him for a while now.
	1: The last place he was visiting was bunker 9.
	8: Mm, I recall that being a huge base.
	8: It had a lot of experimental tech back in the day, but it was also a source of trouble.
	1: If I add that location to your teleporter, then maybe you can go there? 
	ASK 300
	IF -YES, @rejectBunker9Mission
	
	IF -T972, @bunker9TalkToDocAdlingtonFirst
	IF -T1210, @bunker9QuestSamuel
	1: Good, I'll add the location to the teleporter. 
	1: We've disconnected the teleporter in Bunker 9 from the network for the time being.
	1: We don't want to give the creepy crawlers out there the ability to escape from that bunker.
	1: The bunker itself is a mile below ground and was considered to be one of the safest places to perform experiments.
	3: Yeah, nothing comes in or goes out of there without using a teleporter.
	1: Once we receive the 'all clear', we'll enable that teleporter remotely again.
	1: You can go there whenever it's convenient for you, although I'd suggest stocking up on supplies before you go.	
	HOST_GIVE T970	
	END		
	
@bunker9TalkToDocAdlingtonFirst
	1: Good.
	1: However, before I update the location at the teleporter, you should talk to Doc Adlington first.
	1: She has an important assignment for you.
	3: Yeah, she mentioned something about catching %M1700s.
	3: It should be right up your alley.
	END
	
@bunker9QuestSamuel
	1: Before I update your teleporter, you talk to Samuel first.	
	1: You'll need a higher clearance in that bunker than you currently have.
	H: I'll talk to him.
	END
	
@rejectBunker9Mission
	1: Well, I hope you'll change your mind.
	END

@bunker9QuestStarted
	3: I hope your mission is going well.
	4: Meow!
	SOUND meow
	END
	
@bunker9QuestFinished
	1: How did your mission go?
	IF T997, @bunker9Truce
	H: Well, I ended up killing the %M1718 and his men vowed vengeance.
	H: We may want to upgrade the security of bunker 3.
	3: Damn, that's terrible news.
	1: Yeah, let's work on that right away.
	1: From what I saw on the monitors, we're in big trouble once those %M1716s figure out how the teleporter works.
	8: It was probably not our most tactical move, no.
	1: Did you see Silver?
	H: Yes, he's fine.
	H: He made it out of there unscathed.
	1: Thank goodness, I'd hate having to tell my sister know that her husband died.
	3: Yeah, if you think Silver is strong when he's pissed off, then you haven't dealt with Carmen yet.
	3: She'd hunt you to the end of the world and beyond.
	H: Ehm, I'll keep that in mind.
	END	
	
@bunker9Truce
	H: We made a truce with %M1718.
	H: It was pretty nasty, but luckily they're unaware of bunker 3 or the outside world.
	3: That's great news!
	1: Did you see Silver too?
	H: Yes, he's fine.
	H: In fact, he helped me with the mission and sabotaging the %M1716s. 
	H: We won't have to worry about them for a long time to come.
	1: That's a relief to hear.
	END
	

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; This scene only features the terminal computer where the player has to click on in order to move to the CUT scene.
; The scene itself is done.
; 
SCENE 5013, deusex04, SCENE, "Power core computer", 0, 0, 0

	IF T804+T815, @cancel
	ACTOR 1, "Terminal", circuitbuttonsdown, 1, 57,70	
	END

@eventActorClick1
	IF DEAD, @died
	MENU "Open terminal=@openTerminal", "Cancel=@cancel"
	END

@openTerminal
	GOTO SCENE 5014

@cancel
	END
	
@died
	N: You cannot operate the terminal when you are dead.
	END

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; Terminal scene from 5013
SCENE 5014, check1, CUT, "Terminal screen", 0, 0, 0	

	CALL 5101@setUpTerminal	11

	N: Use full screen resolution when letters/ icons overlap, 1920 x 1080 is optimal.
	N: First time players should right click on the HELP button to receive further instructions.
	N: Extra information appears in the chat window.

	; These cookies are mandatory to implement
	SET scene, #<scene.id>
	SET sceneReturn, "5013"
	SET attempts, 5
	STRCMP #<passwordSet>, ""
	IF!= @skipSetTempPassword
	SET passwordSet, "temp"
	
	; passwordScene will be used to retrieve the password.
	; In this scene there is a random part added to it, this is optional.
	; Most likely all passwords will/ should have a random element to them.
	SET temp, %R10
	SUB temp, 1
	SET passwordScene, gunsNroses1#<temp>
@skipSetTempPassword
	
	CALL 5101@startScreen
	9: Click on the blinking cursor to enter text into the terminal.
	END
	
@eventActorClick1
	COMPARE #<loggedIn>, 1
	IF= @commandLine

	ASK 300
	
	STRCMP #<lastAsk>, "help"
	IF= @eventActorClick13
	
	CALL 5101@loginUser	
	CALL 5101@loginPassword
	
	; The actual password checking happens after confirming the correct login was used.
	STRCMP #<login>, "admin"
	IF= @admin 
	STRCMP #<login>, "engineer"
	IF= @engineer
	STRCMP #<login>, "emrys"
	IF= @emrys

	CALL 5101@invalidAccessRequest
	END
	
@eventActorClick13
	CALL 5101@requestHelp
	END
	
@eventActorClick14
	CALL 5101@hackToolMenu
	END	

@accessDenied
	CALL 5101@accessDenied
	END	

@admin
	; admin can search passwords.txt
	SET user, "admin"
	STRCMP #<password>, "admin"
	IF!= @accessDenied
	
	SET dir, "documents"
	SET path, "c:\#<dir>"
	GOTO @accessGranted

@engineer
	SET user, "engineer"
	SET passwordSet, #<passwordScene>
	STRCMP #<password>, #<passwordScene>
	IF!= @accessDenied
	
	SET dir, "program files"
	SET path, "c:\#<dir>"
	GOTO @accessGranted

@emrys	
	; this account is just a little easter egg for my son
	SET user, "emrys"
	STRCMP #<password>, "emrys"
	IF!= @accessDenied
	
	CALL 5101@loginSuccessful
	
	WAIT 1.0
	SOUND tickle	
	WAIT 3.0
	SOUND chick
	WAIT 2.0
	SOUND lol
	WAIT 2.0
	SOUND locococo
	WAIT 2.0	
	SOUND excuseme
	WAIT 2.5
	SOUND tanya_laugh
	WAIT 2.0
	SOUND beg
	WAIT 4.0
	GOTO @commandLogOut
	
@accessGranted	
	CALL 5101@accessGranted
	CALL 5101@loginSuccessful
	CALL 5101@commandAwaitingOrders	
	GOTO @commandLine

	; show several directories, but also show that the user doesn't have the rights to access those
	; open to to see which fuse is burned through (random 1 of 3) in power_management.exe
	END
;---------------------------------
; COMMAND LINE
;---------------------------------
@commandLine
	ASK 300

	; Check the STRCMP commands first, then the STRSTR
	
	STRCMP #<lastAsk>, "logout"
	IF= @commandLogOut
	STRCMP #<lastAsk>, "logoff"
	IF= @commandLogOut
	
	STRCMP #<lastAsk>, "quit"
	IF= @commandQuit

	STRCMP #<lastAsk>, "cd ./"
	IF= @commandCloseDirectory
		
	STRCMP #<lastAsk>, "dir"
	IF= @commandViewDirectory
	
	STRCMP #<lastAsk>, "exit"
	IF= @commandExitProgram
	
	STRCMP #<lastAsk>, "close"
	IF= @commandCloseFile
	
	STRSTR #<lastAsk>, "open"
	IF> @commandOpenFile
	
	STRSTR #<lastAsk>, "run"
	IF> @commandRunProgram

	STRCMP #<lastAsk>, "cd program files"
	IF= @commandOpenDirectoryProgramFiles

	STRCMP #<lastAsk>, "cd documents"
	IF= @commandOpenDirectoryDocuments
	
	STRCMP #<lastAsk>, "help"
	CALL 5101@requestHelp

	CALL 5101@invalidCommand
	GOTO @commandLine
	
@commandLogOut
	CALL 5101@commandLogOut

@commandQuit
	CALL 5101@commandQuit

@commandViewDirectory
	CALL 5101@commandSearching
	
	STRCMP #<path>, "c:\"
	IF= @commandViewDirectoryRoot
	
	STRCMP #<path>, "c:\documents"
	IF= @commandViewDirectoryDocuments
	
	STRCMP #<path>, "c:\program files"
	IF= @commandViewDirectoryProgramFiles
	GOTO @commandLine
	
@commandViewDirectoryRoot	
	SET lastAsk, ""
	SET terminalText, "detonate nuclear bomb.exe"
	CALL 5101@writeText	1
	SET terminalText, "documents"
	CALL 5101@writeText	1
	SET terminalText, "program files"
	CALL 5101@writeText	1
	GOTO @commandLine

@commandViewDirectoryDocuments
	STRCMP #<login>, "engineer"
	IF= @invalidAccessDirectory
	
	CALL 5101@updateProgramName "#<path>"

	SET lastAsk, ""
	SET terminalText, "launchcode.txt"
	CALL 5101@writeText	1
	SET terminalText, "passwords.txt"
	CALL 5101@writeText	1
	SET terminalText, "vault.protected"
	CALL 5101@writeText	1	
	GOTO @commandLine
	
@commandViewDirectoryProgramFiles
	CALL 5101@updateProgramName "#<path>"
	
	SET lastAsk, ""
	SET terminalText, "power_management.exe"
	CALL 5101@writeText	1
	SET terminalText, "diagnostics.exe"
	CALL 5101@writeText	1
	GOTO @commandLine

@commandOpenDirectoryRoot
	SET dir, "c:\"
	SET path, "#<dir>"
	
	SET lastAsk, ""
	SET terminalText, "#<path>"
	CALL 5101@writeText	1	
	GOTO @commandLine
	
@commandOpenDirectoryProgramFiles
	SET dir, "program files"
	SET path, "c:\#<dir>"
	
	SET lastAsk, ""
	SET terminalText, "#<path>"
	CALL 5101@writeText	1	
	GOTO @commandLine		

@commandOpenDirectoryDocuments
	STRCMP #<user>, "engineer"
	IF= @invalidAccessDirectory
	
	SET dir, "documents"
	SET path, "c:\#<dir>"
	
	SET lastAsk, ""
	SET terminalText, "#<path>"
	CALL 5101@writeText	1	
	GOTO @commandLine
	
@commandCloseDirectory
	STRCMP #<dir>, "c:\"
	IF= @commandCloseDirectoryRoot
	GOTO @commandOpenDirectoryRoot

@invalidAccessDirectory	
	7: ERROR: You have insufficient rights to access this directory.
	GOTO @commandLine
	
@invalidAccessFile	
	7: ERROR: You have insufficient rights to access this file.
	GOTO @commandLine	

@invalidAccessProgram
	7: ERROR: You have insufficient rights to run this program, login as another user to run this program.
	GOTO @commandLine	

@commandCloseDirectoryRoot
	CALL 5101@commandInvalidDirectory
	7: You are already in the root directory.
	GOTO @commandLine

@commandOpenFile
	COMPARE #<fileOpen>, "1"
	IF= @commandOpenFileInvalid

	SET fileOpen, "1"
	
	STRCMP #<lastAsk>, "open passwords.txt"
	IF= @commandOpenFilePasswords
	STRCMP #<lastAsk>, "open passwords"
	IF= @commandOpenFilePasswords
	STRCMP #<lastAsk>, "open launchcode.txt"
	IF=	@commandOpenFileLaunchcode
	STRCMP #<lastAsk>, "open launchcode"
	IF=	@commandOpenFileLaunchcode
	
	SET fileOpen, "0"

	STRCMP #<lastAsk>, "open vault.protected"
	IF= @invalidAccessFile

	7: ERROR: The requested file does not exist.
	RETURN

@commandOpenFileInvalid
	7: ERROR: There is already a file open, close the current file first.
	GOTO @commandLine
	
@commandOpenFilePasswords
	7: ----------------
	7: PASSWORDS
	7: ----------------
	7: user name: admin 
	7: password: admin
	7: ----------------
	7: user name: engineer
	7: password: #<passwordScene>
	SET passwordSet, #<passwordScene>
	7: ----------------
	7: user name: emrys
	7: password: emrys
	7: ----------------
	GOTO @commandLine

@commandOpenFileLaunchcode
	7: WARNING: do not use the launch code without explicit permission from RoT's protector.
	7: The following code can be used in the event that total destruction of the world is warranted.
	7: Code: d465aek901ba.2/k17
	7: Please do not condemn us without just cause!
	GOTO @commandLine	
	
@commandCloseFile
	COMPARE #<fileOpen>, "1"
	IF< @commandCloseFileInvalid
	SET fileOpen, "0"
	7: File closed.
	GOTO @commandLine
	
@commandCloseFileInvalid
	7: ERROR: no open file
	GOTO @commandLine
	
@commandRunProgram
	COMPARE #<programActive>, "1"
	IF= @commandRunProgramAlreadyActive

	STRCMP #<lastAsk>, "run detonate nuclear bomb.exe"
	IF= @commandRunProgramNuclearBomb
	STRCMP #<lastAsk>, "run detonate_nuclear_bomb.exe"
	IF= @commandRunProgramNuclearBomb
	STRCMP #<lastAsk>, "run detonate nuclear bomb"
	IF= @commandRunProgramNuclearBomb
	STRCMP #<lastAsk>, "run detonate_nuclear_bomb"
	IF= @commandRunProgramNuclearBomb	
	
	STRCMP #<lastAsk>, "run power_management.exe"
	IF= @commandRunProgramPowerManagement
	STRCMP #<lastAsk>, "run power management.exe"
	IF= @commandRunProgramPowerManagement	
	STRCMP #<lastAsk>, "run powermanagement.exe"
	IF= @commandRunProgramPowerManagement
	STRCMP #<lastAsk>, "run power_management"
	IF= @commandRunProgramPowerManagement
	STRCMP #<lastAsk>, "run power management"
	IF= @commandRunProgramPowerManagement	
	STRCMP #<lastAsk>, "run powermanagement"
	IF= @commandRunProgramPowerManagement
	
	STRCMP #<lastAsk>, "run diagnostics.exe"
	IF= @commandRunProgramDiagnostics
	STRCMP #<lastAsk>, "run diagnostics"
	IF= @commandRunProgramDiagnostics	
	GOTO @commandLine
	
@commandRunProgramAlreadyActive	
	7: ERROR: a program is already active, exit the current program first
	GOTO @commandLine

@commandRunProgramNuclearBomb
	STRCMP #<user>, "engineer"
	IF= @invalidAccessProgram
	
	SET programActive, 1
	
	7: ***************
	7: Status caution
	SOUND voice\status_caution
	7: ***************
	7: Launch program accessed.
	7: Base security has been alerted.
	7: Has RoT's protector authorized the use of this program [YES/NO]?
	ASK 300
	IF YES, @commandRunProgramNuclearBombContinue

@commandRunProgramNuclearBombTerminated	
	7: Program terminated.
	
	SET programActive, 0
	GOTO @commandLine	

@commandRunProgramNuclearBombContinue
	7: ***************
	7: Status yellow
	SOUND voice\status_yellow
	7: ***************
	7: Enter launch code now:
	ASK 300
	STRCMP #<lastAsk>, "d465aek901ba.2/k17"
	IF!= @commandRunProgramNuclearBombTerminated
	7: Code accepted.
	7: ***************
	7: Status red
	SOUND voice\status_red
	7: ***************
	7: Confirm launching procedure:
	7: Are you certain that you want to launch the nuclear bomb [YES/NO]?
	ASK 300
	IF YES, @commandRunProgramNuclearBombContinue2
	GOTO @commandRunProgramNuclearBombTerminated	

@commandRunProgramNuclearBombContinue2
	7: ***************
	7: Status critical
	SOUND voice\status_critical
	7: ***************
	7: Launch will commence in T-minus 5 seconds.
	7: 5...
	WAIT 1.0
	7: 4...
	WAIT 1.0
	7: 3...
	WAIT 1.0
	7: 2...
	WAIT 1.0
	7: 1...
	WAIT 1.0
	7: Launch initiated.
	GOTO SCENE 5015

@commandRunProgramPowerManagement
	SET programActive, 1

	STRCMP #<user>, "engineer"
	IF!= @invalidAccessProgram

	7: --------------------------------
	7: Welcome to Power Management
	7: --------------------------------	
	
	IF T804, @commandRunProgramPowerManagementRepaired
	
	7: Primary power: offline
	7: Secondary power: online
	7: Status yellow
	SOUND voice\status_yellow
	
	SET temp, 24
	SUB temp, #<num.timeHour>
	MUL temp, 100
	DIV temp, 24
	7: Batteries are: #<temp>%% charged.	
	
	SET temp, 24
	SUB temp, #<num.timeHour>
	SET temp2, 60
	SUB temp2, #<num.timeMinute>
	
	7: Total system outage will occur in: #<temp> hours and #<temp2> minutes.
	7: Please run the diagnostics program to determine the cause of the power failure.
	GOTO @commandLine
	
@commandRunProgramPowerManagementRepaired
	7: Primary power: online
	7: Secundary power: online
	7: All systems go
	SOUND voice\all_systems_go
	GOTO @commandLine
	
@commandRunProgramDiagnostics	
	SET programActive, 1

	STRCMP #<user>, "engineer"
	IF!= @invalidAccessProgram
	
	7: ---------------------------
	7: Welcome to Diagnostics
	7: ---------------------------	
	
	IF T804+T815, @commandRunProgramDiagnosticsRepaired	
	
	7: Would you like to initiate a diagnostics run [YES/NO]?
	ASK 300
	IF -YES, @commandLine
	
	7: Running diagnostics...
	CALL 5101@commandSearching
	IF T804, @commandRunProgramDiagnosticsPassageShortCircuit
	IF T802, @skipSettingBurnedFuse
	SET burnedFuse, %R6

@skipSettingBurnedFuse	
	7: Power core fuse number #<burnedFuse> burned through.
	HOST_GIVE T802
	7: Replace this fuse immediately.
	IF T815, @commandLine	

@commandRunProgramDiagnosticsPassageShortCircuit
	7: WARNING: short circuit detected in the Passage.
	7: The Passage is located south in the base.
	7: Immediate action required.
	GOTO @commandLine

@commandRunProgramDiagnosticsRepaired	
	7: Would you like to initiate a diagnostics run [YES/NO]?
	ASK 300
	IF -YES, @commandLine
	
	7: Running diagnostics...
	CALL 5101@commandSearching
	7: All systems go
	SOUND voice\all_systems_go
	GOTO @commandLine
	
@commandExitProgram
	COMPARE #<programActive>, "0"
	IF= @commandExiProgramInactive
	SET programActive, "0"
	7: Program exited.
	GOTO @commandLine

@commandExiProgramInactive
	7: ERROR: There is no active program to exit.
	GOTO @commandLine

@securityActivated
	SET temp, #<num.hostMaxHP>
	DIV temp, 4
	ADD temp, 1
	HOST_TAKE H#<temp>
	SOUND tesla_shot
	N: The security system gave you quite a shock!
	WAIT 2.0
	IF DEAD, @securityExit
	END

@securityExit
	WAIT 1.0
	N: You cannot operate the terminal when you are dead.
	WAIT 3.0
	GOTO SCENE 5013

	; something nasty will happen now.
	; computer will call red alert, red alert and shock the player?
	; player gets locked out (no shock since they still have to kill a baby nightmare)
	; Make the player run with GOTO EXIT before something truly nasty happens, they can hear a tesla coil charging, but they run before it discharges N: You feel before the shock hits you!


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; If you mess up really bad, then the world itself will explode.
SCENE 5015, nucfireball, SCENE, "The end of days", 2, 0, 0

	FLAGS	17792
	MUSIC #silence
	SOUND nuke
	
	HOST_TAKE H#<num.hostMaxHP>
	HOST_GIVE L1

	ACTOR	1,	"RoT's Protector",monster002, 4, -15, 85
	MOVE 1, 30, 85
	
	WAIT 3.0
	
	1: You and I need to have a serious talk, %1.
	1: You *can't* go blowing up the world, you idiot!
	1: Look at what you just did!?
	1: Everything we worked so hard to rebuild after the last idiot that couldn't keep his hand of the shiny red button is all gone now.
	1: /a shakes his head.
	1: Unfortunately, you've given me no other option then to put you in Unknown Hell.
	H: Why?
	1: WHY!? Because you destroyed everything else, that's why!
	1: That ugly black hell hole is all we have left now.
	WAIT 3.0
	GOTO LINK 100, 0, 0

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; CUT scene to replace the broken fuse.
SCENE 5016, bunkerenergycore2, CUT, "Power core switch board" , 0, 0, 0

	CALL 5099@setUpSwitch
	CALL 5099@setCircuitBoard
	
	BKGND bunkerenergycore2
	
	SET temp, 0
	; pose 12 = good fuse, pose 13 = bad fuse, pose 14 = no fuse
	
@setUpFuses
	COMPARE #<temp>, "6"
	IF> @endSetUpFuses
		
	SET fuseBroken, "1"
	ADD temp, 1
	
	COMPARE #<temp>, #<burnedFuse>
	IF= @setUpBurnedFuse
	
	SET pose#<temp>, 12
	GOTO @setUpFuses

@setUpBurnedFuse
	SET pose#<temp>, 13
	GOTO @setUpFuses
	
@endSetUpFuses	
	ACTOR 1, "Fuse 1", circuitbuttons, #<pose1>, 28, 40
	ACTOR 2, "Fuse 2", circuitbuttons, #<pose2>, 44, 40
	ACTOR 3, "Fuse 3", circuitbuttons, #<pose3>, 60, 40
	ACTOR 4, "Fuse 4", circuitbuttons, #<pose4>, 28, 73
	ACTOR 5, "Fuse 5", circuitbuttons, #<pose5>, 44, 73
	ACTOR 6, "Fuse 6", circuitbuttons, #<pose6>, 60, 73
	
	N: This scene is optimized for full screen resolution (1920x1080).
	N: Use a higher resolution when icons overlap.
	N:-----------------------------------------------------------	

@end
	END

@getShock
	IF DEAD, @died
	SOUND tesla_shot
	WAIT 1.0
	N: You received a shock!
	SET temp, #<num.hostMaxHP>
	DIV temp, 2
	ADD temp, 1
	HOST_TAKE H#<temp>
	WAIT 1.0
	END

@eventActorClick1
	COMPARE #<power>, "1"
	IF= @getShock
	SET actor, 1
	CALL @checkFuse
	END

@eventActorClick2
	COMPARE #<power>, "1"
	IF= @getShock
	SET actor, 2
	CALL @checkFuse
	END

@eventActorClick3
	COMPARE #<power>, "1"
	IF= @getShock
	SET actor, 3
	CALL @checkFuse
	END

@eventActorClick4
	COMPARE #<power>, "1"
	IF= @getShock
	SET actor, 4
	CALL @checkFuse
	END

@eventActorClick5
	COMPARE #<power>, "1"
	IF= @getShock
	SET actor, 5
	CALL @checkFuse
	END

@eventActorClick6
	COMPARE #<power>, "1"
	IF= @getShock
	SET actor, 6
	CALL @checkFuse
	END

@checkFuse
	IF DEAD, @died
	COMPARE #<actor>, #<burnedFuse>
	IF!= @fuseOkay
	COMPARE #<fuseBroken>, "0"
	IF= @fuseOkay
	IF -I978, @hasNoGoodFuse
	N: You replace the broken fuse.
	SET fuseBroken, "0"
	HOST_GIVE I979
	N: You received a %I979.
	WAIT 2.0
	SEL #<actor>
	POSE 14
	WAIT 3.0
	POSE 12
	WAIT 2.0
	N: You put in the %I978.
	HOST_TAKE I978
	RETURN
	
@hasNoGoodFuse
	N: You want to replace the %I979 with a %I978, but you lack a %I978 to do so.
	N: Find or buy a %I978 first!
	RETURN

@died
	N: You cannot do anything while you are dead.
	END	
	
@finish5006
	COMPARE #<power>, "0"
	IF= @end
	HOST_GIVE T803
	N: You have successfully replaced the burned out fuse and restored power to the base!
	WAIT 4.0
	GOTO SCENE #<scene>

@fuseOkay
	N: This fuse is already working correctly.
	RETURN

@eventActorClick15
	CALL 5099@changeThePower
	
	COMPARE #<fuseBroken>, "0"
	IF= @finish#<scene>	
	END
	
@eventActorClick14
	N: Right click on the fuse to replace it.
	N: Do not forget to turn the power back on once you replaced the fuse.
	END
	
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; This scene is not to be called directly. If a dead player camps on map 35, then 
; Doctor Adlington will come to the rescue.	
SCENE 5017, bunkermedclinic, 	SCENE,	"Clinic",	0, 0, 0

@summonDoctorAdlington
	ACTOR 1, "Doc Adlington", gun001, 1, -15, 85
	POSE 1, 4		
	MOVE 1, 25, 85
	WAIT 3.0
	1: Oh my, you require immediate CPR!
	WAIT 2.0
	SOUND tesla_charge
	WAIT 2.0
	1: Clear!
	WAIT 1.0
	SOUND tesla_shot
	WAIT 3.0
	HOST_GIVE L#<num.hostMaxHP>
	HOST_GIVE M#<num.hostMaxMP>
	1: Please don't get yourself killed, %1.
	H: Thanks for the help, Doc.
	1: You're welcome. 
	1: I'll be on my way now.
	MOVE 1, -15-, 85
	RETURN
	
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; Gun Range
SCENE 5018, bunker02, CUT, "Gun range", 0, 0, 0

	CALL 5099@setCutSceneFlags
	CALL 5099@setUpHelp
	CALL 5099@setUpStart
	
	FLAGS 192
	MUSIC james-bond
	
	SET score, 0
	
	ACTOR 14, "", staticactors, 4, 95, 95 ; exit button
	MOVE 15, 95, 80, 1

	; target actors
	ACTOR 16.2, "", gun64px, 1, -100, -99
	ACTOR 17.3, "", stealth2, 1, -100, -100 
	ACTOR 18.4, "", abcall, 0, -100, -100
	ACTOR 19.-1, "", background, 0, 0, 0
	END
	
@eventActorAttack16
	CALL @preCheck
	N: You hit the target, 2 points!
	ADD score, 2
	GOTO @changeLocationActors
	
@eventActorAttack17
	CALL @preCheck
	N: You hit the middle circle, 3 points!
	ADD score, 3
	GOTO @changeLocationActors

@eventActorAttack18	
	CALL @preCheck
	N: You hit BULLSEYE, 5 points!
	ADD score, 5
	GOTO @changeLocationActors

@eventActorAttack19
	IF XP, @skipExplanation
	CALL @preCheck
	N: You missed!
	GOTO @changeLocationActors

@eventActorAttack12	
@eventActorClick12
	COUNTDOWN 60
	MOVE 12, -50, -50, 1	
	CALL @changeLocationActors

@eventActorClick14
	COUNTDOWN 0
	GOTO SCENE 5010
	
@eventActorClick15	
	9: Welcome to the Gun range.
	9: The objective is to score as many points as possible within 60 seconds.
	9: The countdown begins once you push the 'START'.
	9: The target will randomly change locations.
	9: The more accurate you hit it in the center, the more points you earn.
	9: Make sure you press F2 to ready your weapon.
	9: You can only shoot with ranged weapons. 
	9: Use the left mouse to attack the target.
	9: Click the EXIT button to return to the shop at any time.
	9: Click the HELP button to repeat these instructions.	
	END
	
@changeLocationActors
	CALL @changeXY
	CALL @calculateOffSet
	CALL @teleportActors
	CALL @changeXY
	CALL @calculateOffSet
	CALL @moveActors
	END

@removeXY
	SET x, -100
	SET x17, -100
	SET x18, -100
	RETURN
	
@calculateOffSet	
	SET x16, #<x>
	ADD x16, 1
	SET y16, #<y>
	ADD y16, 5
	
	SET x17, #<x>
	ADD x17, 1
	SET y17, #<y>
	ADD y17, 4
	
	SET x18, #<x>
	ADD x18, 1
	SET y18, #<y>
	ADD y18, 2
	RETURN	

@teleportActors	
	MOVE 16, #<x16>, #<y16>, 1
	MOVE 17, #<x17>, #<y17>, 1
	MOVE 18, #<x18>, #<y18>, 1
	RETURN
	
@moveActors	
	SET randomSpeed, %R3
	ADD randomSpeed, 1

	MOVE 16, #<x16>, #<y16>, #<randomSpeed>
	MOVE 17, #<x17>, #<y17>, #<randomSpeed>
	MOVE 18, #<x18>, #<y18>, #<randomSpeed>
	RETURN	
		
@changeXY
	SET x, %R90
	SET y, %R85
	ADD y, 10
	RETURN	
	
@preCheck
	IF XP, @finished
	CALL @checkWeapon
	RETURN
	
@checkWeapon
	COMPARE #<item.class>, "14"
	IF!= @onlyRangedWeaponsAllowed
	RETURN

@onlyRangedWeaponsAllowed	
	N: Only ranged weapons are allowed.
	END	
	
@finished
;	CALL @removeXY
	SET x, -100
	SET y, -100
	CALL @calculateOffSet
	CALL @teleportActors
	N: You scored #<score> points.
	WAIT 2.0
	STRCMP #<str.serverName>, "Solo Channel"
	IF!= @playerIsOnline
	
@continueSoloMode	
	COMPARE #<score>, #<highScore>
	IF<= @tryAgain
	SET highScore, #<score>
	N: You achieved a new high score!
	GOTO @tryAgain
	
@playerIsOnline
	N: Uploading new high scores while you're online can take up to 10 seconds.
	N: Please be patient, RoT didn't freeze.
	GET_SERVER_VAR highScoreServerName, GunRangeName, highScoreName
	GET_SERVER_VAR highScoreServerPoints, GunRangePoints, highScorePoints
	COMPARE #<score>, #<highScoreServerPoints>
	IF< @notServerHighScore
	IF= @sameServerHighScore
	
	N: You have the new high score on the server!
	N: The old high score was #<highScoreServerPoints> points from #<highScoreServerName>.
	SET highScoreServerName, "#<str.name>"
	SET highScoreServerPoints, #<score>
	SET_SERVER_VAR GunRangePoints, highScorePoints, "#<highScoreServerName>"
	SET_SERVER_VAR GunRangeName, highScoreName, "#<highScoreServerPoints>"
	WAIT 2.0
	N: Your score is uploaded to the server.
	GOTO @continueSoloMode	
	
@notServerHighScore
	N: You did not beat the server high score of #<highScoreServerPoints> points from #<highScoreServerName>.
	GOTO @continueSoloMode
	
@sameServerHighScore
	N: You scored just as high as #<highScoreServerName> who holds the current record with #<highScoreServerPoints> points.
	GOTO @continueSoloMode
	
@tryAgain
	IF T820, @skipGiveT820
	HOST_GIVE T820

@skipGiveT820	
	SET score, 0
	WAIT 2.0
	N: Click the start button if you want to improve your high score.	
	CALL 5099@setUpStart
	END

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5019, bunkerstorage02, SCENE, "PP Coin Exchange"

	ACTOR 1, "Brandon Havik", gun002, 4, 25, 90
	
	IF T803, @powerIsFixed
	COLOR 21
	1: The power is currently offline, but I still offer my services.

@powerIsFixed		
	CALL 984@setUpScene
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; 
SCENE 5020, bunkerserverroom, SCENE, "Server room"

; erick should give a spare parts if the player doesn't have any.

	CALL 5097@addGunslinger
	
	IF T929, @nothingHere

	ACTOR 1, "Switch board", staticactors, 1, 79, 54
	IF T887|T888, @commentActor
	N: Click on the switch board to open it.
	END

@commentActor
	8: Mm, I suppose we'll need to open that switch board?
	H: Yeah, it seems to be the only way to fix things.
	END

@nothingHere
	N: There is nothing left to do here.
	IF T887|T888, @nothingHereActor
	END

@nothingHereActor
	8: I'm glad we fixed those!
	END

@eventActorClick1
	GOTO SCENE 5021


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; 
SCENE 5021, circuitboard3, CUT, "Switch board"

	CALL 5099@setCircuitBoard
	SEL 17
	POSE 1
	
	SET tempHP, #<num.hostMaxHP>
	DIV tempHP, 6
	ADD tempHP, 1
	SET previousSwitch, "0"
	SET currentSwitch, "0"

	CALL @startLoopOff

	ACTOR 1, 	"", circuitbuttons,  #<actorPose1>, 28, 40
	ACTOR 2, 	"", circuitbuttons,  #<actorPose2>, 44, 40
	ACTOR 3, 	"", circuitbuttons,  #<actorPose3>, 60, 40
	ACTOR 4, 	"", circuitbuttons,  #<actorPose4>, 28, 73
	ACTOR 5, 	"", circuitbuttons,  #<actorPose5>, 44, 73 
	ACTOR 6, 	"", circuitbuttons,  #<actorPose6>, 60, 73 
	ACTOR 14,	"", circuitbuttons,  5, 90, 85 ; Help
	ACTOR 16,	"", circuitbuttons,  2, 90, 25 ; Power icon

	N: Flip the switches in the correct order to reset the power.
	END
	
	; pose 4 = off, 3 = on
@startLoopOff	
	SET i, 0
@loop
	ADD i, 1
	SET temp, actorPose#<i>
	SET #<temp>, "4"	
	COMPARE #<i>, "7"
	IF< @loop
	RETURN		

@resetAllButtonsOff
	CALL @startLoopOff

	SOUND switch
	SET previousSwitch, "0"
	SEL 1
	POSE #<actorPose1>
	SEL 2
	POSE #<actorPose2>
	SEL 3
	POSE #<actorPose3>
	SEL 4
	POSE #<actorPose4>
	SEL 5
	POSE #<actorPose5>
	SEL 6
	POSE #<actorPose6>	
	WAIT 0.5
	SOUND tesla_shot
	TAKE H#<tempHP>		
	WAIT 1.5
	N: All the switches were reset!
	WAIT 1.0
	RETURN
	
@checkCorrectOrder
	COMPARE #<previousSwitch>, "0"
	IF= @checkSwitch2
	COMPARE #<previousSwitch>, "2"
	IF= @checkSwitch5
	COMPARE #<previousSwitch>, "5"
	IF= @checkSwitch4
	COMPARE #<previousSwitch>, "4"
	IF= @checkSwitch1
	COMPARE #<previousSwitch>, "1"
	IF= @checkSwitch3
	COMPARE #<previousSwitch>, "3"
	IF= @checkSwitch6
	GOTO @resetAllButtonsOff
	
@checkSwitch1
	COMPARE #<actor>, "1"
	IF!= @resetAllButtonsOff
	SET previousSwitch, "1"
	RETURN	
	
@checkSwitch2
	COMPARE #<actor>, "2"
	IF!= @resetAllButtonsOff
	SET previousSwitch, "2"
	RETURN
	
@checkSwitch3
	COMPARE #<actor>, "3"
	IF!= @resetAllButtonsOff
	SET previousSwitch, "3"
	RETURN	

@checkSwitch4
	COMPARE #<actor>, "4"
	IF!= @resetAllButtonsOff
	SET previousSwitch, "4"
	RETURN
		
@checkSwitch5
	COMPARE #<actor>, "5"
	IF!= @resetAllButtonsOff
	SET previousSwitch, "5"
	RETURN

@checkSwitch6
	COMPARE #<actor>, "6"
	IF!= @resetAllButtonsOff
	GOTO @reward
	
@eventActorClick1
	SET actor, "1"
	CALL @changeSwitchStatus
	CALL @checkCorrectOrder
	END

@eventActorClick2
	SET actor, "2"
	CALL @changeSwitchStatus 
	CALL @checkCorrectOrder
	END
	
@eventActorClick3
	SET actor, "3"
	CALL @changeSwitchStatus 
	CALL @checkCorrectOrder
	END

@eventActorClick4
	SET actor, "4"
	CALL @changeSwitchStatus 
	CALL @checkCorrectOrder
	END

@eventActorClick5
	SET actor, "5"
	CALL @changeSwitchStatus 
	CALL @checkCorrectOrder
	END

@eventActorClick6
	SET actor, "6"
	CALL @changeSwitchStatus 
	CALL @checkCorrectOrder
	END
	
@changeSwitchStatus
	IF DEAD, @died
	SOUND switch
	SET temp, actorPose#<actor>
	COMPARE *#<temp>, "3"
	IF= @turnSwitchOff
	SET #<temp>, "3"
	SEL #<actor>
	POSE *#<temp>
	RETURN

@turnSwitchOff
	SET #<temp>, "4"
	SEL #<actor>
	POSE *#<temp>
	RETURN

@eventActorClick14 
	MENU "How does this work?=@helpGeneral", "Hints=@helpHints", "Cancel=@end"
	END

@helpGeneral	
	N: -----
	N: HELP
	N: -----
	N: Activate the switches in the correct order to turn the power back on.
	N: You will receive a shock whenever you use the wrong order.
	END
	
@helpHints	
	N: ------
	N: HINTS
	N: ------
	N: Flip the switch in the middle of the top row first, then the one below it.
	N: Next, flip the one to the left or right at the bottom row, and then the one above it.
	N: For the final two you need to figure out if you need to flip the top one or bottom one first.
	END

@reward
	SEL 16
	POSE 1
	SEL 17
	POSE 0
	N: You have flipped all the switches in the correct order!
	WAIT 2.0
	HOST_GIVE I2183
	HOST_GIVE T929
	N: You found a %I2183 between the switches.
	WAIT 3.0
	GOTO SCENE 5020
	
@died
	N: You cannot do anything while you are dead.
	END	
	
@end
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5022, bunkerstorage, CUT, "Drone testing"

	MUSIC born-to-be-wild

	; arg0 = total enemies, arg1 = drone health, arg2 = hits you can take, arg3 = hit chance multiplier drone 
	; difficulty is the number of hits you can take before dying
	SET scene, #<scene.id>
	CALL 5096@setup 5, 4, 20, 15
	END
	
@eventActorGive6
@eventActorGive7
@eventActorGive5
	COMPARE #<item.id>, "982"
	IF< @doesNothing
	IF> @doesNothing
	CALL 5096@eventActorGiveEMP
	END
	
@eventActorGive9
	COMPARE #<item.id>, "982"
	IF< @doesNothing
	IF> @doesNothing
	CALL 5096@eventActorGiveMissed
	
@eventActorAttack6
	CALL 5096@eventActorAttack6
	END
	
@eventActorAttack7
	CALL 5096@eventActorAttack7
	END	

@eventActorAttack5
	CALL 5096@eventActorAttack5
	END
	
@eventActorAttack9
	CALL 5096@eventActorAttackMiss
	END
	
@reward
	HOST_GIVE T932
	N: You found 2 %I980.
	HOST_GIVE I980.2
	WAIT 4.0
	GOTO SCENE 5012

@doesNothing
	N: This does nothing, try throwing an %I982 instead!
	END
	
@nothingHere
	N: There is nothing here anymore.
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; HARDCORE CHALLENGE 3 SET UP SCENE
SCENE 5023, bunkerhallway02, SCENE, "Hardcore challenge 3"

	CALL 5097@addGunslinger 		
	
	IF V65, @nothingHere
	IF -V60, @nothingHereYet
	IF T1202, @alreadyBeatChallenge

	ACTOR 1, "Circuit board", staticactors, 1, 20, 58
	CALL 5350@hardcoreChallengeSetUp
	
	SET sceneReturn, #<scene.id>
	
	N: Click on the circuit board to start the challenge.
	8: This is the third challenge, good luck!
	END
	
@eventActorClick1
	GOTO SCENE 5353
	
@eventActorClick7
	IF DEAD, @died
	CALL 5350@setActorGreen
	MENU "General information=@helpGeneral", "Types of challenges=@helpTypeChallenges", "Cancel=@end"
	CALL 5350@setActorRed
	END	
	
@nothingHere
	N: There is nothing here anymore.
	END
	
@nothingHereYet
	N: There is nothing here yet, return at level 60.
	END

@alreadyBeatChallenge
	N: You have beaten this challenge.
	END

@died
	N: You cannot do anything while you are dead.
	END
	
@end
	END

@helpGeneral
	CALL 5350@helpGeneral
	END
	
@helpTypeChallenges
	CALL 5350@helpTypeChallenges
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5024, bunker02, SCENE, "????"

	CALL 5097@addGunslinger

	ACTOR 1, "Hatch", staticactors, 7, 43, 82
	ACTOR 2, "Return", staticactors, 4, 95, 95 

	N: Beware those who seek entrance.	
	WAIT 2
	
	IF T1114, @differentIntro
	
	IF T887|T888, @commentActor
	N: You check your supplies.
	WAIT 3.0
	IF -I976.50, @needMoreWhiskey
	H: I should be fine, I have #<num.item976> %I976s with me.
	END
	
@commentActor	
	8: Are you sure that we're ready to do this?
	8: Whatever place we'll enter next, we should expect the worst.
	H: You're right, I better double-check my supplies.
	WAIT 3.0
	IF -I976.50, @needMoreWhiskey
	H: Mm, we should be fine, I have #<num.item976> %I976s with me.
	END 
	
@needMoreWhiskey
	H: Ack, I only brought #<num.item976> %I976s with me.
	H: Maybe I should stock up first.
	END
	
@differentIntro
	IF T887|T888, @differentIntroActor
	END
	
@differentIntroActor	
	8: Here we are again, let's do this!
	END

@eventActorClick1
	LOCK 1
	EJECT T1301
	HOST_GIVE T1114
	N: You climb down a dark tunnel.
	WAIT 2.0
	BKGND check1
	WAIT 3.0		
	GOTO LINK 41,0,0

@eventActorClick2
	N: You enter a dark underground service tunnel that leads to the south west of bunker 3.
	WAIT 2.0
	BKGND check1
	WAIT 3.0	
	GOTO LINK 35, 17, 0


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; 
SCENE 5025, bunkerhallway, SCENE, "Hidden service hatch"

	CALL 5097@addGunslinger

	ACTOR 1, "Keypad", stealth2, 8, 35, 59	; 						TODO ADD @helpHint5025
	
	SET scene, #<scene.id>
	SET passwordScene, #<5025access>
	IF T1302, @skipPasswordSet
	SET passwordScene, %R899
	ADD passwordScene, 100
	
@skipPasswordSet
	SET temp, "0"
	SET temp2, "0"	
	IF T887|T888, @commentActor
	END
	
@commentActor
	8: I wonder what that keypad is doing this far out in bunker 3?
	H: There is only one way to find out.
	END
	
@eventActorClick1
	IF DEAD, @died
	COMPARE #<temp2>, "1"
	IF= @menu2
	MENU "Enter pincode=@enterPincode", "Open hack tool=@openHackTool", "Cancel=@cancel"
	END
	
@eventActorClick13
	CALL 5101@requestHelp
	END
	
@eventActorClick14
	CALL 5101@hackToolMenu
	END			

@menu2
	MENU "Enter pincode=@enterPincode", "Cancel=@cancel"
	END	

@openHackTool
	SET temp2, "1"
	SET sceneReturn, #<scene.id>
	CALL 5099@setUpHackToolAndHelp
	SET attempts, "6"
	END

@enterPincode
	1: Enter pincode [XXX]:
	ASK 300
	COMPARE #<lastAsk>, #<passwordScene>
	IF= @accessGranted
	SOUND voice\attempt_failed
	1: Attempt failed.
	1: Access denied.
	END

@accessGranted
	SOUND voice\access_granted
	1: Access granted.
	WAIT 3.0
	IF -T1302, @setToken
	GOTO @authorized
	
@setToken	
	SET 5025access, "#<passwordScene>"
	HOST_GIVE T1302	
	N: Access code '#<5025access>' was uploaded to your Quest Diary.
	WAIT 3.0
	GOTO @authorized

@authorized
	LOCK 1
	EJECT T1301
	N: You enter a dark underground service tunnel that leads to the east of bunker 3.
	WAIT 2.0
	BKGND check1
	WAIT 3.0
	GOTO LINK 35, 8, 1

@end
	END	
	
@died
	N: You cannot do anything while you are dead.
	END	


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; SCENES 5026 - 5030 are reserved for Bunker 3


	
	
	
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; ABANDONED RESEARCH LAB
; Scenes 5031 - 5063
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; Ideas:
; A nest with young adult nightmares has taken over the base.
; The power needs to be restored to access various parts of the base.
; The terminal allows you to create a red access card
; You find a resurrection module, but you'll need Nishka and Caeran to fix it. Doc also wants to talk about it.
; You find a better weapon, you can later upgrade it at the gunshop (level 30)
; have a tough young nightmare queen be the end boss for the map
; 
; add more story background information, including a hint that Dae was there.
; show some hints for the stealth suit? probably too early for this right now
; 
; update bunker 3 with feedback from the Kagoshima quests
; update bunker 3 with the liquor quest
; rename the various alcohol items so that they have unique names
;
;
; Nightmares were a failed experiment to create genetically enhanced super soldiers
; Feature CUT scenes with experiments going wrong, maybe old security cam footage?
;
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; Entrance from Kagoshima to abandoned research lab.

SCENE 5031, bunkeroutside, SCENE, "Abandoned Research Lab", 0, 0, 0

	IF -T118, @end
	EJECT T118

	ACTOR 1, "Keypad", stealth2, 8, 37, 52

	SET scene, #<scene.id>
	SET passwordScene, #<researchlab1Password>
	IF T829, @skipPasswordSet
	SET passwordScene, %R899
	ADD passwordScene, 100
	
@skipPasswordSet
	SET temp, "0"
	SET temp2, "0"	
	END

@eventActorClick1
	IF DEAD, @died
	COMPARE #<temp2>, "1"
	IF= @menu2
	MENU "Enter pincode=@enterPincode", "Open hack tool=@openHackTool", "Cancel=@cancel"
	END
	
@eventActorClick13
	CALL 5101@requestHelp
	END
	
@eventActorClick14
	CALL 5101@hackToolMenu
	END			

@menu2
	MENU "Enter pincode=@enterPincode", "Cancel=@cancel"
	END	

@openHackTool
	SET temp2, "1"
	SET sceneReturn, #<scene.id>
	CALL 5099@setUpHackToolAndHelp
	END

@enterPincode
	1: Enter pincode [XXX]:
	ASK 300
	IF -T118, @unauthorizedAccess
	COMPARE #<lastAsk>, #<passwordScene>
	IF= @accessGranted
	SOUND voice\attempt_failed
	1: Attempt failed.
	1: Access denied.
	END

@accessGranted
	SOUND voice\access_granted
	1: Access granted.
	WAIT 3.0
	IF -T829, @setToken
	GOTO @authorized
	
@setToken	
	SET researchlab1Password, "#<passwordScene>"
	HOST_GIVE T829	
	N: Access code #<researchlab1Password> for the research laboratory has been uploaded to your Quest Diary.
	WAIT 3.0
	GOTO @authorized

@authorized
	IF -V20, @statusCaution
	EJECT T118	
	GOTO LINK 37, 0, 0

@end
	END	
	
@died
	N: You cannot do anything while you are dead.
	END

@statusCaution
	SOUND	voice\status_caution
	1: Status caution.
	1: Your current experience is not enough to survive the horrors that await you.
	1: Please return at level 20.
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; Entrance from Kagoshima to abandoned research lab.

SCENE 5032, bunkerentrance, SCENE, "Entrance", 0, 0, 0

	IF DEAD, @died
	GOTO LINK 0, 20, 0
	
@died
	GOTO LINK 35, 1, 1	


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; 5033 - Power core - restore power to the base
SCENE 5033, bunkerenergycore2, SCENE, "Power core" , 0, 0, 0

	IF T843+T844, @allRepaired

	ACTOR 1, "Circuit board", staticactors, 6, 35, 90
	ACTOR 2, "Switch board", staticactors, 1, 75, 90

	IF T843, @skipPowerOff
	COLOR 21
	BKGND bunkerenergycore

@skipPowerOff	
	SET bkgnd, "bunkerenergycore2"
	SET scene, #<scene.id>	
	
	IF -T843-T844, @explanation
	END
	
@explanation
	N: You notice that the power core is not functioning.
	WAIT 4.0
	N: After a quick analysis you conclude that the power core has burned out fuses.
	N: You also need to repair the circuit board.
	END
	
@eventActorClick1
	IF -T843, @powerNotYetFixed
	IF T844, @fixedCircuitAlready
	GOTO SCENE 5111
	
	
@eventActorClick2
	IF T843, @fixedFusesAlready
	GOTO SCENE 5058

@powerNotYetFixed
	N: You need to fix the power first before you can repair the circuit board.
	END
	
@fixedCircuitAlready
	N: You have already repaired the power core's circuit board.
	END

@fixedFusesAlready
	N: You have already fixed the power core's fuses.
	END

@allRepaired
	N: You have repaired the power core, there is nothing left for you to do here.
	SOUND turn-power-on
	WAIT 3.0
	SOUND voice\all_systems_go
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5034, bunkermedclinic2, SCENE, "Clinic"

	ACTOR 1, "Keypad", stealth2, 8, 56, 54
	ACTOR 2, "Search the desk", circuitbuttons, 9, 85, 67 
	ACTOR 3, "Search the desk", circuitbuttons, 9, 29, 71
	ACTOR 9, "", circuitbuttons, 9, -50, -50	

	CALL 5098@checkPower

	SET scene, #<scene.id>
	SET passwordScene, 123
	SET temp, 0
	SET temp2, 0
	END

@eventActorClick1
	IF DEAD, @died
	IF -T844, @noPower
	COMPARE #<temp2>, "1"
	IF= @menu2
	MENU "Enter pincode=@enterPincode", "Open hack tool=@openHackTool", "Cancel=@cancel"
	END
	
@menu2
	MENU "Enter pincode=@enterPincode", "Cancel=@cancel"
	END
	
@eventActorClick2
	N: You search the desk...
	WAIT 4.0
	N: You find an interesting note:
	9: Doctor Kristinson,
	9: Stop asking me for the pincode and memorize it yourself.
	9: For the last time, the pincode is '123'!
	9: Really, it's not that hard, I use the same code everywhere.
	9: Signed, Doctor Melchior
	END
	
@eventActorClick3
	N: You search the desk...
	WAIT 4.0
	N: However, you find nothing of interest.
	END
	
@eventActorClick13
	CALL 5101@requestHelp
	END
	
@eventActorClick14
	CALL 5101@hackToolMenu
	END	
	
@noPower
	N: The Keypad does not respond due to the lack of power.
	END

@enterPincode
	1: Enter pincode [XXX]:
	ASK 300
	COMPARE #<lastAsk>, #<passwordScene>
	IF= @accessGranted
	SOUND voice\attempt_failed
	1: Attempt failed.
	END

@accessGranted
	SOUND voice\access_granted
	1: Access granted.
	WAIT 3.0
	GOTO SCENE 5059
	
@openHackTool
	SET sceneReturn, #<scene.id>
	SET temp2, "1"
	CALL 5099@setUpHackToolAndHelp
	MOVE 13, 95, 80, 1
	MOVE 14, 95, 65, 1
	END

@cancel
	END

@died
	N: You cannot do anything while you are dead.
	END

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5035, deusex02, SCENE, "Research computer", 0, 0, 0

	CALL 5098@checkPower

	ACTOR 1, "Terminal", circuitbuttonsdown, 1, 70,70	
	END

@eventActorClick1
	IF -T844, @noPower
	IF DEAD, @died
	MENU "Open terminal=@openTerminal", "Cancel=@cancel"
	END
	
@noPower
	N: The terminal does not respond due to the lack of power.
	END	

@openTerminal
	GOTO SCENE 5061

@cancel
	END
	
@died
	N: You cannot operate the terminal when you are dead.
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5036, bunkerstorage, SCENE, "Supply room #1"

	IF I2167|I2168|T849|T855, @nothingHere

	ACTOR 1,  "", gun005, 2, 77, 90
	ACTOR 2,  "", gun005, 2, 35, 93
	ACTOR 3,  "", gun005, 2, 50, 95
	ACTOR 4,  "", gun005, 2, 65, 100
	ACTOR 11,  "", gun005, 2, -50, 50
	ACTOR 12,  "", gun005, 2, -50, 50
	ACTOR 13,  "", gun005, 2, -50, 50
	ACTOR 14,  "", gun005, 2, -50, 50		

	SET random, "%R4"
	
	SET x1, 77
	SET y1, 90
	SET x2, 35
	SET y2, 93
	SET x3, 50
	SET y3, 95
	SET x4, 65
	SET y4, 100
	END

@eventHostGive
	CALL 5199@continueGunslingerDrink
	END	
	
@eventActorClick1
@eventActorClick2
@eventActorClick3
@eventActorClick4
	N: The crate is locked, maybe you can blow the lock off?
	END	
	
@eventActorAttack1
	SET x1, -50
	SET y1, -50
	CALL @moveActorFight 1
	STRCMP "#<random>", "1"
	IF= @findBrokenDrive
	IF R50, @alertNightmare
	N: The crate was empty.
	END
	
@eventActorAttack2
	SET x2, -50
	SET y2, -50
	CALL @moveActorFight 2
	STRCMP "#<random>", "2"
	IF= @findBrokenDrive
	IF R25, @alertNightmare
	N: The crate is empty.
	END

@eventActorAttack3
	SET x3, -50
	SET y3, -50
	CALL @moveActorFight 3
	STRCMP "#<random>", "3"
	IF= @findBrokenDrive
	IF R25, @alertNightmare
	N: The crate is empty.
	END

@eventActorAttack4
	SET x4, -50
	SET y4, -50
	CALL @moveActorFight 4
	STRCMP "#<random>", "4"
	IF= @findBrokenDrive
	IF R25, @alertNightmare
	N: The crate was empty.
	END

@findBrokenDrive
	N: You find a %I2167!
	HOST_GIVE I2167
	HOST_GIVE T855
	IF -I980.3, @findExtraParts
	END

@findExtraParts
	N: You find 2 %I980.
	HOST_GIVE I980.2
	END
	
@moveActorFight
	MOVE #<arg0>, -50, -50, 1
	N: You destroyed the crate.
	WAIT 2.0
	RETURN

@alertNightmare
	MOVE 11, #<x1>, #<y1>, 1
	MOVE 12, #<x2>, #<y2>, 1
	MOVE 13, #<x3>, #<y3>, 1
	MOVE 14, #<x4>, #<y4>, 1
	MOVE 1, -50, -50, 1
	MOVE 2, -50, -50, 1
	MOVE 3, -50, -50, 1
	MOVE 4, -50, -50, 1
	
	N: You alert the %M1701s to your presence!
	
	CALL 5199@continueBeforeGunslingerFight
	FIGHT2 1701, 1701
	CALL 5198@gunslingerCPRAndDirectDrinkQuotes	

	N: You received 4 %Z1s
	HOST_GIVE Z1.4
	N: You found %I980
	HOST_GIVE I980
	
	MOVE 1, #<x1>, #<y1>, 1
	MOVE 2, #<x2>, #<y2>, 1
	MOVE 3, #<x3>, #<y3>, 1
	MOVE 4, #<x4>, #<y4>, 1	
	MOVE 11, -50, -50, 1
	MOVE 12, -50, -50, 1
	MOVE 13, -50, -50, 1
	MOVE 14, -50, -50, 1
	END	
	
@nothingHere
	N: You have already cleared this room.
	END	

@end
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5037, bunkermesshall, SCENE, "Workshop"

	ACTOR 1, "Workbench", staticactors, 8, 76, 71
	
	CALL 5097@addGunslinger	
	END	
	
@eventActorClick1
	SET menu9, 0
	SET menu8, 0
	SET menu7, 0
	SET menu6, 0
	SET menu5, 0
	SET menu4, 0
	SET menu3, 0
	SET menu2, 0
	SET menu1, 0
	
	IF -V80, @skipMenu9
	IF -I2513, @skipMenu9
	SET menu9, "Upgrade Black Assault=@upgradeBlackAssault"	
	
@skipMenu9	
	IF -V80, @skipMenu8
	IF -I2512, @skipMenu8
	SET menu8, "Upgrade Quantum Disruptor=@upgradeQuantumDisruptor"	
	
@skipMenu8		
	IF -V80, @skipMenu7
	IF -I2511, @skipMenu7
	SET menu7, "Upgrade The Widow Maker=@upgradeWidowMaker"	
	
@skipMenu7	
	IF -I983, @skipMenu6
	IF I2513, @skipMenu6
	SET menu6, "Create Black Assault=@createBlackAssault"

@skipMenu6	
	IF -I983, @skipMenu5
	IF I2512, @skipMenu5
	SET menu5, "Create Quantum Disruptor=@createQuantumDisruptor"
	
@skipMenu5		
	IF -I983, @skipMenu4
	IF I2511, @skipMenu4
	SET menu4, "Create The Widow Maker=@createWidowMaker"

@skipMenu4	
	IF T931, @skipMenu3
	IF -T930, @skipMenu3
	SET menu3, "Repair broken pocket watch=@repairBrokenPocketWatch"

@skipMenu3		
	IF T893, @skipMenu2
	IF -V40, @skipMenu2
	SET menu2, "Revision pocket watch=@revisionPocketWatch"
	
@skipMenu2		
	IF I2168, @skipMenu1
	SET menu1, "Repair broken external drive=@fixDrive"
	
@skipMenu1		
	MENU #<menu9>, #<menu8>, #<menu7>, #<menu6>, #<menu5>, #<menu4>, #<menu3>, #<menu2>, #<menu1>, "Repair burned out fuse=@fixFuse", "Cancel=@cancel"
	END	

@workshopSounds
	SOUND toolbox-workshop
	WAIT 4.0	
	SOUND wheelnutairgun
	WAIT 3.0	
	SOUND wheelnutairgun
	WAIT 3.0
	RETURN
	

@fixDrive
	IF I2168|T849, @alreadyFixedDrive
	IF -I980, @lackSpareParts
	IF -I2167, @lackBrokenDrive
	N: You study the %I2167 for a moment and then start to repair it. 	
	SOUND wheelnutairgun
	WAIT 4.0
	HOST_TAKE I980
	HOST_TAKE I2167
	HOST_GIVE I2168
	N: You successfully repaired the %I2167 and restored it into an %I2168!
	END

@lackSpareParts
	IF T887|T888, @lackSparePartsActor
	N: You don't have enough %I980 to do this.
	N: Fight %M1703s in the military research facility to find more.
	END
	
@lackSparePartsActor
	H: It looks like I ran out of %I980.
	8: Mm, we'll have to get some somewhere. 
	8: The military research facility is ideal for that, we scavenge %I980 from %M1703s. 
	END

@lackBrokenDrive
	N: You cannot repair a %I2167 without a %I2167.
	N: Maybe you can find one in one of the workshops?
	END
	
@alreadyFixedDrive
	N: You have already repaired the %I2168.
	END

@fixFuse
	IF T930-T931, @warningThree
	IF -I980, @lackSpareParts
	IF -I979, @lackBurnedOutFuse
	IF -I2168, @warning
	IF -I980.6+-I737, @warningTwo
	N: You study the %I979 for a moment and then start to repair it. 	
	SOUND wheelnutairgun
	WAIT 4.0
	HOST_TAKE I979
	HOST_TAKE I980
	HOST_GIVE I978
	N: You successfully repaired the %I979 and turned it into a %I978!
	END
	
@revisionPocketWatch
	IF -I2640, @lackOldPocketWatch
	IF -I980, @lackSpareParts
	IF -G40000, @lackFunds

	N: You study the %I2640 for a while and then start to revision it.
	CALL @workshopSounds
	
	HOST_TAKE G40000
	HOST_TAKE I980
	HOST_TAKE I2640
	HOST_GIVE I2641
	HOST_GIVE T893
	IF T887|T888, @successfullRevision
	N: You successfully revisioned your %I2640!
	END
	
@successfullRevision
	8: Hell yeah, that's how it's done!
	8: That's one sweet %I2641 you have now.
	END
	
@lackFunds
	IF T887|T888, @lackFundsActor
	N: You need 40,000 GP to revision the %I2640.
	END

@lackFundsActor	
	8: It looks like you don't have 40,000 GP to revision the %I2640.
	8: I wish I could give you some, but I'm broke myself.
	H: No problem, we'll just kill some bastards and take their money.
	8: Aye, that'll work.
	8: It's too bad %M1701s never carry any gold with them.
	END

@lackOldPocketWatch
	IF T887|T888, @lackOldPocketWatchActor	
	N: You cannot revision a %I2640 without a %I2640.
	N: Maybe Xander Quickshot sells one at The Shop?
	END
	
@lackOldPocketWatchActor
	8: I'm not sure what you're trying to accomplish here, but you need %I2640 first to do that.
	H: Yeah, but where can I get one?
	8: Maybe try The Shop in Bunker 3?
	8: Xander Quickshot might be selling one.
	END	
	
@repairBrokenPocketWatch
	IF -I980, @lackSpareParts
	8: Alright, keep calm and keep your hand steady, you've got this, %1.
	H: Here we go.
	N: You study the %I2183 for a while and then start to repair it.
	SOUND toolbox-workshop
	WAIT 4.0	
	SOUND wheelnutairgun
	WAIT 3.0	
	SOUND wheelnutairgun
	WAIT 3.0	
	HOST_TAKE I980
	HOST_TAKE I2183
	HOST_GIVE I2642
	HOST_GIVE T931
	N: You have successfully repaired the %I2183 and turned it into a %I2642 once more!
	WAIT 3.0
	8: Hell yeah, I knew you could do it!
	END	

@lackBurnedOutFuse
	IF T887|T888, @lackBurnedOutFuseActor
	N: You cannot repair a %I979 without a %I979.
	END
	
@lackBurnedOutFuseActor
	8: Why are you trying to repair a %I979 without a %I979?
	H: I thought I had a spare one, it seems like I don't.
	END

@warning
	N: Are you sure you should repair this item first?
	N: Something else likely has a higher priority to repair.
	END
	
@warningTwo
	N: Are you sure you will have enough %I980 left to create a %I737?
	N: Maybe you should come back another time when you have more %I980.
	END

@warningThree
	IF T887|T888, @warningThreeActor
	N: It would probably be a good idea to repair your %I2183 first.
	END
	
@warningThreeActor
	8: Eh, are you sure you want to do this first?
	8: I think fixing that %I2183 is far more important right now, don't you think?
	H: I suppose I could repair that watch first, yes.
	END
	
@createItem
	N: You study the schematics for a bit.
	WAIT 3.0
	N: You figure out how to make this item. 
	WAIT 2.0
	RETURN
	
@createWidowMaker	
	IF -I980.2, @lackSpareParts
	CALL @createItem
	CALL @workshopSounds
	HOST_TAKE I980.2
	HOST_TAKE I983
	HOST_GIVE I2511
	N: You have successfully created the %I2511!
	END

@upgradeWidowMaker
	IF -I980.2, @lackSpareParts
	CALL @createItem
	CALL @workshopSounds
	HOST_TAKE I980.2
	HOST_TAKE I2511
	HOST_GIVE I2515
	N: You have successfully upgraded the %I2511 into %I2515!
	END

@createQuantumDisruptor
	IF -I980.2, @lackSpareParts
	CALL @createItem
	CALL @workshopSounds
	HOST_TAKE I980.2
	HOST_TAKE I983
	HOST_GIVE I2512
	N: You have successfully created a %I2512!
	END

@upgradeQuantumDisruptor
	IF -I980.2, @lackSpareParts
	CALL @createItem
	CALL @workshopSounds
	HOST_TAKE I980.2
	HOST_TAKE I2512
	HOST_GIVE I2516
	N: You have successfully upgraded your %I2512 into a %I2516!
	END

@createBlackAssault
	IF -I980.2, @lackSpareParts
	CALL @createItem
	CALL @workshopSounds
	HOST_TAKE I980.2
	HOST_TAKE I983
	HOST_GIVE I2513
	N: You have successfully created a %I2513!
	END

@upgradeBlackAssault
	IF -I980.2, @lackSpareParts
	CALL @createItem
	CALL @workshopSounds
	HOST_TAKE I980.2
	HOST_TAKE I2513
	HOST_GIVE I2514
	N: You have successfully upgraded your %I2513 into a %I2514!
	END

@cancel
	END
	

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5038, bunkerstorage03, SCENE, "Supply room #2"

	IF T856, @nothingLeftOfInterest

	ACTOR 1,  "", gun005, 2, 25, 63 
	ACTOR 2,  "", gun005, 2, 20, 80
	ACTOR 3,  "", gun005, 2, 40, 70
	ACTOR 4,  "", gun005, 2, 50, 80
	ACTOR 5,  "", gun005, 2, 35, 85
	
	ACTOR 11,  "", gun005, 2, 25, -63 
	ACTOR 12,  "", gun005, 2, 20, -80
	ACTOR 13,  "", gun005, 2, 40, -70
	ACTOR 14,  "", gun005, 2, 50, -80
	ACTOR 15,  "", gun005, 2, 35, -85	

	SET temp, %R5
	SET temp1, 0
	SET temp2, 0
	SET temp3, 0
	SET temp4, 0
	SET temp5, 0
	SET attack, 0
	
	N: If you want a real challenge, try shooting the crates.
	N: Otherwise, clicking on them will get the same result.
	END	
	
@nothingLeftOfInterest
	N: There is nothing left of interest in this supply room. 
	END
	
@eventActorClick1
	SET actor, "1"
	GOTO @checkReward

@eventActorClick2
	SET actor, "2"
	GOTO @checkReward

@eventActorClick3
	SET actor, "3"
	GOTO @checkReward

@eventActorClick4
	SET actor, "4"
	GOTO @checkReward

@eventActorClick5
	SET actor, "5"
	GOTO @checkReward
		
@checkReward
	IF DEAD, @died
	SET check, temp#<actor>
	COMPARE *#<check>, "0"
	IF> @alreadyCheckedCrate
	SET temp#<actor>, 1
	COMPARE #<temp>, #<actor>
	IF= @foundSpareParts
	GOTO @nothingHere	

@alreadyCheckedCrate
	N: You have already checked this crate.
	END

@nothingHere
	IF R40, @findDust
	IF R40, @decayaedAnimal
	IF R40, @oldSocks
	N: This crate appears to have been looted a long time ago.
	WAIT 1.0
	END

@findDust
	N: You found nothing but dust in this crate.
	WAIT 1.0
	END
	
@decayaedAnimal
	N: You found a dead animal that has mostly decayed.
	N: It looks disgusting and you leave it alone.
	WAIT 1.0
	END

@oldSocks
	N: You found a pair of stained old socks with holes in them.
	N: You decide to leave them where they are.
	WAIT 1.0
	END
	
@foundSpareParts
	IF T856, @end
	N: You found 4 %I980
	HOST_GIVE I980.4
	HOST_GIVE T856
	WAIT 1.0
	END

@eventActorAttack1
@eventActorAttack2
@eventActorAttack3
@eventActorAttack4
@eventActorAttack5
	COMPARE #<item.class>, "14"
	IF!= @notRangedWeapon
	IF V30|T856|T857, @crateTooStrong
	SOUND attroarvampire1
	ADD attack, 1
	COMPARE #<attack>, "3"
	IF> @nightmaresAttack
	N: You hear roaring sounds in the distance, it sounds like several %M1701s.
	COMPARE #<attack>, "1"
	IF> @end
	N: Maybe shooting the crates several times will lure them out?
	N: You may want to keep your slave ready!
	END
	
@notRangedWeapon
	N: Are you a %C or what? 
	N: Use a gun instead!
	END

@nightmaresAttack
	LOCK 1
	EJECT T172
	CALL 5199@continueBeforeGunslingerFight	

	MOVE 11, 25, 63, 1
	MOVE 12, 20, 80, 1
	MOVE 13, 40, 70, 1
	MOVE 14, 50, 80, 1
	MOVE 15, 35, 85, 1
	
	MOVE 1, 25, -63, 1
	MOVE 2, 20, -80, 1
	MOVE 3, 40, -70, 1
	MOVE 4, 50, -80, 1
	MOVE 5, 35, -85, 1
	
	FIGHT2 1701, 1701, 1701, 1701, 1701
	CALL 5198@gunslingerCPRAndDirectDrinkQuotes	
	
	MOVE 1, 25, 63, 1
	MOVE 2, 20, 80, 1
	MOVE 3, 40, 70, 1
	MOVE 4, 50, 80, 1
	MOVE 5, 35, 85, 1
	
	MOVE 11, 25, -63, 1
	MOVE 12, 20, -80, 1
	MOVE 13, 40, -70, 1
	MOVE 14, 50, -80, 1
	MOVE 15, 35, -85, 1	
	
	IF DEAD, @diedFighting
	HOST_GIVE T857
	HOST_GIVE Z1.10
	N: You found 10 %Z1s	
	GOTO @foundSpareParts
	
@diedFighting
	HOST_GIVE T858
	GOTO @foundSpareParts

@crateTooStrong
	N: This crate is too strong to destroy.
	END
	
@end	
	END
	
@died
	N: You cannot do anything while you are dead.
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; This scene only features the terminal computer where the player has to click on in order to move to the CUT scene.
; 
SCENE 5039, deusex04, SCENE, "Command computer", 0, 0, 0

	CALL 5098@checkPower 

	ACTOR 1, "Terminal", circuitbuttonsdown, 1, 57,70	
	END

@eventActorClick1
	IF -T844, @noPower
	IF DEAD, @died
	MENU "Open terminal=@openTerminal", "Cancel=@cancel"
	END

@noPower
	N: The terminal does not respond due to the lack of power.
	END		

@openTerminal
	GOTO SCENE 5060

@cancel
	END
	
@died
	N: You cannot operate the terminal when you are dead.
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5040, deusex03, SCENE, "Security computer", 0, 0, 0

	CALL 5098@checkPower 

	ACTOR 1, "Terminal", circuitbuttonsdown, 1, 75,97	
	END 

@eventActorClick1
	IF -T844, @noPower
	IF DEAD, @died
	IF T859, @menu
	N: You notice that the files on the terminal are corrupted.
	WAIT 3.0
	1: Initiate recovery procedure [YES/NO]?
	ASK 300
	IF YES, @startProcedure
	1: Exiting terminal...
	END
	
@startProcedure	
	1: Procedure started...
	WAIT 4.0
	HOST_GIVE T859
	1: There are three recovered files.
	1: Would you like to view them [YES/NO]?
	ASK 300
	IF YES, @menu
	1: Exiting terminal...
	END
	
@menu	
	MENU "Access security tape #4=@securityOne", "Access security tape #52=@securityTwo", "Access security tape #310=@securityThree", "Cancel=@cancel"
	END

@noPower
	N: The terminal does not respond due to the lack of power.
	END		

@cancel
	END
	
@died
	N: You cannot operate the terminal when you are dead.
	END
	
@securityOne
	GOTO SCENE 5041

@securityTwo
	GOTO SCENE 5042

@securityThree
	GOTO SCENE 5043


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5041, bunker01, CUT, "Security tape #4"

	FLAGS	17792

	ACTOR 1, "Doctor Melchior", gun010, 3, 40, 90
	POSE 3, 4
	ACTOR 2, "Doctor Kristinson", gun010, 1, 110, 95
	POSE 1, 2
	
	N: This footage is from 286 years ago.
	
	MOVE 2, 50, 95
	WAIT 2.0
	2: You called for me?
	1: Yes, I did.
	1: I assume you were not followed?
	WAIT 3.0
	FACE 2,1
	WAIT 1.0
	FACE 2,0
	WAIT 1.0
	2: Not as far as I can tell.
	2: What is this about?
	1: An experiment that I want to start with cutting edge technology.
	1: I 'acquired' rather interesting technology from Samuel Raven.
	2: I see.
	2: What are you planning to do with it?
	1: What do you think of creating the ultimate soldier?
	2: Alright, you have me interested...
	1: A few months ago, I discovered what I like to call the God particle.
	1: It is a power that allows for the renewal of human cells.
	1: In other words, instant regeneration.
	2: That sounds ground breaking!
	1: Yes, but that is not all.
	1: Every force in the universe has an equal counter force.
	1: The discovery of the God particle has also led me to the discovery of what I call the Devil particle.
	1: It allows for instant destruction of cellular tissue. 
	1: I have experimented with both, but I found them to be too unstable to work with.
	1: I needed an aggregate to stabilize both particles.
	1: I believe that the technology from Samuel solves my problems.
	2: I see, and when you heard about it you sought to 'acquire' it?
	1: I had some help from one of his not-so-loyal subjects.
	1: It is amazing what a promise for immortality and unlimited power will get you.
	2: Alright, go on.
	1: I want to infuse Samuel's technology with this God and Devil particle and then inject it into a soldier to create a super soldier.
	1: Should the subject survive, then I believe it will become incredibly powerful.
	2: Mm, I think you might be onto something, Doctor.
	HOST_GIVE T860
	CALL 5098@soundstatic
	GOTO SCENE 5040


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5042, bunkergrowthvats, CUT, "Security tape #52"

	FLAGS	17792
	
	ACTOR 1, "Doctor Melchior", gun010, 3, 45, 90
	POSE 3, 4
	ACTOR 2.1, "Doctor Kristinson", gun010, 1, 33, 90
	POSE 1, 2
	ACTOR 3, "", staticactors, 9, 34, 89 ; Computer
	ACTOR 4, "Nightmare", elemental012, 6, -74, 62 
	POSE 6, 7

	N: This footage is from 283 years ago.
	
	1: After 96 failed experiments, I believe we have finally succeeded!
	WAIT 3.0
	2: Initiating wake up procedure... now!
	WAIT 3.0
	SOUND screen-lettering
	WAIT 3.0
	SOUND hitroarvampire1
	WAIT 1.0
	MOVE 2, 60, 95
	WAIT 3.0
	MOVE 4, 74, 62, 1
	MOVE 4, 70, 86
	1: Marvelous, we have done it!
	2: Indeed, Doctor, it is a success.
	1: Tell me, how are you feeling?
	4: Pain...
	4: So... much... pain...
	2: Let me see what I can do about this.
	MOVE 2, 66, 85
	WAIT 3.0
	SOUND tesla_shot
	WAIT 1.5
	SOUND hitroarvampire1	
	WAIT 2.0
	SOUND attroarvampire1
	SEL 4
	POSE 3
	WAIT 1.0
	1: Kill it, kill it!
	HOST_GIVE T861
	CALL 5098@soundstatic
	GOTO SCENE 5040


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5043, bunkerredalert, CUT, "Security tape #310"

	FLAGS	17792

	ACTOR 1, "Doctor Melchior", gun010, 3, 40, 90
	POSE 3, 4
	ACTOR 2, "Doctor Kristinson", gun010, 1, 50, 92
	POSE 1, 2
	FACE 2,0
	ACTOR 3, "Nightmare", elemental012, 2, -15, 99 
	ACTOR 4, "Nightmare", elemental012, 2, 110, 99 
	ACTOR 5, "Terminal", circuitbuttons, 9, -50, -50
	
	N: This footage is from 279 years ago.	
	
	WAIT 1.0
	5: Status caution.
	SOUND voice\status_caution
	5: Project specimen N31A-2 has escaped.
	WAIT 2.0
	
	2: This is getting out of hand, Doctor Melchior!
	2: We need to eleminate all these-, these monsters.
	1: Destroy my beautiful specimens and all that hard work?
	1: I refuse, I finally created the breakthrough that I was after!
	1: I have perfected the ultimate soldier.
	2: No, what you have created is a-, a nightmare.
	2: We need to call in the %C63s while there is still time.
	2: They are our only hope to survive these horrors.
	1: And inform Samuel that I stole his technology?
	1: NEVER!
	WAIT 2.0
	
	5: Status red.
	SOUND voice\status_red
	5: Project specimen N31A-2 has disengaged safety protocols.
	WAIT 2.0
	
	1: Hah, they are even more intelligent than I thought!
	2: We need to leave NOW.
	2: If we do then we might still make it to the teleporter.
	WAIT 2.0
	
	5: Status critical.
	SOUND voice\status_critical
	MOVE 2, 110, 95
	SOUND attroarvampire1
	WAIT 0.5
	MOVE 3, 40, 90, 2
	MOVE 4, 50, 90, 2

	HOST_GIVE T862
	WAIT 2.0
	MOVE 1, -50,50,1
	MOVE 2, -50,50,1
	MOVE 3, -50,50,1
	MOVE 4, -50,50,1
	SOUND hitpainmale1	
	CALL 5098@soundstatic
	GOTO SCENE 5040


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5044, bunkergrowthvats, SCENE, "Growth vats"

	ACTOR 1, "Terminal", staticactors, 9, 34, 89
	ACTOR 2, "Keypad", stealth2, 8, 18, 73
	ACTOR 3, "Keypad", stealth2, 8, 81, 73

	ACTOR 11, "Terminal", staticactors, 9, 34, -89
	ACTOR 12, "Keypad", stealth2, 8, 18, -73
	ACTOR 13, "Keypad", stealth2, 8, 81, -73
	
	SET codeLeft, 0
	SET codeRight, 0	
	
	IF T863|T864, @nothingToDO	
	N: Enter the pincode in the left and right Keypad, 
	N: then confirm your choice at the Terminal.	
	END

@eventActorclick1
	IF DEAD, @died
	IF T863|T864, @nothingToDO
	MENU "Confirm codes=@confirmCodes", "Help=@helpTerminal", "Cancel=@cancel"
	END
		
@eventActorClick2
	IF DEAD, @died
	IF T863|T864, @nothingToDO	
	2: Enter pincode [XXX]:
	ASK 300
	COMPARE #<lastAsk>, "111"
	IF= @setPincodeLeft
	COMPARE #<lastAsk>, "333"
	IF= @setPincodeLeft	
	2: Attempt failed
	SOUND voice\attempt_failed
	2: Invalid code, code is not accepted.
	2: Enter '111' to shut the growth vats down, enter '333' to reroute the power more efficiently.
	END
	
@eventActorClick3
	IF DEAD, @died
	IF T863|T864, @nothingToDO	
	3: Enter pincode [XXX]:
	ASK 300
	COMPARE #<lastAsk>, "111"
	IF= @setPincodeRight
	COMPARE #<lastAsk>, "333"
	IF= @setPincodeRight	
	3: Attempt failed
	SOUND voice\attempt_failed
	3: Invalid code, code is not accepted.
	3: Enter '111' to shut the growth vats down, enter '333' to reroute the power more efficiently.
	END

@setPincodeLeft
	2: Code accepted.
	SET codeLeft, #<lastAsk>
	END
	
@setPincodeRight
	3: Code accepted.
	SET codeRight, #<lastAsk>
	END
	
@confirmCodes	
	STRCMP #<codeLeft>, #<codeRight>
	IF!= @codesDoNotMatch
	STRCMP #<codeLeft>, "111"
	IF= @killNightmares
	STRCMP #<codeLeft>, "333"
	IF= @saveNightmares
	1: CRITICAL ERROR: incorrect input in Keypads.
	END

@killNightmares
	1: You have choosen to shut down the power to the growth vats and thus kill the %M1700s.
	1: Is this correct [YES/NO]?
	ASK 300
	IF YES, @killThem
	1: Change your input in the Keypads and try again.
	END
	
@killThem
	1: Initiating shut down procedure...
	HOST_GIVE T863
	SOUND turn-power-off
	WAIT 4.0
	1: Power terminated.
	WAIT 2.0
	N: 8 %M1700s burst out of the growth vats!
	SOUND attroarvampire1
	WAIT 1.0
	
	MOVE 11, 34, 89, 1
	MOVE 12, 18, 73, 1
	MOVE 13, 81, 73, 1
	MOVE 1, 34, -89, 1
	MOVE 2, 18, -73, 1
	MOVE 3, 81, -73, 1	
	
	CALL 5199@continueBeforeGunslingerFight
	FIGHT2 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700
	CALL 5198@gunslingerCPRAndDirectDrinkQuotes
	
	MOVE 1, 34, 89, 1
	MOVE 2, 18, 73, 1
	MOVE 3, 81, 73, 1
	MOVE 11, 34, -89, 1
	MOVE 12, 18, -73, 1
	MOVE 13, 81, -73, 1	
	
	IF DEAD, @cancel
	N: You found 8 %Z1s
	HOST_GIVE Z1.8
	END

@saveNightmares
	1: You have choosen to reroute the power and save the lives of the %M1700s.
	1: Is this correct [YES/NO]?
	ASK 300
	IF YES, @saveThem
	1: Change your input in the Keypads and try again.
	END
	
@saveThem	
	1: Initiating shut down procedure...
	HOST_GIVE T864
	SOUND turn-power-off
	WAIT 4.0
	SOUND voice\unit_disabled
	1: Unit disabled.
	1: Rerouting power...
	WAIT 4.0
	1: Rebooting system...
	SOUND turn-power-on
	WAIT 3.0
	1: All systems go!
	SOUND voice\all_systems_go
	WAIT 2.0
	N: You have spared the lives of the %M1700s.
	END
	
@codesDoNotMatch
	1: CRITICAL ERROR: the codes in the left and right keypad do not match.
	1: Go back and set the correct codes.
	END
	
@helpTerminal
	1: You need to enter the same code in the left and right Keypad.
	1: Enter '111' to shut down the growth vats and to kill the %M1700s growing inside.
	1: Enter '333' to reroute the power.
	1: This second option saves the lives of the %M1700s while allowing the teleporter to operate.
	1: Confirm your choice at this terminal next.
	END
	
@nothingToDO
	1: You have already changed the power settings for the growth vats.
	1: There is nothing left for you to do here.
	END

@cancel
	END

@died
	N: You cannot do anything while you are dead.
	END

@eventHostGive
	CALL 5199@continueGunslingerDrink
	END	


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5045, bunkerredalert, SCENE, "Nightmare nest"
	
	IF DEAD, @died
	IF T868|T869|T870, @nothingHere
	
	ACTOR 1, "Young Nightmare Queen", nightmare, 1, 25, 90
	POSE 1, 4
	
	1: So, you are the one causing all this havoc in my hive.

@question	
	1: Have you come to talk or fight? (talk/fight)
	ASK 300
	IF Qfight, @fightQueen
	IF Qtalk, @talkQueen
	1: You are avoiding the question.
	GOTO @question
	
@fightQueen	
	1: As you wish, %C.	
	
	CALL 5199@continueBeforeGunslingerFight
	MOVE 1, -25, 90, 1	
	FIGHT2 1702.25.90, 1701, 1701
	CALL 5198@gunslingerCPRAndDirectDrinkQuotes	
	
	IF DEAD, @died
	HOST_GIVE T869
	N: You found 10 %Z1s
	N: You found an %I2504
	HOST_GIVE Z1.10
	HOST_GIVE I2504	
	WAIT 2.0
	H: It looks like my business here is concluded, it's time to head home.
	END
	
@died
	HOST_GIVE T868
	N: You found an %I2504
	HOST_GIVE I2504
	MOVE 1, 25, 90
	WAIT 2.0
	1: Let this be a lesson, %C.
	1: You and your kind are not welcome here.
	1: We will haunt you day and night until the end of time.
	MOVE 1, -25, 90
	END	
	
@talkQueen	
	IF T864, @sparedNightmares
	1: My poor children...
	1: You killed them all. 
	1: They were innocent, they had not even experienced their first hunt when you shut down the growth vats.
	1: Have you come to kill me as well? (Yes/No)
	ASK 300
	IF YES, @fightQueen
	H: No, I will spare your life.
	H: You will live with the knowledge that your children died.
	H: I deem that sufficient torture.
	H: The death of your children will also serve as a warning to you.
	H: Leave the %C63s alone or I will return and finish the job.
	WAIT 2.0
	SOUND cathiss2
	WAIT 1.0
	1: I do not like your words, but I value you sparing my life.
	1: You may have this gift, I hope it will give you reason to leave us alone.
	1: In return, we will leave you alone.
	HOST_GIVE T870
	HOST_GIVE I2504
	WAIT 2.0
	N: You received an %I2504.
	WAIT 1.0
	H: Thank you, now begone.
	SOUND cathiss2	
	MOVE 1, -25, 90
	END
	
@sparedNightmares
	1: You spared my children, for which I am grateful.
	1: Will you extend the same courtesy to me? (Yes/No)
	ASK 300
	IF -YES, @fightQueen
	1: You are a great #<g.man>.
	1: I will not forget your actions today.
	1: Please, accept this token for my gratitude.
	HOST_GIVE T870
	HOST_GIVE I2504
	WAIT 2.0
	N: You received an %I2504.
	WAIT 1.0
	H: Thank you, you better leave now before I change my mind.
	1: As you wish.
	MOVE 1, -25,90
	END	

@nothingHere
	N: There is nothing here.
	END
	
@died
	N: You cannot do anything while you are dead.
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5046, bunkerbedleft, SCENE, "Bedroom #1"

	IF T831|T839, @nothingHere

	SET bedroom, 1
	CALL 5098@setUpSceneLeft
	END
	
@eventActorClick1
	SET location, "in the chest"
	CALL 5098@moveActor	1
	END
	
@eventActorClick2
	SET location, "under the bed"
	Call 5098@moveActor	2
	END
	
@eventActorClick3	
	SET location, "in the lockers"
	CALL 5098@moveActor	3
	END
	
@eventActorClick4
	SET location, "in one of the boxes"
	CALL 5098@moveActor	4

	END
	
@eventActorClick5
	SET location, "in a drawer"
	CALL 5098@moveActor	5
	END
	
@eventActorClick6
	SET location, "in the box"
	CALL 5098@moveActor 6
	END

@nothingHere
	CALL 5098@nothingHere
	END
	
@eventHostGive
	CALL 5199@continueGunslingerDrink
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5047, bunkerbedleft, SCENE, "Bedroom #2"
	
	IF T832|T839, @nothingHere

	SET bedroom, 2
	CALL 5098@setUpSceneLeft
	END
	
@eventActorClick1
	SET location, "in the chest"
	CALL 5098@moveActor	1
	END
	
@eventActorClick2
	SET location, "under the bed"
	Call 5098@moveActor	2
	END
	
@eventActorClick3	
	SET location, "in the lockers"
	CALL 5098@moveActor	3
	END
	
@eventActorClick4
	SET location, "in one of the boxes"
	CALL 5098@moveActor	4

	END
	
@eventActorClick5
	SET location, "in a drawer"
	CALL 5098@moveActor	5
	END
	
@eventActorClick6
	SET location, "in the box"
	CALL 5098@moveActor 6
	END

@nothingHere
	CALL 5098@nothingHere
	END
	
@eventHostGive
	CALL 5199@continueGunslingerDrink
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;	
SCENE 5048, bunkerbedright, SCENE, "Bedroom #3"

	IF T833|T839, @nothingHere

	SET bedroom, 3
	CALL 5098@setUpSceneRight
	END
	
@eventActorClick1
	SET location, "in the chest"
	CALL 5098@moveActor	1
	END
	
@eventActorClick2
	SET location, "under the bed"
	Call 5098@moveActor	2
	END
	
@eventActorClick3	
	SET location, "in the lockers"
	CALL 5098@moveActor	3
	END
	
@eventActorClick4
	SET location, "in one of the boxes"
	CALL 5098@moveActor	4

	END
	
@eventActorClick5
	SET location, "in a drawer"
	CALL 5098@moveActor	5
	END
	
@eventActorClick6
	SET location, "in the box"
	CALL 5098@moveActor 6
	END

@nothingHere
	CALL 5098@nothingHere
	END
	
@eventHostGive
	CALL 5199@continueGunslingerDrink
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;	
SCENE 5049, bunkerbedright, SCENE, "Bedroom #4"

	IF T834|T839, @nothingHere

	SET bedroom, 4
	CALL 5098@setUpSceneRight
	
	IF -T825, @end
	ACTOR 7, "Charley Kissinger", monster039, 4, -10, 90	
	MOVE 7, 30,90
	WAIT 1.0
	7: Hello, %1.
	7: I arrived here a little earier, I didn't know Paul was sending reinforcements. 
	H: Yeah, I'm checking this place out as well.
	7: Good, good, I hope you'll have better luck than I do. 
	7: You should watch yourself here, I heard some disturbing noises.
	7: I'll scout ahead, maybe we'll see each other again.
	H: Alright, good luck.
	MOVE 7, 120,90,2	
	END
	
@eventActorClick1
	SET location, "in the chest"
	CALL 5098@moveActor	1
	END
	
@eventActorClick2
	SET location, "under the bed"
	Call 5098@moveActor	2
	END
	
@eventActorClick3	
	SET location, "in the lockers"
	CALL 5098@moveActor	3
	END
	
@eventActorClick4
	SET location, "in one of the boxes"
	CALL 5098@moveActor	4
	END
	
@eventActorClick5
	SET location, "in a drawer"
	CALL 5098@moveActor	5
	END
	
@eventActorClick6
	SET location, "in the box"
	CALL 5098@moveActor 6
	END

@nothingHere
	CALL 5098@nothingHere
	END
	
@eventHostGive
	CALL 5199@continueGunslingerDrink
	END	

@end
	END

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5050, bunkerbedleft, SCENE, "Bedroom #5"

	IF T835|T839, @nothingHere

	SET bedroom, 5
	CALL 5098@setUpSceneLeft
	END
	
@eventActorClick1
	SET location, "in the chest"
	CALL 5098@moveActor	1
	END
	
@eventActorClick2
	SET location, "under the bed"
	Call 5098@moveActor	2
	END
	
@eventActorClick3	
	SET location, "in the lockers"
	CALL 5098@moveActor	3
	END
	
@eventActorClick4
	SET location, "in one of the boxes"
	CALL 5098@moveActor	4

	END
	
@eventActorClick5
	SET location, "in a drawer"
	CALL 5098@moveActor	5
	END
	
@eventActorClick6
	SET location, "in the box"
	CALL 5098@moveActor 6
	END

@nothingHere
	CALL 5098@nothingHere
	END
	
@eventHostGive
	CALL 5199@continueGunslingerDrink
	END	


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;	
SCENE 5051, bunkerbedleft, SCENE, "Bedroom #6"

	IF T836|T839, @nothingHere

	SET bedroom, 6
	CALL 5098@setUpSceneLeft
	END
	
@eventActorClick1
	SET location, "in the chest"
	CALL 5098@moveActor	1
	END
	
@eventActorClick2
	SET location, "under the bed"
	Call 5098@moveActor	2
	END
	
@eventActorClick3	
	SET location, "in the lockers"
	CALL 5098@moveActor	3
	END
	
@eventActorClick4
	SET location, "in one of the boxes"
	CALL 5098@moveActor	4

	END
	
@eventActorClick5
	SET location, "in a drawer"
	CALL 5098@moveActor	5
	END
	
@eventActorClick6
	SET location, "in the box"
	CALL 5098@moveActor 6
	END

@nothingHere
	CALL 5098@nothingHere
	END
	
@eventHostGive
	CALL 5199@continueGunslingerDrink
	END	


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;	
SCENE 5052, bunkerbedright, SCENE, "Bedroom #7"

	IF T837|T839, @nothingHere

	SET bedroom, 7
	CALL 5098@setUpSceneRight
	END
	
@eventActorClick1
	SET location, "in the chest"
	CALL 5098@moveActor	1
	END
	
@eventActorClick2
	SET location, "under the bed"
	Call 5098@moveActor	2
	END
	
@eventActorClick3	
	SET location, "in the lockers"
	CALL 5098@moveActor	3
	END
	
@eventActorClick4
	SET location, "in one of the boxes"
	CALL 5098@moveActor	4

	END
	
@eventActorClick5
	SET location, "in a drawer"
	CALL 5098@moveActor	5
	END
	
@eventActorClick6
	SET location, "in the box"
	CALL 5098@moveActor 6
	END

@nothingHere
	CALL 5098@nothingHere
	END
	
@eventHostGive
	CALL 5199@continueGunslingerDrink
	END	


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;	
SCENE 5053, bunkerbedright, SCENE, "Bedroom #8"

	IF T838|T839, @nothingHere

	SET bedroom, 8
	CALL 5098@setUpSceneRight
	END
	
@eventActorClick1
	SET location, "in the chest"
	CALL 5098@moveActor	1
	END
	
@eventActorClick2
	SET location, "under the bed"
	Call 5098@moveActor	2
	END
	
@eventActorClick3	
	SET location, "in the lockers"
	CALL 5098@moveActor	3
	END
	
@eventActorClick4
	SET location, "in one of the boxes"
	CALL 5098@moveActor	4

	END
	
@eventActorClick5
	SET location, "in a drawer"
	CALL 5098@moveActor	5
	END
	
@eventActorClick6
	SET location, "in the box"
	CALL 5098@moveActor 6
	END

@nothingHere
	CALL 5098@nothingHere
	END
	
@eventHostGive
	CALL 5199@continueGunslingerDrink
	END	


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5054, bunkerbedcommander, SCENE, "Commander's quarters"

	CALL 5098@checkPower

	IF DEAD, @died
	
	SET random, %R2
	
	ACTOR 1,  "Sleep", circuitbuttons, 9, 19, 77
	ACTOR 2,  "Search desk left side", circuitbuttons, 9, 48, 70	
	ACTOR 3,  "Search desk right side", circuitbuttons, 9, 67, 70	
	ACTOR 4, "Check behind notification", circuitbuttons, 9, 79, 50
	ACTOR 5, "Check landmap", circuitbuttons, 9, 18, 55	
	END

@died
	N: You cannot do anything while you are dead.
	END
	
@eventActorClick1
	GOTO @sleep

@eventActorClick2
	SET temp, 1
	CALL @searchDesk
	END
	
@eventActorClick3
	SET temp, 2
	CALL @searchDesk
	END	
	
@searchDesk	
	IF T845, @findJunk
	COMPARE #<random>, #<temp>
	IF= @findLoginDetails
	
@findJunk
	N: You find nothing but junk inside the desk.
	WAIT 1.0
	RETURN	

@findLoginDetails
	N: You discover a folded paper with the login details of the base commander:
	N: User name = bigboss
	N: Password = 1337soldier
	HOST_GIVE T845
	WAIT 2.0
	N: These login details are uploaded to your Quest Diary.
	RETURN
	
@eventActorClick4
	GOTO @findSomethingRandom
	
@eventActorClick5
	N: You study the landmap for a while...
	WAIT 5.0
	IF T841, @noNewMapInfo
	N: You discover the location of military research facility in the east of Arakaki.
	HOST_GIVE T841	
	END
	
@noNewMapInfo
	N: You discover nothing new on the map.
	END
	
@eventHostGive
	CALL 5199@continueGunslingerDrink
	END	
	
@findSomethingRandom
	IF T842, @noNewDiscoveryNotification
	N: You discover a cleverly hidden compartment behind the notification.
	WAIT 3.0
	HOST_GIVE T842 
	
	IF R20, @findOldFashioned
	IF R20, @findGoodFuse
	IF R15, @findBurnedOutFuse
	IF R10, @findTrojanHorse
	IF R10, @findGeneEnhancement	
	IF R25, @findGP
	
	N: You find 10 %I977s.
	HOST_GIVE I977.10
	END
	
@findOldFashioned
	N: You find 3 %I976s.
	HOST_GIVE I976.3
	END

@findGoodFuse
	N: You find a %I978.
	HOST_GIVE I978
	END

@findBurnedOutFuse
	N: You find 5 %I979s.
	HOST_GIVE I979.5
	END
	
@findTrojanHorse
	N: You find a %I975!
	HOST_GIVE I975
	END

@findGeneEnhancement
	N: You find a %I2166!
	HOST_GIVE I2166
	END
	
@findGP
	N: You find 10,000 GP.
	HOST_GIVE G10000
	END

@noNewDiscoveryNotification
	N: You've already emptied the hidden compartment.
	END		
	
@sleep	
	SET temp, #<num.hostHP>
	MUL temp, 100
	DIV temp, #<num.hostMaxHP>
	SET temp2, #<num.hostMP>
	MUL temp2, 100
	DIV temp2, #<num.hostMaxMP>
	ADD temp, #<temp2>
	
	COMPARE #<temp>, 190
	IF> @notSleepy
	
	CALL 5098@flashbackEffect
	BKGND check1
	
	COMPARE #<temp>, 80
	IF> @nightmareChance	

@fallAsleep	
	N: You sleep peacefully.
	IF R50-T840, @dream
	
@healing
	CALL 5099@startHealing
	CALL 5098@flashbackEffect	
	BKGND bunkerbedcommander
	END
	
@dream
	GOTO SCENE 5057

@notSleepy
	N: You don't feel tired enough to sleep.
	END

@nightmareChance
	DIV temp, 2
	IF R#<temp>, @fightNightmare
	GOTO @fallAsleep

@fightNightmare
	ACTOR 1,  "Sleep", circuitbuttons, 9, 19, -77, 1
	N: You fall asleep, but have a fitful dream.
	WAIT 2.0
	N: Moments later, a %M1701 attacks!
	WAIT 1.0
	
	CALL 5199@continueBeforeGunslingerFight
	
	FIGHT2 1701	
	
	CALL 5198@gunslingerCPRAndDirectDrinkQuotes	
	ACTOR 1,  "Sleep", circuitbuttons, 9, 19, 77, 1	
	
	IF DEAD, @killedByNightmare
	N: You received 2 %Z1s
	HOST_GIVE Z1.2
	WAIT 2.0
	GOTO @fallAsleep

@killedByNightmare
	N: You did not survive the %M1701...
	BKGND bunkerbedcommander
	CALL 5098@flashbackEffect
	WAIT 5.0
	GOTO EXIT
	

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5055, bunkercenter, SCENE, "Teleporter"	
	
	ACTOR 1,	"Teleporter", gun005, 1, 58, 94
	ACTOR 2, 	"Terminal", staticactors, 9, 28, 89
	END
	
@eventActorClick1
	IF DEAD, @died
	SOUND tesla_charge
	WAIT 2.0
	IF T867, @teleportLocal
	IF -T863+-T864, @notEnoughPower
	MENU "Local Teleport=@teleportLocal", "Teleport to Bunker 3=@enterPincodeFirst"
	GOTO @noDestinationIsSet
	
@eventActorClick2
	IF DEAD, @died
	COMPARE #<num.hostEquipId13>, "2161"
	IF!= @accessDenied
	2: Access granted.
	SOUND voice\access_granted
	N: You successfully gain access thanks to your %I2161.
	WAIT 2.0
	IF -T863+-T864, @startDiagnostics
	IF -T865+-T867, @noBunker3Access
	GOTO @readyToUse
	
@teleportBunker3
	GOTO LINK 35, 6, 0

@teleportLocal	
	GOTO LINK 37, 20, 1
	
@enterPincodeFirst
	IF -T866, @teleportBunker3
	N: Please enter the security code:
	ASK 300
	STRCMP "#<lastAsk>", "#<passwordARL>"
	IF= @teleportBunker3
	N: Attempt failed.
	SOUND voice\attempt_failed
	N: You have entered an incorrect security code.
	N: Check your Quest Diary to retrieve the correct one.
	END	

@startDiagnostics
	2: Power drain detected.
	2: Would you like to start a diagnostics program [YES/NO]?
	ASK 300
	IF -YES, @logOff
	2: Searching...
	SOUND voice\searching
	WAIT 4.0
	2: Research complete.
	SOUND voice\research_complete
	2: The growth vats to the east draw too much power.
	2: Recommendations:
	2: - Enter code '111' to shut the growth vats down.
	2: - Enter code '333' to reroute the power, the growth vats will remain online but consume power more efficiently.
	2: The same code needs to be entered at two seperate growth vats.
	2: After this the codes need to be confirmed at the terminal.
	GOTO @logoff
	
@noBunker3Access
	2: You currently have no destination set.
	2: Your options are:
	2: [1] Set local destination.
	2: [2] Set local and remote destination.
	2: WARNING: this choice is permanent and cannot be undone.
	2: Enter 'stop' to exit this program and to decide at another time.
	2: Enter the option you want to set [1/2/stop]:
	ASK 300
	STRCMP #<lastAsk>, "stop"
	IF= @logOff
	STRCMP #<lastAsk>, "1"
	IF= @setLocalDestinationOnly
	STRCMP #<lastAsk>, "[1]"
	IF= @setLocalDestinationOnly
	STRCMP #<lastAsk>, "2"
	IF= @setRemoteDestination
	STRCMP #<lastAsk>, "[2]"
	IF= @setRemoteDestination
	2: Invalid input.
	GOTO @noBunker3Access
	
@setLocalDestinationOnly
	HOST_GIVE T867
	2: Local destination is set.
	2: You can now teleport to the Portal Point in the south of the base.
	GOTO @readyToUse	
	
@setRemoteDestination	
	HOST_GIVE T865
	2: Local destination is set.
	2: You can now teleport to the Portal Point in the south of the base.
	2: Please enter the remote destination that you want to set:
	WAIT 2.0
	H: Bunker 3
	2: Input accepted.
	2: It is possible to protect this location with a security code.
	2: You will have to enter this code every time when you teleport from this point.
	2: The code will be uploaded to your Quest Diary.

@askProtectionAgain
	2: Do you want to protect this location with a security code [YES/NO]?
	ASK 300
	IF YES, @setProtection
	IF NO, @readyToUse
	GOTO @askProtectionAgain
	
@setProtection
	2: Please enter a security code of letters and/ or numbers between 4 and 10 characters:
	ASK 300
	SET_LEN temp, #<lastAsk>
	COMPARE #<temp>, "4"
	IF< @codeTooShort
	COMPARE #<temp>, "10"
	IF> @codeTooLong
	SET passwordARL, "#<lastAsk>"
	HOST_GIVE T866
	2: Code accepted, the new security code is '#<passwordARL>'.
	2: The security code is successfully uploaded to your Quest Diary.
	GOTO @readyToUse	

@codeTooShort
	2: The entered security code is too short.
	GOTO @setProtection
	
@codeTooLong
	2: The entered security code is too long.
	GOTO @setProtection

@readyToUse
	2: The teleporter is now ready to use.
	GOTO @logOff
	
@logOff	
	2: Logging off terminal.
	2: Goodbye.
	SOUND voice\goodbye
	END
	
@notEnoughPower
	SOUND tesla_shot
	N: The teleporter has insufficient power to operate.
	N: Something inside the lab is draining too much power.
	END
	
@noDestinationIsSet
	SOUND tesla_shot
	N: WARNING: there is no destination set for the teleporter.
	N: Enter a destination first at the terminal.
	END	
	
@accessDenied
	2: Attempt failed.
	SOUND voice\attempt_failed
	WAIT 2.0
	2: You have insufficient access.
	N: Equip your %I2161 and try again.
	END
	
@died
	N: You cannot do anything while you are dead.
	END
	
	
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;	
SCENE 5056, bunker02, SCENE, "Portal point"

	ACTOR 1,	"Teleporter", gun005, 1, 42, 95
	END

@eventActorClick1
	SOUND tesla_charge
	WAIT 2.0	
	GOTO LINK 37, 11, 1


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5057,	check1, CUT, "Dream"

	FLAGS	17536

	WAIT 1.0

	BKGND bunkerredalert	

	ACTOR 1, "#<str.name>", mirror, 1, 105, 90
	ACTOR 2, "Ben Sanders", gun002, 1, 21, 88, 7
	ACTOR 3, "Samuel Raven",monster002, 4, -10, 85
	SEL 2
	POSE 1, 4
	
	MOVE 1, 80, 90
	WAIT 3.0

	SEL 1
	POSE 4
	1: What's going on?	
	2: /a spits up blood.
	SOUND hitpainmale1
	WAIT 2.0
	2: It's Michael, he went rogue.
	2: Bastard shot me in the guts before he stole all the %I2169s that he could grab.
	2: I... I don't have long anymore.
	2: Farewell, my friend.
	SOUND hitpainmale1	
	WAIT 2.0
	MOVE 2, -50, 88, 1
	1: Nooo! Ben!
	MOVE 1, 35, 90, 2
	MOVE 3, 10, 85
	WAIT 2.0
	MOVE 3, 21, 88
	WAIT 2.0
	SEL 3
	POSE 1
	3: What happened?
	1: Michael killed Ben and stole all the %I2169s.
	3: Bloody hell...
	POSE 4
	3: If he injects himself with all those doses, then who knows what'll happen.
	3: My research indicates that even a single injection will slow down the aging process by five years.
	3: It also seems to unlock hidden powers in humans, the ability to manipulate time and space with strange effects.
	1: But how-, why did Michael steal all these items?
	3: I... I told him about this yesterday after he asked.
	3: I never thought he'd go rogue and steal all the supplies for himself, he must have realized the potential even better than I did.
	1: Damn it!
	1: Now what will we do?
	3: I'll need you to put a team together and hunt Michael down.
	1: /a sighs.
	1: I'm not looking forward to this.
	3: Neither am I.
	HOST_GIVE T840	
	WAIT 3.0
	
	MOVE 1, -50, 80, 1
	MOVE 3, -50, 80, 1

	BKGND check1	
	CALL 5099@startHealing
	CALL 5098@flashbackEffect
	GOTO SCENE 5054


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; Fix the power core in abandoned research lab
SCENE 5058, bunkerenergycore2, CUT, "Power core switch board", 0, 0, 0

	IF T11|T12|T13|T14|T15|T16, @skipSettingGoodFuses
	SET temp, %R6
	
@setTemp2	
	SET temp2, %R6
	COMPARE #<temp>, #<temp2>
	IF= @setTemp2
	HOST_GIVE T1#<temp>
	HOST_GIVE T1#<temp2>

@skipSettingGoodFuses	
	CALL 5102@setUpBoard
	END
	
@eventActorClick1
	CALL 5102@fuseClicked 1
	END
	
@eventActorClick2
	CALL 5102@fuseClicked 2
	END
	
@eventActorClick3
	CALL 5102@fuseClicked 3
	END
	
@eventActorClick4
	CALL 5102@fuseClicked 4
	END
	
@eventActorClick5
	CALL 5102@fuseClicked 5
	END
	
@eventActorClick6
	CALL 5102@fuseClicked 6
	END		
	
@eventActorClick14
	CALL 5102@callHelp
	END

@eventActorClick15
	CALL 5102@changeThePower
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;	
SCENE 5059, bunkerstorage03, SCENE, "Locked room"	

	ACTOR 1, "Keypad", stealth2, 8, 36, 43
	ACTOR 2, "Search crate", circuitbuttons, 9, 46, 73 
	ACTOR 3, "Search crate", circuitbuttons, 9, 85, 50 	
	ACTOR 4, "Search crate", circuitbuttons, 9, 58, 59 
	ACTOR 5, "Search crate", circuitbuttons, 9, 75, 76	
	ACTOR 15, "", staticactors, 4, 95, 95 

	SET temp, 0
	SET temp2, 0
	SET attempts, "7"
	SET scene, #<scene.id>
	SET passwordScene, %R899
	ADD passwordScene, 100
	END

@eventActorClick1
	IF DEAD, @died
	IF -T844, @noPower
	COMPARE #<temp2>, "1"
	IF= @menu2
	MENU "Enter pincode=@enterPincode", "Open hack tool=@openHackTool", "Cancel=@cancel"
	END

@menu2
	MENU "Enter pincode=@enterPincode", "Cancel=@cancel"
	END
	
@eventActorClick2
	CALL @checkTokens
	IF T1011|T1100, @alreadyCheckedCrate
	HOST_GIVE T1011
	IF I975.3, @giveFirstAidKit
	N: You found a %I975!
	HOST_GIVE I975	
	END

@eventActorClick3
	CALL @checkTokens
	IF T1012|T1100, @alreadyCheckedCrate
	HOST_GIVE T1012
	N: You found nothing of value in this crate.
	END

@eventActorClick4
	CALL @checkTokens
	IF T1013|T1100, @alreadyCheckedCrate
	HOST_GIVE T1013
	N: You found %I980.
	HOST_GIVE I980	
	END

@eventActorClick5
	CALL @checkTokens
	IF T1014|T1100, @alreadyCheckedCrate
	HOST_GIVE T1014
	GOTO @giveFirstAidKit

@eventActorClick13
	CALL 5101@requestHelp
	END
	
@eventActorClick14
	CALL 5101@hackToolMenu
	END		
	
@eventActorClick15
	GOTO SCENE 5034

@giveFirstAidKit
	N: You found a %I981.
	HOST_GIVE I981
	END	
	
@alreadyCheckedCrate
	N: You have already checked this crate.
	END
	
@checkTokens
	IF T1011+T1012+T1013+T1014, @removeTokens
	RETURN

@removeTokens
	HOST_TAKE T1011
	HOST_TAKE T1012
	HOST_TAKE T1013
	HOST_TAKE T1014
	HOST_GIVE T1100
	RETURN

@nothingLeftInTheCrates
	N: You have searched all the crates already, there is nothing left to explore.
	RETURN
	
@enterPincode
	1: Enter pincode [XXX]:
	ASK 300
	COMPARE #<lastAsk>, #<passwordScene>
	IF= @accessGranted
	SOUND voice\attempt_failed
	1: Attempt failed.
	SUB attempts, "1"
	COMPARE #<attempts>, "1"
	IF= @oneAttemptremaining
	1: You have #<attempts> attempts remaining.
	COMPARE #<attempts>, "1"
	IF< @resetPassword
	END

@oneAttemptremaining
	1: You have #<attempts> attempt remaining.
	END
	
@resetPassword
	1: The pincode is reset.
	SET passwordScene, %R899
	ADD passwordScene, 100
	SET attempts, "5"
	END

@accessGranted
	IF I2170|T847, @nothingHere
	SOUND voice\access_granted
	1: Access granted.
	WAIT 3.0
	N: You found the %I2170 Nishka and Caeran were looking for!
	HOST_GIVE I2170
	END
	
@nothingHere
	N: There is nothing left in vault.
	END
	
@openHackTool
	SET sceneReturn, #<scene.id>
	SET temp2, "1"	
	CALL 5099@setUpHackToolAndHelp
	MOVE 13, 95, 80, 1
	MOVE 14, 95, 65, 1
	SET attempts, 5
	END

@cancel
	END
	
	
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; Terminal scene from 5039 (create access card)
SCENE 5060, check1, CUT, "Terminal screen", 0, 0, 0	

	CALL 5101@setUpTerminal	11

	; These cookies are mandatory to implement
	SET scene, #<scene.id>
	SET sceneReturn, "5039"
	SET attempts, 5
	; passwordScene will be used to retrieve the password.
	SET passwordScene, "1337soldier" 
	
	CALL 5101@startScreen
	9: Click on the blinking cursor to enter text into the terminal.
	END
	
@eventActorClick1
	COMPARE #<loggedIn>, 1
	IF= @commandLine

	ASK 300
	
	STRCMP #<lastAsk>, "help"
	IF= @eventActorClick13
	
	CALL 5101@loginUser	
	CALL 5101@loginPassword
	
	; The actual password checking happens after confirming the correct login was used.
	STRCMP #<login>, "admin"
	IF= @admin 
	STRCMP #<login>, "bigboss"
	IF= @bigboss

	CALL 5101@invalidAccessRequest
	END
	
@eventActorClick13
	CALL 5101@requestHelp
	END
	
@eventActorClick14
	CALL 5101@hackToolMenu
	END	

@accessDenied
	CALL 5101@accessDenied
	END	

@admin
	; admin can search passwords.txt
	SET user, "admin"
	STRCMP #<password>, "admin"
	IF!= @accessDenied
	
	SET dir, "documents"
	SET path, "c:\#<dir>"
	GOTO @accessGranted

@bigboss
	SET user, "bigboss"
	SET passwordSet, #<passwordScene>
	STRCMP #<password>, #<passwordScene>
	IF!= @accessDenied
	
	SET dir, "program files"
	SET path, "c:\#<dir>"
	GOTO @accessGranted
	
@accessGranted	
	CALL 5101@accessGranted
	CALL 5101@loginSuccessful
	CALL 5101@commandAwaitingOrders	
	GOTO @commandLine

;---------------------------------
; COMMAND LINE
;---------------------------------
@commandLine
	ASK 300

	; Check the STRCMP commands first, then the STRSTR
	
	STRCMP #<lastAsk>, "logout"
	IF= @commandLogOut
	STRCMP #<lastAsk>, "logoff"
	IF= @commandLogOut
	
	STRCMP #<lastAsk>, "quit"
	IF= @commandQuit

	STRCMP #<lastAsk>, "cd ./"
	IF= @commandCloseDirectory
		
	STRCMP #<lastAsk>, "dir"
	IF= @commandViewDirectory
	
	STRCMP #<lastAsk>, "exit"
	IF= @commandExitProgram
	
	STRCMP #<lastAsk>, "close"
	IF= @commandCloseFile
	
	STRSTR #<lastAsk>, "open"
	IF> @commandOpenFile
	
	STRSTR #<lastAsk>, "run"
	IF> @commandRunProgram

	STRCMP #<lastAsk>, "cd program files"
	IF= @commandOpenDirectoryProgramFiles

	STRCMP #<lastAsk>, "cd documents"
	IF= @commandOpenDirectoryDocuments
	
	STRCMP #<lastAsk>, "help"
	CALL 5101@requestHelp

	CALL 5101@invalidCommand
	GOTO @commandLine
	
@commandLogOut
	CALL 5101@commandLogOut

@commandQuit
	CALL 5101@commandQuit

@commandViewDirectory
	CALL 5101@commandSearching
	
	STRCMP #<path>, "c:\"
	IF= @commandViewDirectoryRoot
	
	STRCMP #<path>, "c:\documents"
	IF= @commandViewDirectoryDocuments
	
	STRCMP #<path>, "c:\program files"
	IF= @commandViewDirectoryProgramFiles
	GOTO @commandLine
	
@commandViewDirectoryRoot	
	SET lastAsk, ""
	SET terminalText, "documents"
	CALL 5101@writeText	1
	SET terminalText, "program files"
	CALL 5101@writeText	1
	GOTO @commandLine

@commandViewDirectoryDocuments
	STRCMP #<login>, "engineer"
	IF= @invalidAccessDirectory
	
	CALL 5101@updateProgramName "#<path>"

	SET lastAsk, ""
	SET terminalText, "passwords.txt"
	CALL 5101@writeText	1
	SET terminalText, "vault.protected"
	CALL 5101@writeText	1	
	GOTO @commandLine
	
@commandViewDirectoryProgramFiles
	CALL 5101@updateProgramName "#<path>"
	
	SET lastAsk, ""
	SET terminalText, "create_access_card.exe"
	CALL 5101@writeText	1
	GOTO @commandLine

@commandOpenDirectoryRoot
	SET dir, "c:\"
	SET path, "#<dir>"
	
	SET lastAsk, ""
	SET terminalText, "#<path>"
	CALL 5101@writeText	1	
	GOTO @commandLine
	
@commandOpenDirectoryProgramFiles
	SET dir, "program files"
	SET path, "c:\#<dir>"
	
	SET lastAsk, ""
	SET terminalText, "#<path>"
	CALL 5101@writeText	1	
	GOTO @commandLine		

@commandOpenDirectoryDocuments
	SET dir, "documents"
	SET path, "c:\#<dir>"
	
	SET lastAsk, ""
	SET terminalText, "#<path>"
	CALL 5101@writeText	1	
	GOTO @commandLine
	
@commandCloseDirectory
	STRCMP #<dir>, "c:\"
	IF= @commandCloseDirectoryRoot
	GOTO @commandOpenDirectoryRoot

@invalidAccessDirectory	
	7: ERROR: You have insufficient rights to access this directory.
	GOTO @commandLine
	
@invalidAccessFile	
	7: ERROR: You have insufficient rights to access this file.
	GOTO @commandLine	

@invalidAccessProgram
	7: ERROR: You have insufficient rights to run this program, login as another user to run this program.
	GOTO @commandLine	

@commandCloseDirectoryRoot
	CALL 5101@commandInvalidDirectory
	7: You are already in the root directory.
	GOTO @commandLine

@commandOpenFile
	COMPARE #<fileOpen>, "1"
	IF= @commandOpenFileInvalid

	SET fileOpen, "1"
	
	STRCMP #<lastAsk>, "open passwords.txt"
	IF= @commandOpenFilePasswords
	STRCMP #<lastAsk>, "open passwords"
	IF= @commandOpenFilePasswords
	
	SET fileOpen, "0"

	STRCMP #<lastAsk>, "open vault.protected"
	IF= @invalidAccessFile

	7: ERROR: The requested file does not exist.
	RETURN

@commandOpenFileInvalid
	7: ERROR: There is already a file open, close the current file first.
	GOTO @commandLine
	
@commandOpenFilePasswords
	7: ----------------
	7: PASSWORDS
	7: ----------------
	7: user name: admin 
	7: password: admin
	7: ----------------
	7: user name: bigboss
	7: password: #<passwordScene>
	SET passwordSet, #<passwordScene>
	7: ----------------
	GOTO @commandLine

@commandCloseFile
	COMPARE #<fileOpen>, "1"
	IF< @commandCloseFileInvalid
	SET fileOpen, "0"
	7: File closed.
	GOTO @commandLine
	
@commandCloseFileInvalid
	7: ERROR: no open file
	GOTO @commandLine
	
@commandRunProgram
	COMPARE #<programActive>, "1"
	IF= @commandRunProgramAlreadyActive

	STRCMP #<lastAsk>, "run create_access_card.exe"
	IF= @commandRunProgramCreateAccessCard
	STRCMP #<lastAsk>, "run create access card.exe"
	IF= @commandRunProgramCreateAccessCard	
	STRCMP #<lastAsk>, "run create_access_card"
	IF= @commandRunProgramCreateAccessCard
	STRCMP #<lastAsk>, "run create access card"
	IF= @commandRunProgramCreateAccessCard
	
	STRCMP #<lastAsk>, "run diagnostics.exe"
	IF= @commandRunProgramDiagnostics
	STRCMP #<lastAsk>, "run diagnostics"
	IF= @commandRunProgramDiagnostics	
	GOTO @commandLine
	
@commandRunProgramAlreadyActive	
	7: ERROR: a program is already active, exit the current program first
	GOTO @commandLine

@commandRunProgramCreateAccessCard
	SET programActive, 1

	STRCMP #<user>, "bigboss"
	IF!= @invalidAccessProgram

	7: ---------------------------------
	7: Welcome to Create Access Card
	7: ---------------------------------	
@commandRunProgramCreateAccessCardCreatingCard	
	7: What card do you want to upgrade [yellow], [red], [blue], or [violet]?:
	ASK 300

	STRCMP #<lastAsk>, "[yellow]"
	IF= @commandRunProgramCreateAccessCardRed
	STRCMP #<lastAsk>, "yellow"
	IF= @commandRunProgramCreateAccessCardRed	
	STRCMP #<lastAsk>, "[red]"
	IF= @commandRunProgramCreateAccessCardInsufficientAccess
	STRCMP #<lastAsk>, "red"
	IF= @commandRunProgramCreateAccessCardInsufficientAccess
	STRCMP #<lastAsk>, "[blue]"
	IF= @commandRunProgramCreateAccessCardInsufficientAccess
	STRCMP #<lastAsk>, "blue"
	IF= @commandRunProgramCreateAccessCardInsufficientAccess
	STRCMP #<lastAsk>, "[violet]"
	IF= @commandRunProgramCreateAccessCardInsufficientAccess
	STRCMP #<lastAsk>, "violet"
	IF= @commandRunProgramCreateAccessCardInsufficientAccess
	7: Error: unrecognized command.
	GOTO @commandLine
	
@commandRunProgramCreateAccessCardRed
	IF I2161, @commandRunProgramCreateAccessCardRedError
	7: Upgrading %I2160...
	WAIT 1.0
	7: ...
	WAIT 1.0
	7: ......
	WAIT 1.0
	7: .........
	WAIT 1.0
	7: Upgrade complete.
	WAIT 2.0
	N: You received a %I2161.
	HOST_GIVE I2161
	HOST_GIVE T1208	
	HOST_TAKE I2160
	7: Exiting program...
	GOTO @commandExitProgram

@commandRunProgramCreateAccessCardRedError
	7: ERROR: user already possesses %I2161.
	7: Please select another access level.
	GOTO @commandRunProgramCreateAccessCardCreatingCard	
	
@commandRunProgramCreateAccessCardInsufficientAccess
	7: ERROR: You are not authorized to create a card with this access level.
	7: Please contact Samuel Raven to update your permissions.
	GOTO @commandRunProgramCreateAccessCardCreatingCard		
		
@commandExitProgram
	COMPARE #<programActive>, "0"
	IF= @commandExiProgramInactive
	SET programActive, "0"
	7: Program exited.
	GOTO @commandLine

@commandExiProgramInactive
	7: ERROR: There is no active program to exit.
	GOTO @commandLine

@securityActivated
	SET temp, #<num.hostMaxHP>
	DIV temp, 4
	ADD temp, 1
	HOST_TAKE H#<temp>
	SOUND tesla_shot
	N: The security system gave you quite a shock!
	WAIT 2.0
	IF DEAD, @securityExit
	END

@securityExit
	WAIT 1.0
	N: You cannot operate the terminal when you are dead.
	WAIT 3.0
	GOTO SCENE 5039
	
	
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; Terminal scene from 5035 (medical terminal)
SCENE 5061, check1, CUT, "Terminal screen", 0, 0, 0	

	CALL 5101@setUpTerminal	11

	IF T851, @terminalCrash

	; These cookies are mandatory to implement
	SET scene, #<scene.id>
	SET sceneReturn, "5035"
	SET attempts, 6
	; passwordScene will be used to retrieve the password.
	SET passwordScene, "123"
@skipSetTempPassword
	
	CALL 5101@startScreen
	9: Click on the blinking cursor to enter text into the terminal.
	END

@terminalCrash
	SET temp, 0
	SET lastAsk, ""

@terminalCrashLoop
	COMPARE #<temp>, 10
	IF> @terminalCrashExitLoop
	WAIT 1.0
	BKGND check
	SET terminalText, "Error... "
	CALL @writeText	1
	WAIT 0.1
	BKGND check1
	WAIT 2.0
	ADD temp, 1
	GOTO @terminalCrashLoop

@terminalCrashExitLoop
	N: It appears you crashed the program beyond repair.
	WAIT 3.0
	GOTO SCENE 5035
	
@eventActorClick1
	COMPARE #<loggedIn>, 1
	IF= @commandLine

	ASK 300
	
	STRCMP #<lastAsk>, "help"
	IF= @eventActorClick13
	
	CALL 5101@loginUser	
	CALL 5101@loginPassword
	
	; The actual password checking happens after confirming the correct login was used.
	STRCMP #<login>, "admin"
	IF= @admin 
	STRCMP #<login>, "melchior"
	IF= @melchior
	STRCMP #<login>, "kristinson"
	IF= @kristinson

	CALL 5101@invalidAccessRequest
	END
	
@eventActorClick13
	CALL 5101@requestHelp
	END
	
@eventActorClick14
	CALL 5101@hackToolMenu
	END	

@accessDenied
	CALL 5101@accessDenied
	END	

@admin
	; admin can search passwords.txt
	SET user, "admin"
	STRCMP #<password>, "admin"
	IF!= @accessDenied
	
	SET dir, "documents"
	SET path, "c:\#<dir>"
	GOTO @accessGranted

@melchior
	SET user, "melchior"
	SET passwordSet, #<passwordScene>
	STRCMP #<password>, #<passwordScene>
	IF!= @accessDenied
	
	SET dir, "program files"
	SET path, "c:\#<dir>"
	GOTO @accessGranted
	
@kristinson
	SET user, "kristinson"
	STRCMP #<password>, "kristinson"
	IF!= @accessDenied
	
	SET dir, "program files"
	SET path, "c:\#<dir>"
	GOTO @accessGranted	
	
@accessGranted	
	CALL 5101@accessGranted
	CALL 5101@loginSuccessful
	CALL 5101@commandAwaitingOrders	
	GOTO @commandLine

;---------------------------------
; COMMAND LINE
;---------------------------------
@commandLine
	ASK 300

	; Check the STRCMP commands first, then the STRSTR
	
	STRCMP #<lastAsk>, "logout"
	IF= @commandLogOut
	STRCMP #<lastAsk>, "logoff"
	IF= @commandLogOut
	
	STRCMP #<lastAsk>, "quit"
	IF= @commandQuit

	STRCMP #<lastAsk>, "cd ./"
	IF= @commandCloseDirectory
		
	STRCMP #<lastAsk>, "dir"
	IF= @commandViewDirectory
	
	STRCMP #<lastAsk>, "exit"
	IF= @commandExitProgram
	
	STRCMP #<lastAsk>, "close"
	IF= @commandCloseFile
	
	STRSTR #<lastAsk>, "open"
	IF> @commandOpenFile
	
	STRSTR #<lastAsk>, "run"
	IF> @commandRunProgram

	STRCMP #<lastAsk>, "cd program files"
	IF= @commandOpenDirectoryProgramFiles

	STRCMP #<lastAsk>, "cd documents"
	IF= @commandOpenDirectoryDocuments
	
	STRCMP #<lastAsk>, "help"
	CALL 5101@requestHelp

	CALL 5101@invalidCommand
	GOTO @commandLine
	
@commandLogOut
	CALL 5101@commandLogOut

@commandQuit
	CALL 5101@commandQuit

@commandViewDirectory
	CALL 5101@commandSearching
	
	STRCMP #<path>, "c:\"
	IF= @commandViewDirectoryRoot
	
	STRCMP #<path>, "c:\documents"
	IF= @commandViewDirectoryDocuments
	
	STRCMP #<path>, "c:\program files"
	IF= @commandViewDirectoryProgramFiles
	GOTO @commandLine
	
@commandViewDirectoryRoot	
	SET lastAsk, ""
	SET terminalText, "documents"
	CALL 5101@writeText	1
	SET terminalText, "program files"
	CALL 5101@writeText	1
	GOTO @commandLine

@commandViewDirectoryDocuments
	CALL 5101@updateProgramName "#<path>"

	SET lastAsk, ""
	SET terminalText, "passwords.txt"
	CALL 5101@writeText	1
	SET terminalText, "vault.protected"
	CALL 5101@writeText	1	
	GOTO @commandLine
	
@commandViewDirectoryProgramFiles
	CALL 5101@updateProgramName "#<path>"
	
	SET lastAsk, ""
	SET terminalText, "copy files.exe"
	CALL 5101@writeText	1
	SET terminalText, "diagnostics.exe"
	CALL 5101@writeText	1
	GOTO @commandLine

@commandOpenDirectoryRoot
	SET dir, "c:\"
	SET path, "#<dir>"
	
	SET lastAsk, ""
	SET terminalText, "#<path>"
	CALL 5101@writeText	1	
	GOTO @commandLine
	
@commandOpenDirectoryProgramFiles
	SET dir, "program files"
	SET path, "c:\#<dir>"
	
	SET lastAsk, ""
	SET terminalText, "#<path>"
	CALL 5101@writeText	1	
	GOTO @commandLine		

@commandOpenDirectoryDocuments
	SET dir, "documents"
	SET path, "c:\#<dir>"
	
	SET lastAsk, ""
	SET terminalText, "#<path>"
	CALL 5101@writeText	1	
	GOTO @commandLine
	
@commandCloseDirectory
	STRCMP #<dir>, "c:\"
	IF= @commandCloseDirectoryRoot
	GOTO @commandOpenDirectoryRoot

@invalidAccessDirectory	
	7: ERROR: You have insufficient rights to access this directory.
	GOTO @commandLine
	
@invalidAccessFile	
	7: ERROR: You have insufficient rights to access this file.
	GOTO @commandLine	

@invalidAccessProgram
	7: ERROR: You have insufficient rights to run this program, login as another user to run this program.
	GOTO @commandLine	

@commandCloseDirectoryRoot
	CALL 5101@commandInvalidDirectory
	7: You are already in the root directory.
	GOTO @commandLine

@commandOpenFile
	COMPARE #<fileOpen>, "1"
	IF= @commandOpenFileInvalid

	SET fileOpen, "1"
	
	STRCMP #<lastAsk>, "open passwords.txt"
	IF= @commandOpenFilePasswords
	STRCMP #<lastAsk>, "open passwords"
	IF= @commandOpenFilePasswords
	
	SET fileOpen, "0"

	STRCMP #<lastAsk>, "open vault.protected"
	IF= @invalidAccessFile

	7: ERROR: The requested file does not exist.
	RETURN

@commandOpenFileInvalid
	7: ERROR: There is already a file open, close the current file first.
	GOTO @commandLine
	
@commandOpenFilePasswords
	7: ----------------
	7: PASSWORDS
	7: ----------------
	7: user name: admin 
	7: password: admin
	7: ----------------
	7: user name: melchior
	7: password: #<passwordScene>
	SET passwordSet, #<passwordScene>
	7: ----------------
	7: user name: kristinson
	7: password: kristinson
	7: ----------------	
	GOTO @commandLine

@commandCloseFile
	COMPARE #<fileOpen>, "1"
	IF< @commandCloseFileInvalid
	SET fileOpen, "0"
	7: File closed.
	GOTO @commandLine
	
@commandCloseFileInvalid
	7: ERROR: no open file
	GOTO @commandLine
	
@commandRunProgram
	COMPARE #<programActive>, "1"
	IF= @commandRunProgramAlreadyActive

	SET programActive, 1

	STRCMP #<lastAsk>, "run copy_files.exe"
	IF= @commandRunProgramCopyFiles
	STRCMP #<lastAsk>, "run copy files.exe"
	IF= @commandRunProgramCopyFiles	
	STRCMP #<lastAsk>, "run copy_files"
	IF= @commandRunProgramCopyFiles
	STRCMP #<lastAsk>, "run copy files"
	IF= @commandRunProgramCopyFiles
	
	STRCMP #<lastAsk>, "run diagnostics.exe"
	IF= @commandRunProgramDiagnostics
	STRCMP #<lastAsk>, "run diagnostics"
	IF= @commandRunProgramDiagnostics	

	7: Error: invalid command
	SET programActive, 0

	GOTO @commandLine
	
@commandRunProgramAlreadyActive	
	7: ERROR: a program is already active, exit the current program first
	GOTO @commandLine
	
@commandRunProgramDiagnostics	
	SET programActive, 1

	7: ---------------------------
	7: Welcome to Diagnostics
	7: ---------------------------			
	7: Would you like to initiate a diagnostics run [YES/NO]?
	ASK 300
	IF -YES, @commandExitProgram
	7: Running diagnostics...
	CALL 5101@commandSearching	
	7: WARNING: file 'Top_secret_research' is corrupted!
	7: Do not attempt to copy this file or the terminal will crash and become unresponsive.
	GOTO @commandExitProgram	

@commandRunProgramCopyFiles
	SET programActive, 1

	STRCMP #<user>, "melchior"
	IF= @accessProgramCopyFiles
	STRCMP #<user>, "kristinson"
	IF= @accessProgramCopyFiles 
	GOTO @invalidAccessProgram

@accessProgramCopyFiles 
	7: ---------------------------------
	7: Welcome to the File Copy Program
	7: ---------------------------------	
	7: There are 5 files available to copy:
	7: [1] Auto_CPR_Unit_schematics...(2 GB)
	7: [2] Top_secret_research...........(3 GB)
	7: [3] Strength_enhancements.......(1 GB)
	7: [4] Experimental_Research.........(2 GB)
	7: [5] Naughty_magazines.zip........(6 GB)
	IF -I2168, @accessProgramCopyFilesWarning
	IF T1103, @skipSetDiscSpace	
	SET discSpace, "10"
	HOST_GIVE T1103

@skipSetDiscSpace		
	7: Available space on %I2168: #<discSpace> GB.
	
@accessProgramCopyFilesLoop	
	7: Please enter the number of file you wish to download or type 'exit' to exit this program:
	ASK 300
	STRCMP #<lastAsk>, "exit"
	IF= @commandExitProgram
	STRCMP #<lastAsk>, "1"
	IF= @accessProgramCopyFiles1
	STRCMP #<lastAsk>, "2"
	IF= @accessProgramCopyFiles2
	STRCMP #<lastAsk>, "3"
	IF= @accessProgramCopyFiles3
	STRCMP #<lastAsk>, "4"
	IF= @accessProgramCopyFiles4
	STRCMP #<lastAsk>, "5"
	IF= @accessProgramCopyFiles5
	7: Invalid input.
	GOTO @accessProgramCopyFilesLoop	

@accessProgramCopyFiles1
	IF T849, @accessProgramCopyFilesData
	7: Download [Auto_CPR_Unit_schematics] started...
	HOST_GIVE T849
	SET temp, "2"
	GOTO @accessProgramCopyFilesDownloading	

@accessProgramCopyFiles2
	IF -T849, @accessProgramCopyFilesGrabCPR 
	7: ERROR... ERROR...
	HOST_GIVE T851
	7: CorRupt#d d$ta d&teCted...
	BKGND check
	WAIT 0.1
	BKGND check1
	WAIT 0.1
	BKGND check
	WAIT 0.1
	BKGND check1
	WAIT 0.1
	BKGND check
	WAIT 1.0
	SOUND voice\status_critical
	7: Stat$s crit&Cal
	WAIT 3.0
	GOTO SCENE 5035	

@accessProgramCopyFilesGrabCPR
	7: ERROR... ERROR...
	7: CorRupt#d d$ta d&teCted...
	BKGND check
	WAIT 0.1
	BKGND check1
	WAIT 0.1
	BKGND check
	WAIT 0.1
	BKGND check1
	WAIT 0.1
	BKGND check
	WAIT 1.0
	SOUND voice\status_critical
	7: Stat$s crit&Cal
	N: You quickly download the %I2660 schematics to the %I2168.
	HOST_GIVE T849
	HOST_GIVE T851
	WAIT 3.0
	GOTO SCENE 5035

@accessProgramCopyFiles3
	IF T852, @accessProgramCopyFilesData
	SET temp, "1"
	CALL @accessProgramCopyFilesBackUpRoutine
	COMPARE #<discSpace>, #<temp>
	IF< @accessProgramCopyFilesDataError
	7: Download [Strength_enhancements] started...
	HOST_GIVE T852
	GOTO @accessProgramCopyFilesDownloading

@accessProgramCopyFiles4
	IF T853, @accessProgramCopyFilesData
	SET temp, "2"
	CALL @accessProgramCopyFilesBackUpRoutine
	COMPARE #<discSpace>, #<temp>
	IF< @accessProgramCopyFilesDataError
	7: Download [Experimental_Research] started...
	HOST_GIVE T853
	GOTO @accessProgramCopyFilesDownloading	

@accessProgramCopyFiles5 
	IF T854, @accessProgramCopyFilesData
	SET temp, "6"
	CALL @accessProgramCopyFilesBackUpRoutine
	COMPARE #<discSpace>, #<temp>
	IF< @accessProgramCopyFilesDataError
	7: Download [Naughty_magazines.zip] started...
	HOST_GIVE T854
	GOTO @accessProgramCopyFilesDownloading
	
@accessProgramCopyFilesDownloading
	COMPARE #<discSpace>, #<temp>
	IF< @accessProgramCopyFilesDataError
	SUB discSpace, #<temp>
	WAIT 3.0
	7: Download completed, there is #<discSpace> GB remaining on the %I2168.
	GOTO @accessProgramCopyFilesLoop

@accessProgramCopyFilesDownloadingFile
	WAIT 4.0
	7: Download completed.
	7: %I2168 has #<discSpace> GB space remaining.
	GOTO @accessProgramCopyFilesLoop

@accessProgramCopyFilesBackUpRoutine
	IF T849, @return
	SET temp2, #<temp>
	ADD temp2, "2"
	COMPARE #<discSpace>, #<temp2>
	IF< @accessProgramCopyFilesBackUpRoutineCPR
	RETURN 
	
@accessProgramCopyFilesBackUpRoutineCPR
	7: ERROR... ERROR...
	N: You quickly switch commands and download the Auto CPR Unit schematics.
	GOTO @accessProgramCopyFiles1
	
@accessProgramCopyFilesDataError
	7: ERROR: the %I2168 does not have enough available space to copy this file.
	7: There is #<discSpace> GB space remaining on the %I2168.
	GOTO @accessProgramCopyFilesLoop

@accessProgramCopyFilesData
	7: ERROR: You have already downloaded this file.
	GOTO @accessProgramCopyFilesLoop
	
@accessProgramCopyFilesWarning
	7: ERROR: there is no %I2168 detected.
	7: This program will now terminate.
	GOTO @commandExitProgram

@commandExitProgram
	COMPARE #<programActive>, "0"
	IF= @commandExiProgramInactive
	SET programActive, "0"
	7: Program exited.
	GOTO @commandLine

@commandExiProgramInactive
	7: ERROR: There is no active program to exit.
	GOTO @commandLine

@return
	RETURN


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; fight nightmares
SCENE 5062, bunkerflooded02, SCENE, "Hunting grounds"

	IF T1101, @nothingLeft
	
	IF -T825, @skipCharley
	ACTOR 2, "Charley Kissinger", monster039, 4, -10, 90
	MOVE 2, 50, 90, 2
	2: Watch out, %1, a couple of %M1701s are attacking!
	WAIT 2.0
	2: Oh shit, I lost my gun, I guess my fist will have to do. 
	H: Let's kill them all!
	MOVE 2, -50,90,1
	
	FIGHT2, 1701, 1701, 1701, 1701, -1794.50.90
	
	IF LOSE, @exit
	
	HOST_GIVE T1101
	CALL 5198@checkCPR
	N: You received 8 %Z1s
	HOST_GIVE Z1.8
	HOST_GIVE I980
	N: You found %I980
	WAIT 3.0
	GOTO EXIT
	
@skipCharley	

	N: Three %M1701s attack!
	
	FIGHT2 1701, 1701, 1701
	
	IF LOSE, @end

	HOST_GIVE T1101
	CALL 5198@checkCPR
	N: You received 6 %Z1s
	HOST_GIVE Z1.6
	HOST_GIVE I980
	N: You found %I980
	END
	
@nothingLeft
	N: You have already exterminated the %M1701s here.
	END

@end
	END

@exit
	WAIT 3.0
	GOTO EXIT

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; fight nightmares
SCENE 5063, bunkerflooded02, SCENE, "Hunting grounds"

	IF T1102, @nothingLeft
	
	N: Three %M1701s attack!
	
	FIGHT2 1701, 1701, 1701
	
	IF LOSE, @end
	
	HOST_GIVE T1102
	CALL 5198@checkCPR
	N: You received 6 %Z1s
	HOST_GIVE Z1.6
	HOST_GIVE I980
	N: You found %I980
	END
	
@nothingLeft
	N: You have already exterminated the %M1701s here.
	END

@end
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;	
SCENE 5064, bunker01, SCENE, "????"

	CALL 5097@addGunslinger
	
	MUSIC MelC-northern-star
	
	IF T934, @nothingHere
	
	ACTOR 1, "Android Elisa", jaie03, 4, 25, 90, 10, hitsighfem1
	ACTOR 2.1, "", explosion, 1, -25, 88
	
	1: My name is Elisa.
	1: Welcome, *bzzt*...
	1: Error... error...
	1: Identity not recognized, please show your identity card.
	8: Mm, this looks like one of the older android models, I think she's broken.
	H: I am %1 and I have a %I2162.
	1: *Bzzt*, authorization accepted. 
	1: Welcome, %1.
	1: I am afraid my protocols are malfunctioning.
	IF T887|T888, @commentActor
	WAIT 2.0
	N: You can right click, attack, use a spell, or give an item to Android Elisa to interact with her.
	END
	
@commentActor
	8: From what I recall, there are various things you can do to get her operational again.
	8: You can right click to interact with her, but you can also attack, cast a spell on her, or give her an item.
	END
	
@eventActorAttack1
	IF DEAD, @died
	GOTO @androidDeath
	
@eventActorSpell1
	IF DEAD, @died
	COMPARE #<spell.element>, "0"
	IF> @androidDeath
	N: You attempt to repair Android Elisa.
	WAIT 3.0
	1: Error... error...
	WAIT 2.0
	N: The Android starts to shake wildly!
	WAIT 1.0
	GOTO @androidDeath
	
@eventActorGive1
	IF DEAD, @died
	GOTO @androidDeath
	
@eventActorClick1
	IF DEAD, @died
	MENU "Diagnostic run=@diagnostic", "Attempt a repair=@repair", "Attempt to reprogram=@reprogram", "Cancel=@end"
	END

@diagnostic
	1: Initiating diagnostic run...
	WAIT 4.0
	1: Error... error...
	1: Model T-1000 is outdated and needs to be restored to factory defaults.
	WAIT 2.0
	1: Restoring factory defaults...
	WAIT 3.0
	1: Error... error...
	N: Something seems to be going horribly wrong!
	WAIT 2.0
	GOTO @androidDeath

@repair
	IF -I980, @noSpareParts
	N: You attempt to repair the android.
	HOST_TAKE I980
	SOUND toolbox-workshop
	WAIT 4.0	
	SOUND wheelnutairgun
	WAIT 3.0	
	SOUND wheelnutairgun
	WAIT 3.0	
	H: There, that ought to do it.
	IF T887|T888, @repairActor
	WAIT 2.0
	N: It appears you missed a screw, the android is making several weird twists and turns.
	GOTO @androidDeath
	
@repairActor
	8: Ehm-, you do realize you forgot that screw on the floor, right?
	H: Wait, what?
	GOTO @androidDeath	
	
@noSpareParts	
	IF T887|T888, @noSparePartsActor
	N: You don't have any %I980 with which you can repair the android.
	END
	
@noSparePartsActor
	8: You silly #<g.man>, how can you repair an android without %I980?
	END
	
@reprogram
	H: Let me shut you down first.
	SOUND turn-power-off
	8: No, wait!
	WAIT 1.0
	N: As you shut the android down you notice a blue screen appear on her interface.
	H: Oh, crap!
	GOTO @androidDeath
	
@androidDeath
	SOUND explbld1
	1: Nooo....
	MOVE 2,  25,87,1
	MOVE 1, -50,50,1
	SEL 2
	WAIT 0.1
	POSE 2
	WAIT 0.1
	POSE 3
	WAIT 0.1
	POSE 4
	MOVE 2, -50,50,1	
	N: You destroyed Android Elisa.
	HOST_GIVE I2184
	HOST_GIVE I980
	HOST_GIVE T934
	WAIT 2.0
	N: You found %I980 and a mostly intact %I2184.
	WAIT 2.0
	8: Well, that escalated quickly.
	END

@end
	END

@nothingHere
	IF T887|T888, @nothingHereActor
	N: There is nothing here anymore.
	END
	
@nothingHereActor
	8: I think you scared all the other androids away, they probably think twice before approaching you.
	H: I claim innocence!
	END
	
@died
	N: You cannot do anything while you are dead.
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;	
SCENE 5065, bunkerredalert, SCENE, "Command"

	CALL 5097@addGunslinger

	ACTOR 1, "Terminal", circuitbuttons, 9, 77, 76	

	IF -T1209, @samuelFirst

	1: %I2162 recognized.
	WAIT 2.0
	SOUND voice\awaiting_orders
	1: Awaiting orders.
	8: This place gives me the shivers, the sooner we're done here, the better it is.
	END

@samuelFirst
	IF T887|T888, @samuelFirstActor
	N: You must visit Commander Raven in the command center of bunker 3 first.
	END

@samuelFirstActor
	8: Eh, we better visit Commander Raven in the command center of bunker 3 first.
	8: It's better to dot the i's and cross the t's before starting a new mission.
	END

@eventActorClick1
	IF DEAD, @died
	IF -T1209, @samuelFirst
	1: Access granted.
	SOUND voice\access_granted
	MENU "Download military research facility access codes=@downloadCodes", "Check recent access logs=@checkLogs", "Cancel=@end"
	END

@downloadCodes
	IF T936, @downloadError
	1: Download initiated...
	WAIT 5.0
	1: Download complete.
	HOST_GIVE T936
	1: Awaiting orders.
	SOUND voice\awaiting_orders
	END

@downloadError
	1: Attempt failed.
	SOUND voice\attempt_failed
	1: Access codes were already downloaded.
	END

@checkLogs
	1: Searching...
	SOUND voice\searching
	WAIT 4.0
	1: Research complete.
	SOUND voice\research_complete
	WAIT 2.0
	
	IF -T825, @skipCharey
	1: USER: Charley Kissinger, DOWNLOADED: file Strength enhancements.
	1: USER: Charley Kissinger, DOWNLOADED: file Naughty magazines.
	1: USER: Charley Kissinger, DOWNLOADED: file Experimental research.
	
@skipCharley	
	IF -T849, @skipAutoCPR
	1: USER: %1, DOWNLOADED: file Auto CPR schematics.

@skipAutoCPR
	IF -T852, @skipStrengthEhancements
	1: USER: %1, DOWNLOADED: file Strength enhancements.

@skipStrengthEhancements	
	IF -T853, @skipExperimentalResearch
	1: USER: %1, DOWNLOADED: file Experimental reseach.	
	
@skipExperimentalResearch
	IF -T854, @skipNaughtyMagazines
	1: USER: %1, DOWNLOADED: file Naughty magazines.
	
@skipNaughtyMagazines	
	IF -T860, @skipSecurity1
	1: USER: %1, VIEWED: security tape #4.
	
@skipSecurity1
	IF -T861, @skipSecurity2
	1: USER: %1, VIEWED: security tape #52.

@skipSecurity2
	IF -T862, @skipSecurity3
	1: USER: %1, VIEWED: security tape #310.

@skipSecurity3
	IF -T825, @skipCharley2
	1: USER: Charley Kissinger, VIEWED: security tape #310.
	
@skipCharley2
	IF -T887, @skipYuku
	IF -T854, @skipYuku
	IF T851, @skipYuku
	1: USER: Yuku Kobra, DOWNLOADED: file Naughty magazines.
	
@skipYuku	
	IF -T888, @skipCarlos
	IF -T854, @skipCarlos
	IF T851, @skipCarlos
	1: USER: Carlos Draak, DOWNLOADED: file Naughty magazines.
	
@skipCarlos	
	IF -T936, @skipAccessCodes
	1: USER: %1, DOWNLOADED, files Security access codes military research facility.

@skipAccessCodes
	1: End of program.
	1: Goodbye.
	SOUND voice\goodbye
	IF T887|T888, @logActorComment
	END
	
@logActorComment
	IF T851, @end
	8: Eh-, don't mind my download history...
	8: I figured I'd get something to read during downtime, eh-, hehe... 
	H: Right...
	8: Anyway, let's go!
	END

@died
	IF T887|T888, @diedActor
	N: You cannot do anything while you are dead.
	END

@diedActor
	8: You should visit Doc Adlington first before attempting to do that.
	END

@end
	END

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5066, bunkerhallway05, SCENE, "Hardcore challenge 1"

	IF V25, @nothingHere
	IF T1200, @alreadyDefeatedHardcoreChallenge

	SET x, 50
	SET y, 70
	CALL 5350@hardcoreChallengeSetUp
	END
	
@nothingHere
	N: There is nothing here anymore.
	END

@alreadyDefeatedHardcoreChallenge
	N: You have already defeated the this hardcore challenge.
	END

@end
	END

@eventActorClick7
	CALL 5350@setActorGreen
	MENU "Activate hardcore challenge=@activateChallenge", "General information=@helpGeneral", "Types of challenges=@helpTypeChallenges", "Cancel=@end"
	CALL 5350@setActorRed
	END

@activateChallenge	
	GOTO SCENE 5351	
	
@helpGeneral
	CALL 5350@helpGeneral
	END

@helpTypeChallenges
	CALL 5350@helpTypeChallenges
	END
	

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; END OF THE ROT WAR FOR GUNSLINGERS
; This scene covers the alternative conclusion to the rot war for gunslingers
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5095, aaadirty,CUT,"",0,0

	FLAGS 16384
	LOCK 1
	EJECT T172
	SET slavaon, #<rating>	
	MUSIC "black_sabbath.mid"
	
	ACTOR	1,	"Samuel Raven",monster002, 4, 30, 90
	ACTOR 2,	"#<str.name>",mirror,1,110,90

	FACE 2,4
	MOVE 2,65,95
	
	IF T426|T427, @skipSetEvil
	
	COMPARE #<rating>, "1"
	IF< @setEvil
	HOST_GIVE T426
	
@setEvil
	IF T426, @skipSetEvil
	HOST_GIVE T427
	
@skipSetEvil	
	1: Hello, %1.
	SEL 2
	POSE 4
	2: Hi, Commander.
	2: What is this?
	1: As you know, I monitor the ongoings in the world, particularly with interesting individuals such as yourself.
	2: Yes, and?
	1: You have accomplished quite a bit.
	1: Devil betrayed us a long time ago, while Atsumori did his best to stop him, but ultimately failed to prevent the nuke from exploding.
	1: Still, you have progressed well, I think we still have a shot.
	
	IF T427, @evilEnd
	1: I want you to join Atsumori's side, it seems to match close with your alignment. 
	1: You can do a lot of good for the world when you're on his and Silver's side.
	1: Ultimately, we need to stop Devil and Daemonium and bring them to justice for their betrayal.
	2: Yes, my goal was to oppose them wherever I could, I'm glad I managed to do some good for this world.
	1: Yes, you have done well.
	GOTO @finish
	
@evilEnd	
	1: You have not exactly done a lot of good deeds, have you?
	2: It's quite simple, Devil and Daemonium are our enemies.
	2: If I ever want to have a shot at getting close to them, then they must think that I betrayed the %C63s.
	2: If I get to join their side, then you'll have a spy on the inside.
	1: Mm, smart thinking and excellent idea.
	1: I had not even considered that, but yes, it makes a lot of sense.
	1: Very well, I want you to join Devil's side and stay undercover, even if it means that you have to fight Atsumori and Silver.
	2: Alright, I can do that.
	GOTO @finish
	
@finish	
	HOST_GIVE T429
	1: It is time to send you to Destroyed Lands.
	1: The next step in your adventure starts there.
	WAIT 3.0
	GOTO LINK 18, 0, 1


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; SET UP SCENE FOR MILITARY RESEARCH FACILITY SECURITY DRONES GUN RANGE
; This scene is only supposed to be called, and never to be entered.
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5096, check, CUT, "Shoot the drones!"

	END

@setUp
	SET totalEnemies, #<arg0>
	SET droneTotalHealth, #<arg1>
	SET difficulty, #<arg2>
	SET hitMultiplier, #<arg3>
	HOST_GIVE T1105
	
	LOCK 1
	EJECT T172
	FLAGS 192
	
	COMPARE #<scene>, "5354"	; fourth hardcore challenge
	IF= @skipSettingGunSlinger
	
	CALL 5097@addGunslinger 
	MOVE 8, -50, -50, 1
	N: You have alerted security drones to your presence!
	8: Lock and loaded, let's hit them hard!	

@skipSettingGunSlinger		
	IF T910, @skipTip
	N: The faster you attack, the less chance you get hit!
	
@skipTip
	; target actors
	ACTOR 6.4, "", gun64px, 2, -100, -99	; 3 points
	ACTOR 7.5, "", stealth2, 1, -100, -100 	; 2 points
	ACTOR 5.6, "", abcall, 0, -100, -100	; 5 points
	ACTOR 9.3, "", background, 0, 0, 0		; 0 points
	
	SET shootHP, #<num.hostMaxHP>
	DIV shootHP, #<difficulty>
	ADD shootHP, "1"
	
	GOTO @changeLocationActors
	RETURN
	
@eventActorGiveEMP
	SOUND tesla_shot
	N: You instantly destroyed the security drone!
	SUB droneHealth, #<droneTotalHealth>	
	GOTO @checkDroneHealth
	
@eventActorGiveMissed
	N: You missed!
	GOTO @checkDroneHealth
	
@eventActorAttack6
	CALL @preCheck
	N: The armor is damaged.
	SUB droneHealth, 2
	GOTO @checkDroneHealth
	
@eventActorAttack7
	CALL @preCheck
	N: The targeting system is damaged.
	SUB droneHealth, 3
	GOTO @checkDroneHealth

@eventActorAttack5	
	CALL @preCheck
	N: The security drone is instantly destroyed!
	SUB droneHealth, #<droneTotalHealth>
	GOTO @checkDroneHealth

@eventActorAttackMiss
	CALL @preCheck
	N: You missed!
	GOTO @checkDroneHealth

@checkDroneHealth
	COMPARE #<droneHealth>, "1"
	IF< @changeLocationActors
	CALL @droneAttack
	CALL @changeXY
	CALL @calculateOffSet
	CALL @moveActors
	IF T887+R50|T888+R50, @helpShooting
	RETURN
	
@changeLocationActors
	IF T1105, @firstChangeActor
	SUB totalEnemies, "1"
	SOUND explosion
	SEL 6
	POSE 4
	WAIT 0.1
	POSE 5
	WAIT 0.1
	POSE 6
	WAIT 0.1
	POSE 7
	WAIT 0.1
	POSE 8

@skippedExplosion
	COMPARE #<totalEnemies> "1"
	IF< @reward
	CALL @setDroneHealth
	CALL @changeXY
	CALL @calculateOffSet
	CALL @teleportActors
	CALL @changeXY
	CALL @calculateOffSet
	CALL @moveActors
	CALL @droneAttack
	IF T887+R40|T888+R40, @helpShooting
	RETURN
	
@firstChangeActor
	HOST_TAKE T1105
	GOTO @skippedExplosion
	
@setDroneHealth
	SET droneHealth, #<droneTotalHealth>
	RETURN
	
@droneAttack
	SEL 6
	POSE 3
	SOUND pillbox_shot
	WAIT 0.5
	POSE 2
	WAIT 0.5
	
	SET timeNext, #<num.timeNow>
	SUB timeNext, #<time>
	SET hitChance, #<timeNext>
	MUL hitChance, #<hitMultiplier>
	IF R#<hitChance>, @droneAttackHits
	N: The attack drone misses!
	RETURN

@droneAttackHits	
	SOUND hitpainmale1
	HOST_TAKE H#<shootHP>
	IF DEAD, @died
	RETURN
	
@helpShooting
	COMPARE #<scene>, "5354"
	IF= @return
	IF T887, @helpYuku
	SOUND machine-gun
	IF R70, @carlosHit
	8: Damn, I missed!
	RETURN
	
@carlosHit
	8: Got it!
	SET hitPower, %R100
	COMPARE #<hitPower>, "26"
	IF< @eventActorAttack5
	COMPARE #<hitPower>, "66"
	IF< @eventActorAttack7
	GOTO @eventActorAttack6
	
@helpYuku
	SOUND sniper-rifle
	IF R60, @yukuHit
	8: Crap, I missed!
	RETURN

@yukuHit
	8: Die!
	SET hitPower, %R100
	COMPARE #<hitPower>, "41"
	IF< @eventActorAttack5
	COMPARE #<hitPower>, "61"
	IF< @eventActorAttack7
	GOTO @eventActorAttack6	

@removeXY
	SET x, -100
	SET x7, -100
	SET x5, -100
	RETURN
	
@calculateOffSet	
	SET x6, #<x>
	ADD x6, 1
	SET y6, #<y>
	ADD y6, 5
	
	SET x7, #<x>
	ADD x7, 1
	SET y7, #<y>
	ADD y7, 4
	
	SET x5, #<x>
	ADD x5, 1
	SET y5, #<y>
	ADD y5, 2
	RETURN	

@teleportActors	
	SEL 6
	POSE 2
	MOVE 6,  #<x6>, #<y6>, 1
	MOVE 7,  #<x7>, #<y7>, 1
	MOVE 5,  #<x5>, #<y5>, 1
	RETURN
	
@moveActors	
	SOUND hover
	SET randomSpeed, %R3
	ADD randomSpeed, 1

	MOVE 6,  #<x6>, #<y6>, #<randomSpeed>
	MOVE 7,  #<x7>, #<y7>, #<randomSpeed>
	MOVE 5,  #<x5>, #<y5>, #<randomSpeed>	
	
	SET time, #<num.timeNow>
	RETURN	
		
@changeXY
	SET x, %R90
	SET y, %R85
	ADD y, 10
	RETURN	
	
@preCheck
	CALL @checkWeapon
	RETURN
	
@checkWeapon
	COMPARE #<item.id>, "982"
	IF= RETURN
	COMPARE #<item.class>, "14"
	IF!= @onlyRangedWeaponsAllowed
	RETURN

@onlyRangedWeaponsAllowed	
	N: Only ranged weapons are allowed.
	END	
	
@died
	N: You died.
	5: Target destroyed.
	WAIT 4.0
	GOTO EXIT	

@reward
	MOVE 6,  -100,-100,1
	MOVE 7,  -100,-100,1
	MOVE 5,  -100,-100,1
	MOVE 9,  -100,-100,1
	N: You have defeated all the attack drones!
	GOTO #<scene>@reward	

@return
	RETURN

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; SET UP SCENE FOR MILITARY RESEARCH FACILITY EXPLORING
; This scene is only supposed to be called, and never to be entered.
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;		
SCENE 5097, check1, CUT
	END

@died
	N: There is nothing you can do here while you are dead.
	WAIT 3.0
	GOTO EXIT	
	
@checkPower
	IF T892, @end
	COLOR 21
	RETURN

@moveActor
	SET token, "876"
	ADD token, "#<bedroom>"
	MOVE #<arg0>, -50, -50, 1
	IF T#<token>, @nothingHere
	ADD random, 17
	CALL @randomEvent
	RETURN
	
@randomEvent
	IF R#<random>-T#<token>, @findBonusItem
	IF R15, @fightSecurity
	IF R25, @findItem
	N: There is nothing of interest here.
	WAIT 1.0
	RETURN
	
@fightSecurity
	COMPARE #<fightMRF>, "0"
	IF> @nothingHere
	ADD fightMRF, 1
	N: You have alerted security to your presence!
	WAIT 1.0

	CALL 5199@beforefightgunslingerstart
	
	MOVE 8, -50, -50, 1

	IF T887, @fight3WithYuku
	IF T888, @fight3WithCarlos
	FIGHT2 1703, 1703, 1703, 1703
	GOTO @fightEnd
	
@fight3WithYuku
	FIGHT2 1703, 1703, 1703, 1703, -1798.80.95
	GOTO @fightEnd
	
@fight3WithCarlos
	FIGHT2 1703, 1703, 1703, 1703, -1797.80.95
	GOTO @fightEnd	
	
@fightEnd	
	CALL 984@rewardMissionPP
	CALL 5198@gunslingerCPRAndAfterFightQuotes
	IF R40+WON, @dropSparePart
	RETURN
	
@dropSparePart
	N: The %M1703 dropped %I980!
	HOST_GIVE I980
	RETURN
	
@findItem
	IF R40, @findEMPGrenade
	IF R30, @findOldFashioned
	IF R25, @findTrojanHorse
	IF R5, @findGeneEnhancement
	N: You found a %I977.
	HOST_GIVE I977
	WAIT 1.0
	RETURN
	
@findEMPGrenade
	N: You found a %I982.
	HOST_GIVE I982
	WAIT 1.0
	IF T887|T888, @findEMPGrenadeActor
	RETURN
	
@findEMPGrenadeActor
	8: Sweet, you can blow up those nasty flying drone fuckers with these things.
	RETURN

@findOldFashioned
	CALL 9098@findOldFashioned
	RETURN

@findTrojanHorse
	CALL 9098@findTrojanHorse
	RETURN
	
@findGeneEnhancement
	CALL 9098@findGeneEnhancement
	RETURN
	
@findBonusItem
	HOST_GIVE T#<token>
	COMPARE #<bedroom>, "2"
	IF< @findHat
	IF= @findSneakers
	N: You found a %I2617!
	HOST_GIVE I2617
	8: That should offer some protection.
	RETURN
	
@findHat
	N: You found a %I2555!
	HOST_GIVE I2555
	8: That hat will look great on you.
	RETURN
	
@findSneakers
	N: You found a pair of %I2587!
	HOST_GIVE I2587
	8: Nice, I love this model, they're quite comfortable.
	RETURN
	
@nothingHere
	N: There is nothing of interest here.
	WAIT 1.0
	RETURN

@end
	RETURN
	
@addGunslinger
	IF T887, @setupYuku
	IF T888, @setupCarlos
	RETURN
	
@setupYuku
	ACTOR 8, "Yuku", gun009, 1, 110, 95, 0, tanya_death
	SEL 8
	POSE 1, 4
	MOVE 8, 80, 95
	RETURN

@setupCarlos
	ACTOR 8, "Carlos", gun007, 1, 110, 95, 0, man_die7
	SEL 8
	POSE 1, 4
	MOVE 8, 80, 95
	RETURN	
	
	
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; SET UP SCENE FOR ABANDONED RESEARCH LAB EXPLORING
; This scene is only supposed to be called, and never to be entered.
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;	
SCENE 5098, check1, CUT
	END

@setUpSceneLeft
	ACTOR 1,  "Chest", gun005, 2, 70, 95
	ACTOR 2, "Check below the bed" circuitbuttons, 9, 17, 95
	ACTOR 3, "Check the lockers", circuitbuttons, 9, 40, 75
	ACTOR 4, "Check the boxes", circuitbuttons, 9, 55, 78
	ACTOR 5, "Check the drawers", circuitbuttons, 9, 66, 81
	ACTOR 6, "Check the box", circuitbuttons, 9, 53, 39
	GOTO @message

@setUpSceneRight
	ACTOR 1,  "Chests", gun005, 2, 51, 95
	ACTOR 2, "Check below the bed", circuitbuttons, 9, 82, 95
	ACTOR 3, "Check the lockers", circuitbuttons, 9, 62, 75
	ACTOR 4, "Check the boxes", circuitbuttons, 9, 45, 83
	ACTOR 5, "Check the drawers", circuitbuttons, 9, 33, 81
	ACTOR 6, "Check the box", circuitbuttons, 9, 48, 39
	GOTO @message

@message	
	CALL 5097@addGunslinger
	MOVE 8, 70, 95
	SET fightMRF, 0
	SET checks, 0
	SET random, 0
	CALL @checkPower
	IF DEAD, @died
	N: There are several places you can search to find something of interest in this room.	
	RETURN

@died
	IF T887|T888, @diedActor
	N: There is nothing you can do here while you are dead.
	WAIT 3.0
	GOTO EXIT
	
@diedActor
	8: You should visit Doc Adlington first, %1.
	8: We can't explore this room while you're in this state.
	WAIT 3.0
	GOTO EXIT
	
@checkPower
	IF T843+T844, @powerIsOn
	COLOR 21
	
@powerIsOn	
	RETURN

@moveActor
	IF T83#<bedroom>|T839, @nothingLeftOfInterest
	MOVE #<arg0>, -50, -50, 1
	ADD checks, #<arg0>	
	CALL @randomEvent
	COMPARE #<checks>, "21"
	IF= @giveToken
	RETURN
	
@randomEvent
	IF R15, @fightNightmare
	IF R25, @findItem
	IF R25, @findFuse
	N: There is nothing of interest here.
	WAIT 1.0
	RETURN
	
@fightNightmare
	N: You found a monster #<location>!
	WAIT 1.0

	CALL 5199@continueBeforeGunslingerFight	

	FIGHT2 1701
	
	CALL 5198@gunslingerCPRAndDirectDrinkQuotes
	
	IF LOSE, @end
	N: You received 2 %Z1s
	HOST_GIVE Z1.2
	IF R25, @dropSparePart
	RETURN
	
@dropSparePart
	N: The %M1701 dropped %I980!
	HOST_GIVE I980
	RETURN
	
@findItem
	IF R40, @findOldFashioned
	IF R25, @findTrojanHorse
	IF R5, @findGeneEnhancement
	N: You found a %I977.
	HOST_GIVE I977
	WAIT 1.0
	RETURN

@findOldFashioned
	N: You found an %I976.
	HOST_GIVE I976
	WAIT 1.0
	IF T887|T888, @findOldFashionedActor
	RETURN
	
@findOldFashionedActor
	8: I could use a drink.
	RETURN

@findTrojanHorse
	N: You found a %I975!
	HOST_GIVE I975
	WAIT 1.0
	IF T887|T888, @findTrojanHorseActor
	RETURN	
	
@findTrojanHorseActor
	8: Damn, that's a good find!
	RETURN
	
@findGeneEnhancement
	N: You found a %I2166!
	HOST_GIVE I2166
	WAIT 1.0
	IF T887|T888, @findGeneEnhancementActor
	RETURN
	
@findGeneEnhancementActor
	8: Holy crap, that's a great find!
	RETURN
	
@findFuse
	N: You found a %I978!
	HOST_GIVE I978
	GOTO @giveToken
	
@giveToken
	HOST_GIVE T83#<bedroom>	
	IF T831+T832+T833+T834+T835+T836+T837+T838, @removeTokens
	RETURN
	
@removeTokens
	HOST_TAKE T831
	HOST_TAKE T832
	HOST_TAKE T833
	HOST_TAKE T834
	HOST_TAKE T835
	HOST_TAKE T836
	HOST_TAKE T837
	HOST_TAKE T838
	HOST_GIVE T839
	RETURN
	
@nothingHere
	IF T887|T888, @nothingHereActor
	N: You have already explored this room, there is nothing of interest here.
	END
	
@nothingHereActor
	CALL 5097@addGunslinger
	8: Why are we here again?
	8: There isn't anything left to discover in this room.
	END
	
@nothingLeftOfInterest
	IF T887|T888, @nothingLeftOfInterestActor
	N: You have already discovered something valuable in this room, there is nothing of interest left.
	WAIT 3.0
	GOTO EXIT
	
@nothingLeftOfInterestActor
	8: It looks like we found everything of value in this room that there is to find.
	H: Yeah, you're right.
	H: Let's go. 
	WAIT 3.0
	GOTO EXIT
	
@flashbackEffect
	FX 1
	SOUND flashback
	WAIT 2.0
	FX 0
	RETURN
	
@end
	RETURN
	
@eventHostGive
	CALL 5199@continueGunslingerDrink
	RETURN	

@soundstatic
	WAIT 3.0
	MOVE  1, -50,50,1
	MOVE  2, -50,50,1
	MOVE  3, -50,50,1
	MOVE  4, -50,50,1
	MOVE  5, -50,50,1
	MOVE  6, -50,50,1
	MOVE  7, -50,50,1
	MOVE  8, -50,50,1
	MOVE  9, -50,50,1
	MOVE 10, -50,50,1
	MOVE 11, -50,50,1
	MOVE 12, -50,50,1
	MOVE 13, -50,50,1
	MOVE 14, -50,50,1
	MOVE 15, -50,50,1
	MOVE 16, -50,50,1
	MOVE 17, -50,50,1
	MOVE 18, -50,50,1
	MOVE 19, -50,50,1
	MOVE 20, -50,50,1
	SOUND static
	WEATHER 6
	WAIT 2.0
	WEATHER 0
	BKGND check1
	WAIT 2.0
	RETURN

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; GENERAL SET UP
; This scene is only supposed to be called, and never to be entered.
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;

SCENE 5099, check1, CUT, 0, 0, 0
	END
	
@setCutSceneFlags
	FLAGS	17536
	LOCK 	1
	EJECT 	T172
	RETURN
	
@setUpSwitch
	SET power, "1"
	ACTOR 9, "Help", circuitbuttons, 9, -50, -50	; Help talker
	ACTOR 14,	"", circuitbuttons,  5, 90, 85 ; Help
	ACTOR 15, 	"", circuitbuttons,  3, 90, 45 ; Switch
	ACTOR 16,	"", circuitbuttons,  1, 90, 25 ; Power icon
	RETURN
	
@setCircuitBoard	
	SET boardIsFixed, "0"
	SET temp, %R6
	
	ACTOR 17.-1000,	"", circuitboard_#<temp>, 0, 45, 90
	RETURN
	
@setUpAnalyzer
	ACTOR 13, 	"", circuitbuttons, 16, 90, 65 ; Analyzer
	RETURN

@setUpHelp
	ACTOR 9, "Help", circuitbuttons, 9, -50, -50
	ACTOR 15,	"", circuitbuttons, 5, 72, 28
	RETURN	
	
@setUpHackToolAndHelp
	SET hacktool, 0	
	SET attempts, 999
	
	SET virusScannerPose, "9"
	ACTOR 6, "Hack tool", circuitbuttons, 9, -50, -50
	ACTOR 9, "Help", circuitbuttons, 9, -50, -50
	ACTOR 13,	"", circuitbuttons, 5, 85, 90 ; help
	ACTOR 14,	"", circuitbuttons, 6, 85, 70 ; hack tool
	RETURN
	
@setUpStart
	ACTOR 12, "", circuitbuttons, 15, 50, 80
	RETURN

@changeThePower
	IF DEAD, @died
	SOUND switch
	SET actor, #<totalActors>
	COMPARE #<power>, "1"
	IF< @turnPowerOn
	SEL 16
	POSE 2
	SEL 15
	POSE 4
	SET power, "0"
	N: The power is turned OFF
	RETURN

@turnedPowerOff		
	COMPARE #<actor>, 1
	IF< RETURN
	CALL @changeActorPoseOff
	CALL @substractActor
	GOTO @turnedPowerOff

@turnPowerOn
	SEL 16
	POSE 1
	SEL 15
	POSE 3
	SET power, "1"
	N: The power is turned ON
	RETURN
; Update all the pins next.		

@explosion
	ACTOR 63,	"", explosion,1, -150,100
	SOUND explosion
; sound must be an explosion	
	MOVE 63,48,59,1
	SELECT 63
	POSE 1
	WAIT 0.2
	POSE 2
	WAIT 0.2
	POSE 3
	WAIT 0.2
	POSE 4
	WAIT 0.2
	MOVE 63,-150,100,1
	WAIT 2.0
	RETURN

@startHealing
	SET temp, #<num.hostMaxHP>
	SUB temp, #<num.hostHP>
	DIV temp, 5
	ADD temp, 1
	SET temp2, #<num.hostMaxMP>
	SUB temp2, #<num.hostMP>
	DIV temp2, 5
	ADD temp2, 1
	SET i, 0
	GOTO @healing

@healing
	COMPARE #<i>, 4
	IF> @stopHealing
	HOST_GIVE H#<temp>
	HOST_GIVE M#<temp2>
	ADD i, 1
	WAIT 1.0
	GOTO @healing
	
@stopHealing
	RETURN

@died
	N: You cannot do anything while you are dead.
	RETURN

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; CIRCUIT BOARD SET UP
; This scene is only supposed to be called, and never to be entered.
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5100, check1, CUT, 0, 0, 0
	
	END
	
; SET desiredState for each pin in the actual implementation scene
; EXAMPLE CODE to set desired state to unencrypted data:
; SET desiredState6, #<poseActor6>
; ADD desiredState6, 6
;
; Add the following to change color:
; yellow +0, blue +6, green +12, red +18, purple +24, orange +30
;  
; yellow = normal voltage, green = low voltage, orange = high voltage
; blue = unencrypted data, purple = encrypted data, red = security data
	
@setScene	
	FLAGS	17536
	BKGND	circuitboard3
	LOCK 	1
	EJECT 	T172
		
	SET power, "1"
	SET boardIsFixed, "0"
	SET allowedAttempts, "3"
	SET temp, %R6
	
	ACTOR 13, 	"", circuitbuttons, 16, 90, 65 ; Analyzer
	ACTOR 14,	"", circuitbuttons,  5, 90, 85 ; Help
	ACTOR 15, 	"", circuitbuttons,  3, 90, 45 ; Switch
	ACTOR 16,	"", circuitbuttons,  1, 90, 25 ; Power icon
	ACTOR 17.-1000,	"", circuitboard_#<temp>, 0, 45, 90		
	
	SET music, %R12
	GOTO @selectMusic#<music>
	
@selectMusic1
	MUSIC	AliceCooper_Poison
	RETURN

	RETURN ; for some reason the script wants to return to this line, the RETURN statement fixes issues that are caused by that.
@selectMusic2
	MUSIC	born-to-be-wild
	RETURN

@selectMusic3
	MUSIC	gangstas-paradise
	RETURN

@selectMusic4
	MUSIC	queen-Bohemian-Rhapsody
	RETURN

@selectMusic5
	MUSIC	apocalyptica-Hope
	RETURN

@selectMusic6
	MUSIC	country-Love2
	RETURN

@selectMusic7
	MUSIC	sons-of-skyrim
	RETURN

@selectMusic8
	MUSIC	mgs-callingtothenight
	RETURN

@selectMusic9
	MUSIC	mgs2-maintheme
	RETURN

@selectMusic10
	MUSIC	apocalyptica-betrayal
	RETURN
	
@selectMusic11
	MUSIC	Blue_Da_Ba_Dee
	RETURN	

@selectMusic12
	MUSIC	apocalyptica-LifeBurns
	RETURN

; This call supports up to 4 arguments right now, 0 = left, 1 = up, 2 = right, 3 = down.
; These positions determine the place on the board. To not place anything give 0 as an argument.
; Recommended is to put at most 4 pins left and right and 2 pins up and down, however 4 up/down and 2 left/right also works 
; If you want no pins on left or right, then enter 0 for that value.	
@setPins
	SET Left, #<arg0>
	SET Up, #<arg1>
	SET Right, #<arg2>
	SET Down, #<arg3>
	SET actor, 0
	ADD actor, #<Left>
	ADD actor, #<Up>
	ADD actor, #<Right>
	ADD actor, #<Down>
	SET totalActors, #<actor>
		
	SET position, "Left"
	CALL @setPinPosition
	SET position, "Up"
	CALL @setPinPosition
	SET position, "Right"
	CALL @setPinPosition
	SET position, "Down"
	CALL @setPinPosition
	RETURN
	
@setPinPosition
	COMPARE "*#<position>", "1"
	IF< RETURN
	
	SET offset, *#<position>
	CALL @randomPose
	CALL @setActor#<position>
	CALL @substractActor
	SUB #<position>, 1
	GOTO @setPinPosition

@setActorLeft
	CALL @calculateOffSetY
	ACTOR #<actor>.#<actor>, "", circuitbuttons#<position>, #<pose>, 27, #<y>
	RETURN

@setActorRight
	CALL @calculateOffSetY
	ACTOR #<actor>.#<actor>, "", circuitbuttons#<position>, #<pose>, 60, #<y>
	RETURN

@setActorUp
	CALL @calculateOffSetX
	ACTOR #<actor>.#<actor>, "", circuitbuttons#<position>, #<pose>, #<x>, 34
	RETURN	

@setActorDown
	CALL @calculateOffSetX
	ACTOR #<actor>.#<actor>, "", circuitbuttons#<position>, #<pose>, #<x>, 85
	RETURN		
	
@calculateOffSetY
	SET y, 100
	MUL offset, 15
	SUB y, #<offset>
	RETURN
	
@calculateOffSetX
	SET x, 60
	MUL offset, 10
	SUB x, #<offset>
	RETURN

@substractActor
	SUB actor, 1
	RETURN

@randomPose
	SET pose, %R3
	MUL pose, 2
	SET poseActor#<actor>, #<pose>
	RETURN
	
; This label determines what color the pin will be set to.	
; arg0 is the the actor that the player clicked on.
@interactionMenu
	IF DEAD, @died
	
	COMPARE #<power>, "1"
	IF= @cannotUpdateNodeWithPowerOn

	SET clicked, #<arg0>
	
	SET temp, "poseActor#<clicked>"
	SET newPose, *#<temp>
	
	COMPARE #<newPose>, "31"
	IF<= @newPosePurple
	SUB newPose, 30
	GOTO @menuInteractionMenu
	
@newPosePurple
	COMPARE #<newPose>, "25"
	IF<= @newPoseRed
	SUB newPose, 24
	GOTO @menuInteractionMenu

@newPoseRed
	COMPARE #<newPose>, "19"
	IF<= @newPoseGreen
	SUB newPose, 18
	GOTO @menuInteractionMenu	

@newPoseGreen	
	COMPARE #<newPose>, "13"
	IF<= @newPoseBlue
	SUB newPose, 12
	GOTO @menuInteractionMenu	
	
@newPoseBlue	
	COMPARE #<newPose>, "7"
	IF<= @newPoseYellow
	SUB newPose, 6
	GOTO @menuInteractionMenu	

@newPoseYellow
	GOTO @menuInteractionMenu
	
@menuInteractionMenu
	MENU "Enable/ disable node=@changeNode", "Low voltage=@interactionMenuLowVoltage", "Normal voltage=@interactionMenuNormalVoltage", "High voltage=@interactionMenuHighVoltage", "Unencrypted data=@interactionMenuUnencryptedData", "Encrypted data=@interactionMenuEncryptedData", "Security data=@interactionMenuSecurityData", "Cancel=@cancel"
	RETURN

@changeNode
	SET temp, poseActor#<clicked>
	SET modCalculation, *#<temp>
	MOD modCalculation, 2
	COMPARE #<modCalculation>, "0"
	IF= @disableNode
	
	SUB #<temp>, "1"
	SUB *#<temp>, "1"
	RETURN
	
@disableNode
	ADD #<temp>, "1"
	ADD *#<temp>, "1"
	RETURN
	
@cannotUpdateNodeWithPowerOn
	N: You cannot update a node while the power is on.
	RETURN
	
; yellow +0, blue +6, green +12, red +18, purple +24, orange +30
@interactionMenuLowVoltage	
	ADD newPose, "12"
	GOTO @updatePinToNewState

@interactionMenuNormalVoltage
	GOTO @updatePinToNewState

@interactionMenuHighVoltage
	ADD newPose, "30"
	GOTO @updatePinToNewState

@interactionMenuUnencryptedData
	ADD newPose, "6"
	GOTO @updatePinToNewState

@interactionMenuEncryptedData
	ADD newPose, "24"
	GOTO @updatePinToNewState

@interactionMenuSecurityData
	ADD newPose, "18"
	GOTO @updatePinToNewState
	
@updatePinToNewState
	SET temp, "poseActor#<clicked>"
	SET #<temp>, #<newPose>
	SEL #<clicked>
	POSE *#<temp>
	
	SET modCalculation, #<newpose>
	MOD modCalculation, 2
	COMPARE #<modCalculation>, "0"
	IF> RETURN 	
	SET pose, *#<temp>
	ADD pose, "1"
	POSE #<pose>
	RETURN
	
@analyzeBoard
	IF DEAD, @died
	CALL @analyzingBoard
	CALL @analyzeAnimationSetUp
	RETURN
	
; Analyze animation starts here	
@analyzeAnimationSetUp
	SEL 13
	N: Analyzing...
	SET temp, 0

@analyzeAnimationRun	
	COMPARE #<temp>, 3
	IF> @analyzeAnimationComplete
	POSE 17
	WAIT 0.3
	POSE 16
	WAIT 0.2	
	ADD temp, 1
	GOTO @analyzeAnimationRun
	
@analyzeAnimationComplete
	N: ----------------------------
	N: #<correct> out of #<totalActors> nodes are correct
	N: ---------------------------- 
	RETURN 
; Analyze animation finished here	

; Actual analysis starts here	
@analyzingBoard
	SET actor, #<totalActors>
	SET correct, 0
	
@analyzeAllPins	
	COMPARE #<actor>, "1"
	IF< RETURN
	SET temp, poseActor#<actor>
	SET temp2, desiredState#<actor>
	COMPARE "*#<temp>", "*#<temp2>"
	IF!= @analyzeNextPin
	ADD correct, 1
	
@analyzeNextPin
	SUB actor, 1
	GOTO @analyzeAllPins
; Actual analysis finished here	
	
@changeThePower
	IF DEAD, @died
	SOUND switch
	SET actor, #<totalActors>
	COMPARE #<power>, "1"
	IF< @turnPowerOn
	SEL 17
	POSE 1
	SEL 16
	POSE 2
	SEL 15
	POSE 4
	SET power, "0"
	MUSIC #silence
	N: The power is turned OFF
; Update all the pins next.	
@turnedPowerOff		
	COMPARE #<actor>, 1
	IF< RETURN
	CALL @changeActorPoseOff
	CALL @substractActor
	GOTO @turnedPowerOff

@turnPowerOn
	SEL 17
	POSE 0
	SEL 16
	POSE 1
	SEL 15
	POSE 3
	SET power, "1"
	CALL @selectMusic#<music>
	N: The power is turned ON
; Update all the pins next.		
@turnedPowerOn	
	COMPARE #<actor>, 1
	IF< @verifyChanges
	CALL @changeActorPoseOn
	CALL @substractActor
	GOTO @turnedPowerOn
	
@changeActorPoseOn	
	SET currentActor, poseActor#<actor>	
	SEL #<actor>
	POSE *#<currentActor>	
	RETURN
	
@changeActorPoseOff
	; check the current actor pose
	SET currentActor,	poseActor#<actor>	
	; create a seperate cookie to calculate the modulo
	SET modCalculation, *#<currentActor>
	; divide the modulo by 2, even means that it's on
	MOD modCalculation, 2
	COMPARE #<modCalculation>, "0"
	IF> RETURN 
	
	SEL #<actor>
	SET temp, *#<currentActor>
	ADD temp, 1
	POSE #<temp>
	RETURN
	
@verifyChanges
	CALL @analyzingBoard
	COMPARE #<correct>, #<totalActors>
	IF= @boardIsFixed
	SET tempHP, #<num.hostMaxHP>
	DIV tempHP, #<allowedAttempts>
	ADD tempHP, 1
	SOUND tesla_shot
	WAIT 2.0
	HOST_TAKE H#<tempHP>
	N: You received a shock because one or more of the nodes are incorrect!
	RETURN
	
@boardIsFixed
	SET boardIsFixed, "1"
	RETURN
	
@helpRequested
	MENU "What does the power switch do?=@helpPowerSwitch", "What does the magnifying glass do?=@helpAnalyzing", "How do I update a node?=@helpUpdatingNode", "Why did the music stop?=@helpNoMusic", "Hints=@helpHints", "Cancel=@cancel"
	RETURN
	
@helpPowerSwitch
	N: ----------------
	N: POWER SWITCH
	N: ----------------
	N: With the power switch you can turn the power ON and OFF.
	N: Turning the power OFF will prevent you from getting a shock when make adjustments to the circuit board.
	N: However, you need power in order to activate your changes.
	N: You also won't see disabled (dark colored nodes) turn into enabled (light colored nodes) until the power is on again.
	RETURN
	
@helpAnalyzing
	N: ------------------
	N: ANALYZING ICON
	N: ------------------
	N: The Analyze button helps you to determine if you made the correct changes to nodes.
	N: Analyzing works while the power is off.
	N: Even disabled nodes need to have the correct setting or it won't count as a correct node.
	N: Turn the power back on once you are satisfied.
	N: Note that the Analyzing may not always be available.
	RETURN
		
@helpUpdatingNode
	N: -----------------
	N: UPDATING NODE
	N: -----------------
	N: Right click on a node to alter its voltage or data stream.
	N: You can also change a node from voltage to data or vice versa.
	N: Sometimes you may end up updating a node you did not click on.
	N: If this happens, then click lower on the pin, the pins occasionally overlap even if this is not visible.
	N: Click also lower on the pin if you have trouble getting the pop up to change the node.
	N: Alternatively, you can also set your screen to a higher resolution, 1920 x 1080 is recommended.
	RETURN
	
@helpNoMusic
	N: -----------
	N: No music
	N: -----------
	N: The music is wired into the circuit board.
	N: When you turn off the power, then the music also stops.
	N: The song will start again when you turn on the power.
	RETURN
	
@helpHints
	N: --------
	N: HINTS
	N: --------
	GOTO @helpHints#<scene>
	N: You will have to solve this circuit board yourself, there are no hints available.
	RETURN
	
@helpHints5034
	N: You can attempt to brute force the pincode or search for a hint in the room.
	RETURN		
	
@helpHints5059
	N: You have 5 attempts before the pincode of the vault resets.
	N: You will have to think of a clever way to retrieve this pincode.
	N: Alternatively, you could use a %I975.
	RETURN
	
@helpHints5110	
	N: Use the Magnifying glass (Analyse icon) to determine how many nodes are already correct.
	N: Use this icon again after every change you make to determine if your change is successful.
	N: On this board all the nodes should be enabled.
	N: Two nodes have normal voltage (yellow), two nodes have unencrypted data (blue nodes), and two nodes require high voltage (orange).
	N: Turn the power back on once you have 6 out of 6 correct nodes.
	RETURN
	
@helpHints5111
	N: The different types of data nodes are placed on the right.
	N: The normal voltage nodes are on the same side.
	N: There are two high voltage nodes on opposite sides.
	N: Seven of the nodes should be enabled, one should be disabled.
	RETURN
	
@helpHints5112
	N: This circuit board uses no regular power nodes.
	N: Three types of nodes appear twice while two other types appear only once.
	N: One node is turned off.
	RETURN
	
@helpHints5113	
	N: Erick Finkers requested the following changes to this circuit board:
	N: The two top nodes on the left and right should be high voltage.
	N: The node below the high voltage node on the left and right side should be low voltage.
	N: The bottom node on the left and right side should be normal voltage.
	N: The two top nodes should be encrypted data nodes.
	N: The two bottom nodes should be security data nodes.
	N: All nodes need to be enabled.
	RETURN

@helpHints5114
	N: This circuit board should contain the following:
	N: 3 low voltage nodes, 3 high voltage nodes, and 2 normal voltage nodes.
	N: It should also contain 2 security nodes, 1 encrypted data node, and 1 unencrypted data node.
	N: No side has a node that shares the same color with another node on that side.
	N: There are no high voltage nodes at the bottom and no low voltage nodes at the top of the board.	
	N: All the nodes are turned on.
	RETURN
	
@helpHints5232
	N: Disable the security nodes and check if the encrypted nodes should be unencrypted.
	RETURN
	
@helpHints5353
	N: Two nodes are opposites; one is a high voltage node, the other one is a low voltage node.
	N: Two other nodes are also opposites; one has encrypted data, the other has unencrypted data.
	N: The final node can be a normal voltage node or a security node.
	N: There are no disabled nodes.
	RETURN	
	
@cancel	
	RETURN

@died
	N: You cannot do anything while you are dead.
	RETURN	

	
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; TERMINAL SET UP
; This scene is only supposed to be called, and never to be entered.
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5101, check1, CUT, "Terminal", 0, 0, 0 
		
	END
	
; terminal scenes cannot be below 5000 or above 6000
@S11
	HOST_GIVE T172
	EJECT T172
	GOTO LINK 99, 0, 1

; arg0 indicates if the virus scanner is active or not
; POSES: 9 = show no virus scanner at all, 10 = inactive virus scanner, 11 = active virusscanner	
@setUpTerminal	
	BKGND	check1
	FLAGS	17792
	LOCK 	1	
	EJECT 	T172
	
	SET loggedIn, 0
	SET fileOpen, 0
	SET programActive, 0
	SET hacktool, 0
	SET x, 5
	SET y, 15
	SET actorId, 16
	SET virusScannerPose, #<arg0>
	
	CALL @setMusic
	MUSIC #<music>	
	
	ACTOR 1, "", abcall, 1, #<x>, #<y>
	POSE 1, 47
	
	; These are the invisible actors that write in chat
	ACTOR 6, "Hack tool", circuitbuttons, 9, -50, -50	
	ACTOR 7, "c\", circuitbuttons, 9, -50, -50  	
	ACTOR 9, "Help", circuitbuttons, 9, -50, -50		
	
	; These are the visible actors on screen
	ACTOR 12, 	"", circuitbuttons, #<virusScannerPose>, 85, 25
	ACTOR 13,	"", circuitbuttons, 5, 85, 90
	ACTOR 14,	"", circuitbuttons, 6, 85, 70
	RETURN

	RETURN	; additional return here is needed because WoS jumps to this part of the script, probably due to a buffer overload or something

@setMusic
	SET music, %R5
	GOTO @setMusic#<music>
	RETURN

@setMusic1
	SET music, "bomfunk-freestyler"
	RETURN
	
@setMusic2
	SET music, "MelC-I-turn-to-you"
	RETURN
	
@setMusic3
	SET music, "MelC-never-be-the-same-again"
	RETURN

@setMusic4
	SET music, "MelC-northern-star"
	RETURN

@seMusic5
	SET music, "The_Matrix"
	RETURN

@updateProgramName
	ACTOR 2, "#<arg0>", circuitbuttons, 9, -50, -50 
	RETURN
	
@resetProgramName
	ACTOR 2, "c\", circuitbuttons, 9, -50, -50 
	RETURN

@startScreen
	SET lastAsk, ""	
	SET terminalText, "connecting to terminal..."
	CALL @writeText	0
	
	WAIT 1.0
	SET terminalText, "login as: "
	CALL @writeText	1
	RETURN
	
@loginUser	
	SET login, #<lastAsk>	
	SET terminalText, ""
	CALL @writeText 0	
	RETURN
	
@loginPassword
	SET lastAsk, ""
	SET terminalText, "enter password: "
	CALL @writeText	1
	
	ASK 300
	SET password, #<lastAsk>
	SET lastAsk, ""
	SET terminalText, ""
	SET terminalText, "******"
	CALL @writeText 0	
	RETURN
	
@loginSuccessful
	SET lastAsk, ""
	SET terminalText, "Welcome #<login>"
	CALL @writeText	1	
	RETURN

@commandLogOut
	SET loggedIn, 0
	SET lastAsk, ""
	SET terminalText, "Goodbye"
	CALL @writeText	1
	SOUND voice\goodbye
	WAIT 2.0
	GOTO SCENE #<scene>

@commandQuit
	SET loggedIn, 0
	SET lastAsk, ""
	SET terminalText, "Goodbye"
	CALL @writeText	1
	SOUND voice\goodbye
	WAIT 2.0
	GOTO SCENE #<sceneReturn>

@commandInvalidDirectory
	7: PATH BLOCKED
	SOUND voice\path_blocked
	7: Invalid directory, please try again
	RETURN

@commandSearching
	SET lastAsk, ""
	SET terminalText, "searching..."
	CALL 5101@writeText 1
	SOUND voice\searching
	WAIT 2.0
	SET terminalText, "research complete"
	CALL 5101@writeText	1	
	SOUND voice\research_complete
	RETURN	
	
@commandAwaitingOrders
	SET lastAsk, ""
	SET terminalText, "Awaiting orders: "
	CALL @writeText	1	
	SOUND voice\awaiting_orders
	RETURN

@commandLine
	; It's probably best to do local commandLine implements, it gives more control over the scene.
	N: @commandLine scene 5101 is not yet implemented.	
	RETURN			
	
@invalidCommand
	7: Invalid command, please try again.
	7: Type 'help' to receive help.
	RETURN
	
@activateHackTool
	6: ALL SYSTEMS GO
	SOUND voice\all_systems_go
	SET hacktool, 1
	SEL 14
	POSE 7, 8	
	RETURN
	
@deactivateHackTool
	6: UNIT DISABLED
	SOUND voice\unit_disabled
	SET hacktool, 0
	SEL 14
	POSE 6
	RETURN	
	
@hackToolMenu
	COMPARE #<hacktool>, 0
	IF> @hackToolActive
	MENU "Activate Hacktool=@activateHackTool", "Cancel=@cancelHackTool"
	RETURN

@hackToolActive
	MENU "Dectivate hack tool=@deactivateHackTool", "Brute force attack=@hackBruteForce", "Mask brute force attack=@hackMaskBruteForce", "Guess attack=@hackGuessAttack", "Self-learning algorithm=@hackRandomWordGuessing", "Attack virus scanner=@hackVirusScanner", "Upload Trojan Horse=@hackUploadVirus", "Cancel=@cancel"
	RETURN
	
@lockedOut
	CALL @hackAttemptFailed
	
	CALL @setNumberOrWOrd
	
	N: You have attempted too many wrong #<numberWord> and are locked out of the system!
	COMPARE #<scene>, "5000"
	IF < @S11
	COMPARE #<scene>, "6000"
	IF> @S11
	WAIT 2.0
	GOTO SCENE #<sceneReturn>

@hackSearching
	6: Searching...
	SOUND voice\searching
	RETURN

@hackResearchComplete
	WAIT 1.0
	6: Research complete
	SOUND voice\research_complete
	RETURN
	
@hackAttemptFailed	
	WAIT 1.0
	6: Attempt failed
	SOUND voice\attempt_failed
	RETURN

@setNumberOrWord
	SET temp, #<passwordScene>
	DIV temp, "2"
	STRCMP #<temp>, "0"
	IF= @setWord
	SET numberWord, "numbers"
	RETURN
	
@setWord
	SET numberWord, "words"	
	RETURN
	
@hackSuccess
	CALL @hackResearchComplete
	6: -----------------------------
	6: The result = #<passwordScene>
	RETURN	

@hackBruteForce
	CALL @hackSearching
	SET_LEN len, #<passwordScene>
	COMPARE #<len>, 3
	IF> @hackBruteForceNotPossible
	SET temp, #<passwordScene>
	DIV temp, "2"
	STRCMP #<temp>, "0"
	IF= @hackBruteForceNotPossible
	SET temp, 0

@attemptBruteForce
	COMPARE #<attempts>, "1"
	IF< @lockedOut
	COMPARE #<temp>, "999"
	IF> @lockedOut
	COMPARE #<temp>, #<passwordScene>
	IF= @hackSuccess
	ADD temp, 1
	SUB attempts, 1
	GOTO @attemptBruteForce
	
@hackBruteForceNotPossible
	CALL @hackAttemptFailed
	6: The number is longer than four numbers or contains letters.
	6: It is not possible to brute force it, try using Mask brute force attack instead.
	6: You can enter the known part of the word or number with that.
	RETURN

@hackMaskBruteForce
	N: Enter the known part of the word:
	ASK 300
	SET mask, #<lastAsk>
	SET_LEN len, #<passwordScene>
	SET_LEN len2, #<mask>
	SUB len, #<len2>
	
	COMPARE #<len>, 1
	IF< @hackMaskBruteForceNotPossible
	
	COMPARE #<len>, "3"
	IF> @hackMaskBruteForceNotPossible
	
	SET_LEN len3, #<passwordScene>
	SUB len3,	#<len2>
	SET temp, 0
	
	6: Is the known part at the beginning or at the end of the word?
	MENU "I know the beginning of the word=@hackMaskBeginning", "I know the end of the word=@hackMaskEnd"
	6: Invalid input, try again.
	RETURN

@hackMaskBruteForceNotPossible
	CALL @hackAttemptFailed
	6: It is not possible to use a mask brute force on this word.
	6: Either the input is of equal length to the password, 
	6: there is more than three characters difference, or the remaining part contains letters.
	RETURN

@hackMaskBeginning
	CALL @hackSearching
	SET_SUBSTR temp2, #<len2>, #<len>, #<passwordScene>
	DIV temp2, 2
	COMPARE #<temp2>, 1
	IF< @hackMaskBruteForceNotPossible

@attemptBruteForceMaskBeginning	
	COMPARE #<attempts>, "1"
	IF< @lockedOut
	COMPARE #<temp>, "999"
	IF> @lockedOut
	SET check,	"#<mask>#<temp>"
	STRCMP #<check>, #<passwordScene>
	IF= @hackSuccess
	ADD temp, 1
	SUB attempts, 1
	GOTO @attemptBruteForceMaskBeginning
	
@hackMaskEnd
	SET_SUBSTR temp2, 0, #<len>, #<passwordScene>
	DIV temp2, 2
	COMPARE #<temp2>, 1
	IF< @hackMaskBruteForceNotPossible

@attemptBruteForceMaskEnd	
	CALL @hackSearching
	COMPARE #<attempts>, "1"
	IF< @lockedOut
	COMPARE #<temp>, "999"
	IF> @lockedOut
	SET check,	"#<temp>#<mask>"
	STRCMP #<check>, #<passwordScene>
	IF= @hackSuccess
	ADD temp, 1
	SUB attempts, 1
	GOTO @attemptBruteForceMaskEnd	

@hackNoResultsWithCurrentMask
	CALL @hackAttemptFailed
	6: There were no results found with the current.
	6: Check if you made a typo and try again.
	RETURN

@hackGuessAttack
	6: Enter your attempt [enter 'stop' to stop guessing]:
	ASK 300
	
	STRCMP #<lastAsk>, "stop"
	IF= @cancel

	CALL @hackSearching
	
	SET temp, #<lastAsk>
	DIV temp, 2
	COMPARE #<temp>, 1
	IF< @hackGuessAttackString

	SET temp, "number"
	COMPARE #<lastAsk>, #<passwordScene>
	IF> @hackGuessIsHigher
	IF< @hackGuessIsLower
	IF= @hackSuccess
	RETURN

@hackGuessAttackString	
	SET temp, "word"
	STRCMP #<lastAsk>, #<passwordScene>
	IF> @hackGuessIsHigher
	IF< @hackGuessIsLower
	IF= @hackSuccess
	RETURN

@hackGuessIsHigher
	6: Your guess is higher than the #<temp>.
	GOTO @hackGuessFail
	
@hackGuessIsLower
	6: Your guess is lower than the #<temp>.
	GOTO @hackGuessFail
	
@hackGuessFail
	SUB attempts, "1"
	COMPARE #<attempts>, "1"
	IF< @lockedOut	
	GOTO @hackGuessAttack

@hackRandomWordGuessing
	CALL @hackSearching

	SET hackRandom, 1
	SET temp, 1
	IF E2160, @attemptRandomMaxYellow
	IF E2161, @attemptRandomMaxRed
	IF E2162, @attemptRandomMaxBlue
	IF E2163, @attemptRandomMaxViolet
	IF E2688, @attemptRandomMaxAll
	
	SET hackRandomMax, "1"
	GOTO @attemptRandomHack

@attemptRandomMaxYellow
	SET hackRandomMax, "3"
	GOTO @attemptRandomHack

@attemptRandomMaxRed
	SET hackRandomMax, "4"
	GOTO @attemptRandomHack
	
@attemptRandomMaxBlue
	SET hackRandomMax, "5"
	GOTO @attemptRandomHack

@attemptRandomViolet
	SET hackRandomMax, "6"
	GOTO @attemptRandomHack
	
@attemptRandomMaxAll
	SET hackRandomMax, "7"
	GOTO @attemptRandomHack	
	
@attemptRandomHack
	COMPARE #<attempts>, "1"
	IF< @lockedOut
	COMPARE #<temp>, #<hackRandomMax>
	IF> @hackRandomFailed
	
	MUL hackRandom, 2
	IF R#<hackRandom>, @hackSuccess
	
	SUB attempts, 1
	ADD temp, 1
	GOTO @attemptRandomHack

@hackRandomFailed
	CALL @hackAttemptFailed
	6: You have #<attempts> attempt(s) remaining.
	RETURN

@hackVirusScanner
	COMPARE #<virusScannerPose>, "11"
	IF< @alreadyDisabledVirusScanner

	IF E2160+R40, @disableVirusScanner 
	IF E2161+R50, @disableVirusScanner	
	IF E2162+R65, @disableVirusScanner
	IF E2163+R80, @disableVirusScanner
	IF E2688+R95, @disableVirusScanner
	GOTO @alertedViruScanner
	
@alertedViruScanner	
	CALL @hackAttemptFailed
	6: The virus scanner is alerted and locked you out!
	WAIT 2.0
	COMPARE #<scene>, "5000"
	IF < @S11
	COMPARE #<scene>, "6000"
	IF> @S11
	GOTO SCENE #<sceneReturn>

@alreadyDisabledVirusScanner
	COMPARE #<virusScannerPose>, "9"
	IF= @noVirusScannerPresent	
	6: The virus scanner is already disabled!
	RETURN

@noVirusScannerPresent
	6: There is no virus scanner present to hack.
	RETURN
	
@disableVirusScanner
	SET virusScannerPose, "10"
	SEL 12
	POSE #<virusScannerPose>
	SOUND voice\unit_disabled
	6: -----------------
	6: Unit disabled
	6: -----------------
	6: You have successfully disabled the virus scanner!
	RETURN

@hackUploadVirus
	IF -I975, @hasNoVirus
	COMPARE #<virusScannerPose>, "11"
	IF< @uploadingVirusSuccessful
	IF E2160+R40, @uploadingVirusSuccessful 
	IF E2161+R50, @uploadingVirusSuccessful	
	IF E2162+R65, @uploadingVirusSuccessful
	IF E2163+R80, @uploadingVirusSuccessful
	IF E2688+R95, @uploadingVirusSuccessful
	GOTO @alertedViruScanner

@uploadingVirusNotPossible
	6: It is not possible to upload a virus to this terminal.
	RETURN

@hasNoVirus
	6: You do not have a %I975 to upload.
	RETURN

@uploadingVirusSuccessful
	HOST_TAKE I975
	SOUND	voice\attacking
	6: Attacking
	WAIT 2.0
	6: Mission successful
	SOUND voice\mission_successful
	6: You uploaded a %I975. 
	6: ...
	WAIT 0.2
	6: ......
	WAIT 0.2
	6: .........
	CALL @hackResearchComplete
	6: You retrieved the word: #<passwordScene>
	RETURN		

@requestHelp
	CALL @requestAwaitingOrders
	MENU "How does this work?=@requestBasicHelp", "Terminal commands=@helpTerminalCommands", "Hack tool=@helpHackTool", "Why is text disappearing?=@helpDisappearingText", "Why is the text appearing very slow?=@helpSlowText", "Hints=@helpHints", "Cancel=@cancel"
	RETURN
	
@requestAwaitingOrders
	7: Awaiting orders.
	SOUND voice\awaiting_orders
	RETURN
	
@requestBasicHelp
	9: You can interact with three different elements on the screen by right clicking on them:
	9: 1. Use the blinking cursor to enter commands in the terminal.
	9: 2. Use the Help button to receive additional help.
	9: 3. Use to the hack tool to perform various hacks, the help explains more about how this works.
	9: You can interact with each element in order you want.
	9: If you don't know the password, then use the hack tool first to discover it.
	9: You can login once you have uncovered all login details.
	9: Once you're logged in, you can enter other commands to get things done on the terminal.
	9: For example, type 'dir' to see what files or folders are in a dictory.
	9: Or type 'run program_name.exe' to run a program and then 'exit' to close that program.
	9: You can open files with 'open <file_name>' and close them with 'close'.
	9: Other help commands explain more about this.
	9: You can use 'logout' to logout when you're done and to login as another user.
	9: Enter 'quit' to exit the terminal completely.
	RETURN

@helpTerminalCommands
	MENU "General help=@helpGeneral", "Open directory=@helpOpenDirectory", "Close directory@helpCloseDirectory", "View directory=@helpViewDirectory", "Open file=@helpOpenFile", "Close file=@helpCloseFile", "Run program=@helpRunProgram", "Exit program=@helpExitProgram", "Logging out=@helpLogOut", "Quit terminal=@helpQuitTerminal", "Help=@helpHelp" "Cancel=@cancel"
	RETURN
	
@helpGeneral
	9: -----------------
	9: GENERAL HELP
	9: -----------------	
	9: Right click on the blinking cursor to type commands into the terminal.
	9: The question chat balloon will pop up when you can enter text.
	9: Note that not all commands are always available.
	9: Maximize your screen if icons are overlapping.
	RETURN

@helpOpenDirectory	
	9: ---------------------
	9: OPEN DIRECTORY
	9: ---------------------
	9: To open a directory type 'cd <directory name>'
	9: For example: cd documents
	9: You can open any valid directory, even if it's a higher one.
	RETURN
	
@helpCloseDirectory
	9: ---------------------
	9: CLOSE DIRECTORY
	9: ---------------------
	9: To move to a higher directory type 'cd ./'
	9: Only this command works: cd ./
	9: You can only go up one directory at a time.
	RETURN	
	
@helpViewDirectory
	9: ---------------------
	9: VIEW DIRECTORY
	9: ---------------------
	9: Type 'dir' to view the contents of a directory.
	RETURN

@helpOpenFile
	9: -----------
	9: OPEN FILE
	9: -----------
	9: Type 'open <filename.extension>' to open a file.
	9: For example: open passwords.txt
	9: You don't have to be in the file's directory to open it.
	RETURN
	
@helpCloseFile
	9: -----------
	9: CLOSE FILE
	9: -----------
	9: Type 'close' to close a file.
	9: No other words are needed.
	RETURN
	
@helpRunProgram
	9: -------------
	9: RUN PROGRAM
	9: -------------
	9: Type 'run <program_name>.exe' to run a program.
	9: For example: run deactivate_cameras.exe
	RETURN	
	
@helpExitProgram
	9: --------------
	9: EXIT PROGRAM
	9: --------------	
	9: Type 'exit' to exit a program.
	9: No other words than exit is needed.
	RETURN
	
@helpLogOut
	9: ---------------
	9: LOGGING OUT
	9: ---------------
	9: Type 'logout' to log out as the current user.
	RETURN	
	
@helpQuitTerminal
	9: -----------------
	9: QUIT TERMINAL
	9: -----------------
	9: Type 'quit' to log out and exit the terminal.
	RETURN	
	
@helpHelp
	9: -------
	9: HELP
	9: -------
	9: Typing 'help' will activate the help menu.
	RETURN
	
	
@helpHackTool
	MENU "Activate/deactive hack tool=@helpActivateDeactivate", "How to hack=@helpHowToHack", "Brute force attack=@helpBruteForceAttack", "Mask brute force attack=@helpMaskBruteForceAttack", "Guess attack=@helpGuessAttack", "Self-learning algorithm=@helpRandomPasswordGuessing", "Attack virus scanner=@helpAttackVirusScanner", "Upload virus=@helpUploadVirus", "Previous menu=@requestHelp", "Cancel=@cancel"
	RETURN

@helpActivateDeactivate
	9: ----------------------------------------------
	9: ACTIVATING/ DEACTIVATING HACK TOOL
	9: ----------------------------------------------
	9: You need to activate the hack tool before you can use it.
	9: The hack tool visually changes when it's active.
	9: WARNING: if the terminal has antivirus software running, then this could trigger an alert.
	9: A system will indicate with an icon in the upper-right corner when antivirus protection is active.
	RETURN

@helpHowToHack
	9: -----------------
	9: HOW TO HACK
	9: -----------------
	9: Hacking is a multistep process.
	9: First determine if the virus scanner is active.
	9: If it is, then you may have to disable it, but this is not always necessary.
	9: If you have a user name or a (partial) password, then determine which hack would work best.
	9: Brute force works best on keypads, but is a bad idea for passwords.
	9: Sometimes, you can adjust the circuit board before attempting to hack.
	9: Look for such opportunities since it may make your job easier.
	RETURN

@helpBruteForceAttack
	9: ---------------------------
	9: BRUTE FORCE ATTACK
	9: ---------------------------
	9: Brute force attacks work best on numbers.
	9: This attack won't run if there are more than thousand combinations to crack.
	RETURN
	
@helpMaskBruteForceAttack
	9: -------------------------------
	9: MASK BRUTE FORCE ATTACK
	9: -------------------------------
	9: This option is more sophisticated than a brute force attack.
	9: You can enter the part of the password that you know.
	9: This program will then attempt to brute force with the known part.
	RETURN
	
@helpGuessAttack
	9: ------------------
	9: GUESS ATTACK
	9: ------------------
	9: This attack will indicate if your entered password is equal, smaller, or greater than the actual password.
	9: This option works particularly well with numbers, 
	9: but can also work with letters if you know part of the password and its length.
	9: Example 1: 1000 is greater than 200.
	9: Example 2: cat is smaller than dog because the 'c' comes before the 'd' in the alphabet.
	RETURN
	
@helpRandomPasswordGuessing
	9: -----------------------------------
	9: SELF-LEARNING ALGORITHM
	9: -----------------------------------
	9: With this option the system will try random passwords.
	9: The system is self-learning and will have a higher chance of success with each guess.
	9: The times the system can try this increases if you have a higher access level card equiped.
	RETURN

@helpAttackVirusScanner
	9: -----------------------------
	9: ATTACK VIRUS SCANNER
	9: -----------------------------
	9: This attack has a chance to disable the virusscanner.
	9: Your chance to disable increases if you have a higher level access card equiped.
	9: WARNING: you have a chance to trigger an alarm.
	COMPARE #<virusScannerPose>, 11
	IF= @helpAttackVirusScannerActive
	COMPARE #<virusScannerPose>, 10
	IF= @helpAttackVirusScannerInactive
	COMPARE #<virusScannerPose>, 9
	IF= @helpAttackVirusScannerUnavailable	
	RETURN 	

@helpAttackVirusScannerActive
	9: Current status virus scanner: ACTIVE
	RETURN

@helpAttackVirusScannerInactive
	9: Current status virus scanner: INACTIVE
	RETURN

@helpAttackVirusScannerUnavailable	
	9: Current status virus scanner: NOT PRESENT
	RETURN
	
@helpUploadVirus
	9: -------------------
	9: UPLOAD VIRUS
	9: -------------------
	9: This option will infect the system with a virus.
	9: The chance of success is determined by the level of your access card.
	9: Uploading a virus will always successful if the virus scanner is disabled.
	9: Uploading a virus can result in a system lock up or unpredicted behavior.
	9: You can only use this option when you have at least one %I975.
	9: You currently have #<num.item975> %I975(s).
	RETURN	
	
@helpDisappearingText
	9: ----------------------
	9: DISAPPEARING TEXT
	9: ----------------------
	9: Unfortunately, the WoS engine is very limited to what it can handle on the screen.
	9: As a trade of for cool functionality, old letters are reused to create new ones.
	9: That's why you see old text disappearing when new text appears.
	RETURN
	
@helpSlowText
	9: -----------------
	9: VERY SLOW TEXT
	9: -----------------
	9: Most likely you're not allowing WoS to use all cpu.
	9: Go to Books | Book of Options
	9: The third lowest option is 'Don't use 100% cpu on WoS'
	9: Make sure that this option is turned off.
	9: This should speed up the text considerably, however, please note that this feature takes a lot of calculating power.
	9: The WoS engine is quite old and it takes time to process all the scripts on the background.
	9: To compensate for this running programs and opening files in the terminal only happen in the chatbox and not on the screen.
	RETURN
	
@helpHints
	9: --------
	9: HINTS
	9: --------
	GOTO @helpHints#<scene>
	9: You will have to solve this circuit board yourself, there are no hints available.
	RETURN
	
@helpHints5014	
	9: Activate the hack tool to see various hack options.
	9: The various options can help you to retrieve the password.
	9: Keep in mind that you already received the user name and part of the password: gunsNroses1*
	9: You only have to figure out what is on the *.
	RETURN

@helpHints5004
	9: The pincode is a three digit number.
	9: You can check your Quest Log to find it back, or use the hack tool to retrieve it.
	RETURN
	
@helpHints5025
	N: Your best attempt to break this pincode is by either using a guess attack or self-learning algorithm.
	N: Alternatively, you can use a %I975.
	RETURN	

@helpHints5031
	9: The pincode is a three digit number.
	9: You can either try all 999 combinations manually, or use the hack tool to retrieve the pincode.
	9: A brute force attack or a guess attack work very well with numbers.
	9: With guessing you could try '500' as a start number.
	9: If your guess is higher than the pincode, then try '250' next.
	9: Likewise, if your guess is lower than try '750' next.
	9: Using this process of elimination you can retrieve the number with fewer attempts than through brute force.
	9: On this specific Keypad you can also use a brute force attack, but that may not always work in the future.
	RETURN 
	
@helpHints5060
	9: You can find the login details in the Commander's Quarters.
	9: Login as the commander, then use the command 'dir' to find which programs you can access.
	9: Run the program you find to create a new access card.
	9: You only need to enter the first letter of the access level card that you want to create.
	RETURN
	
@helpHints5061
	IF T848, @helpHints5061T848
	9: Visit Doc Adlington to receive a hint for the login name.
	GOTO @helpHints5061T848continued
	
@helpHints5061T848
	9: Doc Adlington gave you a hint for the login name, she uploaded this to your Quest Diary.

@helpHints5061T848continued
	9: You can use the hacktool to discover the password.
	9: You can also search the Clinic in the Abandoned Research Lab to find a hint for the password.
	9: Use the 'dir' command to find which programs you can run.
	9: Run the appropriate program to copy the %I2660 schematics onto the %I2168.
	IF -I2168, @helpHints5061T848ExternalDrive
	RETURN

@helpHints5061T848ExternalDrive
	9: You will have to search the Abandoned Research Lab to find an %I2168.
	9: Maybe you can fix a %I2167 in the workshop with %I980?
	RETURN
	
@helpHints5202
	9: You can probably brute force this password with the hack tool.
	RETURN
	
@helpHints5203
	9: You have a limited chances to enter a pincode before the vault pincode resets.
	IF T887|T888, @helpHints5203Actor
	9: You can use the hack tool to hack the pincode.
	RETURN
	
@helpHints5203Actor
	9: Maybe your partner will give you the correct password if you enter a random pincode?
	RETURN
	
@helpHints5204
	9: You should look around in the Clinic for a password.
	9: Doctor Melchior's login name is 'melchior'.
	RETURN
	
@helpHints5208
	9: You can find the login details for this terminal in the terminal from the Clinic to the north east.
	9: Run the program 'medical files' in that terminal and check the medical records from Zander Pearson.
	RETURN
	
@helpHints5234
	9: The login name belongs to the person who infiltrated this bunker.
	9: You should search for the password in that person's bedroom or view the security footage.
	9: You need to disable the security in order to disable the growth vats.
	9: Run the 'copy files' program to find the schematics to upgrade your %I2661.
	RETURN
	
@helpHints5265
	9: The login name for this terminal is 'anderson' and the password is 'doubletime'.
	9: You can enable the cameras by running the security program.
	RETURN
	
@helpHints5268
	9: The login name for this terminal is 'docwalker' the password starts with 'dumplinglove5**'.
	9: You need to crack the digits for ** with the hack tool.
	9: The best methods to do so are guess attacks, self-learning algorithm, or uploading a %I975.
	RETURN
	
@helpHints5270			
	9: Brute forcing this keypad will not work, you will have to use an alternative hacking method.
	RETURN

@helpHints5352
	9: The number is above 100 and below 1000. A good first guess would be 450, which is the average of 1000 - 100.
	9: After that you can further eliminate the numbers.
	RETURN			
			
@cancel	
	RETURN		
	
; Argument 0 is whether or not Y should be moved upon receiving a new line	
@writeText
	SET_LEN inputLength, "#<lastAsk>"
	COMPARE inputLength, "24"
	IF> @invalidInputTooManyCharacters

	COMPARE #<arg0>, 0
	IF> @setNewLine

@setText
	SET text, "#<terminalText>#<lastAsk>"
	SET startlen, 0
	SET_LEN len, "#<text>"
	
@setCharacter	
	COMPARE #<startlen>, #<len>
	IF= @blinkingCursor
	SET_SUBSTR char, #<startlen>, 1, "#<text>"
	CALL @setActorPose
	ADD startlen, 1
	GOTO @setCharacter

@endWriteText
	RETURN
	
@invalidInputTooManyCharacters
	7: ERROR: you have entered too many characters.
	GOTO @endWriteText
	
@setNewLine
	SET x, "5"
	ADD y, "2"
	COMPARE #<y>, 95
	IF< @setText
	SET y, "15"
	GOTO @setText

@setActorPose
	SET pose, 2	
	STRCMP #<char>, "*"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN
		
@actorPose2
	ADD pose, 1
	STRCMP #<char>, "/"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN
	
@actorPose3
	ADD pose, 1
	STRCMP #<char>, "\"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN
	
@actorPose4
	ADD pose, 1
	STRCMP #<char>, "."
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN
	
@actorPose5
	ADD pose, 1
	STRCMP #<char>, ":"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN
	
@actorPose6
	ADD pose, 1
	STRCMP #<char>, "a"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN
	
@actorPose7
	ADD pose, 1
	STRCMP #<char>, "b"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN
	
@actorPose8
	ADD pose, 1
	STRCMP #<char>, "c"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN
	
@actorPose9
	ADD pose, 1
	STRCMP #<char>, "d"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN
	
@actorPose10
	ADD pose, 1
	STRCMP #<char>, "e"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN
	
@actorPose11
	ADD pose, 1
	STRCMP #<char>, "f"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN

@actorPose12
	ADD pose, 1
	STRCMP #<char>, "g"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN

@actorPose13
	ADD pose, 1
	STRCMP #<char>, "h"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN

@actorPose14
	ADD pose, 1
	STRCMP #<char>, "i"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN

@actorPose15
	ADD pose, 1
	STRCMP #<char>, "j"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN

@actorPose16
	ADD pose, 1
	STRCMP #<char>, "k"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN

@actorPose17
	ADD pose, 1
	STRCMP #<char>, "l"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN

@actorPose18
	ADD pose, 1
	STRCMP #<char>, "m"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN

@actorPose19
	ADD pose, 1
	STRCMP #<char>, "n"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN

@actorPose20
	ADD pose, 1
	STRCMP #<char>, "o"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN
	
@actorPose21
	ADD pose, 1
	STRCMP #<char>, "p"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN

@actorPose22
	ADD pose, 1
	STRCMP #<char>, "q"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN

@actorPose23
	ADD pose, 1
	STRCMP #<char>, "r"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN

@actorPose24
	ADD pose, 1
	STRCMP #<char>, "s"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN

@actorPose25
	ADD pose, 1
	STRCMP #<char>, "t"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN

@actorPose26
	ADD pose, 1
	STRCMP #<char>, "u"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN

@actorPose27
	ADD pose, 1
	STRCMP #<char>, "v"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN

@actorPose28
	ADD pose, 1
	STRCMP #<char>, "w"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN

@actorPose29
	ADD pose, 1
	STRCMP #<char>, "x"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN

@actorPose30
	ADD pose, 1
	STRCMP #<char>, "y"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN

@actorPose31
	ADD pose, 1
	STRCMP #<char>, "z"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN

@actorPose32
	ADD pose, 1
	STRCMP #<char>, "0"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN

@actorPose33
	ADD pose, 1
	STRCMP #<char>, "1"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN

@actorPose34
	ADD pose, 1
	STRCMP #<char>, "2"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN

@actorPose35
	ADD pose, 1
	STRCMP #<char>, "3"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN

@actorPose36
	ADD pose, 1
	STRCMP #<char>, "4"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN

@actorPose37
	ADD pose, 1
	STRCMP #<char>, "5"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN

@actorPose38
	ADD pose, 1
	STRCMP #<char>, "6"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN

@actorPose39
	ADD pose, 1
	STRCMP #<char>, "7"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN

@actorPose40
	ADD pose, 1
	STRCMP #<char>, "8"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN
	
@actorPose41
	ADD pose, 1
	STRCMP #<char>, "9"
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN
	
; empty space	
@actorPose42
	ADD pose, 1
	STRCMP #<char>, " "
	IF!= @actorPose#<pose>	
	CALL @determinePose
	RETURN
	
@setActorPose43
	ADD pose, 1	
	STRCMP #<char>, "_"
	IF!= @actorPose#<pose>
	; The _ is a special symbol
	SET pose, 1
	CALL @determinePose
	RETURN
	
@actorPose44
	; By keeping this pose empty all invalid input is sanitized.
	RETURN
	
@determinePose
	ACTOR #<actorId>, "", abcall, #<pose>, #<x>, #<y>
	ADD x, "1"
	ADD actorId, 1
	COMPARE #<actorId>, 64
	IF< RETURN
	SET actorId, 16
	RETURN
		
@blinkingCursor
	MOVE 1, #<x>, #<y>, 1	
	RETURN

@accessDenied	
	SET lastAsk, ""
	SET terminalText, "attempt failed"
	CALL @writeText, 1
	SOUND voice\attempt_failed
	SUB attempts, 1
	COMPARE #<attempts>, 1
	IF< @lockedOut	
	SET terminalText, "remaining login attempts #<attempts>"
	CALL @writeText 1
	WAIT 1.0
	SET terminalText, "login as: "
	CALL 5101@writeText 1
	RETURN

@invalidAccessRequest	
	SET lastAsk, ""
	SET terminalText, "attempt failed"
	CALL @writeText, 1
	SOUND voice\attempt_failed
	WAIT 1.0
	SET terminalText, "login as: "
	CALL 5101@writeText 1
	RETURN	
	
@accessGranted
	SET loggedIn, 1
;	SET lastAsk, ""
;	SET terminalText, "access granted"
	7: access granted
	SOUND voice\access_granted
;	CALL @writeText 1
	RETURN	
	
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; SET UP SCENE FUSE REPAIRS	
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
	
	
SCENE 5102, bunkerenergycore2, CUT, "Power core switch board" , 0, 0, 0

; arg0 = number of broken fuses
@setUpBoard
	CALL 5099@setUpSwitch
	CALL 5099@setCircuitBoard
	
	BKGND #<bkgnd>
	
	SET temp, 0
	
	; pose 12 = good fuse, pose 13 = bad fuse, pose 14 = no fuse
@setUpFuses
	COMPARE #<temp>, "6"
	IF> @endSetUpFuses
	ADD temp, 1
	IF T1#<temp>, @setGoodFuse
	SET pose#<temp>, 13
	GOTO @setUpFuses
	
@setGoodFuse
	SET pose#<temp>, 12
	GOTO @setUpFuses
	
@endSetUpFuses	
	ACTOR 1, "Fuse 1", circuitbuttons, #<pose1>, 28, 40
	ACTOR 2, "Fuse 2", circuitbuttons, #<pose2>, 44, 40
	ACTOR 3, "Fuse 3", circuitbuttons, #<pose3>, 60, 40
	ACTOR 4, "Fuse 4", circuitbuttons, #<pose4>, 28, 73
	ACTOR 5, "Fuse 5", circuitbuttons, #<pose5>, 44, 73
	ACTOR 6, "Fuse 6", circuitbuttons, #<pose6>, 60, 73

@end
	RETURN

@getShock
	IF DEAD, @died
	SOUND tesla_shot
	WAIT 1.0
	N: You received a shock!
	SET temp, #<num.hostMaxHP>
	DIV temp, 2
	ADD temp, 1
	HOST_TAKE H#<temp>
	WAIT 1.0
	RETURN
	
@fuseClicked	
	COMPARE #<power>, "1"
	IF= @getShock
	SET actor, #<arg0>
	CALL @checkFuse
	RETURN

@checkFuse
	IF DEAD, @died
	IF T1#<actor>, @fuseOkay
	IF -I978, @hasNoGoodFuse
	N: You replace the broken fuse.
	WAIT 2.0
	SET fuseBroken, "0"
	SEL #<actor>
	POSE 14
	HOST_GIVE I979
	WAIT 3.0
	POSE 12
	HOST_TAKE I978
	HOST_GIVE T1#<actor>
	RETURN
	
@hasNoGoodFuse
	N: You want to replace the %I979 with a %I978, but you lack a %I978 to do so.
	N: Find or buy a %I978 first!
	RETURN

@died
	N: You cannot do anything while you are dead.
	END	
	
@callHelp
	N: Right click on a burned out fuse to replace it.
	N: Do not forget to turn the power back on once you replaced the broken fuses.
	RETURN		
	
@fuseOkay
	N: This fuse is already working correctly.
	RETURN

@changeThePower
	CALL 5099@changeThePower
	
	IF T11+T12+T13+T14+T15+T16, @finish	
	RETURN
	
@finish
	COMPARE #<power>, "0"
	IF= @end
	HOST_TAKE T11
	HOST_TAKE T12
	HOST_TAKE T13
	HOST_TAKE T14
	HOST_TAKE T15
	HOST_TAKE T16	
	GOTO @finish#<scene>
	RETURN
	
@finish5033	
	HOST_GIVE T843
	N: You have successfully replaced the burned out fuses and restored power to the base!
	WAIT 4.0
	GOTO SCENE #<scene>	
	
@finish5206
	HOST_GIVE T890
	N: You have successfully replaced the burned out fuses and restored power to the base!
	WAIT 4.0
	GOTO SCENE #<scene>		
	
	
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; 
SCENE 5110, check, CUT, "Circuit board", 0, 0

	SET scene,	#<scene.id>

	CALL 5100@setScene
	CALL 5100@setPins 3 1 2
	
	N: Circuit boards are optimized for full screen resolution (1920 x 1080).
	N: Use a higher resolution when icons overlap.
	N: Right click the HELP button for more instructions.
	N: --------------------------------------------------------------------------
	
	SET poseActor6, 7
	SEL 6
	POSE #<poseActor6>	
	
	SET poseActor5, 5
	SEL 5
	POSE #<poseActor5>
	
	SET poseActor3, 3	
	SEL 3
	POSE #<poseActor3>	
		
	; unencrypted data
	SET desiredState6, #<poseActor6>
	ADD desiredState6, "5"
	; high voltage
	SET desiredState5, #<poseActor5>
	ADD desiredState5, "29"
	; normal voltage
	SET desiredState4, #<poseActor4>
	; high voltage
	SET desiredState3, #<poseActor3>
	ADD desiredState3, "29"
	; unencrypted data
	SET desiredState2, #<poseActor2>
	ADD desiredState2, "6"		
	; normal voltage
	SET desiredState1, #<poseActor1>	
	END

@eventActorClick15
	CALL 5100@changeThePower
	
	COMPARE #<power>, "1"
	IF= @checkFinished
	END
	
@checkFinished
	COMPARE #<boardIsFixed>, "1"
	IF= @finished
	END

@finished
	WAIT 1.0
	N: You successfully repaired the circuit board!
	HOST_GIVE T814
	WAIT 3.0
	GOTO SCENE 5012

@eventActorClick14
	CALL 5100@helpRequested
	END
	
@eventActorClick13
	CALL 5100@analyzeBoard
	END

@eventActorClick1
	CALL 5100@interactionMenu	1
	END
	
@eventActorClick2
	CALL 5100@interactionMenu	2
	END

@eventActorClick3
	CALL 5100@interactionMenu	3
	END

@eventActorClick4
	CALL 5100@interactionMenu	4
	END

@eventActorClick5
	CALL 5100@interactionMenu	5
	END

@eventActorClick6
	CALL 5100@interactionMenu	6
	END

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; 
SCENE 5111, check, CUT, "Circuit board", 0, 0

	SET scene,	#<scene.id>

	CALL 5100@setScene
	CALL 5100@setPins 3 1 3 1
	
	SET poseActor8, 17
	SEL 8
	POSE #<poseActor8>	
	
	SET poseActor7, 3
	SEL 7
	POSE #<poseActor7>
	
	SET poseActor4, 8
	SEL 4
	POSE #<poseActor4>
	
	SET poseActor3, 30	
	SEL 3
	POSE #<poseActor3>	
	
	SET poseActor2, 24	
	SEL 2
	POSE #<poseActor2>	
	
	; low voltage on
	SET desiredState8, #<poseActor8>
	SUB desiredState8, "1"
	
	; normal voltage on
	SET desiredState7, #<poseActor7>
	SUB desiredState7, "1"
	
	; normal voltage on
	SET desiredState6, #<poseActor6>
	
	; high voltage on
	SET desiredState5, #<poseActor5>
	ADD desiredState5, 30
	
	; encrypted data on
	SET desiredState4, #<poseActor4>
	ADD desiredState4, 18
	
	; encrypted data on
	SET desiredState3, #<poseActor3>
	SUB desiredState3, "18"
	
	; security data off
	SET desiredState2, #<poseActor2>
	ADD desiredState2, "1"	
	
	; high voltage on
	SET desiredState1, #<poseActor1>	
	ADD desiredState1, 30
	END

@eventActorClick15
	CALL 5100@changeThePower
	
	COMPARE #<power>, "1"
	IF= @checkFinished
	END
	
@checkFinished
	COMPARE #<boardIsFixed>, "1"
	IF= @finished
	END

@finished
	WAIT 1.0
	N: You successfully repaired the circuit board!
	HOST_GIVE T844
	WAIT 3.0
	GOTO SCENE 5033

@eventActorClick14
	CALL 5100@helpRequested
	END
	
@eventActorClick13
	CALL 5100@analyzeBoard
	END

@eventActorClick1
	CALL 5100@interactionMenu	1
	END
	
@eventActorClick2
	CALL 5100@interactionMenu	2
	END

@eventActorClick3
	CALL 5100@interactionMenu	3
	END

@eventActorClick4
	CALL 5100@interactionMenu	4
	END

@eventActorClick5
	CALL 5100@interactionMenu	5
	END

@eventActorClick6
	CALL 5100@interactionMenu	6
	END		
	
@eventActorClick7
	CALL 5100@interactionMenu	7
	END		

@eventActorClick8
	CALL 5100@interactionMenu	8
	END			

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; Circuit board repair military research facility
SCENE 5112, check, CUT, "Circuit board", 0, 0

	SET scene,	#<scene.id>

	CALL 5100@setScene
	CALL 5100@setPins 2 2 2 2
	
	; low voltage on
	SET desiredState8, #<poseActor8>
	ADD desiredState8, 12
	
	; low voltage on
	SET desiredState7, #<poseActor7>
	ADD desiredState7, 12
	
	; unencrypted data
	SET desiredState6, #<poseActor6>
	ADD desiredState6, 6
	
	; encrypted data
	SET desiredState5, #<poseActor5>
	ADD desiredState5, 24
	
	; high voltage on
	SET desiredState4, #<poseActor4>
	ADD desiredState4, 30
	
	; high voltage off
	SET desiredState3, #<poseActor3>
	ADD desiredState3, 31
	
	; security data on
	SET desiredState2, #<poseActor2>
	ADD desiredState2, 18	
	
	; security data on
	SET desiredState1, #<poseActor1>	
	ADD desiredState1, 18
	END

@eventActorClick15
	CALL 5100@changeThePower
	
	COMPARE #<power>, "1"
	IF= @checkFinished
	END
	
@checkFinished
	COMPARE #<boardIsFixed>, "1"
	IF= @finished
	END

@finished
	WAIT 1.0
	N: You successfully repaired the circuit board!
	HOST_GIVE T892
	WAIT 3.0
	GOTO SCENE 5206

@eventActorClick14
	CALL 5100@helpRequested
	END
	
@eventActorClick13
	CALL 5100@analyzeBoard
	END

@eventActorClick1
	CALL 5100@interactionMenu	1
	END
	
@eventActorClick2
	CALL 5100@interactionMenu	2
	END

@eventActorClick3
	CALL 5100@interactionMenu	3
	END

@eventActorClick4
	CALL 5100@interactionMenu	4
	END

@eventActorClick5
	CALL 5100@interactionMenu	5
	END

@eventActorClick6
	CALL 5100@interactionMenu	6
	END		
	
@eventActorClick7
	CALL 5100@interactionMenu	7
	END		

@eventActorClick8
	CALL 5100@interactionMenu	8
	END			


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; Remodeling the circuit board in bunker 3
SCENE 5113, check, CUT, "Circuit board", 0, 0

	SET scene,	#<scene.id>

	CALL 5100@setScene
	CALL 5100@setPins 4 2 4 2
	
	; unencrypted data on
	SET poseActor11, 8
	SEL 11
	POSE #<poseActor11>

	; high voltage on
	SET poseActor10, 34
	SEL 10
	POSE #<poseActor10>

	; high voltage on
	SET poseActor7, 32
	SEL 7
	POSE #<poseActor7>
	
	; unencrypted data on
	SET poseActor4, 12
	SEL 4
	POSE #<poseActor4>

	
	; high voltage on
	SET desiredState12, #<poseActor12>
	ADD desiredState12, 30	
	
	; high voltage on
	SET desiredState11, #<poseActor11>
	ADD desiredState11, 24	
	
	; low voltage on
	SET desiredState10, #<poseActor10>
	SUB desiredState10, 18	
	
	; normal voltage
	SET desiredState9, #<poseActor9>
	ADD desiredState9, 0	
	
	; encrypted data on
	SET desiredState8, #<poseActor8>
	ADD desiredState8, 24
	
	; encrypted data on
	SET desiredState7, #<poseActor7>
	SUB desiredState7, 6
	
	; high voltage on
	SET desiredState6, #<poseActor6>
	ADD desiredState6, 30
	
	; high voltage on
	SET desiredState5, #<poseActor5>
	ADD desiredState5, 30
	
	; low voltage on
	SET desiredState4, #<poseActor4>
	ADD desiredState4, 6
	
	; normal voltage on
	SET desiredState3, #<poseActor3>
	ADD desiredState3, 0
	
	; security data on
	SET desiredState2, #<poseActor2>
	ADD desiredState2, 18	
	
	; security data on
	SET desiredState1, #<poseActor1>	
	ADD desiredState1, 18
	END

@eventActorClick15
	CALL 5100@changeThePower
	
	COMPARE #<power>, "1"
	IF= @checkFinished
	END
	
@checkFinished
	COMPARE #<boardIsFixed>, "1"
	IF= @finished
	END

@finished
	WAIT 1.0
	N: You successfully upgraded the circuit board!
	HOST_GIVE T919
	HOST_TAKE I2176
	WAIT 3.0
	GOTO SCENE 5006

@eventActorClick14
	CALL 5100@helpRequested
	END
	
@eventActorClick13
	CALL 5100@analyzeBoard
	END

@eventActorClick1
	CALL 5100@interactionMenu	1
	END
	
@eventActorClick2
	CALL 5100@interactionMenu	2
	END

@eventActorClick3
	CALL 5100@interactionMenu	3
	END

@eventActorClick4
	CALL 5100@interactionMenu	4
	END

@eventActorClick5
	CALL 5100@interactionMenu	5
	END

@eventActorClick6
	CALL 5100@interactionMenu	6
	END		
	
@eventActorClick7
	CALL 5100@interactionMenu	7
	END		

@eventActorClick8
	CALL 5100@interactionMenu	8
	END	
	
@eventActorClick9
	CALL 5100@interactionMenu	9
	END	

@eventActorClick10
	CALL 5100@interactionMenu	10
	END	

@eventActorClick11
	CALL 5100@interactionMenu	11
	END	

@eventActorClick12
	CALL 5100@interactionMenu	12
	END	
	
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; Circuit board repair bunker 9
SCENE 5114, check, CUT, "Circuit board", 0, 0

	SET scene,	#<scene.id>

	CALL 5100@setScene
	CALL 5100@setPins 4 2 4 2
	
	; high voltage on
	SET desiredState12, #<poseActor12>
	ADD desiredState12, 30

	; security data
	SET desiredState11, #<poseActor11>
	ADD desiredState11, 18

	; normal voltage on
	SET desiredState10, #<poseActor10>

	; low voltage on
	SET desiredState9, #<poseActor9>
	ADD desiredState9, 12	
	
	; high voltage on
	SET desiredState8, #<poseActor8>
	ADD desiredState8, 30
	
	; unencrypted data on
	SET desiredState7, #<poseActor7>
	ADD desiredState7, 6
	
	; low voltage on
	SET desiredState6, #<poseActor6>
	ADD desiredState6, 12
	
	; security data on
	SET desiredState5, #<poseActor5>
	ADD desiredState5, 18
	
	; high voltage on
	SET desiredState4, #<poseActor4>
	ADD desiredState4, 30
	
	; encrypted data on
	SET desiredState3, #<poseActor3>
	ADD desiredState3, 24
	
	; normal voltage on
	SET desiredState2, #<poseActor2>

	; low voltage on
	SET desiredState1, #<poseActor1>	
	ADD desiredState1, 12
	END

@eventActorClick15
	CALL 5100@changeThePower
	
	COMPARE #<power>, "1"
	IF= @checkFinished
	END
	
@checkFinished
	COMPARE #<boardIsFixed>, "1"
	IF= @finished
	END

@finished
	WAIT 1.0
	SET bunker9a, %R4
	SET bunker9d, 10
	SUB bunker9d, #<bunker9a>	

@loop2		
	SET bunker9b, %R4
	COMPARE #<bunker9a>, #<bunker9b>
	IF= @loop2	
	SUB bunker9d, #<bunker9b>

@loop3
	SET bunker9c, %R4
	COMPARE #<bunker9a>, #<bunker9c>
	IF= @loop3
	COMPARE #<bunker9b>, #<bunker9c>
	IF= @loop3
	SUB bunker9d, #<bunker9c>
	
	ADD bunker9a, 3
	ADD bunker9b, 3
	ADD bunker9c, 3
	ADD bunker9d, 3
	
	N: You successfully reconfigured the circuit board!
	HOST_GIVE T977	
	WAIT 3.0
	GOTO SCENE 5262
	
@eventActorClick14
	CALL 5100@helpRequested
	END
	
@eventActorClick13
	CALL 5100@analyzeBoard
	END

@eventActorClick1
	CALL 5100@interactionMenu	1
	END
	
@eventActorClick2
	CALL 5100@interactionMenu	2
	END

@eventActorClick3
	CALL 5100@interactionMenu	3
	END

@eventActorClick4
	CALL 5100@interactionMenu	4
	END

@eventActorClick5
	CALL 5100@interactionMenu	5
	END

@eventActorClick6
	CALL 5100@interactionMenu	6
	END		
	
@eventActorClick7
	CALL 5100@interactionMenu	7
	END		

@eventActorClick8
	CALL 5100@interactionMenu	8
	END			
	
@eventActorClick9
	CALL 5100@interactionMenu	9
	END			

@eventActorClick10
	CALL 5100@interactionMenu	10
	END			

@eventActorClick11
	CALL 5100@interactionMenu	11
	END			

@eventActorClick12
	CALL 5100@interactionMenu	12
	END			
	

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; Gunslinger CPR units
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  

SCENE 5198, , CUT
	END

@gunslingerCPRAndAfterFightQuotes
	IF -T118, @end
	CALL 5199@afterfightgunslingerstart
	GOTO @checkCPR

@gunslingerCPRAndDirectDrinkQuotes
	IF -T118, @end
	CALL 5199@gunslingerCPRAndDirectDrinkQuotes
	GOTO @checkCPR
	
@checkCPR
	IF -T118, @end
	COMPARE	#<num.hostEquipId11>, "2660"
	IF= @autoCPR
	COMPARE	#<num.hostEquipId11>, "2661"
	IF= @autoCPR2
	COMPARE	#<num.hostEquipId11>, "2662"
	IF= @autoCPR3
	COMPARE	#<num.hostEquipId11>, "2663"
	IF= @autoCPR4
	COMPARE	#<num.hostEquipId11>, "2664"
	IF= @autoCPR5
	RETURN

@autoCPR	
	IF R50+DEAD, @resurrect
	RETURN

@autoCPR2
	IF DEAD, @resurrect2
	RETURN

@autoCPR3
	IF DEAD, @resurrect2
	SET tempHP, #<num.hostMaxHP>
	DIV tempHP, "10"
	ADD tempHP, "1"
	SET tempMP, #<num.hostMaxMP>
	DIV tempMP, "10"
	ADD tempMP, "1"
	HOST_GIVE H#<tempHP>
	HOST_GIVE M#<tempMP>
	RETURN

@autoCPR4
	IF DEAD, @resurrect3
	SET tempHP, #<num.hostMaxHP>
	DIV tempHP, "4"
	ADD tempHP, "1"
	SET tempMP, #<num.hostMaxMP>
	DIV tempMP, "4"
	ADD tempMP, "1"
	HOST_GIVE H#<tempHP>
	HOST_GIVE M#<tempMP>
	RETURN

@autoCPR5
	IF DEAD, @resurrect3
	SET tempHP, #<num.hostMaxHP>
	DIV tempHP, "2"
	ADD tempHP, "1"
	SET tempMP, #<num.hostMaxMP>
	DIV tempMP, "2"
	ADD tempMP, "1"
	HOST_GIVE H#<tempHP>
	HOST_GIVE M#<tempMP>
	RETURN

@resurrect
	SOUND tesla_charge
	WAIT 2.0
	SOUND tesla_shot
	HOST_GIVE L1
	RETURN

@resurrect2
	SET tempHP, #<num.hostMaxHP>
	DIV tempHP, "5"
	ADD tempHP, "1"
	SET tempMP, #<num.hostMaxMP>
	DIV tempMP, "5"
	ADD tempMP, "1"
	SOUND tesla_charge
	WAIT 2.0
	SOUND tesla_shot	
	HOST_GIVE L#<tempHP>
	HOST_GIVE M#<tempMP>
	RETURN

@resurrect3
	SOUND tesla_charge
	WAIT 2.0
	SOUND tesla_shot
	HOST_GIVE L#<num.hostMaxHP>
	HOST_GIVE M#<num.hostMaxMP>
	RETURN
	
@end
	RETURN


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; Gunslinger quotes before and after the fight
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  

SCENE 5199,,CUT
	END
; unique gunslinger quotes before a fight started
@beforefightgunslingerstart
	IF -T118, @end
	IF R5, @continueBeforeGunslingerFight
	RETURN

@continueBeforeGunslingerFight	
	SET temp, 	%R65
	GOTO @beforefightgunslinger#<temp>
	RETURN
	
@beforefightgunslinger1
	H: Hail to the #<g.king>, baby!
	RETURN

@beforefightgunslinger2
	H: Gonna rip 'em a new one.
	RETURN
	
@beforefightgunslinger3	
	MUSIC born-to-be-wild
	H: Boooorn tooo beee wiiiiiiild...
	RETURN
	
@beforefightgunslinger4	
	H: Come get some!
	RETURN
	
@beforefightgunslinger5	
	H: Come on!
	RETURN
	
@beforefightgunslinger6	
	H: Cool!
	RETURN
	
@beforefightgunslinger7	
	H: Curiouser and curiouser...
	RETURN
	
@beforefightgunslinger8	
	H: Damn!
	RETURN
	
@beforefightgunslinger9	
	H: Damn it.
	RETURN
	
@beforefightgunslinger10	
	H: Damn, those bastards are gonna pay.
	RETURN
	
@beforefightgunslinger11	
	H: Damn, you're ugly.
	RETURN
	
@beforefightgunslinger12	
	H: I won't be wronged. I won't be insulted. I won't be laid a-hand on.
	RETURN
	
@beforefightgunslinger13	
	H: Die, you son of a bitch!
	RETURN
	
@beforefightgunslinger14	
	H: Eat shit and die.
	RETURN
	
@beforefightgunslinger15	
	H: Get that crap outta here.
	RETURN
	
@beforefightgunslinger16	
	H: Hassan chop! 
	RETURN
	
@beforefightgunslinger17	
	H: Harr matey, someone's gonna take a long walk off a short gang plank!
	RETURN
	
@beforefightgunslinger18	
	H: Guess again, freak show. I'm coming back to town, and the last thing that's gonna go through your mind before you die... is my size-13 boot!
	RETURN
	
@beforefightgunslinger19	
	H: It's playtime!
	RETURN
	
@beforefightgunslinger20	
	H: Hmm, I'm going in!
	RETURN
	
@beforefightgunslinger21	
	H: Hmm, that's one doomed bastard.
	RETURN
	
@beforefightgunslinger22	
	H: I ain't afraid of no quake! 
	RETURN
	
@beforefightgunslinger23	
	H: I'll rip your head off and shit down your neck. 
	RETURN
	
@beforefightgunslinger24	
	H: I'm %1, and I'm coming to get the rest of you bastards! 
	RETURN
	
@beforefightgunslinger25	
	H: I'm gonna get medieval on your ass!
	RETURN
	
@beforefightgunslinger26	
	H: I'm gonna kick your ass, bitch!
	RETURN
	
@beforefightgunslinger27	
	H: I'm gonna roast your nuts over an open fire, you dirty bitch.
	RETURN
	
@beforefightgunslinger28	
	H: It's down to you and me, you soon to be one-eyed freak! 
	RETURN
	
@beforefightgunslinger29	
	H: It's time to abort your whole freaking species! 
	RETURN
	
@beforefightgunslinger30	
	H: It's time to kick ass and chew bubble gum... and I'm all outta gum. 
	RETURN
	
@beforefightgunslinger31	
	H: Let's rock!
	RETURN
	
@beforefightgunslinger32	
	H: Looks like it's time for me to go postal!
	RETURN
	
@beforefightgunslinger33	
	H: Lucky son of a bitch.
	RETURN
	
@beforefightgunslinger34	
	H: No way I'm eating this shit!
	RETURN
	
@beforefightgunslinger35	
	H: Nobody jacks with our independence!
	RETURN
	
@beforefightgunslinger36	
	H: Oh...your ass is grass and I've got the weed-whacker.
	RETURN
	
@beforefightgunslinger37	
	H: Ready for action.
	RETURN
	
@beforefightgunslinger38	
	H: Shake it, baby!
	RETURN
	
@beforefightgunslinger39	
	H: This really pisses me off!
	RETURN	
	
@beforefightgunslinger40	
	H: What are you waitin' for? Christmas?
	RETURN
	
@beforefightgunslinger41	
	H: What are you? Some bottom-feeding, scum-sucking algae eater?
	RETURN
	
@beforefightgunslinger42	
	H: What we do in life, echoes in eternity. Here's your eternity, you bitch! 
	RETURN
	
@beforefightgunslinger43	
	H: Who wants some?
	RETURN
	
@beforefightgunslinger44	
	H: You wanna dance?
	RETURN
	
@beforefightgunslinger45	
	H: You're pissing me off!
	RETURN
	
@beforefightgunslinger46	
	H: My boot, your face; the perfect couple.
	RETURN
	
@beforefightgunslinger47	
	H: You're the disease, and I'm the cure.
	RETURN
	
@beforefightgunslinger48	
	H: I'm an equal opportunity ass kicker.
	RETURN
	
@beforefightgunslinger49	
	H: Little pig, little pig let me in. Or I'll huff and I'll puff and I'll kick your ass in!
	RETURN
	
@beforefightgunslinger50	
	H: I've got balls of steel.
	RETURN
	
@beforefightgunslinger51	
	H: Well son, since you haven't learned to respect your elders, it's time you learned to respect your betters!
	RETURN
	
@beforefightgunslinger52
	H: A big mouth doesn't make a big man.
	RETURN
	
@beforefightgunslinger53
	H: If it bleeds, I can kill it.
	RETURN
	
@beforefightgunslinger54	
	H: I eat punks for breakfast. And right now, I'm very hungry!
	RETURN
	
@beforefightgunslinger55
	H: You've got to ask yourself one question: 'Do I feel lucky?' Well, do ya, punk?
	RETURN
	
@beforefightgunslinger56	
	H: Go ahead, make my day.
	RETURN
	
@beforefightgunslinger57	
	H: Say 'hello' to my little friend!
	RETURN
	
@beforefightgunslinger58	
	H: You talking to me?
	RETURN
	
@beforefightgunslinger59	
	H: Here's %1!
	RETURN
	
@beforefightgunslinger60	
	H: Show me the money!
	RETURN
	
@beforefightgunslinger61	
	H: Hello, gorgeous.
	RETURN
	
@beforefightgunslinger62
	H: Who's first?
	RETURN
	
@beforefightgunslinger63	
	H: I'm gonna get you!
	RETURN

@beforefightgunslinger64
	H: I'll blow you up, because I like blowing stuff up!
	RETURN
	
@beforefightgunslinger65
	H: Don't confuse my personality with my attitude. My personality is who I am. My attitude depends on who you are.
	RETURN	

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
@afterfightgunslingerstart
	IF -T118, @end
	IF R5, @continueAfterGunslingerFight 
	RETURN

@continueAfterGunslingerFight
	IF DEAD, @afterfightgunslingerdead

	SET temp, 	%R55
	GOTO @afterfightgunslinger#<temp>
	RETURN
	
@afterfightgunslingerdead
	IF R75, RETURN
	H: Ugh, this sucks. 
	RETURN	
	
@afterfightgunslinger1
	H: After a few days of R&R... I'll be ready for more action!
	RETURN
	
@afterfightgunslinger2	
	H: Are you crazy? Is that your problem? 
	RETURN
	
@afterfightgunslinger3	
	H: Bitchin'!
	RETURN
	
@afterfightgunslinger4	
	H: Blow it out your ass!
	RETURN
	
@afterfightgunslinger5	
	H: Damn...
	RETURN
	
@afterfightgunslinger6	
	IF DEAD, @afterfightgunslingerdead
	H: Damn, I'm good! 
	RETURN
	
@afterfightgunslinger7	
	H: Damn, that was annoying!
	RETURN
	
@afterfightgunslinger8	
	H: Do, or do not. There is no try.
	RETURN
	
@afterfightgunslinger9	
	H: Game over!
	RETURN
	
@afterfightgunslinger10	
	H: Heh, heh, heh... What a mess! 
	RETURN
	
@afterfightgunslinger11	
	H: Hmm, my kind of party! I wish I had time!
	RETURN
	
@afterfightgunslinger12	
	H: Holy cow!
	RETURN
	
@afterfightgunslinger13	
	H: Holy shit!
	RETURN
	
@afterfightgunslinger14	
	H: I like a good cigar...and a bad woman...
	RETURN
	
@afterfightgunslinger15	
	H: I should have known those maggots booby-trapped this dumphole.
	RETURN
	
@afterfightgunslinger16	
	H: I wish I knew how to quit you.
	RETURN
	
@afterfightgunslinger17	
	H: I'll be back.
	RETURN
	
@afterfightgunslinger18	
	H: I'm getting too old for this shit.
	RETURN
	
@afterfightgunslinger19	
	H: I'm not crying over this! 
	RETURN
	
@afterfightgunslinger20	
	H: Let Devil sort 'em out!
	RETURN
	
@afterfightgunslinger21	
	H: Looks like cleanup on Aisle Four.
	RETURN
	
@afterfightgunslinger22	
	IF DEAD, @afterfightgunslingerdead
	H: Mess with the best, you will die like the rest.
	RETURN
	
@afterfightgunslinger23	
	H: Mm. Smells like someone cut the fromage. 
	RETURN
	
@afterfightgunslinger24	
	H: Nobody messes with my meat!
	RETURN
	
@afterfightgunslinger25	
	H: Nobody steals our chicks... and lives!
	RETURN
	
@afterfightgunslinger26	
	H: Ooh, I needed that!
	RETURN
	
@afterfightgunslinger27	
	H: Ooh, that's gotta hurt.
	RETURN
	
@afterfightgunslinger28	
	H: See you in Hell!
	RETURN
	
@afterfightgunslinger29	
	H: So help me Silver.
	HOST_GIVE L#<num.hostMaxHP>
	RETURN
	
@afterfightgunslinger30	
	H: Somebody's gonna freaking pay for screwing up my vacation! 
	RETURN
	
@afterfightgunslinger31		
	H: Shit happens.
	RETURN
	
@afterfightgunslinger32	
	H: Sometimes I even amaze myself. 
	RETURN
	
@afterfightgunslinger33	
	IF DEAD, @afterfightgunslingerdead
	H: Ah, ah, ah, staying alive, staying alive.
	RETURN
	
@afterfightgunslinger34	
	H: Suck it down!
	RETURN
	
@afterfightgunslinger35	
	H: Terminated!
	RETURN
	
@afterfightgunslinger36	
	H: That's gonna leave a mark!
	RETURN
	
@afterfightgunslinger37	
	H: The fifth element is always %1!
	RETURN
	
@afterfightgunslinger38	
	H: They don't make 'em better than me!
	RETURN
	
@afterfightgunslinger39	
	IF DEAD, @afterfightgunslingerdead
	H: Hasta la vista, baby!
	RETURN
	
@afterfightgunslinger40
	IF DEAD, @afterfightgunslingerdead
	H: Woo-hoo!
	RETURN
	
@afterfightgunslinger41	
	IF DEAD, @afterfightgunslingerdead
	H: Yeah, piece of cake!
	RETURN
	
@afterfightgunslinger42	
	IF DEAD, @afterfightgunslingerdead	
	H: Yippee-ki-yay, motherfucker! 
	RETURN
	
@afterfightgunslinger43	
	H: Yo-ho-ho and a bottle of jack!
	RETURN
	
@afterfightgunslinger44	
	H: You guys suck!
	RETURN
	
@afterfightgunslinger45	
	H: You're an inspiration for birth control.
	RETURN
	
@afterfightgunslinger46	
	H: Your face, your ass. What's the difference?
	RETURN
	
@afterfightgunslinger47	
	H: "No way. Not possible," they said. But it's true, I killed them anyway. 
	RETURN
	
@afterfightgunslinger48
	IF DEAD, @afterfightgunslingerdead
	H: A man deserves a second chance, too bad you weren't man enough.
	RETURN
	
@afterfightgunslinger49	
	H: Consider that a divorce!
	RETURN
	
@afterfightgunslinger50	
	IF DEAD, @afterfightgunslingerdead
	H: Here's your Sub-Zero... now plain zero.
	RETURN
	
@afterfightgunslinger51	
	H: What we've got here is a failure to communicate.
	RETURN
	
@afterfightgunslinger52	
	H: I love the smell of gunsmoke in the morning.
	RETURN
	
@afterfightgunslinger53	
	H: I see dead people.
	RETURN
	
@afterfightgunslinger54	
	H: Well, nobody's perfect.
	RETURN
	
@afterfightgunslinger55	
	H: I'm the #<g.king> of the world!
	RETURN 
	
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
@gunslingerDrink
	IF -T118, @end
	IF R25, @continueGunslingerDrink
	RETURN	
	
@continueGunslingerDrink
	COMPARE #<item.id>, "976"
	IF= @gunslingerDrinkGoodStuff
	COMPARE #<item.id>, "977"
	IF= @gunslingerDrinkGoodStuff
	RETURN
	
	IF DEAD, @end

@gunslingerDrinkGoodStuff
	SET temp, 	%R80
	GOTO @continueGunslingerDrink#<temp>
	RETURN	
	
@continueGunslingerDrink1
	H: One whiskey, two whiskey, three whiskey, floor.
	RETURN

@continueGunslingerDrink2
	H: I drink to make other people more interesting.
	RETURN

@continueGunslingerDrink3
	H: Candy is dandy, but liquor is quicker.
	RETURN

@continueGunslingerDrink4
	H: After the first glass, you see things as you wish they were. After the second, you see things as they are not. Finally, you see things as they really are, and that is the most horrible thing in the world.
	RETURN

@continueGunslingerDrink5
	H: I love scotch. Scotchy, scotch, scotch. Here it goes down, down into my belly.
	RETURN

@continueGunslingerDrink6
	H: A #<g.man>'s true character comes out when #<g.he>'s drunk.
	RETURN

@continueGunslingerDrink7
	H: Whiskey, if drunk in moderation, softens the temper, cheers the spirit and promotes health.
	RETURN

@continueGunslingerDrink8
	H: The more I drink, the less there is for the kids to drink.
	RETURN

@continueGunslingerDrink9
	H: There comes a time in every #<g.man>'s life when the only thing that helps is a glass of whiskey.
	RETURN

@continueGunslingerDrink10
	H: Whiskey is sunlight, held together by water.
	RETURN

@continueGunslingerDrink11
	H: Always do sober what you said you'd do drunk. That will teach you to keep your mouth shut.
	RETURN

@continueGunslingerDrink12
	H: In a study, scientists report that drinking beer can be good for the liver. I'm sorry, did I say ‘scientists'? I meant Rebels.
	RETURN

@continueGunslingerDrink13
	H: They say as soon as you have to cut down on your drinking, you have a drinking problem.
	RETURN

@continueGunslingerDrink14
	H: Independence is a heady draught, and if you drink it in your youth, it can have the same effect on the brain as young whiskey does. It does not matter that its taste is not always appealing. It is addictive and with each drink you want more.
	RETURN

@continueGunslingerDrink15
	H: I may be drunk, Miss, but in the morning I will be sober and you will still be ugly.
	RETURN

@continueGunslingerDrink16
	H: I feel sorry for people who don't drink. When they wake up in the morning, that's as good as they're going to feel all day.
	RETURN

@continueGunslingerDrink17
	H: I don't have a drinking problem, 'cept when I can't get a drink.
	RETURN

@continueGunslingerDrink18
	H: Whiskey, it's the best damn drink in the world.
	RETURN

@continueGunslingerDrink19
	H: Too much of anything is bad, but too much good whiskey is barely enough.
	RETURN

@continueGunslingerDrink20
	H: I pray you, do not fall in love with me, for I am falser than vows made in whiskey.
	RETURN

@continueGunslingerDrink21
	H: I work until whiskey o'clock.
	RETURN

@continueGunslingerDrink22
	H: Happiness is having a rare steak, a bottle of whisky and a dog to eat the rare steak.
	RETURN

@continueGunslingerDrink23
	H: Here's to alcohol, the rose-colored glasses of life.
	RETURN

@continueGunslingerDrink24
	H: That's what I do. I drink and I know things.
	RETURN

@continueGunslingerDrink25
	H: They say the only people who tell the truth are drunkards and children. Guess which one I am.
	RETURN

@continueGunslingerDrink26
	H: Writer's block is a fancy term made up by whiners so they can have an excuse to drink alcohol.
	RETURN

@continueGunslingerDrink27
	H: There's a special rung in hell reserved for people who waste good whiskey.
	RETURN

@continueGunslingerDrink28
	H: Whiskey is kind of a hobby.
	RETURN

@continueGunslingerDrink29
	H: Milk is for babies. When you grow up you have to drink whiskey.
	RETURN

@continueGunslingerDrink30
	H: Don't be such a square. Everybody who's anybody drinks.
	RETURN

@continueGunslingerDrink31
	H: Whiskey is proof that Atsumori loves us and wants us to be happy.
	RETURN

@continueGunslingerDrink32
	H: Wasted away again in Whiskeyville.
	RETURN

@continueGunslingerDrink33
	H: Never lie, steal, cheat or drink. But if you must lie, lie in the arms of the one you love. If you must steal, steal away from bad company. If you must cheat, cheat death. And if you must drink, drink in the moments that take your breath away.
	RETURN

@continueGunslingerDrink34
	H: Alcohol may be a #<g.man>'s worst enemy, but the word of Atsumori says love your enemy.
	RETURN

@continueGunslingerDrink35
	H: There are two kinds of people I don't trust: people who don't drink and people who love Nightmares.
	RETURN

@continueGunslingerDrink36
	H: Why is the whiskey gone?
	RETURN

@continueGunslingerDrink37
	H: The worst thing about some #<g.men> is that when they are not drunk they are sober.
	RETURN

@continueGunslingerDrink38
	H: We were not a hugging people. In terms of emotional comfort, it was our belief that no amount of physical contact could match the healing powers of a well-made cocktail.
	RETURN

@continueGunslingerDrink39
	H: Clear alcohols are for rich #<g.men> on diets.
	RETURN

@continueGunslingerDrink40
	H: My justification is that most people my age spend a lot of time thinking about what they're going to do for the next five or ten years. The time they spend thinking about their life, I just spend time drinking.
	RETURN

@continueGunslingerDrink41
	H: You say potato, I say whiskey.
	RETURN

@continueGunslingerDrink42
	H: What good can drinkin' do, what good can drinkin' do? #<g.clord>, I drink all night but the next day I still feel blue.
	RETURN

@continueGunslingerDrink43
	H: Whiskey makes daily living easier, less hurried, with fewer tensions and more tolerance.
	RETURN

@continueGunslingerDrink44
	H: Shaken, not stirred.
	RETURN

@continueGunslingerDrink45
	H: A #<g.man> may acquire a taste for whiskey or brandy, and so lose #<g.his> love for water, but should we not pity #<g.him>.
	RETURN

@continueGunslingerDrink46
	H: A #<g.man> is a fool if #<g.he> drinks before #<g.he> reaches the age of fifty and a fool if #<g.he> doesn't afterward.
	RETURN

@continueGunslingerDrink47
	H: Whiskey is the most healthful and most hygienic of beverages.
	RETURN

@continueGunslingerDrink48
	H: It is the whiskey that leads me on, the wild wine that sets the wisest #<g.man> to sing at the top of #<g.his> lungs, laugh like a fool-it drives the #<g.man> to dancing... it even tempts #<g.him> to blurt out stories better never told.
	RETURN

@continueGunslingerDrink49
	H: My own experience has been that the tools I need for my trade are paper, tobacco, food and a little whiskey.
	RETURN

@continueGunslingerDrink50
	H: Here's to alcohol, the cause of, and solution to, all life's problems.
	RETURN

@continueGunslingerDrink51
	H: To me 'drink responsibly' means don't spill it!
	RETURN

@continueGunslingerDrink52
	H: Whisky is liquid sunshine.
	RETURN

@continueGunslingerDrink53
	H: My relationship to whiskey is on the rocks.
	RETURN

@continueGunslingerDrink54
	H: me flies when you are having a cocktail.
	RETURN

@continueGunslingerDrink55
	H: I'm in need of liquid therapy.
	RETURN

@continueGunslingerDrink56
	H: I always make time for whiskey.
	RETURN

@continueGunslingerDrink57
	H: If you don't drink, how will your friends know that you love them at two am?
	RETURN

@continueGunslingerDrink58
	H: Keep calm and grab a whiskey.
	RETURN

@continueGunslingerDrink59
	H: Life and whiskey are very similar, chill for best results.
	RETURN

@continueGunslingerDrink60
	H: I'm one drink away from telling everyone what I REALLY think.
	RETURN

@continueGunslingerDrink61
	H: Whiskey is always a good idea.
	RETURN

@continueGunslingerDrink62
	H: It's not drinking alone if your slave is home.
	RETURN

@continueGunslingerDrink63
	H: 99% of all problems can be solved by money - and for the other 1%% there's alcohol. 
	RETURN

@continueGunslingerDrink64
	H: #<g.cmen> are like wine- some turn to vinegar, but the best improve with age.
	RETURN

@continueGunslingerDrink65
	H: Everybody's got to believe in something. I believe I'll have another whiskey. 
	RETURN

@continueGunslingerDrink66
	H: All is fair in love and whiskey.
	RETURN

@continueGunslingerDrink67
	H: Hear no evil, speak no evil, and you won't be invited to cocktail parties.
	RETURN

@continueGunslingerDrink68
	H: Here's to alcohol, the rose colored glasses of life.
	RETURN

@continueGunslingerDrink69
	H: I went out with a #<g.guy> who once told me I didn't need to drink to make myself more fun to be around. I told #<g.him>, I'm drinking so that you're more fun to be around.
	RETURN

@continueGunslingerDrink70
	H: I drink too much. The last time I gave a urine sample it had an olive in it.
	RETURN
	
@continueGunslingerDrink71
	H: A drunk #<g.man>'s words are a sober #<g.man>'s thoughts.
	RETURN

@continueGunslingerDrink72
	H: I cook with whiskey, sometimes I even add it to the food.
	RETURN
	
@continueGunslingerDrink73
	H: Whiskey is cheaper than therapy.
	RETURN
	
@continueGunslingerDrink74
	H: Never chase anything but drinks and dreams.
	RETURN
	
@continueGunslingerDrink75
	H: Move over, coffee. Today is a day for cocktails.
	RETURN

@continueGunslingerDrink76
	H: It's whiskey o'clock somewhere.
	RETURN
	
@continueGunslingerDrink77
	H: Sip, sip, hooray!
	RETURN
	
@continueGunslingerDrink78
	H: Save water, drink cocktails.
	RETURN
	
@continueGunslingerDrink79
	H: A drink a day keeps reality at bay.
	RETURN
	
@continueGunslingerDrink80
	H: Sip happens.
	RETURN	

@end
	RETURN
	

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; TIER 3 - MILITARY RESEARCH FACILITY (level 40 - 50) (5200 - xxxx)
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
;

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; 
SCENE 5200, bunkerhidden,	SCENE,	"Bunker entrance", 	0, 0, 0

	IF -T118, @end
	EJECT T118

	ACTOR 1, "Keypad", stealth2, 8, 37, 52

	SET scene, #<scene.id>
	SET passwordScene, #<mrfPassword>
	IF T876, @skipPasswordSet
	SET passwordScene, %R899
	ADD passwordScene, 100
	
@skipPasswordSet
	SET temp, "0"
	SET temp2, "0"	
	END

@eventActorClick1
	IF DEAD, @died
	IF -T868-T869-T870, @finishARLFirst
	COMPARE #<temp2>, "1"
	IF= @menu2
	MENU "Enter pincode=@enterPincode", "Open hack tool=@openHackTool", "Cancel=@cancel"
	END
	
@eventActorClick13
	CALL 5101@requestHelp
	END
	
@eventActorClick14
	CALL 5101@hackToolMenu
	END			

@menu2
	MENU "Enter pincode=@enterPincode", "Cancel=@cancel"
	END	

@openHackTool
	SET temp2, "1"
	SET sceneReturn, #<scene.id>
	CALL 5099@setUpHackToolAndHelp
	END

@enterPincode
	1: Enter pincode [XXX]:
	ASK 300
	IF -T118, @unauthorizedAccess
	COMPARE #<lastAsk>, #<passwordScene>
	IF= @accessGranted
	SOUND voice\attempt_failed
	1: Attempt failed.
	1: Access denied.
	END

@accessGranted
	SOUND voice\access_granted
	1: Access granted.
	WAIT 3.0
	IF -T876, @setToken
	GOTO @authorized
	
@setToken	
	SET mrfPassword, "#<passwordScene>"
	HOST_GIVE T876
	N: Access code #<mrfPassword> for the military research facility has been uploaded to your Quest Diary.
	WAIT 3.0
	GOTO @authorized

@authorized
	IF -V40, @statusCaution
	EJECT T118	
	GOTO LINK 38, 0, 0

@end
	END	
	
@died
	N: You cannot do anything while you are dead.
	END

@statusCaution
	SOUND	voice\status_caution
	1: Status caution.
	1: Your current experience is not enough to survive the horrors that await you.
	1: Please return at level 40.
	END
	
@finishARLFirst
	1: Your access is denied until you cleared the abandoned research lab.
	END

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; 
SCENE 5201, bunkerhallway04,	SCENE,	"Entrance", 	0, 0, 0

	IF DEAD, @died
	GOTO LINK 2, 15, 0
	
@died
	GOTO LINK 35, 1, 1	

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; 
SCENE 5202, bunkermedclinic2, 	SCENE,	"Clinic",	0, 0, 0

	CALL 5097@addGunslinger

	ACTOR 0, "Keypad", stealth2, 8, 56, 54	
	ACTOR 1, "Terminal", staticactors, 9, 79, 82 
	ACTOR 2, "Search the desk", circuitbuttons, 9, 85, 67 
	ACTOR 3, "Search the desk", circuitbuttons, 9, 29, 71
	ACTOR 9, "", circuitbuttons, 9, -50, -50	
	
	CALL 5206@powerCheck
	
	SET scene, #<scene.id>	
	SET temp, 0
	SET temp2, 0
	
	IF T894, @passwordIsSet
	SET passwordScene, %R899
	ADD passwordScene, 100	
	IF T887|T888, @commentActor
	END
	
@commentActor
	8: Doc Wellington used to run this base and patch us up. 
	8: He was a great doctor and very skilled, friendly guy too.
	8: Doctor Melchior also visited this base on occasion.
	8: He had as bad vibe, though, as if the guy had no good bone in his body and had some evil plans in the works.
	IF T861, @commentHero
	H: I'm not sure what to think of Doctor Melchior, but I think have to agree with your assesment.
	END

@commentHero
	H: Yeah, I saw a security tape in the research facility.
	H: He was experimenting on a %M1701 there, in fact, he was the one who created them.
	8: Bloody scientist, nothing but trouble.
	END
	
@eventActorClick0
	CALL @checks
	COMPARE #<temp2>, "1"
	IF= @menu2
	MENU "Enter pincode=@enterPincode", "Open hack tool=@openHackTool", "Cancel=@cancel"
	END
	
@menu2
	MENU "Enter pincode=@enterPincode", "Cancel=@cancel"
	END

@eventActorClick1
	CALL @checks
	GOTO SCENE 5204
	
@eventActorClick2
	CALL @checks	
	N: You find a stack of papers, among which is a sheet with notes.
	9: Security has been lacking recently. 
	9: I've put a %I2166 in the supply room vault.
	9: The password will change randomly and the attempts are set to just three.
	9: Signed, Doctor Kristinson
	END

@eventActorClick3
	CALL @checks
	N: You find a crumpled note on the desk.
	9: For the last time, Doctor Melchior, password '123' is not a strong password!
	9: I've reset your password to '123iamanidiot', I suggest you change it right away.
	9: Signed, Admin
	IF T887|T888, @extraTipActor
	WAIT 2.0
	N: Hint: make sure you check the medical files in the terminal for extra information.
	END

@eventActorClick13
	CALL 5101@requestHelp
	END
	
@eventActorClick14
	CALL 5101@hackToolMenu
	END	

@extraTipActor
	8: I wonder the medical records on that terminal hold any useful information.
	END

@enterPincode
	0: Enter pincode [XXX]:
	ASK 300
	COMPARE #<lastAsk>, #<passwordScene>
	IF= @accessGranted
	SOUND voice\attempt_failed
	0: Attempt failed.
	END

@accessGranted
	SOUND voice\access_granted
	0: Access granted.
	IF -T894, @setPassword
	WAIT 3.0
	GOTO SCENE 5203
	
@setPassword
	SET passwordClinicMRF, #<passwordScene>
	HOST_GIVE T894
	N: The pincode '#<passwordClinicMRF>' is uploaded to your Quest Diary.
	WAIT 3.0
	GOTO SCENE 5203
	
@passwordIsSet
	SET passwordScene, #<passwordClinicMRF>
	END
	
@openHackTool
	SET sceneReturn, #<scene.id>
	SET temp2, "1"
	CALL 5099@setUpHackToolAndHelp
	MOVE 13, 95, 80, 1
	MOVE 14, 95, 65, 1
	END

@cancel
	END

@checks
	IF DEAD, @died
	IF -T892, @powerIsDown
	RETURN

@powerIsDown
	IF T887|T888, @powerIsDownActor
	N: You cannot do anything while the power is down.
	END
	
@powerIsDownActor
	8: We won't be able to do anything here until the power is back up and running.
	8: The power core is to our south west.
	END
	
@died
	IF T887|T888, @diedActor
	N: You cannot do anything while you are dead.
	END
	
@diedActor
	8: You need to a resurrect before you can do anything, %1.
	8: We better visit Doc Adlington, she knows what to do.
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; 
SCENE 5203, bunkerstorage03, SCENE, "Storage room"	

	ACTOR 1, "Keypad", stealth2, 8, 36, 43
	
	IF T895, @skipSearchCrates
	
	ACTOR 2, "Search crate", circuitbuttons, 9, 46, 73 
	ACTOR 3, "Search crate", circuitbuttons, 9, 85, 50 	
	ACTOR 4, "Search crate", circuitbuttons, 9, 58, 59 
	ACTOR 5, "Search crate", circuitbuttons, 9, 75, 76	

@skipSearchCrates	

	CALL 5097@addGunslinger

	ACTOR 15, "", staticactors, 4, 95, 95 

	SET temp, 0
	SET temp2, 0
	SET attempts, "3"
	SET scene, #<scene.id>
	SET passwordScene, %R899
	ADD passwordScene, 100
	HOST_GIVE T895
	
	SET random, %R889
	ADD random, 100
	IF T887|T888, @commentActor
	END

@commentActor	
	8: I once saw Doc Wellington enter his access code here.
	8: Mm, I wonder if the pincode to that vault was '#<random>'?	
	END

@eventActorClick1
	IF DEAD, @died
	IF -T844, @noPower
	COMPARE #<temp2>, "1"
	IF= @menu2
	MENU "Enter pincode=@enterPincode", "Open hack tool=@openHackTool", "Cancel=@cancel"
	END

@menu2
	MENU "Enter pincode=@enterPincode", "Cancel=@cancel"
	END
	
@eventActorClick2
	CALL @moveActor 2
	GOTO @reward

@eventActorClick3
	CALL @moveActor 3
	GOTO @reward	

@eventActorClick4
	CALL @moveActor 4
	GOTO @reward	

@eventActorClick5	
	CALL @moveActor 5	
	GOTO @reward	
	
@eventActorClick13
	CALL 5101@requestHelp
	END
	
@eventActorClick14
	CALL 5101@hackToolMenu
	END		
	
@eventActorClick15
	GOTO SCENE 5202

@moveActor
	MOVE #<arg0>, -50, -50, 1
	RETURN
	
@reward
	IF R50, @giveFirstAidKit
	IF R5,  @giveTrojanHorse
	N: You found nothing of value in this crate.
	END 

@giveFirstAidKit
	N: You found a %I981.
	HOST_GIVE I981
	END	
	
@giveTrojanHorse
	N: You found a %I975!
	HOST_GIVE I975
	END
	
@enterPincode
	1: Enter pincode [XXX]:
	ASK 300
	COMPARE #<lastAsk>, #<passwordScene>
	IF= @accessGranted
	SOUND voice\attempt_failed
	1: Attempt failed.
	SUB attempts, "1"
	COMPARE #<attempts>, "1"
	IF= @oneAttemptremaining
	1: You have #<attempts> attempts remaining.
	COMPARE #<attempts>, "1"
	IF< @resetPassword
	IF T887|T888, @failedAttemptActor
	END
	
@failedAttemptActor
	8: Nope, that wasn't it...
	SET random, %R889
	ADD random, 100
	8: Maybe it was '#<random>'?
	END

@oneAttemptremaining
	1: You have #<attempts> attempt remaining.
	IF T887|T888, @oneAttemptremainingActor
	END
	
@oneAttemptremainingActor
	8: Argh, wrong again!
	8: Oh wait, I remember now, the pincode is '#<passwordScene>'.
	END
	
@resetPassword
	1: The pincode is reset.
	SET passwordScene, %R899
	ADD passwordScene, 100
	SET attempts, "3"
	END

@accessGranted
	IF T896, @nothingHere
	SOUND voice\access_granted
	1: Access granted.
	WAIT 3.0
	N: You found a %I2166!
	HOST_GIVE I2166
	HOST_GIVE T896
	IF T887|T888, @accessGrantedActor
	END
	
@accessGrantedActor
	8: Nice, you better use that %I2166 immediately, you never know when you might find another one of those.
	END
	
@nothingHere
	N: There is nothing left in vault.
	IF T887|T888, @nothingHereActor
	END
	
@nothingHereActor
	8: Why are you checking an empty vault?
	H: Eh, never mind, let's get going.
	END
	
@openHackTool
	SET sceneReturn, #<scene.id>
	SET temp2, "1"	
	CALL 5099@setUpHackToolAndHelp
	MOVE 13, 95, 80, 1
	MOVE 14, 95, 65, 1
	SET attempts, 5
	END

@cancel
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; 
SCENE 5204, check1, CUT, "Terminal screen", 0, 0, 0	 

	CALL 5101@setUpTerminal	11

	SET scene, #<scene.id>
	SET sceneReturn, "5202"
	SET attempts, 5
	SET passwordScene, "123iamanidiot"
	
	CALL 5101@startScreen
	9: Click on the blinking cursor to enter text into the terminal.
	END
	
@programCrash
	SET temp, 0
	SET lastAsk, ""

@terminalCrashLoop
	COMPARE #<temp>, 5
	IF> @terminalCrashExitLoop
	WAIT 1.0
	BKGND check
	SET lastAsk, ""
;	SET terminalText, "error..."
;	CALL 5099@writeText	1
	7: Error... Error...
	WAIT 0.1
	BKGND check1
	WAIT 2.0
	ADD temp, 1
	GOTO @terminalCrashLoop

@terminalCrashExitLoop
	N: It appears you crashed the program beyond repair.
	WAIT 3.0
	GOTO SCENE 5202	

@eventActorClick1
	COMPARE #<loggedIn>, 1
	IF= @commandLine

	ASK 300
	
	STRCMP #<lastAsk>, "help"
	IF= @eventActorClick13
	
	CALL 5101@loginUser	
	CALL 5101@loginPassword
	
	; The actual password checking happens after confirming the correct login was used.
	STRCMP #<login>, "admin"
	IF= @admin 
	STRCMP #<login>, "melchior"
	IF= @melchior
	STRCMP #<login>, "kristinson"
	IF= @kristinson
	STRCMP #<login>, "pearson"
	IF= @pearson

	CALL 5101@invalidAccessRequest
	END
	
@eventActorClick13
	CALL 5101@requestHelp
	END
	
@eventActorClick14
	CALL 5101@hackToolMenu
	END	

@accessDenied
	CALL 5101@accessDenied
	END	

@admin
	; admin can search passwords.txt
	SET user, "admin"
	STRCMP #<password>, "admin"
	IF!= @accessDenied
	
	SET dir, "documents"
	SET path, "c:\#<dir>"
	GOTO @accessGranted

@melchior
	SET user, "melchior"
	SET passwordSet, #<passwordScene>
	STRCMP #<password>, #<passwordScene>
	IF!= @accessDenied
	
	SET dir, "program files"
	SET path, "c:\#<dir>"
	GOTO @accessGranted
	
@kristinson
	SET user, "kristinson"
	STRCMP #<password>, "kristinson"
	IF!= @accessDenied
	
	SET dir, "program files"
	SET path, "c:\#<dir>"
	GOTO @accessGranted	
	
@pearson
	SET user, "pearson"
	STRCMP #<password>, "1337pearson"
	IF!= @accessDenied
	
	SET dir, "program files"
	SET path, "c:\#<dir>"
	GOTO @accessGranted		
	
@accessGranted	
	CALL 5101@accessGranted
	CALL 5101@loginSuccessful
	CALL 5101@commandAwaitingOrders	
	GOTO @commandLine

;---------------------------------
; COMMAND LINE
;---------------------------------
@commandLine
	ASK 300

	; Check the STRCMP commands first, then the STRSTR
	
	STRCMP #<lastAsk>, "logout"
	IF= @commandLogOut
	STRCMP #<lastAsk>, "logoff"
	IF= @commandLogOut
	
	STRCMP #<lastAsk>, "quit"
	IF= @commandQuit

	STRCMP #<lastAsk>, "cd ./"
	IF= @commandCloseDirectory
		
	STRCMP #<lastAsk>, "dir"
	IF= @commandViewDirectory
	
	STRCMP #<lastAsk>, "exit"
	IF= @commandExitProgram
	
	STRCMP #<lastAsk>, "close"
	IF= @commandCloseFile
	
	STRSTR #<lastAsk>, "open"
	IF> @commandOpenFile
	
	STRSTR #<lastAsk>, "run"
	IF> @commandRunProgram

	STRCMP #<lastAsk>, "cd program files"
	IF= @commandOpenDirectoryProgramFiles

	STRCMP #<lastAsk>, "cd documents"
	IF= @commandOpenDirectoryDocuments
	
	STRCMP #<lastAsk>, "help"
	CALL 5101@requestHelp

	CALL 5101@invalidCommand
	GOTO @commandLine
	
@commandLogOut
	CALL 5101@commandLogOut

@commandQuit
	CALL 5101@commandQuit

@commandViewDirectory
	CALL 5101@commandSearching
	
	STRCMP #<path>, "c:\"
	IF= @commandViewDirectoryRoot
	
	STRCMP #<path>, "c:\documents"
	IF= @commandViewDirectoryDocuments
	
	STRCMP #<path>, "c:\program files"
	IF= @commandViewDirectoryProgramFiles
	GOTO @commandLine
	
@commandViewDirectoryRoot	
	SET lastAsk, ""
	SET terminalText, "documents"
	CALL 5101@writeText	1
	SET terminalText, "program files"
	CALL 5101@writeText	1
	GOTO @commandLine

@commandViewDirectoryDocuments
	CALL 5101@updateProgramName "#<path>"

	SET lastAsk, ""
	SET terminalText, "passwords.txt"
	CALL 5101@writeText	1
	GOTO @commandLine
	
@commandViewDirectoryProgramFiles
	CALL 5101@updateProgramName "#<path>"
	
	SET lastAsk, ""
	SET terminalText, "copy files.exe"
	CALL 5101@writeText	1
	SET terminalText, "diagnostics.exe"
	CALL 5101@writeText	1
	SET terminalText, "medical files.exe"
	CALL 5101@writeText	1		
	GOTO @commandLine

@commandOpenDirectoryRoot
	SET dir, "c:\"
	SET path, "#<dir>"
	
	SET lastAsk, ""
	SET terminalText, "#<path>"
	CALL 5101@writeText	1	
	GOTO @commandLine
	
@commandOpenDirectoryProgramFiles
	SET dir, "program files"
	SET path, "c:\#<dir>"
	
	SET lastAsk, ""
	SET terminalText, "#<path>"
	CALL 5101@writeText	1	
	GOTO @commandLine		

@commandOpenDirectoryDocuments
	SET dir, "documents"
	SET path, "c:\#<dir>"
	
	SET lastAsk, ""
	SET terminalText, "#<path>"
	CALL 5101@writeText	1	
	GOTO @commandLine
	
@commandCloseDirectory
	STRCMP #<dir>, "c:\"
	IF= @commandCloseDirectoryRoot
	GOTO @commandOpenDirectoryRoot

@invalidAccessDirectory	
	7: ERROR: You have insufficient rights to access this directory.
	GOTO @commandLine
	
@invalidAccessFile	
	7: ERROR: You have insufficient rights to access this file.
	GOTO @commandLine	

@invalidAccessProgram
	7: ERROR: You have insufficient rights to run this program, login as another user to run this program.
	GOTO @commandLine	

@commandCloseDirectoryRoot
	CALL 5101@commandInvalidDirectory
	7: You are already in the root directory.
	GOTO @commandLine

@commandOpenFile
	COMPARE #<fileOpen>, "1"
	IF= @commandOpenFileInvalid

	SET fileOpen, "1"
	
	STRCMP #<lastAsk>, "open passwords.txt"
	IF= @commandOpenFilePasswords
	STRCMP #<lastAsk>, "open passwords"
	IF= @commandOpenFilePasswords
	
	SET fileOpen, "0"

	7: ERROR: The requested file does not exist.
	RETURN

@commandOpenFileInvalid
	7: ERROR: There is already a file open, close the current file first.
	GOTO @commandLine
	
@commandOpenFilePasswords
	7: ----------------
	7: PASSWORDS
	7: ----------------
	7: user name: admin 
	7: password: admin
	7: ----------------
	7: user name: melchior
	7: password: #<passwordScene>
	SET passwordSet, #<passwordScene>
	7: ----------------
	7: user name: kristinson
	7: password: kristinson
	7: ----------------	
	7: user name: pearson
	7: password: 1337pearson
	GOTO @commandLine

@commandCloseFile
	COMPARE #<fileOpen>, "1"
	IF< @commandCloseFileInvalid
	SET fileOpen, "0"
	7: File closed.
	GOTO @commandLine
	
@commandCloseFileInvalid
	7: ERROR: no open file
	GOTO @commandLine
	
@commandRunProgram
	COMPARE #<programActive>, "1"
	IF= @commandRunProgramAlreadyActive

	STRCMP #<lastAsk>, "run copy_files.exe"
	IF= @commandRunProgramCopyFiles
	STRCMP #<lastAsk>, "run copy files.exe"
	IF= @commandRunProgramCopyFiles	
	STRCMP #<lastAsk>, "run copy_files"
	IF= @commandRunProgramCopyFiles
	STRCMP #<lastAsk>, "run copy files"
	IF= @commandRunProgramCopyFiles
	
	STRCMP #<lastAsk>, "run diagnostics.exe"
	IF= @commandRunProgramDiagnostics
	STRCMP #<lastAsk>, "run diagnostics"
	IF= @commandRunProgramDiagnostics	

	STRCMP #<lastAsk>, "run medical files.exe"
	IF= @commandRunProgramMedicFiles
	STRCMP #<lastAsk>, "run medical_files.exe"
	IF= @commandRunProgramMedicFiles
	STRCMP #<lastAsk>, "run medical files"
	IF= @commandRunProgramMedicFiles
	STRCMP #<lastAsk>, "run medical_files"
	IF= @commandRunProgramMedicFiles

	GOTO @commandLine
	
@commandRunProgramAlreadyActive	
	7: ERROR: a program is already active, exit the current program first
	GOTO @commandLine
	
@commandRunProgramDiagnostics	
	SET programActive, 1

	7: ---------------------------
	7: Welcome to Diagnostics
	7: ---------------------------			
	7: Would you like to initiate a diagnostics run [YES/NO]?
	ASK 300
	IF -YES, @commandExitProgram
	7: Running diagnostics...
	CALL 5101@commandSearching	
	7: WARNING: file 'Classified_secret_research' is corrupted!
	7: Do not attempt to copy this file or the terminal will crash and become unresponsive.
	7: WARNING: various medical files are corrupted, you will not be able to read these files.
	GOTO @commandExitProgram	

@commandRunProgramCopyFiles
	SET programActive, 1

	STRCMP #<user>, "melchior"
	IF= @accessProgramCopyFiles
	STRCMP #<user>, "kristinson"
	IF= @accessProgramCopyFiles 
	GOTO @invalidAccessProgram

@accessProgramCopyFiles 
	7: ---------------------------------
	7: Welcome to the File Copy Program
	7: ---------------------------------	
	
	IF T901, @programCrash
	
	7: There are 5 files available to copy:
	7: [1] Auto_CPR_Unit_schematics_MK_2.............(3 GB)
	7: [2] Experimental_Research...........................(2 GB)
	7: [3] Stamina_enhancements..........................(2 GB)
	7: [4] Classified_secret_research......................(1 GB)
	7: [5] A_Steamy_Night_In_Maku's_Tunner.mp4...(5 GB)
	IF -I2168, @accessProgramCopyFilesWarning
	IF T1104, @skipSetDiscSpace	
	SET discSpace, "10"
	HOST_GIVE T1104

@skipSetDiscSpace		
	7: Available space on %I2168: #<discSpace> GB.
	
@accessProgramCopyFilesLoop	
	7: Please enter the number of file you wish to download or type 'exit' to exit this program:
	ASK 300
	STRCMP #<lastAsk>, "exit"
	IF= @commandExitProgram
	STRCMP #<lastAsk>, "1"
	IF= @accessProgramCopyFiles1
	STRCMP #<lastAsk>, "2"
	IF= @accessProgramCopyFiles2
	STRCMP #<lastAsk>, "3"
	IF= @accessProgramCopyFiles3
	STRCMP #<lastAsk>, "4"
	IF= @accessProgramCopyFiles4
	STRCMP #<lastAsk>, "5"
	IF= @accessProgramCopyFiles5	
	7: Invalid input.
	GOTO @accessProgramCopyFilesLoop	

@accessProgramCopyFiles1
	IF T897, @accessProgramCopyFilesData
	7: Download [Auto_CPR_Unit_schematics MK 2] started...
	HOST_GIVE T897
	SET temp, "3"
	CALL @accessProgramCopyFilesDownloading
	GOTO @accessProgramCopyFilesLoop

@accessProgramCopyFiles4
	IF -T897, @accessProgramCopyFilesGrabCPR 
	7: ERROR... ERROR...
	HOST_GIVE T901
	7: CorRupt#d d$ta d&teCted...
	BKGND check
	WAIT 0.1
	BKGND check1
	WAIT 0.1
	BKGND check
	WAIT 0.1
	BKGND check1
	WAIT 0.1
	BKGND check
	WAIT 1.0
	SOUND voice\status_critical
	7: Stat$s crit&Cal
	WAIT 3.0
	GOTO SCENE 5202	

@accessProgramCopyFilesGrabCPR
	7: ERROR... ERROR...
	7: CorRupt#d d$ta d&teCted...
	BKGND check
	WAIT 0.1
	BKGND check1
	WAIT 0.1
	BKGND check
	WAIT 0.1
	BKGND check1
	WAIT 0.1
	BKGND check
	WAIT 1.0
	SOUND voice\status_critical
	7: Stat$s crit&Cal
	N: You quickly download the %I2661 schematics to the %I2168.
	HOST_GIVE T897
	HOST_GIVE T901
	WAIT 3.0
	GOTO SCENE 5202

@accessProgramCopyFiles3
	IF T898, @accessProgramCopyFilesData
	SET temp, "2"
	CALL @accessProgramCopyFilesBackUpRoutine
	COMPARE #<discSpace>, #<temp>
	IF< @accessProgramCopyFilesDataError	
	7: Download [Stamina_enhancements] started...
	CALL @accessProgramCopyFilesDownloading
	COMPARE #<temp4>, "0"
	IF> @accessProgramCopyFilesLoop	
	HOST_GIVE T898
	GOTO @accessProgramCopyFilesLoop

@accessProgramCopyFiles2
	IF T899, @accessProgramCopyFilesData
	SET temp, "2"
	CALL @accessProgramCopyFilesBackUpRoutine
	COMPARE #<discSpace>, #<temp>
	IF< @accessProgramCopyFilesDataError	
	7: Download [Experimental_Research] started...
	CALL @accessProgramCopyFilesDownloading
	COMPARE #<temp4>, "0"
	IF> @accessProgramCopyFilesLoop
	HOST_GIVE T899
	GOTO @accessProgramCopyFilesLoop	

@accessProgramCopyFiles5 
	IF T900, @accessProgramCopyFilesData
	SET temp, "5"
	CALL @accessProgramCopyFilesBackUpRoutine
	COMPARE #<discSpace>, #<temp>
	IF< @accessProgramCopyFilesDataError	
	7: Download [Naughty_movies.zip] started...
	CALL @accessProgramCopyFilesDownloading
	COMPARE #<temp4>, "0"
	IF> @accessProgramCopyFilesLoop
	HOST_GIVE T900
	GOTO @accessProgramCopyFilesLoop
	
@accessProgramCopyFilesDownloading
	SET temp4, "1"
	COMPARE #<discSpace>, #<temp>
	IF< @accessProgramCopyFilesDataError
	SUB discSpace, #<temp>
	WAIT 3.0
	7: Download completed, there is #<discSpace> GB remaining on the %I2168.
	SET temp4, "0"
	RETURN	

@accessProgramCopyFilesDownloadingFile
	WAIT 4.0
	7: Download completed.
	7: %I2168 has #<discSpace> GB space remaining.
	GOTO @accessProgramCopyFilesLoop

@accessProgramCopyFilesBackUpRoutine
	IF T897, @return
	SET temp2, #<temp>
	ADD temp2, "2"
	COMPARE #<discSpace>, #<temp2>
	IF< @accessProgramCopyFilesBackUpRoutineCPR
	RETURN 
	
@accessProgramCopyFilesBackUpRoutineCPR
	7: ERROR... ERROR...
	N: You quickly switch commands and download the Auto CPR Unit schematics MK 2.
	GOTO @accessProgramCopyFiles1
	
@accessProgramCopyFilesDataError
	7: ERROR: the %I2168 does not have enough available space to copy this file.
	7: There is #<discSpace> GB space remaining on the %I2168.
	RETURN

@accessProgramCopyFilesData
	7: ERROR: You have already downloaded this file.
	GOTO @accessProgramCopyFilesLoop
	
@accessProgramCopyFilesWarning
	7: ERROR: there is no %I2168 detected.
	7: This program will now terminate.
	GOTO @commandExitProgram
	
@commandRunProgramMedicFiles
	SET programActive, 1

	7: ------------------------------
	7: Welcome to the medical files
	7: ------------------------------
	7: 57 medical files are found.
	SOUND voice\status_caution
	7: Status caution.
	7: Various medical files are corrupted.

@commandRunProgramMedicFilesList
	7: Available non-corrupted files are:
	7: [1] Atsumori
	7: [2] Carlos Draak
	7: [3] Devil
	7: [4] Kristinson
	7: [5] Melchior
	7: [6] Samuel Raven
	7: [7] Yuku Kobra
	7: [8] Zander Pearson

@commandRunProgramMedicFilesEnterCommand	
	7: Please enter the number of the file you want to read, type 'list' to view the list again, or 'exit' to exit the program.
	ASK 300
	
	STRCMP #<lastAsk>, "exit"
	IF= @commandExitProgram
	STRCMP #<lastAsk>, "list"
	IF= @commandRunProgramMedicFilesList
	STRCMP #<lastAsk>, "1"
	IF= @commandRunProgramMedicFilesAtsumori
	STRCMP #<lastAsk>, "2"
	IF= @commandRunProgramMedicFilesCarlos
	STRCMP #<lastAsk>, "3"
	IF= @commandRunProgramMedicFilesDevil
	STRCMP #<lastAsk>, "4"
	IF= @commandRunProgramMedicFilesKristinson
	STRCMP #<lastAsk>, "5"
	IF= @commandRunProgramMedicFilesMelchior
	STRCMP #<lastAsk>, "6"
	IF= @commandRunProgramMedicFilesSamuel
	STRCMP #<lastAsk>, "7"
	IF= @commandRunProgramMedicFilesYuku	
	STRCMP #<lastAsk>, "8"
	IF= @commandRunProgramMedicFilesZander
	
	7: Invalid command.
	GOTO @commandRunProgramMedicFilesEnterCommand
	
@commandRunProgramMedicFilesAtsumori
	SET temp, "319"
	7: NAME: code name: Atsumori (real name unknown)
	7: STATUS: alive
	7: AGE: unknown, estimated age is #<temp> years
	7: SEX: male
	7: CONDITION: evolved through the second generation genetics program and achieved immortality.
	GOTO @commandRunProgramMedicFilesEnterCommand

@commandRunProgramMedicFilesCarlos
	SET temp, "307"
	7: NAME: Carlos Draak
	IF -T888, @commandRunProgramMedicFilesCarlosDead
	7: STATUS: alive
	7: AGE: #<temp> years
	7: SEX: male
	7: CONDITION: healthy, slept in stasis for 276 years. Long term stasis effects are unknown.
	GOTO @commandRunProgramMedicFilesEnterCommand

@commandRunProgramMedicFilesCarlosDead
	7: STATUS: deceased
	7: AGE: #<temp> years
	7: SEX: male
	7: CONDITION: died in stasis. 
	GOTO @commandRunProgramMedicFilesEnterCommand

@commandRunProgramMedicFilesDevil
	SET temp, "320"
	7: NAME: code name: Devil (real name unknown)
	7: STATUS: alive
	7: AGE: unknown, estimated age is #<temp> years
	7: SEX: male
	7: CONDITION: evolved through the first generation genetics program and achieved immortality.
	7: WARNING: subject might be mentally unstable. 
	GOTO @commandRunProgramMedicFilesEnterCommand

@commandRunProgramMedicFilesKristinson
	7: NAME: Doctor Jan Kristinson
	7: STATUS: deceased
	7: AGE: 34 years old
	7: CONDITION: died from a Nightmare attack in the research lab.
	GOTO @commandRunProgramMedicFilesEnterCommand

@commandRunProgramMedicFilesMelchior
	7: NAME: Doctor Hans Melchior
	7: STATUS: deceased
	7: AGE: 88 years old
	7: CONDITION: lost his right arm during a Nightmare attack on the research lab and lost his left eye in an unexplainable accident. Died from cancer at an advanced age. 
	GOTO @commandRunProgramMedicFilesEnterCommand

@commandRunProgramMedicFilesSamuel
	SET temp, "328"
	7: NAME: code name: RoT's Protector, real name: Samuel Raven
	7: STATUS: alive
	7: AGE: unknown, estimated age is #<temp> years
	7: SEX: male
	7: CONDITION: evolved through the second generation genetics program and achieved immortality.
	HOST_GIVE T924
	GOTO @commandRunProgramMedicFilesEnterCommand

@commandRunProgramMedicFilesYuku	
	SET temp, "302"
	7: NAME: Yuku Kobra
	IF -T887, @commandRunProgramMedicFilesYukuDead
	7: STATUS: alive
	7: AGE: #<temp> years
	7: SEX: female
	7: CONDITION: healthy, slept in stasis for 276 years. Long term stasis effects are unknown.
	GOTO @commandRunProgramMedicFilesEnterCommand
	
@commandRunProgramMedicFilesYukuDead
	7: STATUS: deceased
	7: AGE: #<temp> years
	7: SEX: female
	7: CONDITION: died in stasis. 
	GOTO @commandRunProgramMedicFilesEnterCommand
	
@commandRunProgramMedicFilesZander
	7: NAME: code name: Commander Pearson, real name: Zander Pearson
	7: STATUS: deceased
	7: AGE: 44 years
	7: SEX: male
	7: CONDITION: was killed by an unknown invisible entity known only as 'Predator' while defending the base.
	7: ADDITIONAL INFORMATION: Commander Pearson attached a file to his medical records, this file was to be sealed until his death.
	7: Would you like to open this file [YES/NO]?
	ASK 300
	IF -YES, @commandRunProgramMedicFilesEnterCommand
	7: --- BEGIN FILE ---
	7: Dear reader,
	7: These are strange times with weird events happening.
	7: A nuclear explosion has rocked the world and we live in dangerous times now.
	7: Thirty brave %C63s and %C64s have entered stasis so they can help us rebuild in the future after the worst of the nuclear fallout is gone.
	7: I have taken in as many refugees as possible, but our resources are quickly dwindling.
	7: In the event that I die, I need somebody to assume command of the base.
	7: Since my options are limited, this will have to be you, the reader of this file.
	7: My login details for the Terminal north of of the power core are:
	7: login name: 'pearson', password: '1337pearson', without the single quotes of course.
	7: Signed, Commander Pearson
	HOST_GIVE T907
	7: --- END FILE ---
	N: The login details from Commander Pearson have been uploaded to your Quest Diary.
	GOTO @commandRunProgramMedicFilesEnterCommand
	
@commandExitProgram
	COMPARE #<programActive>, "0"
	IF= @commandExiProgramInactive
	SET programActive, "0"
	7: Program exited.
	GOTO @commandLine

@commandExiProgramInactive
	7: ERROR: There is no active program to exit.
	GOTO @commandLine

@return
	RETURN


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; 
SCENE 5205, bunkermesshall, SCENE, "Mess hall"

	CALL 5097@addGunslinger

	IF T911, @nothingHere
	ACTOR 1, "Scrap of paper", circuitbuttons, 9, 61,73
	
	MUSIC sweet-whiskey-lies
	
	IF -T887-T888, @noActor
	8: Damn, this place looks like a dump now.
	H: I guess it didn't always used to be like this?
	8: No, not at all, I have some fine memories of this place.
	8: We used to come here after a mission and pour ourselves a drink.
	8: One time a buddy of mine was stitching up my leg while I drank a %I2181.
	8: It sure was a great way of numbing the pain.
	8: It's a pity that recipe is probably lost to the ages now.
	END
	
@noActor
	N: This mess hall has definitely seen better days.
	END
	
@eventActorClick1
	IF T887|T888, @findRecipeActor
	N: You found a recipe to mix a %I2181.
	N: Chris Robbinson would probably love to take a look at it.
	HOST_GIVE T911
	END
	
@findRecipeActor
	HOST_GIVE T911
	8: No way, for real?
	8: It's the old %I2181 recipe!
	8: I wish we had the ingredients to mix one.
	H: Actually, I might know a guy.
	H: Chris Robbinson back in Bunker 3 wants to become a mixologist like how his great, geat, great-, and so on, grandfather used to be.
	8: Wait, you don't mean Harry Robbinson, do you?
	H: Yeah, that's the guy!
	8: I love Harry, he helped me through some rough times.
	8: So one of his offspring survived, eh?
	8: I'd love to meet Chris.
	H: I'm certain that the feeling will be mutual.
	END
	
@nothingHere
	IF T887|T888, @nothingHereActor
	N: There is nothing here.
	END
	
@nothingHereActor
	8: Although I love remeniscing about old times, we should probably move onto more important matters.
	H: Yeah, I suppose so.
	END

@eventHostGive
	CALL 5199@continueGunslingerDrink
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; 
SCENE 5206, bunkerenergycore2, SCENE, "Power core" , 0, 0, 0

	CALL 5097@addGunslinger
	IF T892, @allRepaired

	ACTOR 1, "Circuit board", staticactors, 6, 35, 90
	ACTOR 2, "Switch board", staticactors, 1, 75, 90

	CALL @powerOff
	
	SET bkgnd, "bunkerenergycore2"
	SET scene, #<scene.id>	
		
	IF -T890, @explanation
	END
	
@explanation
	IF T887|T888, @explanationActor
	N: You notice that the power core is not functioning.
	WAIT 4.0
	N: After a quick analysis you conclude that the power core has burned out fuses.
	N: You also need to repair the circuit board.
	END
	
@explanationActor
	8: It seems like the power core isn't functioning.
	8: I'm guessing you'll have to replace one or two fuses and then fix that damned circuit board.
	H: Yeah, it seems so.
	H: I ran into similar problems in the research lab.
	8: Mm, well at least you know what to do then.
	END
	
@eventActorClick1
	IF -T890, @powerNotYetFixed
	IF T892, @fixedCircuitAlready
	IF -T891, @replaceCircuitBoard
	GOTO SCENE 5112
	
@eventActorClick2
	IF T890, @fixedFusesAlready
	GOTO SCENE 5209

@replaceCircuitBoard
	IF I2178, @replacingCircuitBoard
	IF T887|T888, @replaceCircuitBoardActor
	N: You need a %I2178 to replace the broken circuit board before you can update its settings.
	END

@replaceCircuitBoardActor
	8: It looks like this circuit board is a total bust. 
	8: You'll need a %I2178 to replace it and then restore the thing.
	8: There should be a couple of storage rooms that may have a spare one.
	8: Once it's replaced you can update the settings on the circuit board.
	H: Mm, we better go look for a new %I2178 then.
	END

@replacingCircuitBoard
	IF T887|T888, @replacingCircuitBoardActor
	N: You power the power core down.
	SOUND turn-power-off
	WAIT 4.0
	N: You replace the broken Circuit Board with a %I2178.
	WAIT 3.0
	N: You turn the power back on.
	GOTO @finalReplacingCircuitBoard

@replacingCircuitBoardActor
	8: Let's power down the power core.
	H: That'll take me just a moment.
	SOUND turn-power-off
	WAIT 4.0
	N: You replace the broken Circuit Board with a %I2178.
	WAIT 3.0
	8: Mm, everything seems okay to me.
	8: Alright, you just need to turn the power back on now.
	H: Just a second...
	WAIT 2.0
	H: Here we go.
	GOTO @finalReplacingCircuitBoard

@finalReplacingCircuitBoard
	SOUND turn-power-on
	WAIT 3.0
	SOUND voice\all_systems_go
	HOST_TAKE I2178
	HOST_GIVE T891
	IF T887|T888, @finalReplacingCircuitBoardActor
	N: You can right click on the circuit board now to fix the settings.
	END
	
@finalReplacingCircuitBoardActor
	8: Yeah, you did it!
	H: Nice, let's fix the settings and then we should be done, right?
	8: Aye, that's all you need to do to get it all up and running again.
	8: Just right click on the circuit board again to open the settings.
	END

@powerNotYetFixed
	IF T887|T888, @powerNotYetFixedActor
	N: You need to fix the power first before you can repair the circuit board.
	END
	
@powerNotYetFixedActor
	8: That won't do you a lot of good until you fixed those fuses.
	END
	
@fixedCircuitAlready
	IF T887|T888, @fixedCircuitAlreadyActor
	N: You have already repaired the power core's circuit board.
	END
	
@fixedCircuitAlreadyActor
	8: You do realize that you already repaired the power core's circuit board, right?
	END

@fixedFusesAlready
	IF T887|T888, @fixedFusesAlreadyActor
	N: You have already fixed the power core's fuses.
	END
	
@fixedFusesAlreadyActor
	8: What are you doing?
	8: You already fixed the power core's fuses.
	END

@allRepaired
	IF T887|T888, @allRepairedActor
	N: You have repaired the power core, there is nothing left for you to do here.
	SOUND turn-power-on
	WAIT 3.0
	SOUND voice\all_systems_go
	END
	
@allRepairedActor
	SOUND turn-power-on
	WAIT 3.0
	SOUND voice\all_systems_go
	8: Yeah, you've done it, the power is back online!
	8: Let's get the hell out of here before the security bots arrive.
	END	

@powerOff
	IF T892, @powerFixed
	COLOR 21
	BKGND bunkerenergycore	
	
@powerFixed	
	RETURN	
	
@powerCheck	
	IF T892, @powerFixed
	COLOR 21
	RETURN


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5207, deusex02, SCENE, "Terminal"

	CALL 5097@addGunslinger

	ACTOR 1, "Terminal", circuitbuttonsdown, 1, 70,70	
	
	CALL 5206@powerCheck
	IF -T907, @extraHint	
	END

@eventActorClick1
	IF DEAD, @died
	IF -T892, @powerIsDown	
	MENU "Open terminal=@openTerminal", "Cancel=@cancel"
	END

@openTerminal
	GOTO SCENE 5208

@cancel
	END
	
@died
	N: You cannot operate the terminal when you are dead.
	END

@powerIsDown
	IF T887|T888, @powerIsDownActor
	N: You cannot do anything while the power is down.
	END
	
@powerIsDownActor
	8: We'll need to get the power back online before you can do anything with that terminal. 
	END

@extraHint
	IF T887|T888, @extraHintActor
	N: Tip: check the medical terminal first to discover a potential login name.
	END

@extraHintActor
	8: We should be able to turn off the security bots with this terminal.
	8: Commander Pearson used to run this base, I'm guessing the login name 'pearson' would work.
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5208, check1, CUT, "Terminal screen"

	CALL 5101@setUpTerminal	11

	SET scene, #<scene.id>
	SET sceneReturn, "5207"
	SET attempts, 3
	SET passwordScene, "1337pearson"
	
	CALL 5101@startScreen
	9: Click on the blinking cursor to enter text into the terminal.
	END

@eventActorClick1
	COMPARE #<loggedIn>, 1
	IF= @commandLine

	ASK 300
	
	STRCMP #<lastAsk>, "help"
	IF= @eventActorClick13
	
	CALL 5101@loginUser	
	CALL 5101@loginPassword
	
	; The actual password checking happens after confirming the correct login was used.
	STRCMP #<login>, "admin"
	IF= @admin 
	STRCMP #<login>, "melchior"
	IF= @melchior
	STRCMP #<login>, "kristinson"
	IF= @kristinson
	STRCMP #<login>, "pearson"
	IF= @pearson

	CALL 5101@invalidAccessRequest
	END
	
@eventActorClick13
	CALL 5101@requestHelp
	END
	
@eventActorClick14
	CALL 5101@hackToolMenu
	END	

@accessDenied
	CALL 5101@accessDenied
	END	

@admin
	; admin can search passwords.txt
	SET user, "admin"
	STRCMP #<password>, "admin"
	IF!= @accessDenied
	
	SET dir, "documents"
	SET path, "c:\#<dir>"
	GOTO @accessGranted

@melchior
	SET user, "melchior"
	SET passwordSet, #<passwordScene>
	STRCMP #<password>, #<passwordScene>
	IF!= @accessDenied
	
	SET dir, "program files"
	SET path, "c:\#<dir>"
	GOTO @accessGranted
	
@kristinson
	SET user, "kristinson"
	STRCMP #<password>, "kristinson"
	IF!= @accessDenied
	
	SET dir, "program files"
	SET path, "c:\#<dir>"
	GOTO @accessGranted	
	
@pearson
	SET user, "pearson"
	STRCMP #<password>, "1337pearson"
	IF!= @accessDenied
	
	SET dir, "program files"
	SET path, "c:\#<dir>"
	GOTO @accessGranted		
	
@accessGranted	
	CALL 5101@accessGranted
	CALL 5101@loginSuccessful
	CALL 5101@commandAwaitingOrders	
	GOTO @commandLine

;---------------------------------
; COMMAND LINE
;---------------------------------
@commandLine
	ASK 300

	; Check the STRCMP commands first, then the STRSTR
	
	STRCMP #<lastAsk>, "logout"
	IF= @commandLogOut
	STRCMP #<lastAsk>, "logoff"
	IF= @commandLogOut
	
	STRCMP #<lastAsk>, "quit"
	IF= @commandQuit

	STRCMP #<lastAsk>, "cd ./"
	IF= @commandCloseDirectory
		
	STRCMP #<lastAsk>, "dir"
	IF= @commandViewDirectory
	
	STRCMP #<lastAsk>, "exit"
	IF= @commandExitProgram
	
	STRCMP #<lastAsk>, "close"
	IF= @commandCloseFile
	
	STRSTR #<lastAsk>, "open"
	IF> @commandOpenFile
	
	STRSTR #<lastAsk>, "run"
	IF> @commandRunProgram

	STRCMP #<lastAsk>, "cd program files"
	IF= @commandOpenDirectoryProgramFiles

	STRCMP #<lastAsk>, "cd documents"
	IF= @commandOpenDirectoryDocuments
	
	STRCMP #<lastAsk>, "help"
	CALL 5101@requestHelp

	CALL 5101@invalidCommand
	GOTO @commandLine
	
@commandLogOut
	CALL 5101@commandLogOut

@commandQuit
	CALL 5101@commandQuit

@commandViewDirectory
	CALL 5101@commandSearching
	
	STRCMP #<path>, "c:\"
	IF= @commandViewDirectoryRoot
	
	STRCMP #<path>, "c:\documents"
	IF= @commandViewDirectoryDocuments
	
	STRCMP #<path>, "c:\program files"
	IF= @commandViewDirectoryProgramFiles
	GOTO @commandLine
	
@commandViewDirectoryRoot	
	SET lastAsk, ""
	SET terminalText, "documents"
	CALL 5101@writeText	1
	SET terminalText, "program files"
	CALL 5101@writeText	1
	GOTO @commandLine

@commandViewDirectoryDocuments
	CALL 5101@updateProgramName "#<path>"

	SET lastAsk, ""
	SET terminalText, "passwords.txt"
	CALL 5101@writeText	1
	GOTO @commandLine
	
@commandViewDirectoryProgramFiles
	CALL 5101@updateProgramName "#<path>"
	
	SET lastAsk, ""
	SET terminalText, "security.exe"
	CALL 5101@writeText	1		
	GOTO @commandLine

@commandOpenDirectoryRoot
	SET dir, "c:\"
	SET path, "#<dir>"
	
	SET lastAsk, ""
	SET terminalText, "#<path>"
	CALL 5101@writeText	1	
	GOTO @commandLine
	
@commandOpenDirectoryProgramFiles
	SET dir, "program files"
	SET path, "c:\#<dir>"
	
	SET lastAsk, ""
	SET terminalText, "#<path>"
	CALL 5101@writeText	1	
	GOTO @commandLine		

@commandOpenDirectoryDocuments
	SET dir, "documents"
	SET path, "c:\#<dir>"
	
	SET lastAsk, ""
	SET terminalText, "#<path>"
	CALL 5101@writeText	1	
	GOTO @commandLine
	
@commandCloseDirectory
	STRCMP #<dir>, "c:\"
	IF= @commandCloseDirectoryRoot
	GOTO @commandOpenDirectoryRoot

@invalidAccessDirectory	
	7: ERROR: You have insufficient rights to access this directory.
	GOTO @commandLine
	
@invalidAccessFile	
	7: ERROR: You have insufficient rights to access this file.
	GOTO @commandLine	

@invalidAccessProgram
	7: ERROR: You have insufficient rights to run this program, login as another user to run this program.
	GOTO @commandLine	

@commandCloseDirectoryRoot
	CALL 5101@commandInvalidDirectory
	7: You are already in the root directory.
	GOTO @commandLine

@commandOpenFile
	COMPARE #<fileOpen>, "1"
	IF= @commandOpenFileInvalid

	SET fileOpen, "1"
	
	STRCMP #<lastAsk>, "open passwords.txt"
	IF= @commandOpenFilePasswords
	STRCMP #<lastAsk>, "open passwords"
	IF= @commandOpenFilePasswords
	
	SET fileOpen, "0"

	7: ERROR: The requested file does not exist.
	RETURN

@commandOpenFileInvalid
	7: ERROR: There is already a file open, close the current file first.
	GOTO @commandLine
	
@commandOpenFilePasswords
	7: ----------------
	7: PASSWORDS
	7: ----------------
	7: user name: admin 
	7: password: admin
	7: ----------------
	7: user name: pearson
	7: password: 1337pearson
	GOTO @commandLine

@commandCloseFile
	COMPARE #<fileOpen>, "1"
	IF< @commandCloseFileInvalid
	SET fileOpen, "0"
	7: File closed.
	GOTO @commandLine
	
@commandCloseFileInvalid
	7: ERROR: no open file
	GOTO @commandLine
	
@commandRunProgram
	COMPARE #<programActive>, "1"
	IF= @commandRunProgramAlreadyActive

	STRCMP #<lastAsk>, "run security.exe"
	IF= @commandRunProgramSecurity
	STRCMP #<lastAsk>, "run security"
	IF= @commandRunProgramSecurity	

	GOTO @commandLine
	
@commandRunProgramAlreadyActive	
	7: ERROR: a program is already active, exit the current program first
	GOTO @commandLine
		
@commandExitProgram
	COMPARE #<programActive>, "0"
	IF= @commandExiProgramInactive
	SET programActive, "0"
	7: Program exited.
	GOTO @commandLine

@commandExiProgramInactive
	7: ERROR: There is no active program to exit.
	GOTO @commandLine

@commandRunProgramSecurity	
	SET programActive, 1

	7: --------------------
	7: SECURITY PROGRAM
	7: --------------------
	
	IF T908, @commandRunProgramSecurityBotsDisabled

@commandRunProgramSecurityOptions	
	7: STATUS: active
	7: Security bots are actively patrolling the perimeter.
	7: Available actions:
	7: [1] Disable security bots
	7: [2] Lower threat level
	7: [3] Exit program

@commandRunProgramSecurityCommand	
	7: Please enter the number of your choice:
	ASK 300
	
	STRCMP #<lastAsk>, "1"
	IF= @commandRunProgramSecurityDisableBots
	STRCMP #<lastAsk>, "2"
	IF= @commandRunProgramSecurityThreatLevel
	STRCMP #<lastAsk>, "3"
	IF= @commandExitProgram
	
	7: Invalid input.
	GOTO @commandRunProgramSecurityCommand
	
@commandRunProgramSecurityDisableBots	
	7: Processing request...
	WAIT 3.0
	SOUND voice\unit_disabled
	7: Unit disabled.
	7: All security bots are disabled.
	HOST_GIVE T908
	N: You'll exit fight scenes in the military research facility immediately.	
	WAIT 2.0
	GOTO @commandExitProgram	
	
@commandRunProgramSecurityThreatLevel
	7: ERROR... ERROR...
	SOUND voice\status_caution
	7: Status caution.
	7: Commander Access Card not recognized.
	7: Unable to adjust security bot threat levels.
	7: Disable security bots instead [YES/NO]?
	ASK 300
	IF YES, @commandRunProgramSecurityDisableBots
	GOTO @commandRunProgramSecurityOptions		
	
@commandRunProgramSecurityBotsDisabled
	7: STATUS: inactive
	7: Would you like to activate the security bots [YES/NO]?
	ASK 300
	IF -YES, @commandExitProgram
	
	7: Processing request...
	WAIT 3.0
	SOUND voice\all_systems_go
	7: All systems go.
	7: Security bots are active again.
	HOST_TAKE T908
	GOTO @commandExitProgram

@return
	RETURN


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; Fix the power core in abandoned research lab
SCENE 5209, bunkerenergycore2, CUT, "Power core switch board", 0, 0, 0

	IF T11|T12|T13|T14|T15|T16, @skipSettingGoodFuses
	SET temp, %R3

	HOST_GIVE T1#<temp>
	HOST_GIVE T14
	HOST_GIVE T15
	HOST_GIVE T16

@skipSettingGoodFuses	
	CALL 5102@setUpBoard
	END
	
@eventActorClick1
	CALL 5102@fuseClicked 1
	END
	
@eventActorClick2
	CALL 5102@fuseClicked 2
	END
	
@eventActorClick3
	CALL 5102@fuseClicked 3
	END
	
@eventActorClick4
	CALL 5102@fuseClicked 4
	END
	
@eventActorClick5
	CALL 5102@fuseClicked 5
	END
	
@eventActorClick6
	CALL 5102@fuseClicked 6
	END		
	
@eventActorClick14
	CALL 5102@callHelp
	END

@eventActorClick15
	CALL 5102@changeThePower
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; 	
SCENE 5210, bunkerbedright, SCENE, "Bedroom #1"

	IF T877, @nothingHere		
	SET bedroom, 1
	CALL 5098@setUpSceneRight
	
	8: This used to be my room, but it looks like they put somebody else in here after I entered stasis.
	8: I wonder if we'll find anything useful in here?
	END
	
@eventActorClick1
	CALL 5097@moveActor	1
	END
	
@eventActorClick2
	Call 5097@moveActor	2
	END
	
@eventActorClick3	
	CALL 5097@moveActor	3
	END
	
@eventActorClick4
	CALL 5097@moveActor	4
	END
	
@eventActorClick5
	CALL 5097@moveActor	5
	END
	
@eventActorClick6
	CALL 5097@moveActor 6
	END

@nothingHere
	CALL 5097@addGunslinger
	CALL 5098@nothingHere
	END
	
@eventHostGive
	CALL 5199@continueGunslingerDrink
	END	
	

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; 
SCENE 5211, bunkerbedright, SCENE, "Bedroom #2"

	IF T878, @nothingHere
	SET bedroom, 2
	CALL 5098@setUpSceneRight
	
	8: This place looks trashed.
	8: The last #<g.man> who lived here probably wasn't a %C63 and should have cleaned #<g.his> room better.
	8: I don't know how the situation was in Bunker 3, but here we took pride in our high standards.
	END
	
@eventActorClick1
	CALL 5097@moveActor	1
	END
	
@eventActorClick2
	Call 5097@moveActor	2
	END
	
@eventActorClick3	
	CALL 5097@moveActor	3
	END
	
@eventActorClick4
	CALL 5097@moveActor	4
	END
	
@eventActorClick5
	CALL 5097@moveActor	5
	END
	
@eventActorClick6
	CALL 5097@moveActor 6
	END

@nothingHere
	CALL 5097@addGunslinger
	CALL 5098@nothingHere
	END
	
@eventHostGive
	CALL 5199@continueGunslingerDrink
	END	
	

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; 	
SCENE 5212, bunkerbedright, SCENE, "Bedroom #3"

	IF T879, @nothingHere
	SET bedroom, 3
	CALL 5098@setUpSceneRight
	
	8: Hopefully there will be something of value in here.
	8: All I see is dust and trash, this base really has fallen into a sorry state.
	END
	
@eventActorClick1
	CALL 5097@moveActor	1
	END
	
@eventActorClick2
	Call 5097@moveActor	2
	END
	
@eventActorClick3	
	CALL 5097@moveActor	3
	END
	
@eventActorClick4
	CALL 5097@moveActor	4
	END
	
@eventActorClick5
	CALL 5097@moveActor	5
	END
	
@eventActorClick6
	CALL 5097@moveActor 6
	END

@nothingHere
	CALL 5097@addGunslinger
	CALL 5098@nothingHere
	END
	
@eventHostGive
	CALL 5199@continueGunslingerDrink
	END	
	
	
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; 	
SCENE 5213, bunkerstasispods,SCENE,"Stasis pods",0,0,0

	CALL 5097@addGunslinger

	ACTOR 0, "", staticactors 0, -50, -50		
	ACTOR 1.2, "Terminal", staticactors, 9, 48, 57
	
	ACTOR 4, "Empty pod", staticactors, 10, 34, 59
	ACTOR 5, "Empty pod", staticactors, 10, 60, 59
	FACE 5,0
	ACTOR 6, "Empty pod", staticactors, 10, 31, 68
	ACTOR 7, "Empty pod", staticactors, 10, 62, 68
	FACE 7,0
	ACTOR 18, "Empty pod", staticactors, 10, 28, 77
	ACTOR 9, "Empty pod", staticactors, 10, 64, 77
	FACE 9,0
	ACTOR 10, "Empty pod", staticactors, 10, 23, 96
	ACTOR 11, "Empty pod", staticactors, 10, 66, 96
	FACE 11,0
	
	IF T886|T887|T888|T889, @emptyPods
	IF V50, @tooLate
	
	ACTOR 2.1, "Yuku Kobra", staticactors, 11, 39, 50
	ACTOR 3.1, "Carlos Draak", staticactors, 12, 58, 50
	FACE 3, 0	
	
	1: Status critical
	SOUND voice\status_critical
	1: Life pods are failing.
	N: You can only wake one stasis pod occupant, click on a stasis pod or the terminal for more information.
	N: WARNING: if you leave this scene then both die.	
	HOST_GIVE T886
	END
	
@emptyPods
	ACTOR 12, "Empty pod", staticactors, 10, 39, 50
	ACTOR 13, "Empty pod", staticactors, 10, 58, 50
	FACE 13,0
	IF T886-T887|T886-T888, @failedBoth
	IF T887-T888, @emptyPodsActor
	N: There is nothing left for you to do here.
	END
	
@emptyPodsActor
	WAIT 2.0
	8: Eh, can we leave this place?
	8: Seeing my stasis pod like that and knowing how close I came to dying gives me the creeps.
	8: There isn't anything we can do here anymore anyway.
	END
	
@tooLate
	HOST_GIVE T886
	N: You have waited too long before attempting to save Yuku or Carlos.
	GOTO @emptyPods

@failedBoth
	HOST_GIVE T889
	SOUND turn-power-off
	WAIT 4.0	
	N: Both Yuku and Carlos have died.
	N: There is nothing left for you to do here.
	END
	
@eventActorClick1
	IF T887|T888|T889, @terminalShutdown
	MENU "Wake up Carlos or Yuku=@saveOccupant", "Determine cause of failing power=@determineCause", "Help=@help", "Cancel=@cancel"
	END
	
@eventActorClick2
	SET temp, "26"
	SET temp2, #<temp>
	ADD temp2, "276"

	IF T887, @statusYukuAwake
	IF T888, @statusYukuDead
	SET status, "Asleep"

@continueYuku	
	N: STASIS POD OCCUPANT: Yuku Kobra 	
	N: STATUS: #<status>
	N: AGE: #<temp> years (#<temp2> years including stasis time)
	N: SEX: Female
	N: HEIGHT: 5'5"/ 165 cm
	N: SPECIALISM: Sniper
	N: BIOGRAPHY: Yuku Kobra was born as the daughter of Jim Kobra and Hika Sukanada.
	N: Jim was a career soldier while Hika was an olympic gold medal sharpshooter champion.
	N: Due to her parents' careers, Yuku traveled a lot as a child and attended international schools.
	N: It was clear from an early age that she inherited her parents' talents.
	N: Yuku grew quickly into an excellent student thanks to the combination Jim's 'can-do' attitude her and her mother's training.
	N: Yuku learned persistence, patience, and perseverance, from an early age.
	N: Samuel Raven recruited her after she finished college at the age of 22.
	N: Yuku quickly rose in the ranks of the %C63s, becoming an %C64 at the age of 25.
	N: ACCOMPLISHMENTS: 
	N: - Graduated as most excellent sniper at the top of her class
	N: - Best sniper three years in a row
	N: - 59 confirmed kills
	N: - 26 deaths by headshot
	N: - 4 confirmed %M1701 kills
	N: --- END OF FILE ---	
	WAIT 2.0
	END

@eventActorClick3
	SET temp, "31"
	SET temp2, #<temp>
	ADD temp2, "276"

	IF T888, @statusCarlosAwake
	IF T887, @statusCarlosDead
	SET status, "Asleep"

@continueCarlos	
	N: Information about the stasis occupant appears in the chat window.
	
	N: STASIS POD OCCUPANT: Carlos Draak 
	N: STATUS: #<status>
	N: AGE: #<temp> years (#<temp2> years including stasis time)
	N: SEX: Male
	N: HEIGHT: 6'1"/ 185 cm
	N: SPECIALISM: Guerrilla
	N: BIOGRAPHY: Carlos Draak was born as the son of Vladamir Draak and Tanya Vuursteen.
	N: A neighbouring country invaded his country when he was six years old.
	N: Carlos was raised on the battlefield during the fifteen year occuptation that followed. 
	N: His parents were leading members of the resistance and taught Carlos everything they knew about trapping and ambushing the enemy.
	N: As he grew older, he took more initiative himself and led a squad of young men and women to victory.
	N: Due to his brutal guerrilla tactics, he turned the tide of battle more than once.
	N: Carlos does everything to win a fight, no matter how dirty the tactic. 
	N: On top of that, he has a great aim and will continue to fight where others would flee or surrender.
	N: Samuel Raven recruited him at the age of 26.
	N: Carlos' squad was the only one to survive the battle in the research facility from where the first %M1701s escaped.
	N: ACCOMPLISHMENTS: 
	N: - Decorated war hero
	N: - Expert ambusher
	N: - 34 confirmed %M1701 kills
	N: - 5 confirmed %M1701 kills with his bare hands when he ran out of ammo	
	N: --- END OF FILE ---
	WAIT 2.0
	END
	
@terminalShutdown
	SOUND turn-power-off
	WAIT 4.0
	N: The terminal is shut down due to a lack of power.
	WAIT 4.0
	GOTO EXIT

@saveOccupant
	MENU "Wake up Carlos Draak=@wakeCarlos", "Wake up Yuku Kobra=@wakeYuku", "Cancel=@cancel"
	END
	
@wakeCarlos	
	SOUND turn-power-off
	WAIT 4.0

	ACTOR 3.3, "Carlos Draak", gun007, 1, 58, 50
	FACE 3, 0		
	ACTOR 13, "Empty pod", staticactors, 10, 58, 50
	FACE 13,0	

	MOVE 3, 51, 71
	3: /a yawns.
	3: Damn, I have a bloody headache.
	3: What happened?
	FACE 3, 2
	HOST_TAKE T886
	HOST_GIVE T888
	
	CALL @explanation
	
	3: Damn, I don't know what's worse, my headache or this news.
	3: So, I'm the only one left?
	H: Yeah, Yuku didn't make it.
	3: Aw, Damn it, I was going to ask her on a date.
	FACE 3, 0
	3: I hope you find rest in the afterlife, Yuku.
	END
	
@wakeYuku
	SOUND turn-power-off
	WAIT 4.0

	ACTOR 2.3, "Yuku Kobra", gun009, 1, 39, 50
	ACTOR 12, "Empty pod", staticactors, 10, 39, 50
	MOVE 2, 42, 71
	2: /a yawns.
	2: Oh, wow, my head hurts.
	2: What happened?
	FACE 2,2
	HOST_TAKE T886
	HOST_GIVE T887
	
	CALL @explanation
	
	2: Geez, that's a lot to take in with a banging headache.
	2: I suppose we better get going.
	2: Am I the only one left?
	H: Yes, unfortunately I couldn't save Carlos as well.
	FACE 2,1
	2: Poor Carlos, he was such a fun guy...
	2: May he rest in peace.
	END
	
@explanation
	H: You've been asleep for more than 358 years.
	H: I rescued you from your failing stasis pod.
	H: A lot has happened since when you went to sleep, but I'll give you a short rundown. 
	H: A nuclear missile exploded, which caused the collapse of the world as we knew it.
	H: Most of the technology we once had is gone, although I've been able to restore our teleporter technology.
	H: %M1701s have recently made their return to the world and it's up to us to stop them.
	RETURN	

@determineCause
	1: The stasis pods are running on a seperate power grid.
	1: The power core that powers the pods is drained for 99.998%%.
	1: It takes 0.002%% power to wake up one occupant. 
	1: Eight other stasis pods have already failed and were automatically shut down.	
	1: Yuku Kobra and Carlos Draak were deemed the most valuable remaining %C64s.
	1: After a shut down the corpse inside is destroyed, leaving an empty pod behind for a next occupant.
	END

@help
	1: You need to decide who you want to save, Yuku Kobra or Carlos Draak.
	1: You can right click on either pod to receive more information about the occupants.
	1: The power to the stasis pods is failing and you can only save one inhabitant.
	END
	
@cancel
	END	
		
@statusYukuAwake
	SET status, "Awake"
	GOTO @continueYuku

@statusYukuDead
	SET status, "Deceased"
	GOTO @continueYuku
	
@statusCarlosAwake
	SET status, "Awake"
	GOTO @continueCarlos

@statusCarlosDead	
	SET status, "Deceased"
	GOTO @continueCarlos
	

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; 
SCENE 5214, bunkerbrokenpods, SCENE, "Broken stasis pods #1"

	CALL 5097@addGunslinger

	IF T909|T914|T915, @nothingHere
	ACTOR 1, "Predator", stealth, 1, 25, 90

	WAIT 2.0
	1: Wait, what?
	1: How did you find me?
	1: First Silver and now you?
	1: This is MY base!
	8: Bloody hell, let's kill that creep!
	H: Oh, shit.
	
	MOVE 1, -50,-50,1
	MOVE 8, -50,-50,1

	IF T887, @fightWithYuku
	IF T888, @fightWithCarlos
	FIGHT2 507.25.90
	GOTO @finishedFight

@fightWithYuku
	FIGHT2 507.25.90, -1798.80.95
	GOTO @finishedFight
	
@fightWithCarlos
	FIGHT2 507.25.90, -1797.80.95
	GOTO @finishedFight	

@finishedFight
	CALL 984@rewardMissionPP	
	CALL 5198@gunslingerCPRAndAfterFightQuotes
	HOST_GIVE T909
	H: Who the hell was that?	
	END
	
@nothingHere
	IF T887|T888, @nothingHereActor
	N: There is nothing here anymore.
	END
	
@nothingHereActor
	8: Whatever was here is gone now.
	H: Yeah, it seems so.
	END

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; 
SCENE 5215, bunkerbrokenpods, CUT, "Broken stasis pods #2"

	IF T910, @nothingHere

	; arg0 = total enemies, arg1 = drone health, arg2 = hits you can take, arg3 = hit chance multiplier drone 
	; difficulty is the number of hits you can take before dying
	SET scene, #<scene.id>
	IF T887|T888, @setDifficultyHarder
	CALL 5096@setup 9, 5, 25, 20
	END
	
@setDifficultyHarder	
	CALL 5096@setup 9, 5, 15, 20
	END
	
@eventActorGive6
@eventActorGive7
@eventActorGive5
	COMPARE #<item.id>, "982"
	IF< @doesNothing
	IF> @doesNothing
	CALL 5096@eventActorGiveEMP
	END
	
@eventActorGive9
	COMPARE #<item.id>, "982"
	IF< @doesNothing
	IF> @doesNothing
	CALL 5096@eventActorGiveMissed
	
@eventActorAttack6
	CALL 5096@eventActorAttack6
	END
	
@eventActorAttack7
	CALL 5096@eventActorAttack7
	END	

@eventActorAttack5
	CALL 5096@eventActorAttack5
	END
	
@eventActorAttack9
	CALL 5096@eventActorAttackMiss
	END
	
@reward
	HOST_GIVE T910
	SET temp, %R3
	ADD temp, 2
	SET temp2, %R3
	N: You found #<temp> %I980, #<temp2> %I982s, and a %I2182.
	HOST_GIVE I980.#<temp>
	HOST_GIVE I982.#<temp2>
	HOST_GIVE I2182
	WAIT 4.0
	GOTO EXIT

@doesNothing
	N: This does nothing, try throwing an %I982 instead!
	END
	
@nothingHere
	N: There is nothing here anymore.
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; 	
SCENE 5216, bunkercenter, SCENE, "Teleporter"

	ACTOR 1,	"Teleporter", gun005, 1, 58, 94
	ACTOR 2, 	"Terminal", staticactors, 9, 28, 89
	
	CALL 5097@addGunslinger
	CALL 5097@checkPower	
	
	IF I2185+I2186, @bunkerHint
	IF T887|T888, @commentActor
	END
	
@commentActor
	8: This place brings back memories.
	8: I used to travel all over the world in the blink of an eye.
	8: One of my most dangerous missions had us teleporting deep inside an enemy base. 
	8: The bastards never knew what hit them!
	IF -T892, @weNeedPower
	END	
	
@weNeedPower
	8: We'll need to power up the base before we can use this teleporter again.
	END
	
@bunkerHint
	IF T887|T888, @bunkerHintActor
	N: Access the terminal first to gain access to the local portal point in the bunker below.
	END
	
@bunkerHintActor	
	8: You'll have to access that terminal first so we can upgrade our access.
	8: After that we can teleport to the portal point in the bunker below.
	END
	
@eventActorClick1
	IF DEAD, @died
	IF -T892, @noPower
	IF -T904-T906, @noDestinationIsSet
	SOUND tesla_charge
	WAIT 2.0
	IF T906+T956, @teleportLocalChoice
	IF T906, @teleportLocal
	IF T956, @teleportIncludingMRF
	MENU "Local Teleport=@teleportLocal", "Teleport to Bunker 3=@enterPincodeFirst", "Cancel=@end"
	END
	
@teleportIncludingMRF
	MENU "Local Teleport=@teleportLocal", "Teleport into the military research bunker=@teleportMRFBunker", "Teleport to Bunker 3=@enterPincodeFirst", "Cancel=@end"
	END
	
@teleportLocalChoice
	MENU "Local Teleport=@teleportLocal", "Teleport into the military research bunker=@teleportMRFBunker", "Cancel=@end"
	END	
	
@eventActorClick2
	IF DEAD, @died
	IF -T892, @noPower
	IF E2161|E2162|E2163|E2688, @accessGranted
	GOTO @accessDenied

@accessGranted	
	2: Access granted.
	SOUND voice\access_granted
	N: You successfully gain access thanks to your %I#<num.hostEquipId13>.
	WAIT 2.0
	IF -T904-T906, @noBunker3Access
	IF I2185+I2186, @addPortalPoint
	GOTO @readyToUse
	
@teleportBunker3
	GOTO LINK 35, 6, 0

@teleportLocal	
	GOTO LINK 38, 17, 0
	
@teleportMRFBunker
	GOTO LINK 39, 5, 0
	
@noPower
	IF T887|T888, @noPowerActor
	N: There is insufficient power available, repair the power core first!
	END
	
@noPowerActor
	8: I'm afraid that won't do you a lot of good while the power core is still off line.
	8: We need to get the power up and running first before we can do anything here.
	H: Yeah, I suppose you are right, but it was worth a shot.
	END
	
@addPortalPoint
	2: %I2185 and %I2186 detected, do you want to insert these chips [YES/NO]?
	ASK 300
	IF -YES, @logOff
	2: Please insert both chips.
	WAIT 2.0
	N: You insert %I2185 and %I2186.
	WAIT 2.0
	2: Processing...
	WAIT 4.0
	2: Upgrade complete.
	2: You now have access to the portal point inside the military research bunker.
	HOST_GIVE T956
	HOST_TAKE I2185
	HOST_TAKE I2186
	GOTO @logOff
		
@enterPincodeFirst
	IF -T905, @teleportBunker3
	N: Please enter the security code:
	ASK 300
	STRCMP "#<lastAsk>", "#<passwordMRF>"
	IF= @teleportBunker3
	N: Attempt failed.
	SOUND voice\attempt_failed
	N: You have entered an incorrect security code.
	N: Check your Quest Diary to retrieve the correct one.
	END	

@noBunker3Access
	2: You currently have no destination set.
	2: Your options are:
	2: [1] Set local destination.
	2: [2] Set local and remote destination.
	2: WARNING: this choice is permanent and cannot be undone.
	2: Enter 'stop' to exit this program and to decide at another time.
	2: Enter the option you want to set [1/2/stop]:
	ASK 300
	STRCMP #<lastAsk>, "stop"
	IF= @logOff
	STRCMP #<lastAsk>, "1"
	IF= @setLocalDestinationOnly
	STRCMP #<lastAsk>, "[1]"
	IF= @setLocalDestinationOnly
	STRCMP #<lastAsk>, "2"
	IF= @setRemoteDestination
	STRCMP #<lastAsk>, "[2]"
	IF= @setRemoteDestination
	2: Invalid input.
	GOTO @noBunker3Access
	
@setLocalDestinationOnly
	HOST_GIVE T906
	2: Local destination is set.
	2: You can now teleport to the Portal Point in the south of the base.
	GOTO @readyToUse	
	
@setRemoteDestination	
	HOST_GIVE T904
	2: Local destination is set.
	2: You can now teleport to the Portal Point in the south of the base.
	2: Please enter the remote destination that you want to set:
	WAIT 2.0
	H: Bunker 3
	2: Input accepted.
	2: It is possible to protect this location with a security code.
	2: You will have to enter this code every time when you teleport from this point.
	2: The code will be uploaded to your Quest Diary.

@askProtectionAgain
	2: Do you want to protect this location with a security code [YES/NO]?
	ASK 300
	IF YES, @setProtection
	IF NO, @readyToUse
	GOTO @askProtectionAgain
	
@setProtection
	2: Please enter a security code of letters and/ or numbers between 4 and 10 characters:
	ASK 300
	SET_LEN temp, #<lastAsk>
	COMPARE #<temp>, "4"
	IF< @codeTooShort
	COMPARE #<temp>, "10"
	IF> @codeTooLong
	SET passwordMRF, "#<lastAsk>"
	HOST_GIVE T905
	2: Code accepted, the new security code is '#<passwordMRF>'.
	2: The security code is successfully uploaded to your Quest Diary.
	GOTO @readyToUse	

@codeTooShort
	2: The entered security code is too short.
	GOTO @setProtection
	
@codeTooLong
	2: The entered security code is too long.
	GOTO @setProtection

@readyToUse
	2: The teleporter is now ready to use.
	GOTO @logOff
	
@logOff	
	2: Logging off terminal.
	2: Goodbye.
	SOUND voice\goodbye
	END
	
@notEnoughPower
	SOUND tesla_shot
	N: The teleporter has insufficient power to operate.
	N: Something inside the lab is draining too much power.
	END
	
@noDestinationIsSet
	SOUND tesla_shot
	N: WARNING: there is no destination set for the teleporter.
	N: Enter a destination first at the terminal.
	END	
	
@accessDenied
	2: Attempt failed.
	SOUND voice\attempt_failed
	WAIT 2.0
	2: You have insufficient access.
	N: Equip your %I2161 and try again.
	END
	
@died
	N: You cannot do anything while you are dead.
	END

@end
	END

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; 
SCENE 5217, bunkerredalert, SCENE, "Command center"

	CALL 5097@addGunslinger
	
	ACTOR 1, "Terminal", circuitbuttons, 9, 77, 76	

	1: %I2162 recognized.
	WAIT 2.0
	SOUND voice\awaiting_orders
	1: Awaiting orders.
	8: Here we are, let's get this show on the road quickly.
	8: The sooner we're done here, the quicker we can exterminate that vermin in the bunker below.
	END
	
@eventActorClick1
	IF DEAD, @died
	1: Access granted.
	SOUND voice\access_granted
	MENU "Activate elevator=@elevator", "Check recent access logs=@checkLogs", "Cancel=@end"
	END	

@elevator	
	IF -T936, @noAccess
	IF T938, @alreadyAccess
	1: Elevator unlocked, you can now use the elevator.
	HOST_GIVE T938
	1: Goodbye.
	SOUND voice\goodbye
	END

@noAccess
	1: Attempt failed.
	SOUND voice\attempt_failed
	1: You do not have proper clearance to unlock the elevator.
	1: Contact Samuel Raven for more information.
	IF T887|T888, @noAccessActor
	N: Visit the command center in bunker 3 for tips.
	END
	
@alreadyAccess
	1: Attempt failed.
	SOUND voice\attempt_failed
	1: You have already unlocked the elevator.
	END
	
@noAccessActor	
	8: Damn, I was hoping that this would work.
	8: I recall something about having to download access codes in the research lab.
	8: However, you should probably talk to your local commander in the command center of bunker 3 first.
	END
	
@checkLogs
	1: USER: Daemonium, ACCESSED: elevator
	IF -T825, @skipCharley
	1: USER: Charley Kissinger, ACCESSED: elevator
	1: USER: Charley Kissinger, DOWNLOADED: file Experimental research
	1: USER: Charley Kissinger, DOWNLOADED: file Stamina enhancements
	1: USER: Charley Kissinger, VIEWED: Medical files
@skipCharley

	IF -T907, @skipMedicalFiles
	1: USER: %1, VIEWED: Medical files

@skipMedicalFiles	
	IF -T897, @skipSchematics
	1: USER: %1, DOWNLOADED: file Auto CPR Unit schematics MK 2
	
@skipSchematics
	IF -T898, @skipStaminaEnhancements
	1: USER: %1, DOWNLOADED: file Stamina enhancements
	
@skipStaminaEnhancements
	IF -T899, @skipExperimentalResearch
	1: USER: %1, DOWNLOADED: file Experimental research
	
@skipExperimentalResearch	
	IF -T900, @skipEroticMovie
	1: USER: %1, DOWNLOADED: file A Steamy Night In Maku's Tunner

@skipEroticMovie
	1: End of program.
	1: Goodbye.
	SOUND voice\goodbye
	END	

@died
	IF T887|T888, @diedActor
	N: You cannot do anything while you are dead.
	END

@diedActor
	8: You should visit Doc Adlington first before attempting to do that.
	END

@end
	END
	
	
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; 
SCENE 5218, bunkerelevator, SCENE, "Elevator"

	CALL 5097@addGunslinger
	
	ACTOR 1, "Keypad", stealth2, 8, 33, 55
	8: I can't wait to go downstairs so we can hunt that bastard down.
	END
	
@eventActorClick1
	IF DEAD, @died
	IF -T938, @accessDenied
	1: Access granted.
	SOUND voice\access_granted
	WAIT 2.0	
	GOTO LINK 39, 0, 0
	
@accessDenied
	1: Attempt failed.
	SOUND voice\attempt_failed
	1: The elevator is disabled, visit the Command center to the south west of here to activate the elevator.
	END

@died
	IF T887|T888, @diedActor
	N: You cannot do anything while you are dead.
	END

@diedActor
	8: You'll need to visit Doc first before you can do anything.
	END

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; 	
SCENE 5219, bunkerdesert01, SCENE, "Portal point"

	CALL 5097@addGunslinger

	ACTOR 1,	"Teleporter", gun005, 1, 62, 95
	IF T887|T888, @commentActor
	END

@commentActor
	8: These portal points are useful for keeping the vermin outside the base.
	8: It's a good thing you have that %I2161 on you, otherwise we couldn't teleport back.
	END

@eventActorClick1
	IF -T1208, @noTeleport
	SOUND tesla_charge
	WAIT 2.0	
	GOTO LINK 38, 10, 0
	
@noTeleport
	N: Attempt failed.
	SOUND voice\attempt_failed
	N: Insufficient access.
	END

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
;
SCENE 5220, bunkerdesert02, SCENE, "Dangerous outdoors"

	MUSIC Apocalyptica-Betrayal

	CALL 5097@addGunslinger
	
	IF T916|T917, @nothingHere
	IF T914|T915, @concludeScene
	IF DEAD, @nothingHereYet
	
	ACTOR 1, "Predator", stealth, 1, 25, 90
	
	WAIT 2.0
	IF -T909, @alternativeIntroduction
	1: You again, how can I get rid of you?
	1: You may have injured me before, but I can still kick your ass!

@continue
	1: Did Silver sent you?
	H: I don't have the faintest clue what you're talking about.
	H: Just who the hell are you?
	8: I think he has a stealth unit, most of those were destroyed.
	8: It's rare to see a working one.
	
	1: Just who the hell am I?
	WAIT 2.0
	SOUND turn-power-off
	WAIT 1.0
	ACTOR 1, "Daemonium", Daemonium, 4, 25, 90
	SEL 1
	POSE 4,1
	WAIT 1.0
	1: I'm Daemonium, your doom, that's who I am.
	1: And now it's time for you to die!
	8: Bring it on!
	
	MOVE 8, -50, -50, 1
	MOVE 1, -50, -50, 1
	
	IF -T887, @skipYuku
	FIGHT2 -1798.80.95
	MUSIC Apocalyptica-Betrayal
	
@skipYuku	
	IF -T888, @skipCarlos
	FIGHT2 -1797.80.95
	MUSIC Apocalyptica-Betrayal
	
@skipCarlos
	IF -T909, @hardFight
	FIGHT2 1704.25.90
	MUSIC Apocalyptica-Betrayal
	IF LOSE, @lostFight
	GOTO @wonFight

@hardFight
	FIGHT2 1705.25.90
	MUSIC Apocalyptica-Betrayal
	IF LOSE, @lostFight
	GOTO @wonFight

@wonFight	
	N: You received 6 %Z1s
	HOST_GIVE Z1.6
	HOST_GIVE T914
	GOTO @finishedFight
	
@lostFight
	HOST_GIVE T915
	GOTO @finishedFight		
	
@alternativeIntroduction
	1: Who are you? What do you want from me?
	GOTO @continue

@finishedFight
	1: This won't be the last you've seen of me!
	IF T887|T888, @savedYukuOrCarlos
	HOST_GIVE T889
	N: You didn't save Yuku or Carlos in time at the stasis pods, they both died.
	END
	
@savedYukuOrCarlos	
	WAIT 3.0
	IF ALIVE, @skipResurrect
	SOUND tesla_charge
	WAIT 2.0
	SOUND tesla_shot
	HOST_GIVE L#<num.hostMaxHP>
	
@skipResurrect	
	GOTO SCENE #<scene.id>

@concludeScene
	IF T889, @nothingHere
	IF -T887, @skipSettingYukuName
	SET temp, "Yuku"

@skipSettingYukuName
	IF -T888, @skipSettingCarlosName
	SET temp, "Carlos"
	
@skipSettingCarlosName	
	WAIT 2.0	
	8: You know, we worked pretty well together just there.
	H: Yeah, we did.
	8: I'd like to make this a more permanent solution if you let me and join your side.
	8: Would you like that? (Yes/No)
	ASK 300
	IF -YES, @doubleCheck
	GOTO @receiveNewPartner
	
@doubleCheck
	8: Well, that kind of hurts my feelings.
	8: Just to make sure that we're on the same page, I'll ask you once more.
	8: Do you want me as your partner? (Yes/No)
	ASK 300
	IF -YES, @noPartner
	8: I knew you'd turn around.
	GOTO @receiveNewPartner
	
@noPartner
	HOST_TAKE T887
	HOST_TAKE T888
	HOST_GIVE T889
	HOST_GIVE T917
	8: Well, that's a pity, but I respect your decision.
	8: Don't worry, you won't see me again.
	WAIT 2.0
	MOVE 8, 120, 90
	END

@receiveNewPartner
	8: Hell yeah!
	8: We make great partners.
	WAIT 2.0
	MOVE 8, -50, -50, 1
	HOST_GIVE T916
	IF -T887, @skipReceivingYuku
	N: You received %I2180 as your partner!
	HOST_GIVE I2180
	END
	
@skipReceivingYuku
	N: You received %I2179 as your partner!
	HOST_GIVE I2179
	END

@nothingHere
	IF T887|T888, @nothingHereActor
	N: There is nothing here anymore.
	END
	
@nothingHereActor
	8: It looks like the place is empty, there is nothing here anymore.
	H: I guess so, yeah.
	H: We better get moving again.
	END

@nothingHereYet
	IF T887-T888, @nothingHereYetActor
	N: Nothing will happen here while you are dead.
	END
	
@nothingHereYetActor
	8: Eh, %1, maybe you should get your health back first.
	8: I have a bad feeling about this place and you'll probably want to be in the best possible condition.
	H: Yeah, I suppose I should visit Doc Adlington first.
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
;
SCENE 5221, bunkerstorage02, SCENE, "Storage room #1"  

	CALL 5097@addGunslinger

	IF T912, @nothingHere
	ACTOR 1,  "", gun005, 2, 10, 90 
	ACTOR 2,  "", gun005, 2, 25, 88	
	ACTOR 3,  "", gun005, 2, 38, 92

	SET temp, %R3

	IF T887|T888, @commentActor
	END

@commentActor
	8: I wonder what is in those crates.
	H: Well, there is only one way to find out.
	8: Shoot them to pieces?
	H: Eh-, I have bad experiences with that in the abandoned research lab. 
	H: I should just loot them instead.
	8: Whatever gets the job done, right?
	END

@eventActorClick1
	MOVE 1, -50, -50, 1
	COMPARE #<temp>, "1"
	IF= @findTreasure
	IF T887|T888, @commentNoFind
	N: There was nothing of interest in this crate.
	END
	
@eventActorClick2
	MOVE 2, -50, -50, 1
	COMPARE #<temp>, "2"
	IF= @findTreasure
	IF T887|T888, @commentNoFind
	N: There was nothing of interest in this crate.
	END

@eventActorClick3
	MOVE 3, -50, -50, 1
	COMPARE #<temp>, "3"
	IF= @findTreasure
	IF T887|T888, @commentNoFind
	N: There was nothing of interest in this crate.
	END	

@eventActorAttack1
@eventActorAttack2
@eventActorAttack3
	IF T887|T888, @dontShootActor
	N: Your weapon echoes through the hallways, but it doesn't seem to attract any security bots.
	END

@dontShootActor
	8: I thought you wanted to keep the noise down? 
	8: There are other dangers out here besides security bots.
	END

@findTreasure
	N: You found 2 %I979s and a %I2176!
	HOST_GIVE I2176
	HOST_GIVE I979.2
	HOST_GIVE T912
	IF T887|T888, @findTreasureActor
	WAIT 2.0
	N: Erick Finkers at the power core in Bunker 3 will probably be very happy to see this.
	END
	
@findTreasureActor
	8: Bloody hell, a %I2176 in mint condition?
	8: Those are incredibly rare these days, you can rebuild the power distribution of a large energy core with that thing!
	H: Yup, I think Erick will be very happy to see this.
	END

@nothingHere
	IF T887|T888, @nothingHereActor
	N: You have already explored this room.
	END
	
@nothingHereActor
	WAIT 2.0
	8: Eh, you've already explored this room.
	8: Why are you here again?
	H: I figured I'd check if there was any new treasure.
	8: Really? You're weird.
	8: Treasure doesn't just magically appear.
	WAIT 2.0
	SOUND flashback
	FX 1
	WAIT 3.0
	FX 0
	ACTOR 4,  "", gun005, 2, 25, 88	
	WAIT 2.0
	H: Really? 
	H: Well it looks like you were wrong.
	H: Treasure *does* magically appear!
	8: /a facepalms.
	END
	
@eventActorClick4
	N: Nope, no treasure here after all... Sorry!
	WAIT 2.0
	8: What is this, some kind of April's fool joke?
	END
	
@eventActorAttack4
	N: You destroyed the crate.
	MOVE 4, -50,-50, 1
	END

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
;
SCENE 5222, bunkerstorage02, CUT, "Storage room #2" 

	IF T913, @nothingHere

	; arg0 = total enemies, arg1 = drone health, arg2 = hits you can take, arg3 = hit chance multiplier drone 
	; difficulty is the number of hits you can take before dying
	SET scene, #<scene.id>
	IF T887|T888, @setDifficultyHarder
	CALL 5096@setup 12, 6, 30, 22
	END
	
@setDifficultyHarder	
	CALL 5096@setup 12, 6, 20, 22
	END
	
@eventActorGive6
@eventActorGive7
@eventActorGive5
	COMPARE #<item.id>, "982"
	IF< @doesNothing
	IF> @doesNothing
	CALL 5096@eventActorGiveEMP
	END
	
@eventActorGive9
	COMPARE #<item.id>, "982"
	IF< @doesNothing
	IF> @doesNothing
	CALL 5096@eventActorGiveMissed
	
@eventActorAttack6
	CALL 5096@eventActorAttack6
	END
	
@eventActorAttack7
	CALL 5096@eventActorAttack7
	END	

@eventActorAttack5
	CALL 5096@eventActorAttack5
	END
	
@eventActorAttack9
	CALL 5096@eventActorAttackMiss
	END
	
@reward
	HOST_GIVE T913
	N: You found a %I2178.
	HOST_GIVE I2178
	IF T887|T888, @rewardActor
	N: You can use the %I2178 to repair the power core to the north east.
	WAIT 4.0
	GOTO EXIT
	
@rewardActor
	8: Hell yeah! 
	8: We need that %I2178 to repair the power core to the north east.
	WAIT 4.0
	GOTO EXIT

@doesNothing
	N: This does nothing, try throwing an %I982 instead!
	END
	
@nothingHere
	N: There is nothing here anymore.
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; This is the fight scene for map 38 (military research facility)
SCENE 5223

	IF -T118, @skipBeforeFightGunslinger
	CALL 5199@beforefightgunslingerstart
	
@skipBeforeFightGunslinger


	IF R20, @fight3
	IF R30, @fight2
	
	IF T887, @fight1WithYuku
	IF T888, @fight1WithCarlos
	FIGHT 1703
	GOTO @fightEnd
	
@fight1WithYuku
	FIGHT 1703, -1798
	GOTO @fightEnd
	
@fight1WithCarlos
	FIGHT 1703, -1797
	GOTO @fightEnd
	
@fight2
	IF T887, @fight2WithYuku
	IF T888, @fight2WithCarlos
	FIGHT 1703, 1703
	GOTO @fightEnd
	
@fight2WithYuku
	FIGHT 1703, 1703, -1798
	GOTO @fightEnd
	
@fight2WithCarlos
	FIGHT 1703, 1703, -1797
	GOTO @fightEnd	

@fight3	
	IF T887, @fight3WithYuku
	IF T888, @fight3WithCarlos
	FIGHT 1703, 1703, 1703
	GOTO @fightEnd
	
@fight3WithYuku
	FIGHT 1703, 1703, 1703, -1798
	GOTO @fightEnd
	
@fight3WithCarlos
	FIGHT 1703, 1703, 1703, -1797
	GOTO @fightEnd	
	
@fightEnd	
; reward PP coins	
	CALL 984@rewardMissionPP
	CALL @sparePartsDrop
	
; include after fight gunslinger quotes
	IF -T118, @skipAfterFightGunslinger
	CALL 5198@gunslingerCPRAndAfterFightQuotes

@skipAfterFightGunslinger	
	END
	
@sparePartsDrop
	IF R25+T118+WIN, @rewardSpareParts
	RETURN	
	
@rewardSpareParts
	HOST_GIVE I980
	N: You found %I980
	RETURN
	

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; TIER 4 - MILITARY RESEARCH BUNKER
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
;	
SCENE 5230, bunkerelevator, SCENE, "Elevator"

	CALL 5097@addGunslinger
	
	ACTOR 1, "Keypad", stealth2, 8, 33, 55
	8: Is it time to go up again?
	END

@eventActorClick1
	1: Access granted.
	SOUND voice\access_granted
	WAIT 2.0
	IF DEAD, @died
	GOTO LINK 38, 12, 0

@died
	GOTO LINK 35, 1, 1	

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
;	
SCENE 5231, deusex02, SCENE, "Terminal"

	CALL 5097@addGunslinger	

	ACTOR 1, "Security terminal", circuitbuttonsdown, 1, 24, 68	
	ACTOR 2, "Terminal", circuitbuttonsdown, 1, 70,69	
	ACTOR 3, "Attack bot terminal", circuitbuttonsdown, 1, 42, 69	
	
	IF T939, @disabledSecurity
	ACTOR 4, "Circuit board", staticactors, 6, 23, 84

	IF T887|T888, @actorComment
	N: You see three terminals.
	END
	
@actorComment
	8: Hey, three terminals, I wonder if we can hack into them?
	END
	
@disabledSecurity
	IF T887|T888, @disabledSecurityActor
	N: You have hacked the security and attack bot terminals and disabled the login procedure.
	IF T948|T951, @end
	N: You still need to login the terminal, however.
	END

@disabledSecurityActor
	IF T940, @securityBotsActor
	IF T948|T951, @diaryActor
	8: You should be able to login into the security and attack bot terminal now without any issues. 
	8: We'll still have to find the login credentials for the terminal though.
	END	
	
@diaryActor
	8: Heh, that security footage turned out to be more interesting than I imagined it would be.
	END
	
@securityBotsActor
	8: Having those %M1712s activated will make our life a lot easier.
	IF -T942, @hintGrowthVats
	END
	
@hintGrowthVats
	8: You should disable the security of those growth vats with the terminal though.
	8: Run the security program to disable them.
	END
	
@eventActorClick1
	SET temp2, 1
	IF -T939, @failLogin
	1: Access granted.
	SOUND voice\access_granted
	WAIT 2.0
	MENU "View security tape #71=@tape71", "View security tape #103=@tape103", "View security tape #442=@tape442", "View security tape #683=@tape683", "Cancel=@end"
	END
	
@eventActorClick2
	IF -T939, @failLoginTerminal
	GOTO SCENE 5234	
	
@eventActorClick3
	SET temp2, 3
	IF -T939, @failLogin
	3: Access granted.
	SOUND voice\access_granted
	WAIT 2.0
	IF T940, @disableSecurityBotsMenu
	MENU "Enable security bots=@enableSecurityBots", "Cancel=@end"
	END
	
@disableSecurityBotsMenu	
	MENU "Disable security bots=@disableSecurityBots", "Cancel=@end"
	END
	
@eventActorClick4
	GOTO SCENE 5232	
	
@failLogin
	CALL @enterLoginCredentials
	SEL #<temp2>
	' Attempt failed.
	SOUND voice\attempt_failed
	' Invalid credentials.
	IF T887|T888, @failLoginActor
	N: Try to disable the security nodes in the circuit board in order to hack the terminal.
	N: You may also have to update the encrypted data nodes to unencrypted data nodes.
	END
	
@failLoginActor
	8: This won't do, we'll have to hack the circuit board and make some modifications there.
	8: You should disable the security nodes on the circuit board and switch the encrypted data nodes for unencrypted ones.
	8: I bet that if you make those changes you can then login with any user name or password to gain full access.
	H: It was worth a shot.
	END
	
@failLoginTerminal
	IF T887|T888, @failLoginTerminalActor
	N: Disable the circuit board first.
	END
	
@failLoginTerminalActor	
	8: I don't think that'll do anything for us until you hacked that circuit board.
	END
	
	
@enterLoginCredentials
	SEL #<temp2>
	' Please enter your login name: 
	ASK 300
	SET temp, #<lastAsk>
	' Please enter your password:
	ASK 300
	RETURN
	
@tape71
	GOTO SCENE 5235

@tape103
	GOTO SCENE 5236

@tape442	
	GOTO SCENE 5237
	
@tape683
	GOTO SCENE 5233
	
@enableSecurityBots
	3: %M1712s are activated.
	3: %I2162 recognized, updating security policies, please stand by.
	3: ...
	WAIT 1.0
	3: ......
	WAIT 1.0
	3: .........	
	WAIT 2.0
	3: Security policies updated, two %M1712s will now assist you where possible.
	3: Use this terminal again to disable the %M1712s.
	HOST_GIVE T940
	END

@disableSecurityBots
	3: Disabling %M1712s, please stand by.
	3: ...
	WAIT 1.0
	3: ......
	WAIT 1.0
	3: .........	
	WAIT 2.0
	3: %M1712s disabled and previously updated security policies removed.
	3: Use this terminal again to activate the %M1712s.
	HOST_TAKE T940
	END
	
@end
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; Circuit board for scene 5231
SCENE 5232, check, CUT, "Circuit board", 0, 0

	SET scene,	#<scene.id>

	CALL 5100@setScene
	CALL 5100@setPins 3 2 3 2
	
	SET poseActor8, 20
	SEL 8
	POSE #<poseActor8>	
	
	SET poseActor7, 28
	SEL 7
	POSE #<poseActor7>
	
	SET poseActor6, 26
	SEL 6
	POSE #<poseActor6>

	SET poseActor5, 22
	SEL 5
	POSE #<poseActor5>
	
	SET poseActor4, 24	
	SEL 4
	POSE #<poseActor4>	
	
	SET poseActor3, 20	
	SEL 3
	POSE #<poseActor3>	
	
	SET poseActor2, 30
	SEL 2
	POSE #<poseActor2>
	
	SET poseActor1, 28
	SEL 1
	POSE #<poseActor1>	
	
	; voltage on
	SET desiredState10, #<poseActor10>
	
	; voltage on
	SET desiredState9, #<poseActor9>
	
	; security off
	SET desiredState8, #<poseActor8>
	ADD desiredState8, "1"
	
	; unencrypted data on
	SET desiredState7, #<poseActor7>
	SUB desiredState7, "18"
	
	; unencrypted data on
	SET desiredState6, #<poseActor6>
	SUB desiredState6, "18"
	
	; security off
	SET desiredState5, #<poseActor5>
	ADD desiredState5, "1"
	
	; security off
	SET desiredState4, #<poseActor4>
	ADD desiredState4, "1"
	
	; security off
	SET desiredState3, #<poseActor3>
	ADD desiredState3, "1"
	
	; encrypted data on
	SET desiredState2, #<poseActor2>	
	SUB desiredState2, "18"
	
	; unencrypted data on
	SET desiredState1, #<poseActor1>	
	END

@eventActorClick15
	CALL 5100@changeThePower
	
	COMPARE #<power>, "1"
	IF= @checkFinished
	END
	
@checkFinished
	COMPARE #<boardIsFixed>, "1"
	IF= @finished
	END

@finished
	WAIT 1.0
	N: You successfully disabled the security on this circuit board and rerouted the data nodes!
	HOST_GIVE T939
	WAIT 3.0
	GOTO SCENE 5231

@eventActorClick14
	CALL 5100@helpRequested
	END
	
@eventActorClick13
	CALL 5100@analyzeBoard
	END

@eventActorClick1
	CALL 5100@interactionMenu	1
	END
	
@eventActorClick2
	CALL 5100@interactionMenu	2
	END

@eventActorClick3
	CALL 5100@interactionMenu	3
	END

@eventActorClick4
	CALL 5100@interactionMenu	4
	END

@eventActorClick5
	CALL 5100@interactionMenu	5
	END

@eventActorClick6
	CALL 5100@interactionMenu	6
	END		
	
@eventActorClick7
	CALL 5100@interactionMenu	7
	END		

@eventActorClick8
	CALL 5100@interactionMenu	8
	END		

@eventActorClick9
	CALL 5100@interactionMenu	9
	END		

@eventActorClick10
	CALL 5100@interactionMenu	10
	END		


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5233, bunkergrowthvats, CUT, "Security tape #683"

	FLAGS	17792

	ACTOR 1, "Silver",  silver, 4, 48, 98 
	ACTOR 2, "Daemonium", Daemonium, 4, 110, 90

	ACTOR 5, "Terminal", staticactors, 9, 34, 89
	ACTOR 6, "Keypad", stealth2, 8, 18, 73
	ACTOR 7, "Keypad", stealth2, 8, 81, 73

	N: This footage is from 248 years ago.
	
	1: ! Daemonium, where are you, you bastard!?
	1: I know you are hiding somewhere.
	WAIT 2.0
	MOVE 1, 33, 90
	WAIT 3.0
	1: Mm, what is this?
	WAIT 1.0
	1: A post-it with login details, password = 'diesilverdie'.
	1: Really, Daemonium?
	1: A post-it?
	1: /a sighs.
	1: What an idiot.
	5: Please enter your login name: 
	1: Daemonium	
	5: Please enter your password:
	1: diesilverdie
	5: Access granted
	SOUND voice\access_granted
	1: Now, let's see...
	WAIT 2.0
	N: You watch Silver adjust various settings.
	WAIT 2.0
	MOVE 2, 70,90
	WAIT 3.0
	1: That ought to take care of it, now it's time to kill that vermin.
	2: !!
	MOVE 2, 110,90, 2
	WAIT 1.0
	1: Daemonium, where are you!?
	WAIT 2.0
	MOVE 1, 50, 95
	1: That's strange, I could have sworn I heard something.
	1: Regardless, his precious %M1713s will now turn against him and view him as their nemesis.
	1: They'll also be infertile in the future and feel dedicated to guard this base.
	1: That'll teach that bastard.
	HOST_GIVE T951
	CALL 5098@soundstatic
	GOTO SCENE 5231	


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; TERMINAL CUT SCENE for scene 5231 - Dae's diaries. 
SCENE 5234, check1, CUT, "Terminal screen", 0, 0, 0	

	CALL 5101@setUpTerminal	11

	; These cookies are mandatory to implement
	SET scene, #<scene.id>
	SET sceneReturn, "5231"
	SET attempts, 5
	STRCMP #<passwordSet>, ""
	SET passwordScene, "diesilverdie"
	
	CALL 5101@startScreen
	END
	
@eventActorClick1
	COMPARE #<loggedIn>, 1
	IF= @commandLine

	ASK 300
	
	STRCMP #<lastAsk>, "help"
	IF= @eventActorClick13
	
	CALL 5101@loginUser	
	CALL 5101@loginPassword
	
	; The actual password checking happens after confirming the correct login was used.
	STRCMP #<login>, "admin"
	IF= @admin 
	STRCMP #<login>, "daemonium"
	IF= @daemonium

	CALL 5101@invalidAccessRequest
	END
	
@eventActorClick13
	CALL 5101@requestHelp
	END
	
@eventActorClick14
	CALL 5101@hackToolMenu
	END	

@accessDenied
	CALL 5101@accessDenied
	END	

@admin
	; admin can search passwords.txt
	SET user, "admin"
	STRCMP #<password>, "admin"
	IF!= @accessDenied
	
	SET dir, "documents"
	SET path, "c:\#<dir>"
	GOTO @accessGranted

@daemonium
	SET user, "daemonium"
	SET passwordSet, #<passwordScene>
	STRCMP #<password>, #<passwordScene>
	IF!= @accessDenied
	
	SET dir, "program files"
	SET path, "c:\#<dir>"
	GOTO @accessGranted

@accessGranted	
	CALL 5101@accessGranted
	CALL 5101@loginSuccessful
	CALL 5101@commandAwaitingOrders	
	GOTO @commandLine

	; show several directories, but also show that the user doesn't have the rights to access those
	; open to to see which fuse is burned through (random 1 of 3) in power_management.exe
	END
;---------------------------------
; COMMAND LINE
;---------------------------------
@commandLine
	ASK 300

	; Check the STRCMP commands first, then the STRSTR
	
	STRCMP #<lastAsk>, "logout"
	IF= @commandLogOut
	STRCMP #<lastAsk>, "logoff"
	IF= @commandLogOut
	
	STRCMP #<lastAsk>, "quit"
	IF= @commandQuit

	STRCMP #<lastAsk>, "cd ./"
	IF= @commandCloseDirectory
		
	STRCMP #<lastAsk>, "dir"
	IF= @commandViewDirectory
	
	STRCMP #<lastAsk>, "exit"
	IF= @commandExitProgram
	
	STRCMP #<lastAsk>, "close"
	IF= @commandCloseFile
	
	STRSTR #<lastAsk>, "open"
	IF> @commandOpenFile
	
	STRSTR #<lastAsk>, "run"
	IF> @commandRunProgram

	STRCMP #<lastAsk>, "cd program files"
	IF= @commandOpenDirectoryProgramFiles

	STRCMP #<lastAsk>, "cd documents"
	IF= @commandOpenDirectoryDocuments
	
	STRCMP #<lastAsk>, "help"
	CALL 5101@requestHelp

	CALL 5101@invalidCommand
	GOTO @commandLine
	
@commandLogOut
	CALL 5101@commandLogOut

@commandQuit
	CALL 5101@commandQuit

@commandViewDirectory
	CALL 5101@commandSearching
	
	STRCMP #<path>, "c:\"
	IF= @commandViewDirectoryRoot
	
	STRCMP #<path>, "c:\documents"
	IF= @commandViewDirectoryDocuments
	
	STRCMP #<path>, "c:\program files"
	IF= @commandViewDirectoryProgramFiles
	GOTO @commandLine
	
@commandViewDirectoryRoot	
	SET lastAsk, ""
	SET terminalText, "documents"
	CALL 5101@writeText	1
	SET terminalText, "program files"
	CALL 5101@writeText	1
	GOTO @commandLine

@commandViewDirectoryDocuments
	CALL 5101@updateProgramName "#<path>"

	SET lastAsk, ""
	SET terminalText, "passwords.txt"
	CALL 5101@writeText	1
	SET terminalText, "diary.doc"
	CALL 5101@writeText	1	
	GOTO @commandLine
	
@commandViewDirectoryProgramFiles
	CALL 5101@updateProgramName "#<path>"
	
	SET lastAsk, ""
	SET terminalText, "security.exe"
	CALL 5101@writeText	1
	SET terminalText, "copy files.exe"
	CALL 5101@writeText	1
	GOTO @commandLine

@commandOpenDirectoryRoot
	SET dir, "c:\"
	SET path, "#<dir>"
	
	SET lastAsk, ""
	SET terminalText, "#<path>"
	CALL 5101@writeText	1	
	GOTO @commandLine
	
@commandOpenDirectoryProgramFiles
	SET dir, "program files"
	SET path, "c:\#<dir>"
	
	SET lastAsk, ""
	SET terminalText, "#<path>"
	CALL 5101@writeText	1	
	GOTO @commandLine		

@commandOpenDirectoryDocuments
	SET dir, "documents"
	SET path, "c:\#<dir>"
	
	SET lastAsk, ""
	SET terminalText, "#<path>"
	CALL 5101@writeText	1	
	GOTO @commandLine
	
@commandCloseDirectory
	STRCMP #<dir>, "c:\"
	IF= @commandCloseDirectoryRoot
	GOTO @commandOpenDirectoryRoot

@invalidAccessDirectory	
	7: ERROR: You have insufficient rights to access this directory.
	GOTO @commandLine
	
@invalidAccessFile	
	7: ERROR: You have insufficient rights to access this file.
	GOTO @commandLine	

@invalidAccessProgram
	7: ERROR: You have insufficient rights to run this program, login as another user to run this program.
	GOTO @commandLine	

@commandCloseDirectoryRoot
	CALL 5101@commandInvalidDirectory
	7: You are already in the root directory.
	GOTO @commandLine

@commandOpenFile
	COMPARE #<fileOpen>, "1"
	IF= @commandOpenFileInvalid

	SET fileOpen, "1"
	
	STRCMP #<lastAsk>, "open passwords.txt"
	IF= @commandOpenFilePasswords
	STRCMP #<lastAsk>, "open passwords"
	IF= @commandOpenFilePasswords
	STRCMP #<lastAsk>, "open diary.doc"
	IF=	@commandOpenFileDiary
	STRCMP #<lastAsk>, "open diary"
	IF=	@commandOpenFileDiary
	
	SET fileOpen, "0"

	7: ERROR: The requested file does not exist.
	RETURN

@commandOpenFileInvalid
	7: ERROR: There is already a file open, close the current file first.
	GOTO @commandLine
	
@commandOpenFilePasswords
	7: ----------------
	7: PASSWORDS
	7: ----------------
	7: user name: admin 
	7: password: admin
	7: ----------------
	7: user name: daemonium
	7: password: #<passwordScene>
	7: ----------------
	GOTO @commandCloseFile

@commandOpenFileDiary
	7: ------------------
	7: Daemonium's Diary
	7: ------------------
	7: WARNING: most entries have been corrupted.
	7: Four entries are available.
@commandOpenFileDiaryEntries	
	7: Do you want to open all entries or close the file [ALL/CLOSE]?
	ASK 300
	IF Qall, @commandOpenFileDiaryAll
	IF Qclose, @commandCloseFile
	7: ERROR: Invalid entry.
	GOTO @commandOpenFileDiaryEntries

@commandOpenFileDiaryAll
	7: --- START OF DIARY RECORDS ---
	7: ENTRY 1: this entry is from 275 years and 5 months ago
	7: I discovered this military research facility three days ago, it seems promising.
	7: There were a bunch of refugees from the war that I had to scare away.
	7: Various soldiers and the base commander put up a good fight, but I killed them all.
	7: I hope that Silver won't be able to trace me down to this base.
	7: I'll need to leave a false trail for him to Bunker 9 and make him think that it's my base of operations.
	
	WAIT 2.0
	7: --- NEXT RECOVERED ENTRY ---
	
	7: ENTRY 8: this entry is from 275 years 4 months and 3 weeks ago
	7: I heard various noises coming from further down the basement.
	7: My investigation led me to believe that there are creatures lurking in the dark.
	7: I'm not spooked easily, but could these be those formidable foes I heard about?

	WAIT 2.0	
	7: --- NEXT RECOVERED ENTRY ---

	7: ENTRY 18: this entry is from 275 years 4 months and 2 weeks ago
	7: I made first contact with those creatures, it did not go well.
	7: They are extremely hostile, but after I killed several of them, they seemed to back off.
	7: As long as I don't wander too close to their area, they seem to leave me alone.
	7: Maybe I can negotiate a truce with them?

	WAIT 2.0	
	7: --- NEXT RECOVERED ENTRY ---
	
	7: ENTRY 34: this entry is from 275 years and 3 months ago
	7: I discovered growth vats today.
	7: It took me a while to break into that lab, those %M1701s were defending it with tooth and nail.
	7: It seems like somebody experimented on %C63s to turn them into %M1701s.
	7: I found several records to Doctor Melchior last week.
	7: It appears that after he created the %M1701s, he continued his research into another kind of super soldiers.
	7: The man was insane, but also brilliant.
	7: Maybe I can create my private army if I can track him down and have him hand over his research?
	7: It'd certainly aid me with liberating Devil again.
	HOST_GIVE T941
	7: --- END OF AVAILABLE DIARIES ---
	GOTO @commandOpenFileDiaryEntries
	
@commandCloseFile
	COMPARE #<fileOpen>, "1"
	IF< @commandCloseFileInvalid
	SET fileOpen, "0"
	7: File closed.
	GOTO @commandLine
	
@commandCloseFileInvalid
	7: ERROR: no open file
	GOTO @commandLine
	
@commandRunProgram
	COMPARE #<programActive>, "1"
	IF= @commandRunProgramAlreadyActive
	
	SET programActive, 1
	
	STRCMP #<lastAsk>, "run security.exe"
	IF= @commandRunProgramSecurity
	STRCMP #<lastAsk>, "run security"
	IF= @commandRunProgramSecurity
	
	STRCMP #<lastAsk>, "run copy_files.exe"
	IF= @commandRunProgramCopyFiles
	STRCMP #<lastAsk>, "run copy files.exe"
	IF= @commandRunProgramCopyFiles	
	STRCMP #<lastAsk>, "run copy_files"
	IF= @commandRunProgramCopyFiles
	STRCMP #<lastAsk>, "run copy files"
	IF= @commandRunProgramCopyFiles
	
	7: Error: invalid command
	SET programActive, 0	

	GOTO @commandLine
	
@commandRunProgramAlreadyActive	
	7: ERROR: a program is already active, exit the current program first
	GOTO @commandLine

@commandRunProgramSecurity
	SET programActive, 1

	STRCMP #<user>, "daemonium"
	IF!= @invalidAccessProgram

	7: --------------------------------
	7: Welcome to Growth Vat Security
	7: --------------------------------	
	
	IF T942, @commandRunProgramSecurityDisabled
	
	7: Security protocols: online
	7: All systems go
	SOUND voice\all_systems_go	
@commandRunProgramSecurityQuestion	
	7: Do you want to disable the security protocols [YES/EXIT]?
	ASK 300
	IF Qyes, @commandRunProgramSecurityDisable
	if Qexit, @commandExitProgram
	7: Invalid input.
	GOTO @commandRunProgramSecurityQuestion	
	
@commandRunProgramSecurityDisable
	IF T942, @commandRunProgramSecurityAlreadyDisabled
	7: Disabling security protocols, please stand by...
	7: ...
	WAIT 1.0
	7: ......
	WAIT 1.0
	7: .........
	WAIT 2.0
	7: Security protocols disabled.
	SOUND voice\unit_disabled
	7: You can now manually override the growth vats with their local keypads.
	HOST_GIVE T942
	GOTO @commandExitProgram
	
@commandRunProgramSecurityEnable
	IF -T942, @commandRunProgramSecurityAlreadyEnabled
	7: Enabling security protocols, please stand by...
	7: ...
	WAIT 1.0
	7: ......
	WAIT 1.0
	7: .........
	WAIT 2.0
	7: Security protocols enabled, all systems go.
	SOUND voice\all_systems_go
	7: The growth vats are now protected against manual overrides.
	HOST_TAKE T942
	GOTO @commandExitProgram
	
@commandRunProgramSecurityDisabled
	7: Security protocols: offline
	7: Unit disabled
	SOUND voice\unit_disabled
	7: Do you want to enable the security protocols [YES/EXIT]?
	ASK 300
	IF Qyes, @commandRunProgramSecurityEnable
	if Qexit, @commandExitProgram
	7: Invalid input.	
	GOTO @commandRunProgramSecurityDisabled

@commandRunProgramSecurityAlreadyDisabled
	7: ERROR: security is already disabled
	GOTO @commandRunProgramSecurityQuestion
	
@commandRunProgramSecurityAlreadyEnabled
	7: ERROR: security is already enabled
	GOTO @commandRunProgramSecurityQuestion

@commandRunProgramCopyFiles
	7: ---------------------------------
	7: Welcome to the File Copy Program
	7: ---------------------------------	
	7: There are 3 files available to copy:
	7: [1] Auto_CPR_Unit_schematics_MK_3...(4 GB)
	7: [2] Dexterity_enhancements..............(3 GB)
	7: [3] Mutant_research.........................(3 GB)
	IF T1107, @skipSetDiscSpace		
	SET discSpace, "10"
	HOST_GIVE T1107

@skipSetDiscSpace		
	7: Available space on %I2168: #<discSpace> GB.
	
@accessProgramCopyFilesLoop	
	7: Please enter the number of file you wish to download or type 'exit' to exit this program:
	ASK 300
	STRCMP #<lastAsk>, "exit"
	IF= @commandExitProgram
	STRCMP #<lastAsk>, "1"
	IF= @accessProgramCopyFiles1
	STRCMP #<lastAsk>, "2"
	IF= @accessProgramCopyFiles2
	STRCMP #<lastAsk>, "3"
	IF= @accessProgramCopyFiles3
	7: Invalid input.
	GOTO @accessProgramCopyFilesLoop		

@commandExitProgram
	COMPARE #<programActive>, "0"
	IF= @commandExiProgramInactive
	SET programActive, "0"
	7: Program exited.
	GOTO @commandLine

@accessProgramCopyFiles1
	IF T943, @accessProgramCopyFilesData
	7: Download [Auto_CPR_Unit_schematics_MK_3] started...
	HOST_GIVE T943
	SET temp, "4"
	GOTO @accessProgramCopyFilesDownloadingFile		

@accessProgramCopyFiles2	
	IF T944, @accessProgramCopyFilesData
	7: Download [Dexterity_enhancements] started...
	HOST_GIVE T944
	SET temp, "3"
	GOTO @accessProgramCopyFilesDownloadingFile	
	
@accessProgramCopyFiles3
	IF T945, @accessProgramCopyFilesData
	IF T946, @accessProgramCopyFiles3Deleted
	7: Status caution
	SOUND voice\status_caution
	7: WARNING: these files contain highly sensitive data about mutant research and genetics.
	7: If these files fall in the wrong hands then the results will be catastrophic.
@accessProgramCopyFiles3Question
	7: Do you want to copy or delete these files [COPY/DELETE]?
	ASK 300
	IF Qcopy, @accessProgramCopyFiles3Copy
	IF Qdelete, @accessProgramCopyFiles3Delete
	7: Invalid input.
	GOTO @accessProgramCopyFiles3Question
	
@accessProgramCopyFiles3Copy
	HOST_GIVE T945
	7: Download [Mutant_research] started...
	SET temp, "3"
	GOTO @accessProgramCopyFilesDownloadingFile	

@accessProgramCopyFiles3Delete	
	HOST_GIVE T946
	7: Deleting [Mutant_research] started...
	WAIT 4.0
	7: File [Mutant_research] is successfully deleted.
	GOTO @accessProgramCopyFilesLoop
	
@accessProgramCopyFiles3Deleted	
	7: ERROR: this file no longer exists.
	GOTO @accessProgramCopyFilesLoop
	
@accessProgramCopyFilesDownloadingFile
	WAIT 4.0
	7: Download completed.
	SUB discSpace, #<temp>
	7: %I2168 has #<discSpace> GB space remaining.
	GOTO @accessProgramCopyFilesLoop	
	
@accessProgramCopyFilesData
	7: ERROR: You have already downloaded this file.
	GOTO @accessProgramCopyFilesLoop	

@commandExiProgramInactive
	7: ERROR: There is no active program to exit.
	GOTO @commandLine

@securityActivated
	SET temp, #<num.hostMaxHP>
	DIV temp, 4
	ADD temp, 1
	HOST_TAKE H#<temp>
	SOUND tesla_shot
	N: The security system gave you quite a shock!
	WAIT 2.0
	IF DEAD, @securityExit
	END

@securityExit
	WAIT 1.0
	N: You cannot operate the terminal when you are dead.
	WAIT 3.0
	GOTO SCENE 5231


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5235, deusex02, CUT, "Security tape #71"

	FLAGS	17792

	ACTOR 1, "Daemonium", Daemonium, 4, 73, 75
	ACTOR 2, "Nightmare", elemental012, 6, -10, 85
	ACTOR 3, "Nightmare", elemental012, 6, -10, 95	
	ACTOR 4, "Security terminal", circuitbuttonsdown, 1, 24, 68	
	ACTOR 5, "Terminal", circuitbuttonsdown, 1, 70,69	
	ACTOR 6, "Attack bot terminal", circuitbuttonsdown, 1, 42, 69	
	
	FACE 1, 0
	SEL 1
	SEL 2
	POSE 6, 7
	SEL 3
	POSE 6, 7
	
	N: This footage is from 275 years ago.	
	
	5: Please enter your login name: 
	1: Daemonium	
	5: Please enter your password:
	1: diesilverdie
	5: Access granted
	SOUND voice\access_granted
	1: Good, now what should I write in my diary today?
	1: Mm...
	MOVE 2, 20, 85
	MOVE 3, 30, 95
	WAIT 4.0
	1: You again!?
	SEL 1
	POSE 3
	WAIT 1.0
	1: Haven't I killed enough of your kind already?
	WAIT 1.0
	2: Please holster your weapon, we are here to talk, not fight.
	3: We have an offer to make to you.
	SEL 1
	POSE 4
	1: Very well, let's hear it.
	2: Our Queen wants to negotiate a truce between you and us.
	2: We want to survive and we merely seek refuge here.
	2: We have nowhere else to go.
	3: We are willing to retreat to the south east and south side of the bunker, leaving the north side to you.
	3: You are a refugee too, right?
	1: I wouldn't be if that damned Silver stopped hunting me.
	1: All I did was kill his wife, how was I supposed to know that he'd hold a grudge this long against me?
	2: Ahem, yes, killing one's lover can cause such a reaction.
	2: Do you accept our deal?
	1: Mm, I suppose it would make it a lot easier on me and allow me to sleep better at night.
	2: We will no longer attack you, if you stay out of our territory and leave us alone.
	3: You have already killed too many of our kind, yet we are too numorous for you to defeat if we attack all at once.
	2: Several of us want gang up on you and destroy you, but our Queen demanded that we talk to you first.
	1: /a sighs.
	1: Very well, I will leave you alone, if you leave me alone.
	1: I also want access to those growth vats I spotted.
	2: No, that is not negotiable.
	SEL 1
	POSE 1
	WAIT 1.0
	1: Oh, really?
	3: Very well, you can have one growth vat, we need the others ourselves.
	SEL 1
	POSE 4
	WAIT 1.0
	1: That is acceptable.
	HOST_GIVE T948
	CALL 5098@soundstatic
	GOTO SCENE 5231


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;	
SCENE 5236, bunkerbedcommander, CUT, "Security tape #103"

	FLAGS	17792

	ACTOR 1, "Daemonium", Daemonium, 4, 56, 88

	N: This footage is from 274 years ago.

	1: At last, Doctor Melchior's research is all mine!
	1: I had to gouge out his left eye and threaten to take his right eye too before he gave in.
	1: Now that I have the mutant research data, I can finally start growing my own army!
	1: The first ones to fall will be those pesky %M1701s.
	1: I want this bunker all to myself.
	1: I'll need to upload this data to the terminal before I can use it, but in the meantime, mm...
	1: Where should I hide it?
	WAIT 1.0
	MOVE 1, 40, 97
	WAIT 3.0
	1: I suppose that below the bed will make for a good hiding place.
	HOST_GIVE T949
	CALL 5098@soundstatic
	GOTO SCENE 5231
	

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;	
SCENE 5237, bunkergrowthvats, CUT, "Security tape #442"

	FLAGS	17792

	ACTOR 1, "Daemonium", Daemonium, 4, 47, 92
	ACTOR 2, "Mutant", gun014, 1, 32, 95
	ACTOR 3, "Mutant", gun014, 1, 40, 90	
	ACTOR 4, "Nightmare", elemental012, 6, 110, 85	
	ACTOR 5, "Nightmare", elemental012, 6, 110, 95	
	ACTOR 11, "Terminal", staticactors, 9, 34, 89
	ACTOR 12, "Keypad", stealth2, 8, 18, 73
	ACTOR 13, "Keypad", stealth2, 8, 81, 73
	
	SEL 2
	POSE 4, 1
	SEL 3
	POSE 4, 1	
	SEL 4
	POSE 6,7
	SEL 5
	POSE 6,7
	
	N: This footage is from 264 years ago.
	
	1: Hah, my first prototypes are ready, let's see them in action.
	WAIT 2.0
	MOVE 4, 75, 85
	MOVE 5, 90, 90
	WAIT 3.0
	4: Daemonium, what is the meaning of this?
	1: I thought the meaning was pretty clear.
	1: I'm canceling our truce, %M1713s, ATTACK!
	SEL 1
	POSE 1
	WAIT 1.0
	4: This betrayal will not go unpunished!
	SEL 1
	POSE 4
	WAIT 2.0
	
	MOVE 2, -50, 50, 1
	MOVE 3, -50, 50, 1
	MOVE 4, -50, 50, 1
	MOVE 5, -50, 50, 1
	
	TAKE H50000
	FIGHT2 1713.32.95, 1713.40.90, -1714.75.85, -1714.90.90	
	GIVE L50000
	
	1: That went swift and brutal, just the way I like it.
	WAIT 2.0
	HOST_GIVE T950
	CALL 5098@soundstatic
	GOTO SCENE 5231
	

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;	
SCENE 5238, bunker01, SCENE, "Final fight"

	CALL 5097@addGunslinger

	MUSIC mortal

	IF T966, @nothingHere
	IF DEAD, @resurrectFirst

	ACTOR 1, "Daemonium", Daemonium, 4, 58,93
	ACTOR 2, "Nightmare Queen", nightmare, 4, 30, 90	
	ACTOR 3, "Nightmare", elemental012, 6, 19,82
	ACTOR 4, "Nightmare", elemental012, 6, 11, 95	
	
	IF T961|T962, @dealWithQueen
	
	FACE 1,0
	SEL 2
	POSE 1, 4
	SEL 3
	POSE 6, 7
	SEL 4
	POSE 6, 7
	
	2: We had no issue with you, Daemonium, until your betrayal.
	1: Yeah, about that...
	1: I'm sorry.
	2: I am sure you are.
	1: Yeah, you see, there are these %Cs that have infiltrated the bunker.
	1: They're killing your %M1701 children and they're hunting me down.
	1: How do you feel about a truce and that we deal with them first?
	2: How do you feel about me ripping your arm off and shoving it up your ass?
	2: We are done with your betrayal!
	SEL 1
	POSE 1
	1: Fine, I'll deal with them myself!
	WAIT 2.0
	FACE 1,1
	1: Oh, fuck...
	1: How long have you been standing there?
	H: Long enough.
	H: Daemonium, I'm hereby placing you under arrest.
	1: Like hell you will!
	8: If you don't come with us, then we'll drag your ass away like a dirty ten GP slave.
	1: Bring it on!
	H: Never bring a sword to a gun fight.
	
	MOVE 1, 58, -93, 1
	MOVE 8, 80, -95, 1
	
	IF -T940, @skipSecurityBots
	FIGHT 1715.58.93, -1712, -1712

@skipSecurityBots	
	IF T940, @skipHardFight
	FIGHT2 1715.58.93

@skipHardFight
	MOVE 1, 58, 93, 1
	FACE 1, 2
	IF LOSE, @lostDaemoniumFight

	CALL 984@rewardMissionPP
	CALL 5199@continueAfterGunslingerFight
	CALL 5198@checkCPR

	1: /a coughs up blood and wipes it away with back of his hand.
	1: You may have beaten me know, but you won't catch me so easily!
	WAIT 2.0
	MOVE 1, 115, 93, 2
	HOST_GIVE T962
	GOTO @dealWithQueen

@lostDaemoniumFight
	HOST_GIVE T961
	WAIT 2.0
	1: Nice try, I'll be seeing you again.
	WAIT 2.0
	MOVE 1, 115, 93, 2
	CALL 5199@continueAfterGunslingerFight
	CALL 5198@checkCPR
	GOTO @dealWithQueen
	
@dealWithQueen
	; Just in case the hero left the scene early and then returns, move Daemonium away.
	MOVE 1, -50, -50, 1
	2: Have you come to destroy me, %C? (Yes/No)
	ASK 300
	IF YES, @fightQueen
	
	2: Good, I was hoping that you would be willing to talk. 
	H: My quarrel isn't with your kind. 
	IF -T870, @skipARLcomment
	H: I have spared the life of a %M1702 in the research lab too.
	2: That was my daughter, so she is still alive then?
	H: Alive and well.
	2: You have my gratitude.
	
@skipARLcomment
	2: We have been hunted down by %Cs ever since our creation.
	2: However, we never choose to become what we are.
	2: Very few of us are left now, most of my kind was captured and send to an extra dimensional space.
	2: That space is most commonly known as Unknown Hell or the void as we call it.
	2: The void drove my kind mad, but it also increased their power by a hundred-fold.
	H: How do you know this?
	2: We managed to contact them in the past, however, Daemonium interrupted our plans.
	2: We were trying to liberate our brethren while they were still sane.
	2: However, we have lost contact with them and we have no way to restore it.
	2: Besides, our brethern too far gone now.
	2: If only we had Samuel's technology.
	H: What do you mean?
	2: Samuel Raven has found a way to travel between dimensions, he has even visited the void.
	2: You may believe that Atsumori and Devil are the rulers of the world, but their power pales compared to the true power of Samuel.
	H: Well, I am not opposed to letting you live, but I rather don't see your kind from Unknown Hell return.
	2: I assure you, neither do we.
	2: At least, not anymore.
	2: They are as much of a threat to us now as they are to you.
	H: So, where do we stand?
	2: My faction will leave you alone, if you leave us alone.
	2: We will remain in this bunker as we have for the past 276 years.
	H: That is acceptable.
	H: I have shut down the growth vats, the %M1713s will eventually die and not return.
	H: Out of curiosity, top side there were many broken stasis pods, did you have anything to do with that?
	2: Yes, we took those people when we noticed the power failing.
	2: We only managed to save two %C64s.
	2: Although they are our sworn enemies, it was dishonorable to kill them like this.
	H: What happened with those you took?
	2: We turned them into %M1701s through the growth vats.
	2: Like Atsumori, Devil, Samuel, and even Daemonium and Silver, we age very slowly, making us nearly immortal.
	2: However, since there are no more people left in the stasis pods, we will eventually go extinct.
	3: My Queen, it is time that we take our leave, we have other matters that we must attend.
	2: Yes, we must go now.
	H: Perhaps we'll meet again one day.
	WAIT 2.0
	MOVE 2, -30, 90
	MOVE 3, -19, 82
	MOVE 4, -19, 95
	WAIT 2.0
	HOST_GIVE T963
	GOTO @reward
	
@fightQueen
	2: You have choosen poorly.
	H: You're an abmination that must be destroyed.
	MOVE 2, -30, -90, 1
	MOVE 3, -19, -82, 1
	MOVE 4, -11, -95, 1
	MOVE 8, -80, -95, 1
	
	FIGHT2 1711.30.90, 1710.19.82, 1710.11.95
	
	MOVE 8, 80, 95, 1
	
	CALL 984@rewardMissionPP	
	IF LOSE, @lostQueenFight
	
	CALL 5199@continueAfterGunslingerFight
	CALL 5198@checkCPR
	8: That's how it's done!
	N: %T964
	HOST_GIVE T964
	GOTO @reward

@lostQueenFight	
	CALL 5199@continueAfterGunslingerFight
	CALL 5198@checkCPR
	8: Crap, that didn't go as planned.
	N: %T965
	HOST_GIVE T965
	GOTO @reward
	
@reward
	N: %T966
	HOST_GIVE T966
	END
	
@resurrectFirst
	IF T887|T888, @resurrectFirstActor
	N: Resurrect first before entering this scene.
	END
	
@resurrectFirstActor	
	8: Oh #<g.man>, you really need to see the Doc first.
	8: We can't do anything here while you're in this state.
	END

@nothingHere
	IF T887|T888, @nothingHereActor
	N: There is nothing left to do here.
	END
	
@nothingHereActor
	8: It seems like everybody is gone now.
	H: Yeah, let's go.
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5239, bunkergrowthvats, SCENE, "Growth vats"

	CALL 5097@addGunslinger
	
	ACTOR 1, "Terminal", staticactors, 9, 34, 89
	ACTOR 2, "Keypad", stealth2, 8, 18, 73
	ACTOR 3, "Keypad", stealth2, 8, 81, 73

	SET codeLeft, 0
	SET codeRight, 0

	IF T955, @terminatedGrowthVats
	IF T954, @scaredAwayMutants		

	ACTOR 11, "Terminal", staticactors, 9, 34, -89
	ACTOR 12, "Keypad", stealth2, 8, 18, -73
	ACTOR 13, "Keypad", stealth2, 8, 81, -73
	
	MOVE 1, 34, -89, 1
	MOVE 2, 18, -73, 1
	MOVE 3, 81, -73, 1
	MOVE 11, 34, 89, 1
	MOVE 12, 18, 73, 1
	MOVE 13, 81, 73, 1
	MOVE 8, -50, -50,1
	
	CALL 5199@continueBeforeGunslingerFight
	IF -T940, @skipSecurityBots
	FIGHT 1706, 1707, 1708, 1709, -1712, -1712

@skipSecurityBots	
	IF T940, @skipHardFight
	FIGHT2 1706, 1707, 1708, 1709

	CALL 5199@continueAfterGunslingerFight
	
@skipHardFight
	MOVE 1, 34, 89, 1
	MOVE 2, 18, 73, 1
	MOVE 3, 81, 73, 1
	MOVE 11, 34, -89, 1
	MOVE 12, 18, -73, 1
	MOVE 13, 81, -73, 1

	IF WON, @won
	ACTOR 4, "Mutant", gun014, 4, -10, 90
	MOVE 4, 30, 90
	WAIT 3.0
	4: Haha, puny %C.
	4: Growth vats ours, you stay away.
	CALL 5198@checkCPR
	WAIT 4.0
	GOTO EXIT

@won
	CALL 984@rewardMissionPP
	CALL 5198@checkCPR	
	HOST_GIVE T954	
	CALL 5097@addGunslinger
	MOVE 8, 80, 95, 1
	8: That sure was a fine mess, I'm glad that we won.
	END
		
@visitTopLevel
	8: We need to return to the teleporter from the military research facility.
	8: Use the terminal to update the teleportation locations first, after that we can teleport.
	END
	
@scaredAwayMutants
	IF T887|T888, @scaredAwayMutantsActor
	N: You scared away all the %M1713s.
	END
	
@scaredAwayMutantsActor
	8: It looks like we scared away all those %M1713s.
	END
	
@terminatedGrowthVats
	MOVE 1, 34, -89, 1
	MOVE 2, 18, -73, 1
	MOVE 3, 81, -73, 1
	MOVE 11, 34, 89, 1
	MOVE 12, 18, 73, 1
	MOVE 13, 81, 73, 1

	CALL 5097@addGunslinger
	IF T887|T888, @terminatedGrowthVatsActor
	
	N: There is left to do here.
	N: Visit the teleporter in the military research facility once you collected both %I2185 and %I2186.
	END
	
@terminatedGrowthVatsActor	
	8: We can't do anything else here, %1.
	8: Once have both %I2185 and %I2186 we should visit the teleporter in the military research facility though.
	8: We can gain access to the portal point on this level that way.
	8: You should click on the terminal to make it so.
	END
	
@eventActorClick1
	IF DEAD, @died
	IF T955, @nothingToDO
	MENU "Confirm codes=@confirmCodes", "Help=@helpTerminal", "Cancel=@end"
	END

@eventActorClick2
	IF DEAD, @died
	IF T955, @nothingToDO
	2: Enter pincode [XXX]:
	ASK 300
	COMPARE #<lastAsk>, "999"
	IF= @setPincodeLeft
	2: Attempt failed
	SOUND voice\attempt_failed
	2: Invalid code, code is not accepted.	
	END

@eventActorClick3
	IF DEAD, @died
	IF T955, @nothingToDO
	3: Enter pincode [XXX]:
	ASK 300
	COMPARE #<lastAsk>, "999"
	IF= @setPincodeRight
	3: Attempt failed
	SOUND voice\attempt_failed
	3: Invalid code, code is not accepted.	
	END
	
@setPincodeLeft
	2: Code accepted.
	SET codeLeft, #<lastAsk>
	END
	
@setPincodeRight
	3: Code accepted.
	SET codeRight, #<lastAsk>
	END	
	
@confirmCodes
	STRCMP #<codeLeft>, #<codeRight>
	IF!= @codesDoNotMatch
	STRCMP #<codeLeft>, "999"
	IF!= @incorrectCodeEntered
	IF -T942, @securityActive
	1: Shutting down growth vats, this will kill the growing %M1713s inside.
	1: Please confirm that this is your intention [YES/NO]:
	ASK 300
	IF -YES, @cancelOrder
	1: Shutdown in progress, please stand-by...
	WAIT 2.0
	SOUND turn-power-off
	WAIT 4.0
	SOUND voice\unit_disabled
	1: Unit disabled.
	HOST_GIVE T955
	N: You found an %I2186.	
	HOST_GIVE I2186
	IF T887|T888, @rewardActor
	N: Visit the teleporter in the military research facility once you have %I2185 and %I2186.
	END

@cancelOrder
	1: Shut down procedure is canceled.
	END	
	
@securityActive
	1: Status red
	SOUND voice\status_red
	1: Security is not disabled, security forces are alerted.

	MOVE 1, 34, -89, 1
	MOVE 2, 18, -73, 1
	MOVE 3, 81, -73, 1
	MOVE 11, 34, 89, 1
	MOVE 12, 18, 73, 1
	MOVE 13, 81, 73, 1
	MOVE 8, -50, -50,1
	
	CALL 5199@continueBeforeGunslingerFight
	IF -T940, @skipSecurityBots2
	FIGHT 1706, 1707, 1708, 1709, -1712, -1712

@skipSecurityBots	
	IF T940, @skipHardFight2
	FIGHT2 1706, 1707, 1708, 1709

@skipHardFight2
	MOVE 1, 34, 89, 1
	MOVE 2, 18, 73, 1
	MOVE 3, 81, 73, 1
	MOVE 11, 34, -89, 1
	MOVE 12, 18, -73, 1
	MOVE 13, 81, -73, 1	
	MOVE 8, 80, 95, 1
	
	CALL 984@rewardMissionPP
	CALL 5198@gunslingerCPRAndAfterFightQuotes
	8: Ouch, we better don't try that again.
	END
	
@rewardActor	
	8: We need that %I2186 to get access to the local portal point.
	IF I2185, @visitTopLevel
	8: Visit the teleporter top level once you have %I2186 too.
	END	

@codesDoNotMatch
	1: CRITICAL ERROR: the codes in the left and right keypad do not match.
	1: Go back and set the correct codes.
	END
	
@incorrectCodeEntered
	1: CRITICAL ERROR: incorrect codes entered in the keypads.
	1: Go back and set the correct codes.
	END	
	
@helpTerminal
	1: You need to enter the same code in the left and right Keypad.
	1: Enter '999' to shut down the growth vats and to kill the %M1713s growing inside.
	1: Make sure that the security is disabled first, you can do so at the terminal to the north west.
	1: Failing to do so will alert security.
	END	
	
@nothingToDO
	IF T887|T888, @nothingToDoActor
	N: You have already turned off the growth vats, there is nothing left for you to do here.
	END	

@nothingToDoActor
	8: There is nothing more we can do here, we should move before those %M1714s come back.
	END
	
@died
	IF T887|T888, @diedActor
	N: You cannot do anything while you are dead.
	END
	
@diedActor
	8: We need to get you to Doc Adlington asap!
	END
	
@end
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5240, bunkerbedcommander, SCENE, "Commander's quarters"

	CALL 5097@addGunslinger

	IF DEAD, @died
	
	SET random, %R2
	
	ACTOR 1, "Sleep", circuitbuttons, 9, 19, 77
	ACTOR 2, "Search desk left side", circuitbuttons, 9, 48, 70	
	ACTOR 3, "Search desk right side", circuitbuttons, 9, 67, 70	
	ACTOR 4, "Hiding place", stealth2, 1, 19, 96
	ACTOR 5, "Check landmap", circuitbuttons, 9, 18, 55	
	
	8: Damn, who messed up this place so badly?
	END

@died
	IF T887|T888, @diedActor
	N: You cannot do anything while you are dead.
	END
	
@diedActor
	8: I'm afraid you need to visit Doc first before you can do anything here.
	END
	
@eventActorClick1
	IF T887|T888, @noSleepActor
	N: With the %M1713s and %M1714s running around, you deem it too dangerous to sleep here.
	END

@noSleepActor
	8: Eh-, although I'd love stand guard, I don't think it's safe to sleep here.
	8: Those %M1713s or %M1714s can attack at any given moment and they'll likely overwhelm me.
	H: Yeah, I suppose you're right.
	END

@eventActorClick2
	SET temp, 1
	CALL @searchDesk
	END
	
@eventActorClick3
	SET temp, 2
	CALL @searchDesk
	END	
	
@searchDesk	
	COMPARE #<random>, #<temp>
	IF= @findLoginDetails
	
@findJunk
	N: You find nothing but junk inside the desk.
	WAIT 1.0
	RETURN	

@findLoginDetails
	N: You discover a crumpled paper with notes.
	N: Unfortunately, the letters are too faded to read.
	WAIT 1.0
	RETURN
	
@eventActorClick4
	IF T1108, @nothingHere
	N: You found a %I2621 in Daemonium's secret hiding space!
	HOST_GIVE I2621
	HOST_GIVE T1108
	WAIT 2.0
	8: Sweet, that's a very good one!
	8: Daemonium must have thought it would protect him from Silver's wrath.
	END
	
@nothingHere
	IF T887|T888, @nothingHereActor
	N: There is nothing here anymore.
	END
	
@nothingHereActor
	8: There doesn't seem to be anything there anymore.
	END
	
@eventActorClick5
	N: You study the landmap for a while...
	WAIT 5.0
	N: It appears to be an old military map with mission details that lost their relevance hundreds of years ago.
	END
	
@eventHostGive
	CALL 5199@continueGunslingerDrink
	END	


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; 
SCENE 5241, bunker02, SCENE, "Portal point"

	ACTOR 1,	"Teleporter", gun005, 1, 12, 93
	
	CALL 5097@addGunslinger
	
	IF T887|T888, @commentActor
	END
	
@commentActor
	8: Let's hope that this thing didn't break down, it'll be impossible to go back if it did.
	END

@eventActorClick1
	SOUND tesla_charge
	WAIT 2.0	
	GOTO LINK 38, 10, 0	


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5242, bunkerhallway, SCENE, "Nightmare infestation"

	IF T952|T953, @nothingLeft

	ACTOR 1, "Nightmare", elemental012, 6, 48, 87
	ACTOR 2, "Nightmare", elemental012, 6, 40, 80
	ACTOR 3, "Nightmare", elemental012, 6, 20, 95
	ACTOR 4, "Nightmare", elemental012, 6, 57, 93
	ACTOR 5, "Nightmare Queen", nightmare, 4, 30, 90
	
	1: Protect the Queen!
	MOVE 5, -20, 90
	2: Kill the intruder!

	WAIT 3.0
		
	MOVE 1, -50, 50, 1
	MOVE 2, -50, 50, 1
	MOVE 3, -50, 50, 1
	MOVE 4, -50, 50, 1		

	CALL 5199@continueBeforeGunslingerFight
	IF -T940, @skipSecurityBots
	FIGHT 1710.48.87, 1710.40.80, 1710.20.95, 1710.57.93, -1712, -1712

@skipSecurityBots	
	IF T940, @skipHardFight
	FIGHT2 1710.48.87, 1710.40.80, 1710.20.95, 1710.57.93

@skipHardFight	
	CALL 984@rewardMissionPP
	IF WON, @won
	HOST_GIVE T952
	GOTO @reward

@won
	HOST_GIVE T953	
	GOTO @reward
		
@reward	
	CALL 5097@addGunslinger
	MOVE 8, 80, 95, 1
	N: You found an %I2185.	
	HOST_GIVE I2185
	CALL 5198@gunslingerCPRAndAfterFightQuotes
	IF T887|T888, @rewardActor
	N: Visit the teleporter in the military research facility once you have %I2185 and %I2186.
	END
	
@rewardActor	
	8: We need that %I2185 to get access to the local portal point.
	IF I2186, @visitTopLevel
	8: Visit the teleporter top level once you have %I2186 too.
	END

@visitTopLevel
	8: We need to return to the teleporter from the military research facility.
	8: Use the terminal to update the teleportation locations first, after that we can teleport.
	END

@nothingLeft
	IF T887|T888, @nothingLeftActor
	N: There is nothing left here.
	N: Visit the teleporter in the military research facility once you have both %I2185 and %I2186.
	END	
	
@nothingLeftActor
	CALL 5097@addGunslinger
	8: There is nothing left for us to do here, partner.
	8: We'll need to go to the teleporter in the military research facility once you have both %I2185 and %I2186.
	8: We can get access to the local portal point here once you have them both.
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5243, bunkerstorage03, SCENE, "Storage room #1"

	IF T957, @nothingHere

	N: Several mutants attack!

	CALL 5199@continueBeforeGunslingerFight
	IF -T940, @skipSecurityBots
	FIGHT 1708, 1708, 1709, -1712, -1712

@skipSecurityBots	
	IF T940, @skipHardFight
	FIGHT2 1708, 1708, 1709

@skipHardFight
	CALL 984@rewardMissionPP
	CALL 5199@continueAfterGunslingerFight		
	
	CALL 5097@addGunslinger
	MOVE 8, 80, 95, 1
	IF LOSE, @lost
	CALL 5198@checkCPR

	8: And stay dead, you mutant scum!

	WAIT 2.0
	N: %T957
	HOST_GIVE T957
	END	
	
@lost
	CALL 5198@checkCPR
	IF T887|T888, @lostActor
	N: You lost the fight, the %M1706s continue to keep control of Storage room #1.
	WAIT 3.0
	GOTO EXIT
	
@lostActor	
	8: Oh, hell no!
	8: We'll need to destroy these bastards.
	H: Yeah, screw them.
	WAIT 4.0
	GOTO EXIT

@nothingHere
	IF T887|T888, @nothingHereActor
	N: There is nothing here anymore.
	END

@nothingHereActor	
	CALL 5097@addGunslinger
	8: The only good mutant is a dead mutant.
	H: Yes, and it looks like these are all exterminated.
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5244, bunkerstorage03, SCENE, "Storage room #2"

	IF T958, @nothingHere

	N: Several mutants attack!

	CALL 5199@continueBeforeGunslingerFight
	IF -T940, @skipSecurityBots
	FIGHT 1706, 1706, 1707, -1712, -1712

@skipSecurityBots	
	IF T940, @skipHardFight
	FIGHT2 1706, 1706, 1707

@skipHardFight
	CALL 984@rewardMissionPP
	CALL 5199@continueAfterGunslingerFight		
	
	CALL 5097@addGunslinger
	MOVE 8, 80, 95, 1
	
	IF LOSE, @lost
	CALL 5198@checkCPR

	8: These mutants really are an inspiration for birth control.

	WAIT 2.0
	N: %T958
	HOST_GIVE T958
	END	
	
@lost
	CALL 5198@checkCPR
	IF T887|T888, @lostActor
	N: You lost the fight, the %M1706s continue to keep control of Storage room #2.
	WAIT 3.0
	GOTO EXIT
	
@lostActor	
	8: Geez, talk about things taking a turn for the worse.
	8: We'll take revenge, right?
	H: Yeah, but let's get patched up first.
	WAIT 4.0
	GOTO EXIT	
	
@nothingHere
	IF T887|T888, @nothingHereActor
	N: There is nothing here anymore.
	END

@nothingHereActor	
	CALL 5097@addGunslinger
	8: Sometimes it feels as if they're exterminators.
	H: Yeah, although it's too bad that a bug bomb doesn't work.
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5245, bunkerbedleft, SCENE, "Trashed bedroom"

	IF T959, @nothingHere

	WAIT 2
	ACTOR 1, "Charley Kissinger", monster039, 1, 39, 79

	MOVE 1, 48, 88
	WAIT 2
	
	1: Oh, hey %1, I see you found your way in here too?
	H: Yeah, I figured I'd investigate everything. 
	1: Well, there is not much left here, except for-...
	1: Crap, do you hear that?
	1: I hate to run, but they got me pretty bad earlier, I need to retreat.
	MOVE 1, 120, 88, 2
	H: Oh, crap!
	
	IF -T940, @skipSecurityBots
	FIGHT 1706, 1706, 1707, 1708, 1709, -1712, -1712

@skipSecurityBots	
	IF T940, @skipHardFight
	FIGHT2 1706, 1706, 1707, 1708, 1709

@skipHardFight
	CALL 984@rewardMissionPP	
	CALL 5097@addGunslinger
	MOVE 8, 80, 95, 1
	IF LOSE, @lost
	CALL 5199@continueAfterGunslingerFight	
	CALL 5198@checkCPR
	N: You found a %I2557.
	HOST_GIVE I2557
	HOST_GIVE T959
	8: Way to go!
	END

@lost
	CALL 5199@continueAfterGunslingerFight	
	CALL 5198@checkCPR
	IF T887|T888, @lostActor
	N: The %M1706s maintain control over this room.
	WAIT 3.0
	GOTO EXIT
	
@lostActor	
	8: That could have gone better.
	8: Let's get you patched up and try again.
	WAIT 3.0
	GOTO EXIT

@nothingHere
	IF T887|T888, @nothingHereActor
	N: There is nothing here anymore.
	END

@nothingHereActor	
	CALL 5097@addGunslinger
	8: It looks like we scared them off for good.
	H: Yeah, those bastards put up a good fight.
	END

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5246, bunkermesshall, SCENE, "Mess hall"

	IF T960, @nothingHere

	N: The %M1701s attack you on sight!

	CALL 5199@continueBeforeGunslingerFight
	IF -T940, @skipSecurityBots
	FIGHT 1710, 1710, 1710, -1712, -1712

@skipSecurityBots	
	IF T940, @skipHardFight
	FIGHT2 1710, 1710, 1710

@skipHardFight
	CALL 984@rewardMissionPP
	CALL 5199@continueAfterGunslingerFight	
	
	CALL 5097@addGunslinger
	MOVE 8, 80, 95, 1
	IF LOSE, @lost
	CALL 5198@checkCPR

	8: Hah, they didn't know what hit them.
	WAIT 2.0
	N: After searching the room, you find five %I976s.
	HOST_GIVE I976.5
	HOST_GIVE T960
	WAIT 2.0
	H: These %I976s sure had time to age.
	END	
	
@lost
	CALL 5198@checkCPR
	IF T887|T888, @lostActor
	N: You lost the fight, the %M1710s continue to keep control of the mess hall.
	WAIT 3.0
	GOTO EXIT
	
@lostActor	
	8: Shit, that went terrible.
	8: Let's get you patched up and try this again.
	WAIT 3.0
	GOTO EXIT
	
@nothingHere
	IF T887|T888, @nothingHereActor
	N: There is nothing here anymore.
	END

@nothingHereActor
	CALL 5097@addGunslinger
	8: I hope that they stay gone, %M1701s are tough.
	H: Yeah, they'd be easier to kill if they didn't heal so much.
	END
	


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; BUNKER 9
; SCENES 5260 - 5299
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;	
	
SCENE 5260, bunkerstorage, CUT, "Drone testing"

	MUSIC born-to-be-wild

	; arg0 = total enemies, arg1 = drone health, arg2 = hits you can take, arg3 = hit chance multiplier drone 
	; difficulty is the number of hits you can take before dying
	SET scene, #<scene.id>
	CALL 5096@setup 10, 7, 15, 25
	END
	
@eventActorGive6
@eventActorGive7
@eventActorGive5
	COMPARE #<item.id>, "982"
	IF< @doesNothing
	IF> @doesNothing
	IF R50, @noEffect
	CALL 5096@eventActorGiveEMP
	END
	
@eventActorGive9
	COMPARE #<item.id>, "982"
	IF< @doesNothing
	IF> @doesNothing
	CALL 5096@eventActorGiveMissed
	
@eventActorAttack6
	CALL 5096@eventActorAttack6
	END
	
@eventActorAttack7
	CALL 5096@eventActorAttack7
	END	

@eventActorAttack5
	CALL 5096@eventActorAttack5
	END
	
@eventActorAttack9
	CALL 5096@eventActorAttackMiss
	END
	
@noEffect
	N: The %I982 had no effect on this drone!
	END
	
@reward
	HOST_GIVE T968
	N: %T968
	N: You found 4 %I980.
	HOST_GIVE I980.4
	WAIT 4.0
	GOTO SCENE 5012

@doesNothing
	N: This does nothing, try throwing an %I982 instead!
	END	


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5261, bunkercenter, SCENE, "Central teleporter"

	CALL 5097@addGunslinger

	ACTOR 1,	"Teleporter", gun005, 1, 58, 94

	CALL 5262@checkPower
	IF -T977, @noPower
	END
	
@eventActorClick1
	IF DEAD, @died
	IF -T977, @noPower
	SOUND tesla_charge
	WAIT 2.0
	IF T997|T998, @teleport
	SOUND tesla_shot
	WAIT 2.0
	1: ERROR: this teleporter is disconnected from the network.
	1: Contact system admin Nishka to update the status.
;	1: WARNING: local teleportation is disabled.
	END
	
@teleport
	GOTO SCENE 1205
	
@noPower
	IF T887|T888, @noPowerActor
	N: The power is off line, you cannot do anything until it is fixed.
	END
	
@noPowerActor
	8: We won't be able to do much until we get the power back online.
	8: The power core is to the west of us.
	END
	
@died
	IF T887|T888, @diedActor
	N: You cannot do anything while you are dead.
	END

@diedActor
	8: You need to fix yourself up before you can do anything here.
	8: You could also sleep it off in the bedroom north of the bathroom.
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5262, bunkerenergycore2, SCENE, "Power core"

	CALL 5097@addGunslinger	
	CALL @checkPowerLocal

	IF T978, @powerBackOnline
	IF T977, @reconfiguredCircuitBoard
	ACTOR 1, "Circuit board", staticactors, 6, 35, 90	

	IF T976, @replacedCircuitBoard
	IF T975, @replacingCircuitBoard

	IF T887|T888, @commentActor
	N: Find a %I2176 to replace the broken circuit board.
	N: Maybe you can find one in the storage room to the south?
	END
	
@commentActor
	8: It looks like the circuit board is busted.
	8: We'll need to find a %I2176 to replace the broken circuit board.
	8: After we replaced it, we'll also need to reconfigure it.
	H: Any suggestions where we should look for that %I2176?
	8: Mm, I'd try south of here, I believe there is a storage room there.
	END
	
@replacingCircuitBoard
	IF T887|T888, @replacingCircuitBoardActor
	N: You have a %I2176, click on the circuit board to replace it.
	END

@replacingCircuitBoardActor
	8: Good, we have the %I2176.
	8: Click on the circuit board to replace it.
	END	
	
@replacedCircuitBoard
	IF T887|T888, @replacedCircuitBoardActor
	N: You have replaced the circuit board, now you need to reconfigure it.
	END
	
@replacedCircuitBoardActor
	8: Good, the circuit board is replaced, but we still need to reconfigure it.
	END
		
@eventActorClick1
	IF -T975, @noReplacementBoard
	IF -T976, @replaceCircuitBoard
	GOTO SCENE 5114

@noReplacementBoard
	IF T887|T888, @noReplacementBoardActor
	N: You need to find a %I2176 first before you can replace the broken circuit board.
	END

@noReplacementBoardActor
	8: We need to find a %I2176 first before we can replace the broken circuit board.
	8: I believe there is a storage room to the south, maybe we can check it for supplies?
	H: It wouldn't hurt to try.
	END
	
@replaceCircuitBoard
	N: You take a moment to study the broken circuit board.
	WAIT 4.0
	N: You remove the broken circuit board and start replacing it with the %I2176.
	SOUND wheelnutairgun
	WAIT 3.0
	N: You successfully replaced the broken circuit board!
	HOST_GIVE T976
	HOST_TAKE I2176
	IF T887|T888, @replacedCircuitBoardActor
	N: You need to reconfigure it next.	
	END
	
@reconfiguredCircuitBoard
	COMPARE #<bunker9a>, "5"
	IF< @switchOrderSetNE
	IF= @switchOrderSetNW
	COMPARE #<bunker9a>, "6"
	IF= @switchOrderSetSE
	IF> @switchOrderSetSW

@switchOrderSet	
	IF T887|T888, @reconfiguredCircuitBoardActor
	N: The circuit board is reconfigured, but you still need to flip the switches in the right order to reactivate the power.
	N: The first switch you need to flip is to the #<bunker9first>.
	END
	
@reconfiguredCircuitBoardActor
	8: Alright, we've reconfigured the circuit board, but we'll still need to flip the switches in the correct order.
	8: If we get it wrong, then the system will reset itself. 
	8: I know that the first switch we need to flip is to the #<bunker9first>, but I have no idea which one will be next.
	END	
	
@switchOrderSetNE		
	SET bunker9first, "north east"
	GOTO @switchOrderSet
	
@switchOrderSetNW	
	SET bunker9first, "north west"
	GOTO @switchOrderSet

@switchOrderSetSE		
	SET bunker9first, "south east"
	GOTO @switchOrderSet
	
@switchOrderSetSW	
	SET bunker9first, "south west"
	GOTO @switchOrderSet
	
@powerBackOnline
	IF T887|T888, @powerBackOnlineActor
	N: The power is back online!
	END

@powerBackOnlineActor
	8: The power is back online!
	END

@checkPower
	IF T978, @skipPowerCheck
	COLOR 21
	RETURN
	
@checkPowerLocal
	IF T978, @skipPowerCheck
	COLOR 21
	BKGND bunkerenergycore
	RETURN	
	
@skipPowerCheck
	RETURN

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; 
SCENE 5263, bunkerflooded, SCENE, "Switch board", 2

	CALL 5097@addGunslinger
		
	ACTOR 1, "Switch board", staticactors, 1, 76, 68

	IF -T977, @fixCircuitBoardFirst
	IF T978, @finished

	IF T887|T888, @commentActor
	IF T1011, @end
	N: Click on the switch to turn it on, be careful to do it in the right order!
	END
	
@commentActor
	IF T1011, @end
	8: Just click on the switch to turn it on and pray that it was the right one.
	END

@eventActorClick1	
	IF DEAD, @died
	IF -T977, @fixCircuitBoardFirst
	IF T978, @finished
	IF -T1011, @firstSwitch
	IF -T1012, @secondSwitch
	IF -T1013, @thirdSwitch

	SOUND switch
	COMPARE #<num.closestLink>, #<bunker9d>
	IF< @guessedWrong
	IF> @guessedWrong
	GOTO @turnedPowerOn

@firstSwitch
	SOUND switch
	COMPARE #<num.closestLink>, #<bunker9a>
	IF< @guessedWrong
	IF> @guessedWrong
	HOST_GIVE T1011
	IF T887|T888, @firstSuccess
	N: You have flipped the correct switch.
	END

@firstSuccess	
	8: One down, three to go.
	END

@secondSwitch
	SOUND switch
	COMPARE #<num.closestLink>, #<bunker9b>
	IF< @guessedWrong
	IF> @guessedWrong
	HOST_GIVE T1012
	IF T887|T888, @secondSuccess
	N: You have flipped the correct switch.
	END
	
@secondSuccess
	8: Good, we're halfway there.
	END
	
@thirdSwitch
	SOUND switch
	COMPARE #<num.closestLink>, #<bunker9c>
	IF< @guessedWrong
	IF> @guessedWrong
	HOST_GIVE T1013
	IF T887|T888, @thirdSuccess
	N: You have flipped the correct switch.
	END

@thirdSuccess
	8: We're on a roll!
	8: Only one left to go, that one will be easy.
	END	

@guessedWrong
	SET temp, #<num.hostMaxHP>
	DIV temp, 2
	SUB temp, 1
	SOUND tesla_shot
	HOST_TAKE H#<temp>
	HOST_TAKE T1011
	HOST_TAKE T1012
	HOST_TAKE T1013
	IF T887|T888, @guessedWrongActor
	N: You guessed wrong, the switches resetted and you'll need to try again.
	END	
	
@guessedWrongActor
	8: Bloody hell, that was the wrong one.	
	IF DEAD, @guessedWrongActorDead
	8: We'll need to start over, remember, the first one is located #<bunker9first>.
	END

@guessedWrongActorDead	
	8: Are you okay?
	H: It could be better.
	8: You better visit Doc first, %1.
	END

@turnedPowerOn
	HOST_TAKE T1011
	HOST_TAKE T1012
	HOST_TAKE T1013
	HOST_GIVE T978	
	SOUND turn-power-on
	IF T887|T888, @turnedPowerOnActor
	N: You have successfully restored power to the base!
	END
	
@turnedPowerOnActor
	8: Hell yeah, we've done it! 
	8: The power is back online.
	END

@died
	IF T887|T888, @diedActor
	N: You cannot do anything while you are dead.
	END
	
@diedActor
	8: You require immediate CPR, you better use some %I771 or sleep it off in the bedroom, %1.
	END
	
@finished
	IF T887|T888, @finishedActor
	N: You have already restored power to the base!
	END
	
@finishedActor	
	8: We've already restored power to the base.
	8: Come on, let's get move on and take care of other things.
	END
	
@fixCircuitBoardFirst	
	IF T887|T888, @fixCircuitBoardFirstActor
	N: You can't do anything here until you changed and configured the circuit board in the power core.
	END

@fixCircuitBoardFirstActor
	8: We need to change and configure the circuit board at the power core first  before we can turn the power back on.
	END
	
@end
	END	
	

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5264, deusex04, SCENE, "Terminal"

	CALL 5097@addGunslinger
	CALL 5263@checkPower
	
	ACTOR 1, "Terminal", circuitbuttonsdown, 1, 57,70	
	
	IF T990, @done
	IF -T978, @nobodyHere
	
	IF -T825, @noCharley
	ACTOR 2, "Charley Kissinger", monster039, 1, 5, 90
	
	MOVE 2, 25, 90
	
	2: Hey there, %1, I see you found your way to bunker 9 too?
	H: Yeah, we just restored the power.
	2: Ah, that explains why the lights suddenly turned on, thank you.
	2: Did you notice that we can't teleport out of bunker 9 with our %I737?
	2: It appears that there is some sort of force field active.
	H: Crap, that sucks.
	8: Yeah, bunker 9 was the only place to have that.
	8: It was one of the latest inventions before the world went dark.
	2: We should try to kill the force field, this terminal might help us.
	H: That's a good idea, yeah.
	2: I found something that'll help. 
	H: Please tell.
	2: Well, first of all, the user name for the terminal is 'anderson' with password 'doubletime'.
	2: I think she was a local colonel or something. 
	8: Colonel Anderson, that sounds about right, yeah.
	8: She was a chill gal when she was off duty, but you didn't want to cross her while she was on duty.
	2: I also found this %I2625.
	2: I have no use of it, so you can have it.
	H: Thanks, Charley, I'm sure it'll come in handy.
	WAIT 2.0
	HOST_GIVE I2625
	HOST_GIVE T990
	N: You received a %I2625.
	N: The login details for anderson were uploaded to your Quest Diary.
	WAIT 2.0
	2: I'll see if I can find a way out of here, but I have a feeling that Nishka is remotely monitoring us.
	2: We should be able to teleport out with that central teleporter once we dealt with the main threat.
	H: Alright, that's good to know.
	H: I don't particularly enjoy being trapped here.
	2: Aye, I agree, but we can't let these freaks escape to the outside world either.
	2: I better get going, maybe we'll run into each other again later on.
	H: Good luck.
	8: It was good to see you again, Charley.
	2: Good luck to you as well.
	MOVE 2, -20, 90
	END
	
@nobodyHere
	IF T887|T888, @nobodyHereActor
	N: You notice that the terminal is offline due to a lack of power.
	END
	
@nobodyHereActor	
	8: We won't be able to do anything with that terminal until the power is restored.
	END
	
@eventActorClick1
	IF DEAD, @died
	IF -T978, @nobodyHere
	GOTO SCENE 5265	
	END
	
@noCharley
	ACTOR 3, "Document", circuitbuttonsdown, 1, 22,70	
	END
	
@eventActorClick3
	N: You find a document that mentions the login name 'anderson' and password 'doubletime'.
	WAIT 2.0
	HOST_GIVE T990
	HOST_GIVE I2625
	N: You also found a %I2625.
	END
	
@done
	END
	
@died
	IF T887|T888, @diedActor
	N: You cannot do anything while you are dead.
	END
	
@diedActor
	8: Geez, you really need some medical attention.
	8: I recommend you sleep it off in the bedroom to the north.
	END
	
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;	
SCENE 5265, check1, CUT, "Terminal"

	CALL 5101@setUpTerminal	11

	; These cookies are mandatory to implement
	SET scene, #<scene.id>
	SET sceneReturn, "5264"
	SET attempts, 5
	SET passwordScene, "doubletime"

@skipSetTempPassword
	
	CALL 5101@startScreen
	9: Click on the blinking cursor to enter text into the terminal.
	END
	
@eventActorClick1
	COMPARE #<loggedIn>, 1
	IF= @commandLine

	ASK 300
	
	STRCMP #<lastAsk>, "help"
	IF= @eventActorClick13
	
	CALL 5101@loginUser	
	CALL 5101@loginPassword
	
	; The actual password checking happens after confirming the correct login was used.
	STRCMP #<login>, "admin"
	IF= @admin 
	STRCMP #<login>, "anderson"
	IF= @anderson

	CALL 5101@invalidAccessRequest
	END
	
@eventActorClick13
	CALL 5101@requestHelp
	END
	
@eventActorClick14
	CALL 5101@hackToolMenu
	END	

@accessDenied
	CALL 5101@accessDenied
	END	

@admin
	; admin can search passwords.txt
	SET user, "admin"
	STRCMP #<password>, "admin"
	IF!= @accessDenied
	
	SET dir, "documents"
	SET path, "c:\#<dir>"
	GOTO @accessGranted

@anderson
	SET user, "anderson"
	STRCMP #<password>, #<passwordScene>
	IF!= @accessDenied
	
	SET dir, "program files"
	SET path, "c:\#<dir>"
	GOTO @accessGranted

@accessGranted	
	CALL 5101@accessGranted
	CALL 5101@loginSuccessful
	CALL 5101@commandAwaitingOrders	
	GOTO @commandLine

;---------------------------------
; COMMAND LINE
;---------------------------------
@commandLine
	ASK 300

	; Check the STRCMP commands first, then the STRSTR
	
	STRCMP #<lastAsk>, "logout"
	IF= @commandLogOut
	STRCMP #<lastAsk>, "logoff"
	IF= @commandLogOut
	
	STRCMP #<lastAsk>, "quit"
	IF= @commandQuit

	STRCMP #<lastAsk>, "cd ./"
	IF= @commandCloseDirectory
		
	STRCMP #<lastAsk>, "dir"
	IF= @commandViewDirectory
	
	STRCMP #<lastAsk>, "exit"
	IF= @commandExitProgram
	
	STRCMP #<lastAsk>, "close"
	IF= @commandCloseFile
	
	STRSTR #<lastAsk>, "open"
	IF> @commandOpenFile
	
	STRSTR #<lastAsk>, "run"
	IF> @commandRunProgram

	STRCMP #<lastAsk>, "cd program files"
	IF= @commandOpenDirectoryProgramFiles

	STRCMP #<lastAsk>, "cd documents"
	IF= @commandOpenDirectoryDocuments
	
	STRCMP #<lastAsk>, "help"
	CALL 5101@requestHelp

	CALL 5101@invalidCommand
	GOTO @commandLine
	
@commandLogOut
	CALL 5101@commandLogOut

@commandQuit
	CALL 5101@commandQuit

@commandViewDirectory
	CALL 5101@commandSearching
	
	STRCMP #<path>, "c:\"
	IF= @commandViewDirectoryRoot
	
	STRCMP #<path>, "c:\documents"
	IF= @commandViewDirectoryDocuments
	
	STRCMP #<path>, "c:\program files"
	IF= @commandViewDirectoryProgramFiles
	GOTO @commandLine
	
@commandViewDirectoryRoot	
	SET lastAsk, ""
	SET terminalText, "documents"
	CALL 5101@writeText	1
	SET terminalText, "program files"
	CALL 5101@writeText	1
	GOTO @commandLine

@commandViewDirectoryDocuments
	STRCMP #<login>, "engineer"
	IF= @invalidAccessDirectory
	
	CALL 5101@updateProgramName "#<path>"

	SET lastAsk, ""
	SET terminalText, "passwords.txt"
	CALL 5101@writeText	1
	GOTO @commandLine
	
@commandViewDirectoryProgramFiles
	CALL 5101@updateProgramName "#<path>"
	
	SET lastAsk, ""
	SET terminalText, "security.exe"
	CALL 5101@writeText	1
	SET terminalText, "diagnostics.exe"
	CALL 5101@writeText	1
	GOTO @commandLine

@commandOpenDirectoryRoot
	SET dir, "c:\"
	SET path, "#<dir>"
	
	SET lastAsk, ""
	SET terminalText, "#<path>"
	CALL 5101@writeText	1	
	GOTO @commandLine
	
@commandOpenDirectoryProgramFiles
	SET dir, "program files"
	SET path, "c:\#<dir>"
	
	SET lastAsk, ""
	SET terminalText, "#<path>"
	CALL 5101@writeText	1	
	GOTO @commandLine		

@commandOpenDirectoryDocuments
	STRCMP #<user>, "anderson"
	IF= @invalidAccessDirectory
	
	SET dir, "documents"
	SET path, "c:\#<dir>"
	
	SET lastAsk, ""
	SET terminalText, "#<path>"
	CALL 5101@writeText	1	
	GOTO @commandLine
	
@commandCloseDirectory
	STRCMP #<dir>, "c:\"
	IF= @commandCloseDirectoryRoot
	GOTO @commandOpenDirectoryRoot

@invalidAccessDirectory	
	7: ERROR: You have insufficient rights to access this directory.
	GOTO @commandLine
	
@invalidAccessFile	
	7: ERROR: You have insufficient rights to access this file.
	GOTO @commandLine	

@invalidAccessProgram
	7: ERROR: You have insufficient rights to run this program, login as another user to run this program.
	GOTO @commandLine	

@commandCloseDirectoryRoot
	CALL 5101@commandInvalidDirectory
	7: You are already in the root directory.
	GOTO @commandLine

@commandOpenFile
	COMPARE #<fileOpen>, "1"
	IF= @commandOpenFileInvalid

	SET fileOpen, "1"
	
	STRCMP #<lastAsk>, "open passwords.txt"
	IF= @commandOpenFilePasswords
	STRCMP #<lastAsk>, "open passwords"
	IF= @commandOpenFilePasswords
	
	SET fileOpen, "0"
	7: ERROR: The requested file does not exist.
	RETURN

@commandOpenFileInvalid
	7: ERROR: There is already a file open, close the current file first.
	GOTO @commandLine
	
@commandOpenFilePasswords
	7: ----------------
	7: PASSWORDS
	7: ----------------
	7: user name: admin 
	7: password: admin
	7: ----------------
	7: user name: anderson
	7: password: #<passwordScene>
	7: ----------------
	7: user name: Atsumori
	7: status: <account deleted>
	7: ----------------
	7: user name: D43m0----
	7: status: <account permanently locked>
	7: ----------------
	GOTO @commandLine
	
@commandCloseFile
	COMPARE #<fileOpen>, "1"
	IF< @commandCloseFileInvalid
	SET fileOpen, "0"
	7: File closed.
	GOTO @commandLine
	
@commandCloseFileInvalid
	7: ERROR: no open file
	GOTO @commandLine
	
@commandRunProgram
	COMPARE #<programActive>, "1"
	IF= @commandRunProgramAlreadyActive

	STRCMP #<lastAsk>, "run security.exe"
	IF= @commandRunProgramSecurity
	STRCMP #<lastAsk>, "run security"
	IF= @commandRunProgramSecurity
	
	STRCMP #<lastAsk>, "run diagnostics.exe"
	IF= @commandRunProgramDiagnostics
	STRCMP #<lastAsk>, "run diagnostics"
	IF= @commandRunProgramDiagnostics	
	GOTO @commandLine
	
@commandRunProgramAlreadyActive	
	7: ERROR: a program is already active, exit the current program first
	GOTO @commandLine

@commandRunProgramDiagnostics	
	SET programActive, 1

	STRCMP #<user>, "anderson"
	IF!= @invalidAccessProgram
	
	7: -----------------------
	7: Welcome to Diagnostics
	7: -----------------------	
	
	7: Would you like to initiate a diagnostics run [YES/NO]?
	ASK 300
	IF -YES, @commandExitProgram
	
	7: Running diagnostics...
	CALL 5101@commandSearching
	7: Status red
	SOUND voice\status_red
	7: Force field is permanently enabled by user Atsumori, teleporting to other locations other than using the central teleporter is impossible.
	7: Teleportation from the central teleporter is remotely disabled from bunker 3.
	7: Contact system administrator Nishka to undo this action.
	7: %M1717s are permanently deployed by user Atsumori.
	7: %M1717s are permanently set to kill all by user Atsumori.
	7: Admin rights are restricted to reading passwords.txt only by user Atsumori.
	7: User account 'Atsumori' was deleted.
	7: Camera feeds were disabled by user D43m0----... 
	7: ERROR: illegal account detected.
	7: User account 'D43m0----' is permanently locked.
	HOST_GIVE T991
	GOTO @commandLine
	
@commandRunProgramSecurity
	SET programActive, 1

	STRCMP #<user>, "anderson"
	IF!= @invalidAccessProgram
	
	7: ----------
	7: SECURITY
	7: ----------
	7: [1] Status force field: ACTIVE
	7: [2] Status %M1717s: ACTIVE
	IF T992, @commandRunProgramSecurityCamerasActive
	7: [3] Status security cameras: DISABLED
	GOTO @commandRunProgramSecurityUpdate	
	
@commandRunProgramSecurityCamerasActive
	7: [3] Status security cameras: ENABLED
	GOTO @commandRunProgramSecurityUpdate

@commandRunProgramSecurityUpdate
	7: Enter the option you want to update or type 'exit' to exit program [1/2/3/EXIT]:
	ASK 300
	IF Qexit, @commandExitProgram
	IF Q1, @commandRunProgramSecurityForceField
	IF Q2, @commandRunProgramSecuritySentinels
	IF Q3, @commandRunProgramSecuritySecurityCameras
	IF Q[1], @commandRunProgramSecurityForceField
	IF Q[2], @commandRunProgramSecuritySentinels
	IF Q[3], @commandRunProgramSecuritySecurityCameras
	7: Invalid input
	GOTO @commandRunProgramSecurityUpdate

@commandRunProgramSecurityForceField
	7: Error: force field status cannot be updated.
	7: Force field is permanently enabled by user 'Atsumori'.
	GOTO @commandRunProgramSecurityUpdate

@commandRunProgramSecuritySentinels
	7: Error: %M1717 status cannot be updated.
	7: %M1717s are permanently enabled by user 'Atsumori'.
	GOTO @commandRunProgramSecurityUpdate

@commandRunProgramSecuritySecurityCameras
	IF T992, @commandRunProgramSecuritySecurityCamerasActive
	7: Do you want to enable the security cameras [YES/NO]:
	ASK 300
	IF YES, @commandRunProgramSecuritySecurityCamerasEnable
	7: Command canceled.
	GOTO @commandRunProgramSecurityUpdate

@commandRunProgramSecuritySecurityCamerasActive
	7: Do you want to disable the security cameras [YES/NO]:
	ASK 300
	IF YES, @commandRunProgramSecuritySecurityCamerasDisable
	7: Command canceled.
	GOTO @commandRunProgramSecurityUpdate

@commandRunProgramSecuritySecurityCamerasEnable
	7: Updating status security cameras...
	WAIT 3.0
	7: Security cameras are enabled.
	HOST_GIVE T992
	GOTO @commandRunProgramSecurity

@commandRunProgramSecuritySecurityCamerasDisable
	7: Updating status security cameras...
	WAIT 3.0
	7: Security cameras are disabled.
	HOST_TAKE T992
	GOTO @commandRunProgramSecurity
	
@commandExitProgram
	COMPARE #<programActive>, "0"
	IF= @commandExiProgramInactive
	SET programActive, "0"
	7: Program exited.
	GOTO @commandLine

@commandExiProgramInactive
	7: ERROR: There is no active program to exit.
	GOTO @commandLine
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5266, bunkerstorage02, SCENE, "Storage room"

	; Retrieve a new circuit board from this location
	
	CALL 5097@addGunslinger	
	
	ACTOR 1,  "", gun005, 2, 10, 90 
	ACTOR 2,  "", gun005, 2, 25, 88	
	ACTOR 3,  "", gun005, 2, 39, 93
	ACTOR 4,  "", gun005, 2, 54, 94

	ACTOR 11,  "", gun005, 2, -10, 90 
	ACTOR 12,  "", gun005, 2, -25, 88	
	ACTOR 13,  "", gun005, 2, -39, 93
	ACTOR 14,  "", gun005, 2, -54, 94

	IF T975, @nothingHere

	COMPARE #<5266temp>, 0
	IF> @skip
	SET 5266temp, %R4
	HOST_TAKE T1011
	HOST_TAKE T1012
	HOST_TAKE T1013
	HOST_TAKE T1014
	
@skip	
	SET temp2, 0		
	
	IF T887|T888, @commentActor
	END
	
@commentActor
	8: Let's hope that these boxes contain something useful.
	END

@eventActorclick1
	IF DEAD, @died
	IF T975, @alreadyFoundCircuitBoard
	IF T1011, @alreadyCheckedCrate
	CALL @reward 1
	HOST_GIVE T1011
	END

@eventActorclick2
	IF DEAD, @died
	IF T975, @alreadyFoundCircuitBoard
	IF T1012, @alreadyCheckedCrate
	CALL @reward 2
	HOST_GIVE T012
	END

@eventActorclick3
	IF DEAD, @died
	IF T975, @alreadyFoundCircuitBoard
	IF T1013, @alreadyCheckedCrate
	CALL @reward 3
	HOST_GIVE T1013
	END

@eventActorclick4
	IF DEAD, @died
	IF T975, @alreadyFoundCircuitBoard
	IF T1014, @alreadyCheckedCrate
	CALL @reward 4
	HOST_GIVE T1014
	END

@reward 
	COMPARE #<5266temp>, #<arg0>
	IF= @foundCircuitBoard
	IF R50, @fight
	COMPARE #<temp2>, 0
	IF= @foundInstructions
	N: you found nothing of value in this box.
	RETURN
	
@foundCircuitBoard
	N: You have found a %I2176.
	HOST_GIVE I2176
	HOST_GIVE T975
	HOST_TAKE T1011
	HOST_TAKE T1012
	HOST_TAKE T1013
	HOST_TAKE T1014	
	COMPARE #<temp2>, 0
	IF= @foundInstructions
	RETURN

@foundInstructions
	ADD temp2, 1
	N: You found a note with instructions for configuring the %I2176.
	N: The board should contain: 3 low voltage nodes, 3 high voltage nodes, and 2 normal voltage nodes.
	N: It should also contain 2 security nodes, 1 encrypted data node, and 1 unencrypted data node.	
	N: All the nodes should be turned on.
	RETURN
	
@alreadyFoundCircuitBoard
	IF T887|T888, @alreadyFoundCircuitBoardActor
	N: You have already found the %I2176, there is nothing left here to explore.
	END

@alreadyFoundCircuitBoardActor
	8: We have found the %I2176 already, there isn't much more we can do here.
	END

@alreadyCheckedCrate
	IF T887|T888, @alreadyCheckedCrateActor
	N: You have already checked this box.
	END
	
@alreadyCheckedCrateActor	
	8: We've already checked this box.
	END

@endCheck
	RETURN
	
@fight
	N: You have alerted 3 %M1716s to your presence!
	CALL 5199@continueBeforeGunslingerFight	
	MOVE 11, 10, 90, 1
	MOVE 12, 25, 88, 1
	MOVE 13, 39, 93, 1
	MOVE 14, 54, 94, 1
	MOVE 1, -10, 90, 1
	MOVE 2, -25, 88, 1
	MOVE 3, -39, 93, 1
	MOVE 4, -54, 94, 1
	MOVE 8, -80, 95, 1
		
	FIGHT2 1716, 1716, 1716
	
	MOVE 1, 10, 90, 1
	MOVE 2, 25, 88, 1
	MOVE 3, 39, 93, 1
	MOVE 4, 54, 94, 1
	MOVE 11, -10, 90, 1
	MOVE 12, -25, 88, 1
	MOVE 13, -39, 93, 1
	MOVE 14, -54, 94, 1
	MOVE 8, 80, 95, 1
	
	CALL 984@rewardMissionPP
	CALL 5199@continueAfterGunslingerFight
	CALL 5198@checkCPR
	RETURN
	
@died
	IF T887|T888, @diedActor
	N: You cannot do anything while you are dead.
	END

@diedActor
	8: You should really visit Doc first, you can't do much while you're in this condition.
	END	

@nothingHere
	IF T887|T888, @nothingHereActor
	N: You have already explored this room.
	END
	
@nothingHereActor
	8: We've already checked all these boxes, there is nothing left for us to do here.
	END
	
	
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; Medical terminal scene
SCENE 5267, bunkermedclinic2, 	SCENE,	"Clinic",	0, 0, 0

	CALL 5097@addGunslinger

	ACTOR 0, "Keypad", stealth2, 8, 56, 54	
	ACTOR 1, "Terminal", staticactors, 9, 79, 82 
	ACTOR 2, "Search the desk", circuitbuttons, 9, 85, 67 
	ACTOR 3, "Search the desk", circuitbuttons, 9, 29, 71
	ACTOR 9, "", circuitbuttons, 9, -50, -50	

	CALL 5263@checkPower

	SET scene, #<scene.id>	
	SET temp, 0
	SET temp2, 0
	
	SET passwordScene, %R899
	ADD passwordScene, 100	
	IF T887|T888, @commentActor
	END

@eventActorClick0
	CALL @checks
	0: Error... error...
	0: Status critical.
	SOUND voice\status_critical
	WAIT 2.0
	0: Ha ha ha, you'll never crack this code!
	IF T887|T888, @unlockActorTip
	0: Daemonium was here, you idiot.
	WAIT 2.0
	N: You'll have to find another way to unlock the access code, maybe damaging would do the trick?
	END 
	
@unlockActorTip
	0: Daemonium was here, you idiots.
	8: Daemonium thinks he's so smart, eh?
	8: I bet he forgot what guns can do.
	END
	
@eventActorAttack0
	CALL @checks
	0: Err-...
	WAIT 2.0
	SOUND voice\access_granted
	0: Access granted.
	WAIT 3.0
	GOTO SCENE 5270
	
@eventActorClick1
	CALL @checks
	GOTO SCENE 5268
	
@eventActorClick2
	N: You find a torn note with the following information:
	N: User name: docwalker
	N: Password: dumplinglove5**
	N: The last two digits are missing. 
	END

@eventActorClick3	
	N: You find a stack of blood-stained notes which mostly faded letters.
	N: It does not appear to make much sense without context.
	END
	
@checks
	IF DEAD, @died
	IF -T978, @powerIsDown
	RETURN

@powerIsDown
	IF T887|T888, @powerIsDownActor
	N: You cannot do anything while the power is down.
	END
	
@powerIsDownActor
	8: We won't be able to do anything here until the power is back up and running.
	8: The power core is to our west.
	END

@died
	IF T887|T888, @diedActor
	N: You cannot do anything while you are dead.
	END
	
@diedActor
	8: We better visit Doc Adlington, she can patch you up.
	END
	

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; Terminal CUT scene from 5267
SCENE 5268, check1, CUT, "Terminal"

	CALL 5101@setUpTerminal	11

	; These cookies are mandatory to implement
	SET scene, #<scene.id>
	SET sceneReturn, "5267"
	SET attempts, 6
	
	CALL @setPassword5268
	SET passwordScene, #<passwordScene5268>
	
	CALL 5101@startScreen
	9: Click on the blinking cursor to enter text into the terminal.
	END
	
@setPassword5268
	IF T1113, @skipSetPassword5268
	SET temp, %R89
	ADD temp, 10		
	SET passwordScene5268, "dumplinglove5#<temp>"
	HOST_GIVE T1113
	RETURN

@skipSetPassword5268
	RETURN
	
	
@eventActorClick1
	COMPARE #<loggedIn>, 1
	IF= @commandLine

	ASK 300
	
	STRCMP #<lastAsk>, "help"
	IF= @eventActorClick13
	
	CALL 5101@loginUser	
	CALL 5101@loginPassword
	
	; The actual password checking happens after confirming the correct login was used.
	STRCMP #<login>, "admin"
	IF= @admin 
	STRCMP #<login>, "docwalker"
	IF= @docwalker

	CALL 5101@invalidAccessRequest
	END
	
@eventActorClick13
	CALL 5101@requestHelp
	END
	
@eventActorClick14
	CALL 5101@hackToolMenu
	END	

@accessDenied
	CALL 5101@accessDenied
	END	

@admin
	; admin can search passwords.txt
	SET user, "admin"
	STRCMP #<password>, "admin"
	IF!= @accessDenied
	
	SET dir, "documents"
	SET path, "c:\#<dir>"
	GOTO @accessGranted

@docwalker
	SET user, "docwalker"
	STRCMP #<password>, #<passwordScene>
	IF!= @accessDenied
	
	SET dir, "program files"
	SET path, "c:\#<dir>"
	GOTO @accessGranted
		
@accessGranted	
	CALL 5101@accessGranted
	CALL 5101@loginSuccessful
	CALL 5101@commandAwaitingOrders	
	GOTO @commandLine

;---------------------------------
; COMMAND LINE
;---------------------------------
@commandLine
	ASK 300

	; Check the STRCMP commands first, then the STRSTR
	
	STRCMP #<lastAsk>, "logout"
	IF= @commandLogOut
	STRCMP #<lastAsk>, "logoff"
	IF= @commandLogOut
	
	STRCMP #<lastAsk>, "quit"
	IF= @commandQuit

	STRCMP #<lastAsk>, "cd ./"
	IF= @commandCloseDirectory
		
	STRCMP #<lastAsk>, "dir"
	IF= @commandViewDirectory
	
	STRCMP #<lastAsk>, "exit"
	IF= @commandExitProgram
	
	STRCMP #<lastAsk>, "close"
	IF= @commandCloseFile
	
	STRSTR #<lastAsk>, "open"
	IF> @commandOpenFile
	
	STRSTR #<lastAsk>, "run"
	IF> @commandRunProgram

	STRCMP #<lastAsk>, "cd program files"
	IF= @commandOpenDirectoryProgramFiles

	STRCMP #<lastAsk>, "cd documents"
	IF= @commandOpenDirectoryDocuments
	
	STRCMP #<lastAsk>, "help"
	CALL 5101@requestHelp

	CALL 5101@invalidCommand
	GOTO @commandLine
	
@commandLogOut
	CALL 5101@commandLogOut

@commandQuit
	CALL 5101@commandQuit

@commandViewDirectory
	CALL 5101@commandSearching
	
	STRCMP #<path>, "c:\"
	IF= @commandViewDirectoryRoot
	
	STRCMP #<path>, "c:\documents"
	IF= @commandViewDirectoryDocuments
	
	STRCMP #<path>, "c:\program files"
	IF= @commandViewDirectoryProgramFiles
	GOTO @commandLine
	
@commandViewDirectoryRoot	
	SET lastAsk, ""
	SET terminalText, "documents"
	CALL 5101@writeText	1
	SET terminalText, "program files"
	CALL 5101@writeText	1
	GOTO @commandLine

@commandViewDirectoryDocuments
	CALL 5101@updateProgramName "#<path>"

	SET lastAsk, ""
	SET terminalText, "passwords.txt"
	CALL 5101@writeText	1
	SET terminalText, "journal.doc"
	CALL 5101@writeText	1	
	GOTO @commandLine
	
@commandViewDirectoryProgramFiles
	CALL 5101@updateProgramName "#<path>"
	
	SET lastAsk, ""
	SET terminalText, "copy files.exe"
	CALL 5101@writeText	1
	SET terminalText, "diagnostics.exe"
	CALL 5101@writeText	1
	
	GOTO @commandLine

@commandOpenDirectoryRoot
	SET dir, "c:\"
	SET path, "#<dir>"
	
	SET lastAsk, ""
	SET terminalText, "#<path>"
	CALL 5101@writeText	1	
	GOTO @commandLine
	
@commandOpenDirectoryProgramFiles
	STRCMP #<user>, "admin"
	IF= @invalidAccessDirectory
	SET dir, "program files"
	SET path, "c:\#<dir>"
	
	SET lastAsk, ""
	SET terminalText, "#<path>"
	CALL 5101@writeText	1	
	GOTO @commandLine		

@commandOpenDirectoryDocuments
	SET dir, "documents"
	SET path, "c:\#<dir>"
	
	SET lastAsk, ""
	SET terminalText, "#<path>"
	CALL 5101@writeText	1	
	GOTO @commandLine
	
@commandCloseDirectory
	STRCMP #<dir>, "c:\"
	IF= @commandCloseDirectoryRoot
	GOTO @commandOpenDirectoryRoot

@invalidAccessDirectory	
	7: ERROR: You have insufficient rights to access this directory.
	GOTO @commandLine
	
@invalidAccessFile	
	7: ERROR: You have insufficient rights to access this file.
	GOTO @commandLine	

@invalidAccessProgram
	7: ERROR: You have insufficient rights to run this program, login as another user to run this program.
	GOTO @commandLine	

@commandCloseDirectoryRoot
	CALL 5101@commandInvalidDirectory
	7: You are already in the root directory.
	GOTO @commandLine

@commandOpenFile
	COMPARE #<fileOpen>, "1"
	IF= @commandOpenFileInvalid

	SET fileOpen, "1"
	
	STRCMP #<lastAsk>, "open passwords.txt"
	IF= @commandOpenFilePasswords
	STRCMP #<lastAsk>, "open passwords"
	IF= @commandOpenFilePasswords
	STRCMP #<lastAsk>, "open journal.doc"
	IF= @commandOpenFileJournal
	STRCMP #<lastAsk>, "open journal"
	IF= @commandOpenFileJournal
	
	SET fileOpen, "0"

	7: ERROR: The requested file does not exist.
	RETURN

@commandOpenFileInvalid
	7: ERROR: There is already a file open, close the current file first.
	GOTO @commandLine
	
@commandOpenFilePasswords
	7: ----------------
	7: PASSWORDS
	7: ----------------
	7: user name: admin 
	7: password: admin
	7: ----------------
	7: user name: docwalker
	7: password: #<passwordScene>
	7: ----------------
	GOTO @commandLine
	
@commandOpenFileJournal	
	7: ********************
	7: Journal from Doctor Walker
	7: ********************
	7: -unknown date-
	7: Long have I doubted whether I am doing what is right.
	7: Doctor Melchior had made great advancements in the creation of the super soldier that we now view as %M1701s.
	7: The %M1701s have proven unreliable, however, and are too dangerous to create.
	7: We have initiated a new program to combat the threat of the %M1701s.
	7: The new soldiers have the Devil element and are stronger than %M1701s.
	7: There are various promising %C63s who we could turn into %M1716s.
	7: The most promising candidates appear to be Robin Salvatore, Kim Freestone, Charley Kissinger, and %1.
	7: Madison Harper was scrapped as a potential candidate due to his creepy behavior.
	7: Our local %C64, John Wick, however, disagreed.
	7: He has hunted down all the %M1701s that escaped in bunker 9 and dealt with them.
	7: As a result, the immediate threat here is gone.
	7: For the time being, we have also activated the %M1717 program.
	7: I have moral and ethical issues with the creation of the %M1716s.
	7: We face the extinction of our species, though, and that is something I cannot allow either.
	7: To prevent more problems in the future, one thing that I insist on is to generally engineer the %M1716s to live fifty years at most. 
	7: It was a huge mistake to make %M1701s immortal.
	HOST_GIVE T979
	7: ****************
	7: --END OF JOURNAL--
	7: ****************	
	GOTO @commandLine

@commandCloseFile
	COMPARE #<fileOpen>, "1"
	IF< @commandCloseFileInvalid
	SET fileOpen, "0"
	7: File closed.
	GOTO @commandLine
	
@commandCloseFileInvalid
	7: ERROR: no open file
	GOTO @commandLine
	
@commandRunProgram
	COMPARE #<programActive>, "1"
	IF= @commandRunProgramAlreadyActive

	SET programActive, 1

	STRCMP #<lastAsk>, "run copy_files.exe"
	IF= @commandRunProgramCopyFiles
	STRCMP #<lastAsk>, "run copy files.exe"
	IF= @commandRunProgramCopyFiles	
	STRCMP #<lastAsk>, "run copy_files"
	IF= @commandRunProgramCopyFiles
	STRCMP #<lastAsk>, "run copy files"
	IF= @commandRunProgramCopyFiles
	
	STRCMP #<lastAsk>, "run diagnostics.exe"
	IF= @commandRunProgramDiagnostics
	STRCMP #<lastAsk>, "run diagnostics"
	IF= @commandRunProgramDiagnostics	

	7: Error: invalid command
	SET programActive, 0

	GOTO @commandLine
	
@commandRunProgramAlreadyActive	
	7: ERROR: a program is already active, exit the current program first
	GOTO @commandLine
	
@commandRunProgramDiagnostics	
	SET programActive, 1

	7: ---------------------------
	7: Welcome to Diagnostics
	7: ---------------------------			
	7: Would you like to initiate a diagnostics run [YES/NO]?
	ASK 300
	IF -YES, @commandExitProgram
	7: Running diagnostics...
	CALL 5101@commandSearching	
	7: There were no corrupted files detected.
	GOTO @commandExitProgram	

@commandRunProgramCopyFiles
	SET programActive, 1

	STRCMP #<user>, "docwalker"
	IF= @accessProgramCopyFiles
	GOTO @invalidAccessProgram

@accessProgramCopyFiles 
	7: ---------------------------------
	7: Welcome to the File Copy Program
	7: ---------------------------------	
	7: There are 5 files available to copy:
	7: [1] Auto_CPR_Unit_schematics_MK_4......(3 GB)
	7: [2] Classified_research_data_bunker_9....(3 GB)
	7: [3] Agility_enhancements.....................(2 GB)
	7: [4] Experimental_research_data.............(2 GB)
	7: [5] Steamy_romance_novels.................(5 GB)						
	IF -I2168, @accessProgramCopyFilesWarning
	IF T1110, @skipSetDiscSpace	
	SET discSpace, "10"
	HOST_GIVE T1110

@skipSetDiscSpace		
	7: Available space on %I2168: #<discSpace> GB.
	
@accessProgramCopyFilesLoop	
	7: Please enter the number of file you wish to download or type 'exit' to exit this program:
	ASK 300
	STRCMP #<lastAsk>, "exit"
	IF= @commandExitProgram
	STRCMP #<lastAsk>, "1"
	IF= @accessProgramCopyFiles1
	STRCMP #<lastAsk>, "2"
	IF= @accessProgramCopyFiles2
	STRCMP #<lastAsk>, "3"
	IF= @accessProgramCopyFiles3
	STRCMP #<lastAsk>, "4"
	IF= @accessProgramCopyFiles4
	STRCMP #<lastAsk>, "5"
	IF= @accessProgramCopyFiles5
	7: Invalid input.
	GOTO @accessProgramCopyFilesLoop	
	
@accessProgramCopyFiles1
	IF T980, @accessProgramCopyFilesData
	7: Download [Auto_CPR_Unit_schematics_MK_4] started...
	HOST_GIVE T980
	SET temp, "3"
	GOTO @accessProgramCopyFilesDownloading	

@accessProgramCopyFiles2
	IF T981, @accessProgramCopyFilesData
	SET temp, "3"
	CALL @accessProgramCopyFilesBackUpRoutine
	COMPARE #<discSpace>, #<temp>
	IF< @accessProgramCopyFilesDataError
	7: Download [Classified_research_data_bunker_9] started...
	HOST_GIVE T981
	GOTO @accessProgramCopyFilesDownloading

@accessProgramCopyFiles3
	IF T982, @accessProgramCopyFilesData
	SET temp, "2"
	CALL @accessProgramCopyFilesBackUpRoutine
	COMPARE #<discSpace>, #<temp>
	IF< @accessProgramCopyFilesDataError	
	7: Download [Agility_enhancements] started...
	HOST_GIVE T982
	GOTO @accessProgramCopyFilesDownloading

@accessProgramCopyFiles4
	IF T983, @accessProgramCopyFilesData
	SET temp, "2"
	CALL @accessProgramCopyFilesBackUpRoutine
	COMPARE #<discSpace>, #<temp>
	IF< @accessProgramCopyFilesDataError	
	7: Download [Experimental_research_data] started...
	HOST_GIVE T983
	GOTO @accessProgramCopyFilesDownloading	

@accessProgramCopyFiles5 
	IF T984, @accessProgramCopyFilesData
	SET temp, "5"
	CALL @accessProgramCopyFilesBackUpRoutine
	COMPARE #<discSpace>, #<temp>
	IF< @accessProgramCopyFilesDataError	
	7: Download [Steamy_romance_novels] started...
	HOST_GIVE T984
	GOTO @accessProgramCopyFilesDownloading
	
@accessProgramCopyFilesDownloading
	COMPARE #<discSpace>, #<temp>
	IF< @accessProgramCopyFilesDataError
	SUB discSpace, #<temp>
	WAIT 3.0
	7: Download completed, there is #<discSpace> GB remaining on the %I2168.
	GOTO @accessProgramCopyFilesLoop

@accessProgramCopyFilesDownloadingFile
	WAIT 4.0
	7: Download completed.
	7: %I2168 has #<discSpace> GB space remaining.
	GOTO @accessProgramCopyFilesLoop

@accessProgramCopyFilesBackUpRoutine
	IF T980, @return
	SET temp2, #<temp>
	ADD temp2, "3"
	COMPARE #<discSpace>, #<temp2>
	IF< @accessProgramCopyFilesBackUpRoutineCPR
	RETURN 
	
@accessProgramCopyFilesBackUpRoutineCPR
	7: ERROR... ERROR...
	N: You quickly switch commands and download the Auto CPR Unit schematics MK 4.
	GOTO @accessProgramCopyFiles1
	
@accessProgramCopyFilesDataError
	7: ERROR: the %I2168 does not have enough available space to copy this file.
	7: There is #<discSpace> GB space remaining on the %I2168.
	GOTO @accessProgramCopyFilesLoop

@accessProgramCopyFilesData
	7: ERROR: You have already downloaded this file.
	GOTO @accessProgramCopyFilesLoop
	
@accessProgramCopyFilesWarning
	7: ERROR: there is no %I2168 detected.
	7: This program will now terminate.
	GOTO @commandExitProgram

@commandExitProgram
	COMPARE #<programActive>, "0"
	IF= @commandExiProgramInactive
	SET programActive, "0"
	7: Program exited.
	GOTO @commandLine

@commandExiProgramInactive
	7: ERROR: There is no active program to exit.
	GOTO @commandLine

@return
	RETURN


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; Hatchery
SCENE 5269, bunkergreenery, CUT, "Hatchery"

	IF T973, @nothingHere
	
	LOCK 1
	EJECT T172
	FLAGS 1344
	
	MUSIC bellz
	
	ACTOR 6.4, "", gun64px, 9, -100, -99	; average chance
	ACTOR 7.5, "", stealth2, 1, -100, -100 	; lowest chance
	ACTOR 5.6, "", abcall, 0, -100, -100	; highest chance
	ACTOR 9.3, "", background, 0, 0, 0			
	
	N: You have 10 seconds before the %M1700s appear.
	N: Select your %I984 in the Items tab.
	COUNTDOWN 10
	WAIT 10
	
	SET droneTotalHealth, 1	
	SET 5269time, #<num.timeNow>
	ADD 5269time, 75
	
	CALL @changeLocationActors
	HOST_GIVE T973
	N: Catch as many %M1700s as you can before they scatter!
	END

@eventActorAttack5
@eventActorAttack6
@eventActorAttack7
@eventActorAttack9
@eventActorSpell5
@eventActorSpell6
@eventActorSpell7
@eventActorSpell9
	GOTO @doesNothing

@eventActorGive6
	CALL @compareRightItem
	IF R80, @reward
	GOTO @escaped
	
@eventActorGive7
	CALL @compareRightItem
	IF R60, @reward
	GOTO @escaped

@eventActorGive5
	CALL @compareRightItem
	IF R95, @reward
	GOTO @escaped

@escaped
	SUB droneHealth, 1
	N: The %M1700 managed to escape.
	CALL @checkDroneHealth
	END

; missed
@eventActorGive9
	CALL @compareRightItem
	N: You missed!
	SEL 6
	POSE 10
	WAIT 0.2
	POSE 9
	CALL @checkDroneHealth
	END	
	
@compareRightItem
	COMPARE #<item.id>, "984"
	IF< @doesNothing
	IF> @doesNothing
	RETURN

@doesNothing
	N: This does nothing, try throwing an %I984 instead!
	END		
	
@reward
	SOUND hitroarvampire1
	SEL 6
	POSE 10
	WAIT 0.2
	N: You caught a %M1700!
	HOST_GIVE I985
	SUB droneHealth, 1
	CALL @checkDroneHealth
	END
	
@checkDroneHealth
	COMPARE #<droneHealth>, "1"
	IF< @changeLocationActors
	CALL @changeXY
	CALL @calculateOffSet
	CALL @moveActors
	RETURN

@changeLocationActors
	COMPARE #<5269time>, #<num.timeNow>
	IF< @stopGame
	SET droneHealth, #<droneTotalHealth>	
	CALL @changeXY
	CALL @calculateOffSet
	CALL @teleportActors
	CALL @changeXY
	CALL @calculateOffSet
	CALL @moveActors
	RETURN	
	
@removeXY
	SET x, -100
	SET x7, -100
	SET x5, -100
	RETURN
	
@calculateOffSet	
	SET x6, #<x>
	ADD x6, 1
	SET y6, #<y>
	ADD y6, 5
	
	SET x7, #<x>
	ADD x7, 1
	SET y7, #<y>
	ADD y7, 4
	
	SET x5, #<x>
	ADD x5, 1
	SET y5, #<y>
	ADD y5, 2
	RETURN	

@teleportActors	
	SEL 6
	POSE 9
	MOVE 6,  #<x6>, #<y6>, 1
	MOVE 7,  #<x7>, #<y7>, 1
	MOVE 5,  #<x5>, #<y5>, 1
	RETURN
	
@moveActors	
	SOUND attroarvampire1
	SET randomSpeed, %R3
	ADD randomSpeed, 1

	MOVE 6,  #<x6>, #<y6>, #<randomSpeed>
	MOVE 7,  #<x7>, #<y7>, #<randomSpeed>
	MOVE 5,  #<x5>, #<y5>, #<randomSpeed>	
	RETURN	
		
@changeXY
	SET x, %R95
	SET y, 45
	ADD y, %R50
	RETURN	

@stopGame
	CALL @removeXY
	CALL @calculateOffSet
	CALL @teleportActors
	MOVE 9, -100,-100,1
	N: The remaining %M1700s ran away, there are none left!
	END

@nothingHere
	N: You have already caught all the %M1700s you could, there are none left.
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; Clinic supply room
SCENE 5270, bunkerstorage03, SCENE, "Clinic supplies" , 0, 0, 0

	CALL 5097@addGunslinger

	ACTOR 1, "Keypad", stealth2, 8, 36, 43

	SET temp, 0
	SET temp2, 0
	SET attempts, "8"
	SET scene, #<scene.id>
	SET passwordScene, %R899
	ADD passwordScene, 100
	
	IF T887|T888, @commentActor
	END
	
@commentActor
	MOVE 8, 70, 90
	IF T1109, @nothingLeftActor
	8: I wonder what that vault is hiding.
	H: Something good, I hope.
	8: Only one way to find out, let's crack that bitch!
	END

@nothingLeftActor
	8: I don't think we'll find anything else here.
	WAIT 4.0
	GOTO SCENE 5267

@eventActorClick1
	IF DEAD, @died
	IF -T844, @noPower
	COMPARE #<temp2>, "1"
	IF= @menu2
	MENU "Enter pincode=@enterPincode", "Open hack tool=@openHackTool", "Cancel=@cancel"
	END

@menu2
	MENU "Enter pincode=@enterPincode", "Cancel=@cancel"
	END

@eventActorClick13
	CALL 5101@requestHelp
	END
	
@eventActorClick14
	CALL 5101@hackToolMenu
	END		

@enterPincode
	1: Enter pincode [XXX]:
	ASK 300
	COMPARE #<lastAsk>, #<passwordScene>
	IF= @accessGranted
	SOUND voice\attempt_failed
	1: Attempt failed.
	SUB attempts, "1"
	COMPARE #<attempts>, "1"
	IF= @oneAttemptremaining
	1: You have #<attempts> attempts remaining.
	COMPARE #<attempts>, "1"
	IF< @resetPassword
	END

@oneAttemptremaining
	1: You have #<attempts> attempt remaining.
	END
	
@resetPassword
	1: The pincode is reset.
	SET passwordScene, %R899
	ADD passwordScene, 100
	SET attempts, "8"
	END

@accessGranted
	IF T1109, @nothingHere
	SOUND voice\access_granted
	1: Access granted.
	WAIT 3.0
	HOST_GIVE T1109
	N: You found a %I2166!
	HOST_GIVE I2166
	WAIT 3.0
	GOTO SCENE 5267
	
@nothingHere
	N: There is nothing left in vault.
	WAIT 3.0
	GOTO SCENE 5267
	
@openHackTool
	SET sceneReturn, #<scene.id>
	SET temp2, "1"	
	CALL 5099@setUpHackToolAndHelp
	MOVE 13, 95, 80, 1
	MOVE 14, 95, 65, 1
	SET attempts, 5
	END

@cancel
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; Bedroom (safe)
SCENE 5271, bunkerbed1, SCENE, "Bedroom"

	CALL 5097@addGunslinger

	ACTOR 1, "Dirty bedroll", circuitbuttons, 9, 6, 94
	ACTOR 2, "Unmade bed with worn mattress", circuitbuttons, 9, 83, 57

	8: It's not the cleanest place, but it's safe enough to sleep here if you want.
	END
	
@eventActorClick1
@eventActorClick2
	CALL 5098@flashbackEffect
	BKGND check1
	WAIT 3
	N: You fall asleep and rest.
	WAIT 3.0
	CALL 5098@flashbackEffect
	BKGND bunkerbed1
	GIVE L#<num.hostMaxHP>
	GIVE M#<num.hostMaxMP>
	WAIT 2.0
	N: You're fully recovered.
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; Bedroom (dangerous)
SCENE 5272, bunkerbed1, SCENE, "Sleeping place"
	

	CALL 5097@addGunslinger

	IF T988, @nothingHere
	
	MUSIC Norther-A-Fallen-Star

	ACTOR 1, "Gloom Reaper", gun016,4, -50, -50
	
	1: Bro, those two-armed freaks are here.
	1: Yeah bro, let's beat them up!

	8: Maybe we should get the hell out of here?
	WAIT 2.0

	CALL 5199@continueBeforeGunslingerFight
	
	MOVE 8, -80, 95, 1
	FIGHT 1716, 1716, 1716
	MOVE 8, 80, 95, 1
	
	MUSIC Norther-A-Fallen-Star

	CALL 984@rewardMissionPP
	CALL 5199@continueAfterGunslingerFight
	IF LOSE, @lostFight
	CALL 5198@checkCPR

	1: Bro, those twits took out our first men.
	1: This is our turf!

	8: I can hear more coming.
	WAIT 3.0
	
	H: There we go, time for round two.
	
	MOVE 8, -80, 95, 1
	FIGHT 1716, 1716, 1716, 1716
	MOVE 8, 80, 95, 1
	
	MUSIC Norther-A-Fallen-Star

	CALL 984@rewardMissionPP
	CALL 5199@continueAfterGunslingerFight
	IF LOSE, @lostFight
	CALL 5198@checkCPR
	
	1: Okay, okay, bros, let's go all in this time!
	8: More are coming!
	H: Hell yeah, let's kill them all.
	
	MOVE 8, -80, 95, 1
	FIGHT 1716, 1716, 1716, 1716, 1716
	MOVE 8, 80, 95, 1
	
	MUSIC Norther-A-Fallen-Star
	
	CALL 984@rewardMissionPP
	CALL 5199@continueAfterGunslingerFight	
	IF LOSE, @lostFight
	CALL 5198@checkCPR
	
	HOST_GIVE T988
	N: %T988
	HOST_GIVE I2596	
	WAIT 2.0
	N: You found a pair of %I2596.
	8: I'm glad that it's over.
	END
	
@lostFight
	CALL 5198@checkCPR
	1: Hah bro, good job!
	1: Yeah bro.
	1: /a fist bumps his %M1716 bro.
	END
	
@nothingHere
	IF T887|T888, @nothingHereActor
	N: There is nothing here anymore.
	WAIT 4.0
	GOTO EXIT

@nothingHereActor
	8: Oh please, not this place again.
	8: Your lust for combat against those freaks has traumatized me enough already, let's go!
	H: Alright, alright, no more %M1716s, for now.
	8: Thank you.
	WAIT 4.0
	GOTO EXIT


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5273, bunkerstasispods, SCENE, "Stasis pods"

	CALL 5097@addGunslinger

	; storyline with Silver
	; (shutting these down to prevent more Gloom Reapers from being born?)
	
	MOVE 8, 50, 95
	MOVE H, 55, 80
	
	ACTOR 4, "Empty pod", staticactors, 10, 34, 59
	ACTOR 5, "Empty pod", staticactors, 10, 60, 59
	FACE 5,0
	ACTOR 6, "Empty pod", staticactors, 10, 31, 68
	ACTOR 7, "Empty pod", staticactors, 10, 62, 68
	FACE 7,0
	ACTOR 18, "Empty pod", staticactors, 10, 28, 77
	ACTOR 9,  "Empty pod", staticactors, 10, 64, 77
	FACE 9,0
	ACTOR 10, "Empty pod", staticactors, 10, 23, 96
	ACTOR 11, "Empty pod", staticactors, 10, 66, 96
	FACE 11,0
	ACTOR 12, "Empty pod", staticactors, 10, 39, 50
	ACTOR 13, "Empty pod", staticactors, 10, 58, 50
	FACE 13,0

	IF T993, @nothingHere
	ACTOR	1,	"Silver",Silver, 4, 30, 90	
	MOVE 1, 40, 80
	
	1: Hello, you must be %1?
	H: Yes, I am.
	1: Excellent, Nishka and Caeran were full of praise when talking about you.
	H: They're a cool couple.
	H: So, you're Silver, right?
	1: Yes, I am.
	H: What is this place, why are all these empty stasis pods here?
	1: These stasis pods were used by %C63s.
	1: After the %M1701s escaped from the research laboratory, the leaders of the time panicked. 
	1: The %M1701s were killing soldiers left and right, even the %C63s of the day had trouble containing them.
	1: Governments did what they do best and created an even bigger mess.
	1: "To combat evil we must create an even bigger evil," they said.
	1: Two different research projects were started, one involving %M1706s and one involving %M1716s.
	1: If you ask me, both projects failed.
	1: I have been able to contain the %M1706s in the military research bunker, while Atsumori did something similar with the %M1716s.
	H: Damn, that's bad.
	8: Worse yet, they used %C63s once again to produce results.
	8: They have turned our people into three different kinds of monstrosities. 
	1: Actually, the %M1716s are not too bad once you get to know them. 
	1: They are kind of naive in their ways and they think that we are the freaks for only having two arms instead of four.
	1: They know nothing of the outside world and it's best to keep it that way too. 
	1: The %M1717s prevent their numbers from growing too large.
	1: Unlike %M1701s, %M1716s only live about forty to fifty years.
	1: Their knowledge comes from word of mouth, passed down the generations.
	H: Are these the only inhabitants here?
	1: No, there is %M1700 project that the scientists of the day ran in the south.
	1: The %M1716s consider the %M1700s to be a delicacy and they have continued to breed them.
	H: That sounds horrible.
	1: Their ways are different compared to ours, but I have seen enough other horrors in the world to know that it can be far worse.
	H: I suppose so.
	1: I believe that there are also others in bunker 9, but I have been unable to contact them.
	IF -T989, @didNotSeeContainersYet
	H: I spotted the containers that blocked the path to the rest of the base. 
	1: Yes, I suspect that there could be other survivors out there.
	GOTO @finish
	
@didNotSeeContainersYet
	H: What makes you say that?
	1: There are giant containers that block parts of the bunker to the rest of the bunker.
	1: There could be other survivors out there.
	GOTO @finish
	
@finish	
	1: Nishka has told me that this was the only bunker that has two teleporters.
	1: Since this bunker is a mile below ground, they wanted a back up system in case their primary system failed.
	1: However, the second teleporter is not connected to the teleporter network, so there is no telling if it's still operational.
	H: I see, interesting.
	H: So, what will we do now? 
	1: I need you to restore the power, without it, we'll never be able to leave.
	1: It would also be helpful if you can thin the %M1716 numbers a bit.
	1: They hang out at a sleeping place to the north east of here.
	1: You should also clear the hatchery somehow, it'll deprive them of protein for a long time to come.
	1: Finally, we should see about dealing with their greenery to the south.
	1: The %M1716s grow their own food and have become very good at that.
	1: However, if you change the fertilizers that they use, then it'll mess up the harvest without it being directly noticeable. 
	1: Meanwhile, they wouldn't immediately suspect the sabotage, meaning that we can escape with little to no trouble.
	1: %M1716s have a very sensitive digestive system that doesn't deal well with changes.
	H: Ah, so mess with their food without them realizing it, got it.
	1: Exactly yes, with the hatchery emptied and the greenery sabotaged, they'll pose less of a threat for a long time to come.
	1: Meet me at the bathroom east of here once you have dealt with all of that.
	1: The %M1718 considers that his throne room, just roll with whatever they say and respect their 'big flush' ritual.
	1: We should make it out of there without a fight.
	H: The... big flush?
	1: /a facepalms.
	1: Don't ask, it's stupid to us, but it's a holy ritual to them.
	8: This sounds so messed up.
	H: Okay... 
	H: So, fix the power, thin their numbers, and deal with the greenery, then meet you at the bathroom.
	1: Yes, that'd be all.
	1: Oh, and one final thing, tempting as it may be, DO NOT flush the toilet.
	1: There is a very limited water supply and if that toilet is flushed too often, then it'll run out of water before the big flush ritual.
	1: It'll likely mean we'll have to fight the %M1718 if that happens.
	H: Eh, okay.
	8: This just keeps getting worse and worse.
	HOST_GIVE T993
	1: I'll be on my way now, good luck, %1.
	H: I suppose I should start taking care of things too.
	MOVE 1, -20, 90	
	END
	
@nothingHere	
	IF T887|T888, @nothingHereActor
	N: There is nothing here anymore.
	END

@nothingHereActor
	8: I hope you don't mind, but can we go?
	8: I find these empty stasis pods creepy, they bring back bad memories.
	H: Yeah, I can understand that.
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5274, bunkermesshall, SCENE, "Mess hall"

	CALL 5097@addGunslinger
	
	IF T995, @nothingHere
	
	ACTOR 1, "Ozzy the Blind Gloom Reaper", gun016, 4, 35, 80, 1, hitbowgroan	
	SEL 1
	POSE 4, 1
	
	ACTOR 20, "Jukebox", staticactors, 14, 79, 71

	CALL 5008@playRandom	
	
	OFFER 976

	IF T994, @welcomeBack
	
	1: /a sniffs the air.
	1: You don't smell familiar.
	H: Neither do you.
	1: Oh, ah, you're blind too?
	1: I see, well I don't, but that explains things.
	8: 'I don't think he realizes what we are, let's keep it that way.
	H: So, what do you do here?
	1: Just chillin' with my home boys.
	1: There isn't much to do around here, but we keep ourselves busy.
	1: Especially the big flush is a big event every day.
	H: What is the big flush?
	1: Every day the %M1718 sits on his throne and produces a big one.
	1: We then all stand around the throne and watch it.
	1: After that, he flushes it away.
	1: It's pure magic how it disappears into the void.
	H: Ah, I see...
	1: Wait, so you're not blind after all?
	8: No, no, we're blind!
	HOST_GIVE T994
	H: Eh, maybe I should just check out what you're selling.
	1: I'm only selling the best.
	END

@welcomeBack
	1: Welcome back.
	1: Feel free to buy more booze, I only sell the best liquor.
	END

@eventActorClick20
	CALL 5008@startMusic
	END	

@eventHostGive
	CALL 5199@continueGunslingerDrink
	END	
	
@eventActorGive1
	COMPARE #<item.id>, "976"
	IF= @drinkGoodStuff
	COMPARE #<item.id>, "977"
	IF= @drinkGoodStuff
	1: Ugh, don't give me that crap.
	END
	
@drinkGoodStuff
	1: Thank you, that is the good stuff.
	END

@eventActorAttack1
	1: Why, gods, why?
	H: Your time has come to die.
	MOVE 1, -50, 80, 1
	FIGHT2 1719.30.80
	IF WON, @killedOzzy
	END

@killedOzzy
	HOST_GIVE T995
	N: You have killed Ozzy, the Blind %M1716.
	WAIT 2.0
	N: You take a few minutes to hide his corpse.
	WAIT 4.0
	N: Ozzy, the Blind %M1716 is no more.
	WAIT 2.0
	8: Was this really necessary?
	H: He was a %M1716 and deserved to die.
	8: There was no honor in this kill.
	MOVE 8, 120, 95
	END
	
@nothingHere
	IF T887|T888, @nothingHereActor
	N: There is nothing here anymore.
	END	

@nothingHereActor
	8: I'm not a fan of these %M1716s, but it was kind of harsh to kill a blind defenseless one.
	8: Even more so when he was selling us the good stuff.
	H: He had it coming.
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5275, bunkergreenery, SCENE, "Greenery"

	CALL 5097@addGunslinger

	IF T996, @skipCookieSetting

	SET 5275act1pose, 1
	SET 5275act2pose, 2
	SET 5275act3pose, 3
	SET 5275act4pose, 4

@skipCookieSetting	
	ACTOR 1, "Nitrogen fertilizer", 	greenery, #<5275act1pose>, 10, 90
	ACTOR 2, "Potassium fertilizer", 	greenery, #<5275act2pose>, 10, 70
	ACTOR 3, "Organic fertilizer", 		greenery, #<5275act3pose>, 20, 90
	ACTOR 4, "Phosphorus fertilizer", 	greenery, #<5275act4pose>, 20, 70

	ACTOR 20, "", greenery, 5,  40, 90
	ACTOR 21, "", greenery, 11,  40, 75
	ACTOR 22, "", greenery, 5,  45, 90
	ACTOR 23, "", greenery, 11,  45, 75
	ACTOR 24, "", greenery, 6,  50, 90
	ACTOR 25, "", greenery, 7,  35, 90
	ACTOR 26, "", greenery, 7,  35, 75
	ACTOR 27, "", greenery, 9,  30, 45
	ACTOR 28, "", greenery, 10, 50, 75
	ACTOR 29, "", greenery, 9, 70, 60
	ACTOR 30, "", greenery, 8, 75, 60
	ACTOR 31, "", greenery, 8, 80, 60
	
	IF T996, @doneHere

	N: Switch the contents of the fertilizers into different bags.
	END
	
@doneHere
	IF T887|T888, @doneHereActor
	N: You have already accomplished your task here.
	END
	
@doneHereActor
	8: We've already done here what we came to do.
	8: Unless you have a fascination for playing with dirt, I suggest we move on.
	END
	
@eventActorClick1
	IF T996, @doneHere
	MENU "Switch nitrogen with potassium=@switchNitrogenWithPotassium", "Switch nitrogen with organic=@switchNitrogenWithOrganic", "Switch nitrogen with phosporus=@switchNitrogenWithPhosphorus", "Cancel=@cancel"
	END
	
@eventActorClick2
	IF T996, @doneHere
	MENU "Switch potassium with nitrogen=@switchNitrogenWithPotassium", "Switch potassium with organic=@switchPotassiumWithOrganic", "Switch potassium with phosporus=@switchPotassiumWithPhosporus", "Cancel=@cancel"
	END

@eventActorClick3
	IF T996, @doneHere
	MENU "Switch organic with nitrogen=@switchNitrogenWithOrganic", "Switch organic with potassium=@switchPotassiumWithOrganic", "Switch organic with phosporus=@switchPhosporusWithOrganic", "Cancel=@cancel"
	END
	
@eventActorclick4
	IF T996, @doneHere
	MENU "Switch phosporus with nitrogen=@switchNitrogenWithPhosphorus", "Switch phosporus with potassium=@switchPotassiumWithPhosporus", "Switch phosporus with organic=@switchPhosporusWithOrganic", "Cancel=@cancel"
	END

@cancel
	END
	
@checkIfDone
	COMPARE #<5275act1pose>, "1"
	IF= @notDoneYet
	COMPARE #<5275act2pose>, "2"
	IF= @notDoneYet
	COMPARE #<5275act3pose>, "3"
	IF= @notDoneYet
	COMPARE #<5275act4pose>, "4"
	IF= @notDoneYet	
	N: You have switched the contents of all the fertilizer bags.
	N: This assures that the %M1716s will have upset stomachs for months to come.
	HOST_GIVE T996
	RETURN
	
@notDoneYet
	N: You have switched the two fertilizers.
	RETURN		
	
@switchNitrogenWithPotassium
	SEL 1
	POSE #<5275act2pose>
	SEL 2 
	POSE #<5275act1pose>
	SET temp, #<5275act1pose>
	SET 5275act1pose, #<5275act2pose>
	SET 5275act2pose, #<temp>
	CALL @checkIfDone
	END

@switchNitrogenWithOrganic
	SEL 1
	POSE #<5275act3pose>
	SEL 3 
	POSE #<5275act1pose>
	SET temp, #<5275act1pose>
	SET 5275act1pose, #<5275act3pose>
	SET 5275act3pose, #<temp>
	CALL @checkIfDone
	END

@switchNitrogenWithPhosphorus
	SEL 1
	POSE #<5275act4pose>
	SEL 4 
	POSE #<5275act1pose>
	SET temp, #<5275act1pose>
	SET 5275act1pose, #<5275act4pose>
	SET 5275act4pose, #<temp>
	CALL @checkIfDone
	END

@switchPotassiumWithOrganic
	SEL 2
	POSE #<5275act3pose>
	SEL 3 
	POSE #<5275act2pose>
	SET temp, #<5275act2pose>
	SET 5275act2pose, #<5275act3pose>
	SET 5275act3pose, #<temp>
	CALL @checkIfDone
	END

@switchPotassiumWithPhosporus
	SEL 2
	POSE #<5275act4pose>
	SEL 4 
	POSE #<5275act2pose>
	SET temp, #<5275act2pose>
	SET 5275act2pose, #<5275act4pose>
	SET 5275act4pose, #<temp>
	CALL @checkIfDone
	END

@switchPhosporusWithOrganic
	SEL 3
	POSE #<5275act4pose>
	SEL 4 
	POSE #<5275act3pose>
	SET temp, #<5275act3pose>
	SET 5275act3pose, #<5275act4pose>
	SET 5275act4pose, #<temp>
	CALL @checkIfDone
	END
	

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5276, bunkerstorage02, SCENE, "Blocked area"

	CALL 5097@addGunslinger
	
	HOST_GIVE T989
	
	IF T887|T888, @commentActor
	N: Your passage is blocked by large containers, you cannot venture deeper into bunker 9.
	END
	
@commentActor
	8: It looks like these large containers are blocking our progress deeper into bunker 9.
	H: Yeah, I wonder why though?
	H: It looks like it was a deliberate act.
	8: My guess is that whoever did this wanted to keep the %M1716s out of there.
	H: Maybe so, I suppose we could always come back once we're stronger to see what it's about.
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5277, bunkertoilets, SCENE, "Final encounter"

	CALL 5097@addGunslinger

	ACTOR 1, "The Throne", staticactors, 15, 25, 72 
	
	COMPARE #<5277flushed>, 0
	IF> @skipSettingFlush
	SET 5277flushed, 0

@skipSettingFlush
	IF T997|T998, @nothingHere
	IF T973+T978+T988+T993+T996, @startFinal
	N: There is nobody here yet, accomplish the following first:
	IF T993, @skipSilverTalk
	N: - Visit the stasis pods to the south west.	
	
@skipSilverTalk	
	IF T978, @skipPowerRestore
	N: - Restore the power to the west.
	
@skipPowerRestore	
	IF T973, @skipHatchling
	N: - Catch the %M1700s to the far south west.

@skipHatchling
	IF T988, @skipDefeatGloomReapers
	N: - Defeat the %M1716s in the sleeping place to the north east.
	
@skipDefeatGloomReapers
	IF T996, @skipFertilizer
	N: - Change the fertilizer to the south west.
	
@skipFertilizer	
	END
	
@eventActorClick1
	IF DEAD, @died
	MENU "Flush the toilet=@flush", "Do nothing=@end"
	END

@flush
	COMPARE #<5277flushed>, "2"
	IF> @usedUpAllWater
	ADD 5277flushed, 1
	SOUND toiletflush
	END
	
@usedUpAllWater
	N: You have used up all the water.
	END

@died
	IF T887|T888, @diedActor
	N: You cannot do anything while you are dead.
	END	
	
@diedActor	
	8: You'll have to sleep it off first, go to the bedroom north of us.
	END
	
@nothingHere
	IF T887|T888, @nothingHereActor
	N: There is nothing here anymore.
	END
	
@nothingHereActor
	MOVE 8, 50, 95
	MOVE H, 23, 78
	H: I need to use that toilet badly, run while you can!
	SOUND fart
	8: Oh fuck!
	H: Go, save yourself!
	MOVE 8, 120, 95, 2	
	WAIT 3.0
	SOUND static
	WAIT 2.0
	BKGND check1
	N: The rest of this scene is censored.
	SOUND fart
	WAIT 2.0
	SOUND toiletflush
	WAIT 3.0
	GOTO EXIT	
	
@startFinal
	ACTOR 2, "Gloom Reaper King", gun016, 4, 34, 74, 5
	ACTOR 3, "Silver",  silver, 4, 83, 70 
	ACTOR 4, "Gloom Reaper", gun016, 4, 50, 60
	ACTOR 5, "Gloom Reaper", gun016, 4, 13, 89
	ACTOR 6, "Gloom Reaper", gun016, 4, 57, 92
	ACTOR 7, "Gloom Reaper", gun016, 4, 65, 80
	IF T995, @killedOzzy
	ACTOR 9, "Ozzy the blind Gloom Reaper", gun016, 4, 42, 90, 1
	OFFER 976
	
@continueFinal
	MOVE H, 70, 85
	SEL 2
	POSE 4, 1
	SEL 3
	FACE 3, 0	
	SEL 4
	POSE 4, 1
	SEL 5
	POSE 4, 1
	SEL 6
	POSE 4, 1
	SEL 7
	POSE 4, 1
	SEL 9
	POSE 4, 1
	
	IF T1112, @skipSilverGivesOldFashioned
	IF T1111, @continueFight

	3: Greetings, King of the %M1716s.
	3: I appreciate that you are willing to have an audience with us.
	2: We appreciate you taking part in our ritual.
	3: Yes, it is a great honor to be here.
	8: 'What the heck are these guys talking about?
	2: I suppose everything is ready.
	2: Oof, I can feel it coming.
	SOUND fart
	5: Quickly my King, sit on your throne!
	MOVE 2, 29, 78
	FACE 4, 0
	FACE 6, 0
	FACE 7, 0
	FACE 9, 0	
	WAIT 2
	FACE 2, 1
	4: Is it happening yet?
	2: Yes, yes!
	2: It's a big one!
	SOUND fart
	2: Damn it, it hurts!
	2: I knew I should have eaten more fibers.
	H: 'This is too painful to watch.
	3: 'I know, but stick to it, it's the only way we can get a truce with them.
	8: 'I'm so glad that's not me sitting there.
	SOUND fart
	2: Okay, I'm done!
	MOVE 2, 34, 74
	WAIT 2.0
	2: It's ready for the grand inspection.
	2: Who is first?
	IF T995, @skipOzzyGoingFirst
	9: /a sniffs the air.
	MOVE 9, 40, 88
	9: Good lord, that smells like a huge one.
	MOVE 9, 42, 90
	2: Yes, it's terrible this time!
	2: Who is next?
	
@skipOzzyGoingFirst
	4: I suppose I will.
	MOVE 4, 46, 64
	WAIT 2
	4: Oh geez, it's even worse than yesterday, what did you eat bro?
	2: I think it was the stuffed %M1700 stew with brown beans and chili peppers that did it.
	MOVE 4, 50, 60
	5: My turn, let's get this over with.
	MOVE 5, 20, 82
	WAIT 2.0
	5: Ugh, it's just too much.
	5: We need to flush this one soon!
	MOVE 5, 13, 89
	WAIT 2.0
	FACE 5,1
	MOVE 6, 54, 88
	6: Sorry bro, but it's too bad for me to approach closer than this.
	7: Yeah, I'm good, it's worse than yesterday and a total assault on my nostrils.
	MOVE 6, 57, 92
	2: Yes, it's horrible indeed.
	FACE 7, 1
	2: It is just our honored guests who are left to inspect the big one.
	3: I have angelic senses, great King, I can easily tell from this distance that it was one of your greatest achievements.
	2: Damn right it was.
	8: Yeah, I've never seen such a big one before, it's traumatizing and the stench is unbearable.
	8: Just flush the damn thing already!
	2: What do you think, %1? 

@menuChoices
	WAIT 2
	MENU "It looks like a mutated brown snake.=@comment1", "The stench could drop a Nightmare dead on the spot.=@comment2", "It's an abomination and insult to life itself.=@comment3"
	N: You need to select one of the menu options.
	GOTO @menuChoices

@comment1
	H: It looks like a mutated brown snake.
	2: Now that you mention it, it does, doesn't it?
	GOTO @continueRitual

@comment2
	H: The stench could drop a Nightmare dead on the spot.
	2: Yeah, it's awful.
GOTO @continueRitual

@comment3
	H: It's an abomination and insult to life itself.
	2: You really think so?
	2: That's the biggest compliment I've ever received.
	GOTO @continueRitual

@continueRitual
	4: Flush, flush, flush!
	2: Yes, we will now perform the big flush!
	FACE 2,0
	WAIT 2.0
	COMPARE #<5277flushed>, "2"
	IF> @noWaterLeft
	SOUND toiletflush
	ADD 5277flushed, 1	
	WAIT 2.0
	2: Yup, there it goes.
	2: Now that we have completed the daily ritual, let's all have a good %I976 to celebrate.
	FACE 2, 1
	2: After that we can discuss the truce that Silver wanted to talk about.
	SOUND drinkahh
	9: Cheers, you can all buy more from me, boys!
	5: Here is to the big flush!
	SOUND drinkahh
	IF I976, @skipSilverGivesOldFashioned
	3: You can have one on me, %1.
	HOST_GIVE I976
	N: Silver gave you an %I976.
	WAIT 2.0

@skipSilverGivesOldFashioned
	N: Drink an %I976 to celebrate the big flush.
	HOST_GIVE T1112
	END
		
@continueCelebration
	COMPARE #<item.id>, "976"
	IF!= @wrongDrink
	HOST_TAKE T1112
	H: Let's hope that this will help me forget everything I just witnessed.
	8: You can say that again.
	2: Alright, with the official ceremony over, let's discuss this truce that Silver proposed.
	3: Yes, let's please do so.
	3: We will vow to stay off your turf if you vow to stay off ours. 
	2: Mm, that sounds reasonable.
	3: We would also appreciate it if you kill Daemonium on sight. 
	2: It'd be our pleasure.
	2: That little punk is a pussy who runs at the first sign of trouble.
	2: We chased him off several times, but he keeps worming his way back in here.
	H: Actually, maybe you should capture him first and make him witness the big flush up close and personal before you kill him.
	8: Nasty, that's probably a violation of the human rights act.
	2: Oh yes, he should definitely watch the big one!
	3: Great King, do you know anything about the area of the base that's blocked off with those containers?
	2: Well yes, you people live there, don't you?
	3: Ah-, yes-, yes, we do, I was just checking if you knew.
	2: Right, well, now that we have truce, we'll cancel our plans to invade your turf.
	3: That is great news indeed, it would appear that we are done then.
	2: It is a small world we live in, but together we can make the best of it.
	3: Those are wise words, King.
	2: %1, I want to thank you for partaking in our rituals and respecting our way of life. 
	2: You can have this %I2559 as a reward for your attendance.
	2: I know that the first time isn't easy to watch.
	H: Thank you. 
	HOST_GIVE T997
	HOST_GIVE I2559
	N: You received a %I2559.	
	WAIT 2.0
	H: I suppose I'll be on my way then.
	8: Yup, time to leave.
	WAIT 3.0
	GOTO EXIT

@wrongDrink
	N: That's the wrong item, drink an %I976 to celebrate.
	END
	
@killedOzzy	
	2: Wait, where is Ozzy?
	4: I don't know boss, I haven't seen him for a while.
	2: Damn it, Ozzy is always one of the biggest admirers.
	2: Let's continue anyway.
	GOTO @continueFinal

@eventHostGive
	IF T1112, @continueCelebration
	CALL 5199@continueGunslingerDrink
	END	
	
@noWaterLeft
	2: Wait, why is there no water left?
	FACE 2, 1
	2: Who used up all the water!?
	WAIT 2
	N: The %M1718 glares at everyone present.
	WAIT 4
	N: His eyes settle on you.
	WAIT 2.0
	2: I know that none of my %M1716s are stupid enough to flush the toilet without my explicit permission.
	2: Silver also knows about the importance of this ritual.
	2: That means only %1 is the one who could have done it.
	2: This is high treason!
	5: Damn, that means we must live with this stench until tomorrow?
	2: Yes, this means war!
	3: 'I had warned you not to flush it.

@continueFight
	GOTO SCENE 5278


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; Fight scene from the final encounter
SCENE 5278, bunkertoilets, SCENE, "Final encounter"
	HOST_GIVE T1111
	ACTOR 1, "The Throne", staticactors, 15, 25, 72 
	
	CALL 5199@continueBeforeGunslingerFight
	
	IF -T995, @fightOzzyToo
	
	FIGHT2 1718.34.74, 1716.50.60, 1716.13.89, 1716.57.92, 1716.65.80, -539.83.70

	IF WIN, @wonBigFight
	GOTO @lostBigFight	

@fightOzzyToo
	FIGHT2 1718.34.74, 1716.50.60, 1716.13.89, 1716.57.92, 1716.65.80, 1719.42.90, -539.83.70
	
	IF WIN, @wonBigFight
	GOTO @lostBigFight
	
@wonBigFight
	CALL 984@rewardMissionPP	
	CALL 5198@gunslingerCPRAndAfterFightQuotes	
	CALL 5198@checkCPR
	ACTOR 6, "Gloom Reaper", gun016, 4, -10, 92
	MOVE 6, 15, 92
	WAIT 3.0
	6: You killed our King, we do not take kindly to this.
	6: I declare war on the %C63s and vow that we will take vengeance.
	6: We will not stop until every last one of your kind is destroyed.
	6: Mark my words, %1, mark my words.
	H: We'll take care of you like we did with your King.
	MOVE 6, -10, 92
	WAIT 2.0
	HOST_GIVE I2559
	HOST_GIVE T995
	HOST_GIVE T998
	HOST_TAKE T1111
	N: You found a %I2559.
	WAIT 3.0
	GOTO EXIT
	
@lostBigFight
	N: Rest & recover, then try again.
	WAIT 2.0
	GOTO EXIT
	

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; Teleporter East scene
SCENE 5278, bunkercenter, SCENE, "Teleporter east"

	CALL 5097@addGunslinger

	ACTOR 1,	"Teleporter", gun005, 1, 58, 94
	END
	
@eventActorClick1
	SOUND tesla_charge
	WAIT 2.0
	GOTO SCENE 1205
	

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; HARDCORE CHALLENGES SET UP
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;	
	
SCENE 5350, check, CUT, ""

	END	

@hardcoreChallengeSetUp
	ACTOR 7, "Hardcore Challenge", staticactors, 13, #<x>, #<y>
	WAIT 0.1
	ACTOR 7, "Hardcore Challenge", staticactors, 13, #<x>, #<y>, 1
	WAIT 0.2
	ACTOR 7, "Hardcore Challenge", staticactors, 13, #<x>, #<y>
	RETURN
	
@setActorGreen
	ACTOR 7, "Hardcore Challenge", staticactors, 13, #<x>, #<y>, 1
	RETURN

@setActorRed
	ACTOR 7, "Hardcore Challenge", staticactors, 13, #<x>, #<y>
	RETURN
	
@helpHardcoreChallenge
	CALL @setActorGreen
	MENU "Activate hardcore challenge=@activateChallenge", "General information=@helpGeneral", "Types of challenges=@helpTypeChallenges", "Cancel=@end"
	GOTO @end
	
@helpGeneral	
	7: The hardcore challenges are completely optional.
	7: You can do these at each tier interval at level 20 - 24, 40 - 44, 60 - 64, and 80 - 84 in a relevant quest location.
	7: Beating all challenges means you are truly an %C64, which means that your class will be promoted from %C63 into an %C64.
	7: The only difference between a %C63 and an %C64 is that the latter has a total of 20%% magic as opposed to 5%%.
	7: These hardcore challenges are meant for those who wish to challenge themselves.
	GOTO @end
	
@helpTypeChallenges
	7: Challenge #1 (20-24): Defeat a group of %M1701s without the use of a slave before reaching level 25.
	7: Challenge #2 (40-44): Hack a keypad with the hack tool with minimal attempts using a guess attack.
	7: Challenge #3 (60-64): Repair a circuit board without hints and minimal analyzing attempts. 
	7: Challenge #4 (80-84): Defeat drone attacks without help.
	7: You can attempt a hardcore challenge as often as you like while you are eligible for them.
	7: The hardcore challenges don't reward anything extra.
	7: You can find the first challenge in the abandoned research lab to the south, the other challenges are spread in Bunker 3.
	7: You can recognize each challenge by the star symbol on the map.
	7: These challenges are meant to be difficult, but not impossible.
	7: If you fail or missed one, however, then you lost your chance at being promoted to an %C64.
	GOTO @end
	
@end
	CALL @setActorRed
	RETURN
	
@activateChallenge
	SET scene, #<scene.id>

	IF -V5,  @challenge1
	IF -V25, @challenge2
	IF -V45, @challenge3
	IF -V65, @challenge4
	IF -V85, @challenge5
	
	N: @enableChallenge not yet implemented
	RETURN
	
	
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; Hardcore challenge 1	
SCENE 5351, bunkerhallway05, SCENE, "Hardcore challenge 1"	
	
	LOCK 1
	EJECT T172
	FLAGS 2176
	
	HOST_GIVE L#<num.hostMaxHP>
	HOST_GIVE M#<num.hostMaxMP>
	N: Prepare yourself, four %M1701s will attack soon!
	WAIT 5.0
	
	FIGHT2 1701, 1701, 1701, 1701
	
	IF WON, @victory
	N: Better luck next time.
	HOST_GIVE L1
	END

@victory
	N: You have defeated the first hardcore challenge!
	HOST_GIVE T1200
	END
	
	
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; Hardcore challenge 2	
SCENE 5352, bunkerstorage03, SCENE, "Hardcore challenge 2"	
	
	
	IF V45, @nothingHere
	IF -V40, @nothingHereYet
	IF T1201, @alreadyDefeatedHardcoreChallenge

	CALL 5097@addGunslinger

	ACTOR 1, "Keypad", stealth2, 8, 36, 43
	SET x, 50
	SET y, 70
	CALL 5350@hardcoreChallengeSetUp
	
	SET scene, #<scene.id>
	SET sceneReturn, #<scene.id>
	SET passwordScene, "%R899"
	ADD passwordScene, "100"	
	SET temp, "0"
	SET temp2, "0"	
	SET attempts, "10"
	END
	
@eventActorClick1
	IF DEAD, @died
	IF -T868-T869-T870, @finishARLFirst
	COMPARE #<temp2>, "1"
	IF= @menu2
	MENU "Enter pincode=@enterPincode", "Open hack tool=@openHackTool", "Cancel=@cancel"
	END
	
@eventActorClick7
	IF DEAD, @died
	CALL 5350@setActorGreen
	MENU "General information=@helpGeneral", "Types of challenges=@helpTypeChallenges", "Cancel=@end"
	CALL 5350@setActorRed
	END
	
@eventActorAttack8
	8: Hey now, that was uncalled for!
	END

@eventActorClick8
	8: Sorry, %1, but I'm afraid I won't be of much use here.
	8: You'll have to tackle this one yourself.
	END
	
@eventActorClick13
	CALL 5101@requestHelp
	END
	
@eventActorClick14
	COMPARE #<hacktool>, 0
	IF> @hackToolActive
	CALL 5101@hackToolMenu
	END

@hackToolActive
	MENU "Dectivate hack tool=@deactivateHackTool", "Guess attack=@hackGuessAttack", "Cancel=@end"
	RETURN
	
@deactivateHackTool
	CALL 5101@deactivateHackTool
	END

@hackGuessAttack
	6: #<attempts>/10 attempts remaining, enter your guess [enter 'stop' to stop guessing]:
	ASK 300
	
	STRCMP #<lastAsk>, "stop"
	IF= @end

	CALL 5101@hackSearching
	
	SET temp, #<lastAsk>
	DIV temp, 2
	COMPARE #<temp>, 1
	IF< @hackGuessAttackString

	SET temp, "number"
	COMPARE #<lastAsk>, #<passwordScene>
	IF> @hackGuessIsHigher
	IF< @hackGuessIsLower
	IF= @hackSuccess
	RETURN

@hackGuessAttackString	
	SET temp, "word"
	STRCMP #<lastAsk>, #<passwordScene>
	IF> @hackGuessIsHigher
	IF< @hackGuessIsLower
	IF= @hackSuccess
	RETURN

@hackGuessIsHigher
	6: Your guess is higher than the #<temp>.
	GOTO @hackGuessFail
	
@hackGuessIsLower
	6: Your guess is lower than the #<temp>.
	GOTO @hackGuessFail
	
@hackGuessFail
	SUB attempts, "1"
	COMPARE #<attempts>, "1"
	IF< @lockedOut	
	GOTO @hackGuessAttack

@hackSuccess
	CALL 5101@hackSuccess
	END
	
@lockedOut
	CALL 5101@lockedOut
	END
	
@menu2
	MENU "Enter pincode=@enterPincode", "Cancel=@cancel"
	END		

@enterPincode
	1: Enter pincode [XXX]:
	ASK 300
	COMPARE #<lastAsk>, #<passwordScene>
	IF= @accessGranted
	SUB attempts, "1"
	SOUND voice\attempt_failed	
	1: Attempt failed.
	1: Access denied, you have #<attempts>/10 attempts remaining.
	COMPARE #<attempts>, "1"
	IF< @lockedOut
	END

@accessGranted
	SOUND voice\access_granted
	1: Access granted.
	HOST_GIVE T1201
	WAIT 3.0
	N: Congratulations, you have beaten the second hardcore challenge!
	END
	
@openHackTool
	SET temp2, "1"
	SET temp3, #<attempts>
	SET sceneReturn, #<scene.id>
	CALL 5099@setUpHackToolAndHelp
	SET attempts, #<temp3>
	END	
	
@helpGeneral
	CALL 5350@helpGeneral
	END
	
@helpTypeChallenges
	CALL 5350@helpTypeChallenges
	END
	
@nothingHere
	N: There is nothing here anymore.
	END
	
@nothingHereYet
	N: There is nothing here yet, return at level 40 to do a hardcore challenge.
	END

@alreadyDefeatedHardcoreChallenge
	N: You have already defeated this hardcore challenge.
	END

@end
	END
	
@died
	N: You cannot do anything while you are dead.
	END

	
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; Hardcore challenge 3	
SCENE 5353, circuitboard3, CUT, "Hardcore challenge 3"	
	
	SET scene,	#<scene.id>

	CALL 5100@setScene
	CALL 5100@setPins 2 1 1 1
	
	; normal voltage or security data
	SET desiredState5, #<poseActor5>
	SET temp, 0
	IF R50, @skipChangingNode
	ADD desiredState5, 18
	
@skipChangingNode	
	; unencrypted data or low voltage
	SET desiredState4, #<poseActor4>	
	ADD desiredState4, 6
	IF R50, @skipChangingNode2
	ADD desiredState4, 6
	
@skipChangingNode2	
	; unencrypted data or low voltage
	SET desiredState3, #<poseActor3>
	ADD desiredState3, "6"
	COMPARE #<desiredState4>, "12"
	IF> @skipChangingNode3
	ADD desiredState3, "6"

@skipChangingNode3	
	; encrypted data or high voltage
	SET desiredState2, #<poseActor2>
	ADD desiredState2, "24"
	COMPARE #<desiredState4>, "13"
	IF< @skipChangingNode4
	ADD desiredState2, "6"

@skipChangingNode4	
	; encrypted data or high voltage
	SET desiredState1, #<poseActor1>
	ADD desiredState1, "24"	
	COMPARE #<desiredState3>, "13"
	IF< @skipChangingNode5
	ADD desiredState1, "6"

@skipChangingNode5	
	SET analyzerAttempts, "5"
	N: The analyzer disappears after #<analyzerAttempts> analyzations, use each one wisely.
	N: Check the Help Hints for extra Hints!
	END

@eventActorClick15
	CALL 5100@changeThePower
	
	COMPARE #<power>, "1"
	IF= @checkFinished
	END
	
@checkFinished
	COMPARE #<boardIsFixed>, "1"
	IF= @finished
	END

@finished
	WAIT 1.0
	N: You successfully repaired the circuit board and beat the third hardcore challenge!
	HOST_GIVE T1202
	WAIT 3.0
	GOTO SCENE 5023

@eventActorClick14
	CALL 5100@helpRequested
	END
	
@eventActorClick13
	SUB analyzerAttempts, "1"
	CALL 5100@analyzeBoard
	COMPARE #<analyzerAttempts>, "1"
	IF< @removeAnalyzer
	N: You can analyze the circuit board #<analyzerAttempts> more time(s).
	END

@eventActorClick1
	CALL 5100@interactionMenu	1
	END
	
@eventActorClick2
	CALL 5100@interactionMenu	2
	END

@eventActorClick3
	CALL 5100@interactionMenu	3
	END

@eventActorClick4
	CALL 5100@interactionMenu	4
	END

@eventActorClick5
	CALL 5100@interactionMenu	5
	END

@removeAnalyzer
	N: You have used all your analyzing attempts.
	N: You can still test the board by switching the power button on and off.
	MOVE 13, -50, 50, 1
	END
	
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; Hardcore challenge 4	
SCENE 5354, bunkerhallway04, CUT, "Hardcore challenge 4"		
	
	MUSIC MelC-I-turn-to-you
	
	IF V85, @nothingHere
	IF -V80, @nothingHereYet
	IF T1203, @alreadyBeatChallenge
		
	; arg0 = total enemies, arg1 = drone health, arg2 = hits you can take, arg3 = hit chance multiplier drone 
	; difficulty is the number of hits you can take before dying
	SET scene, #<scene.id>	
	CALL 5096@setup 10, 8, 9, 40
	N: Defeat all 10 drones to beat the final hardcore challenge, good luck!
	END
	
@eventActorGive9
@eventActorGive6
@eventActorGive7
@eventActorGive5
	COMPARE #<item.id>, "982"
	IF= @noEMP
	N: That does not do anything.
	END
	
@noEMP
	N: These drones are immune to %I982s, you will have to shoot them down!
	END
	
@eventActorAttack6
	CALL 5096@eventActorAttack6
	END
	
@eventActorAttack7
	CALL 5096@eventActorAttack7
	END	

@eventActorAttack5
	CALL 5096@eventActorAttack5
	END
	
@eventActorAttack9
	CALL 5096@eventActorAttackMiss
	END
	
@reward
	HOST_GIVE T1203
	N: You have beaten the final hardcore challenge!
	IF T1200+T1201+T1202+T1203, @beatAllChallenges
	WAIT 4.0
	GOTO EXIT
	
@beatAllChallenges
	HOST_GIVE T1204
	N: Congratulations, you have beaten all hardcore challenges!
	N: Visit the mess hall to celebrate your victory.
	WAIT 4.0
	GOTO EXIT
	
@nothingHere
	N: There is nothing here anymore.
	END
	
@nothingHereYet
	N: There is nothing here yet, return at level 80.
	END

@alreadyBeatChallenge
	N: You have beaten this challenge.
	END

@died
	N: You cannot do anything while you are dead.
	END
	
@end
	END


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; GUNSLINGER PROMOTION VIDEO
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;
SCENE 5355, gunslinger, CUT, "The return of the Gungslingers"

	MUSIC sweet-whiskey-lies
	
	WAIT 15
	
	BKGND bunkercenter
	
	ACTOR 1, "Erick Finkers", 	monster019, 	1, 44, 81	
	ACTOR 2, "Yuku", 			gun009, 		1, 80, 88, 0, tanya_death
	ACTOR 3, "Carlos", 			gun007, 		1, 67, 81, 0, man_die7
	ACTOR 4, "Nishka", 			gun003, 		4, 33, 87
	ACTOR 5, "Xander Quickshot",gun011, 		1, 36, 75	
	ACTOR 6, "Kayla", 			kitty3, 		4, 25, 82
	
	SEL 1
	POSE 1, 4
	SEL 2
	POSE 1, 4
	SEL 3
	POSE 1, 4
	SEL 4
	POSE 1, 4
	SEL 5
	POSE 1, 2
	
	FACE 2, 0
	FACE 3, 0
	
	WAIT 1
	MOVE 1, 50, 90
	WAIT 2
	
	1: Welcome, dear viewer.
	1: My name is Erick Finkers and I'm the local engineer in Bunker 3, home of the %C63s.
	1: We have a couple of exciting announcements to make.
	
	WAIT 2.0
	MOVE 3, 59, 85
	WAIT 2.0
	3: It's been a long wait, hasn't it?
	SEL 6
	POSE 2
	6: Meow!
	SOUND meow
	WAIT 1
	POSE 4
	3: Revolution of Terror's last update was in March 2006, over seventeen years ago.
	3: Fear not though, Silver has worked on an awesome update in the last couple of months.
	3: In the next few minutes, we'll get you right up to speed on what has been added.
	
	WAIT 2
	MOVE 2, 75, 93
	WAIT 2
	2: The biggest addition of the update is the %C63 class.
	2: We have a completely new storyline with new quests every twenty levels, starting at level 1.
	2: You'll learn who %C63s are, where they come from, where they have been all this time, and what their relation to %M1701s is.
	2: On top of that, there are many quality-of-life improvements added, like faster leveling, less grinding, and having an easier time to become a %C4.
	2: We've also included gender support for people who identify as non-binary, they can marry other heroes with the correct pronouns.
	2: This update reveals more about the origins of the world and what happened to the technology in it.
	
	WAIT 2
	MOVE 4, 35, 91
	WAIT 2
	4: That's right, you'll be working with various technologies yourself. 
	4: In the next shots, we'll demonstrate how you can fix a circuit board, shoot at drones, and even hack terminals!
	4: Finally, we also have an exciting contest to announce that you can participate in.
	
	WAIT 2
	MOVE 5, 41, 77
	WAIT 1
	5: Yes, if you ever wanted to become a %C27 or a %C28, then hang on tight.
	5: You'll have your shot at winning a grand prize!
	WAIT 5
	GOTO SCENE 5356
	
	
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;	CIRCUIT BOARD	
SCENE 5356, check, CUT, "The return of the Gungslingers", 0, 0

	SET scene,	#<scene.id>

	FLAGS	17536
	BKGND	circuitboard3
	LOCK 	1
	EJECT 	T172
		
	SET power, "1"
	SET boardIsFixed, "0"
	SET allowedAttempts, "3"
	
	ACTOR 13, 	"", circuitbuttons, 16, 90, 65 ; Analyzer
	ACTOR 14,	"", circuitbuttons,  5, 90, 85 ; Help
	ACTOR 15, 	"", circuitbuttons,  3, 90, 45 ; Switch
	ACTOR 16,	"", circuitbuttons,  1, 90, 25 ; Power icon
	ACTOR 17.-1000,	"", circuitboard_2, 0, 45, 90	

	CALL 5100@setPins 3 1 2
	
	
	SET poseActor6, 20
	SEL 6
	POSE #<poseActor6>	
	
	SET poseActor3, 8	
	SEL 3
	POSE #<poseActor3>	
		
	SET poseActor2, 26
	SEL 2
	POSE #<poseActor2>
	
	SET poseActor1, 32
	SEL 1
	POSE #<poseActor1>
	
	SET desiredState6, #<poseActor6>
	SET desiredState5, #<poseActor5>
	ADD desiredState5, "12"
	SET desiredState4, #<poseActor4>
	SET desiredState3, #<poseActor3>
	SET desiredState2, #<poseActor2>	
	SET desiredState1, #<poseActor1>	
	END

@eventActorClick15
	CALL 5100@changeThePower
	MUSIC sweet-whiskey-lies
	
	COMPARE #<power>, "1"
	IF= @checkFinished
	END
	
@checkFinished
	COMPARE #<boardIsFixed>, "1"
	IF= @finished
	END

@finished
	WAIT 1.0
	N: You successfully repaired the circuit board!
	WAIT 3.0
	GOTO SCENE 5357

@eventActorClick14
	CALL 5100@helpRequested
	END
	
@eventActorClick13
	CALL 5100@analyzeBoard
	END

@eventActorClick1
	CALL 5100@interactionMenu	1
	END
	
@eventActorClick2
	CALL 5100@interactionMenu	2
	END

@eventActorClick3
	CALL 5100@interactionMenu	3
	END

@eventActorClick4
	CALL 5100@interactionMenu	4
	END

@eventActorClick5
	CALL 5100@interactionMenu	5
	END

@eventActorClick6
	CALL 5100@interactionMenu	6
	END

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; SHOOT DRONES
SCENE 5357, bunkercenter, CUT, "The return of the Gungslingers"

	MUSIC sweet-whiskey-lies

	; arg0 = total enemies, arg1 = drone health, arg2 = hits you can take, arg3 = hit chance multiplier drone 
	; difficulty is the number of hits you can take before dying
	SET scene, #<scene.id>
	CALL 5096@setup 3, 5, 25, 20
	END
	
@eventActorGive6
@eventActorGive7
@eventActorGive5
	COMPARE #<item.id>, "982"
	IF< @doesNothing
	IF> @doesNothing
	CALL 5096@eventActorGiveEMP
	END
	
@eventActorGive9
	COMPARE #<item.id>, "982"
	IF< @doesNothing
	IF> @doesNothing
	CALL 5096@eventActorGiveMissed
	
@eventActorAttack6
	CALL 5096@eventActorAttack6
	END
	
@eventActorAttack7
	CALL 5096@eventActorAttack7
	END	

@eventActorAttack5
	CALL 5096@eventActorAttack5
	END
	
@eventActorAttack9
	CALL 5096@eventActorAttackMiss
	END
	
@reward
	WAIT 4.0
	GOTO SCENE 5358
	
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; TERMINAL SCREEN
SCENE 5358, check1, CUT, "The return of the Gungslingers", 0, 0, 0	
	
	BKGND	check1
	FLAGS	17792
	LOCK 	1	
	EJECT 	T172
	MUSIC sweet-whiskey-lies	
	
	SET loggedIn, 0
	SET fileOpen, 0
	SET programActive, 0
	SET hacktool, 0
	SET x, 5
	SET y, 15
	SET actorId, 16
	SET virusScannerPose, 9
	
	ACTOR 1, "", abcall, 1, #<x>, #<y>
	POSE 1, 47
	
	; These are the invisible actors that write in chat
	ACTOR 7, "c\", circuitbuttons, 9, -50, -50  	
	ACTOR 8, "Hack tool", circuitbuttons, 9, -50, -50	
	ACTOR 9, "Help", circuitbuttons, 9, -50, -50		
	
	; These are the visible actors on screen
	ACTOR 12, 	"", circuitbuttons, #<virusScannerPose>, 85, 25
	ACTOR 13,	"", circuitbuttons, 5, 85, 90
	ACTOR 14,	"", circuitbuttons, 6, 85, 70	
	

	; These cookies are mandatory to implement
	SET scene, #<scene.id>
	SET sceneReturn, "5359"
	SET attempts, 4
	SET passwordScene, "mypassword"
	
	CALL 5101@startScreen
	9: Click on the blinking cursor to enter text into the terminal.
	END
	
@eventActorClick1
	COMPARE #<loggedIn>, 1
	IF= @commandLine

	ASK 300
	
	STRCMP #<lastAsk>, "help"
	IF= @eventActorClick13
	
	CALL 5101@loginUser	
	CALL 5101@loginPassword
	
	; The actual password checking happens after confirming the correct login was used.
	STRCMP #<login>, "admin"
	IF= @admin 
	STRCMP #<login>, "engineer"
	IF= @engineer

	CALL 5101@invalidAccessRequest
	END
	
@eventActorClick13
	CALL 5101@requestHelp
	END
	
@eventActorClick14
	CALL 5101@hackToolMenu
	END	

@accessDenied
	CALL 5101@accessDenied
	END	

@admin
	; admin can search passwords.txt
	SET dir, "documents"
	SET path, "c:\#<dir>"
	GOTO @accessGranted

@engineer
	SET user, "engineer"
	STRCMP #<password>, #<passwordScene>
	IF!= @accessDenied
	
	SET dir, "program files"
	SET path, "c:\#<dir>"
	GOTO @accessGranted
	
@accessGranted	
	CALL 5101@accessGranted
	CALL 5101@loginSuccessful
	CALL 5101@commandAwaitingOrders	
	GOTO @commandLine

	; show several directories, but also show that the user doesn't have the rights to access those
	; open to to see which fuse is burned through (random 1 of 3) in power_management.exe
	END
;---------------------------------
; COMMAND LINE
;---------------------------------
@commandLine
	ASK 300

	; Check the STRCMP commands first, then the STRSTR
	
	STRCMP #<lastAsk>, "logout"
	IF= @commandLogOut
	STRCMP #<lastAsk>, "logoff"
	IF= @commandLogOut
	
	STRCMP #<lastAsk>, "quit"
	IF= @commandQuit

	STRCMP #<lastAsk>, "cd ./"
	IF= @commandCloseDirectory
		
	STRCMP #<lastAsk>, "dir"
	IF= @commandViewDirectory
	
	STRCMP #<lastAsk>, "exit"
	IF= @commandExitProgram
	
	STRCMP #<lastAsk>, "close"
	IF= @commandCloseFile
	
	STRSTR #<lastAsk>, "open"
	IF> @commandOpenFile
	
	STRSTR #<lastAsk>, "run"
	IF> @commandRunProgram

	STRCMP #<lastAsk>, "cd program files"
	IF= @commandOpenDirectoryProgramFiles

	STRCMP #<lastAsk>, "cd documents"
	IF= @commandOpenDirectoryDocuments
	
	STRCMP #<lastAsk>, "help"
	CALL 5101@requestHelp

	CALL 5101@invalidCommand
	GOTO @commandLine
	
@commandLogOut
	CALL 5101@commandLogOut

@commandQuit
	CALL 5101@commandQuit

@commandViewDirectory
	CALL 5101@commandSearching
	
	STRCMP #<path>, "c:\"
	IF= @commandViewDirectoryRoot
	
	STRCMP #<path>, "c:\documents"
	IF= @commandViewDirectoryDocuments
	
	STRCMP #<path>, "c:\program files"
	IF= @commandViewDirectoryProgramFiles
	GOTO @commandLine
	
@commandViewDirectoryRoot	
	SET lastAsk, ""
	SET terminalText, "documents"
	CALL 5101@writeText	1
	SET terminalText, "program files"
	CALL 5101@writeText	1
	GOTO @commandLine

@commandViewDirectoryDocuments
	CALL 5101@updateProgramName "#<path>"

	SET lastAsk, ""
	SET terminalText, "passwords.txt"
	CALL 5101@writeText	1
	SET terminalText, "vault.protected"
	CALL 5101@writeText	1	
	GOTO @commandLine
	
@commandViewDirectoryProgramFiles
	CALL 5101@updateProgramName "#<path>"
	
	SET lastAsk, ""
	SET terminalText, "power_management.exe"
	CALL 5101@writeText	1
	SET terminalText, "diagnostics.exe"
	CALL 5101@writeText	1
	GOTO @commandLine

@commandOpenDirectoryRoot
	SET dir, "c:\"
	SET path, "#<dir>"
	
	SET lastAsk, ""
	SET terminalText, "#<path>"
	CALL 5101@writeText	1	
	GOTO @commandLine
	
@commandOpenDirectoryProgramFiles
	SET dir, "program files"
	SET path, "c:\#<dir>"
	
	SET lastAsk, ""
	SET terminalText, "#<path>"
	CALL 5101@writeText	1	
	GOTO @commandLine		

@commandOpenDirectoryDocuments
	SET dir, "documents"
	SET path, "c:\#<dir>"
	
	SET lastAsk, ""
	SET terminalText, "#<path>"
	CALL 5101@writeText	1	
	GOTO @commandLine
	
@commandCloseDirectory
	STRCMP #<dir>, "c:\"
	IF= @commandCloseDirectoryRoot
	GOTO @commandOpenDirectoryRoot

@invalidAccessDirectory	
	7: ERROR: You have insufficient rights to access this directory.
	GOTO @commandLine
	
@invalidAccessFile	
	7: ERROR: You have insufficient rights to access this file.
	GOTO @commandLine	

@invalidAccessProgram
	7: ERROR: You have insufficient rights to run this program, login as another user to run this program.
	GOTO @commandLine	

@commandCloseDirectoryRoot
	CALL 5101@commandInvalidDirectory
	7: You are already in the root directory.
	GOTO @commandLine

@commandOpenFile
	COMPARE #<fileOpen>, "1"
	IF= @commandOpenFileInvalid

	SET fileOpen, "1"
	
	STRCMP #<lastAsk>, "open passwords.txt"
	IF= @commandOpenFilePasswords
	STRCMP #<lastAsk>, "open passwords"
	IF= @commandOpenFilePasswords
	
	SET fileOpen, "0"

	7: ERROR: The requested file does not exist.
	RETURN

@commandOpenFileInvalid
	7: ERROR: There is already a file open, close the current file first.
	GOTO @commandLine
	
@commandOpenFilePasswords
	7: -------------
	7: PASSWORDS
	7: -------------
	7: user name: silver 
	7: password: rotrocks
	7: ------------------
	7: user name: engineer
	7: password: #<passwordScene>
	7: ------------------
	GOTO @commandLine
	
@commandCloseFile
	COMPARE #<fileOpen>, "1"
	IF< @commandCloseFileInvalid
	SET fileOpen, "0"
	7: File closed.
	GOTO @commandLine
	
@commandCloseFileInvalid
	7: ERROR: no open file
	GOTO @commandLine
	
@commandRunProgram
	COMPARE #<programActive>, "1"
	IF= @commandRunProgramAlreadyActive

@commandExitProgram
	COMPARE #<programActive>, "0"
	IF= @commandExiProgramInactive
	SET programActive, "0"
	7: Program exited.
	GOTO @commandLine

@commandExiProgramInactive
	7: ERROR: There is no active program to exit.
	GOTO @commandLine


; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
; END SCENE 
SCENE 5359, bunkercenter, CUT, "The return of the Gungslingers"

	MUSIC sweet-whiskey-lies
	
	ACTOR 1, "Erick Finkers", 	monster019, 	1, 44, 81	
	ACTOR 2, "Yuku", 			gun009, 		1, 80, 88, 0, tanya_death
	ACTOR 3, "Carlos", 			gun007, 		1, 67, 81, 0, man_die7
	ACTOR 4, "Nishka", 			gun003, 		4, 33, 87
	ACTOR 5, "Xander Quickshot",gun011, 		1, 36, 75	
	ACTOR 6, "Kayla", 			kitty3, 		4, 25, 82
	
	SEL 1
	POSE 1, 4
	SEL 2
	POSE 1, 4
	SEL 3
	POSE 1, 4
	SEL 4
	POSE 1, 4
	SEL 5
	POSE 1, 2
	
	FACE 2, 0
	FACE 3, 0
	
	WAIT 1
	MOVE 1, 50, 90
	WAIT 2

	1: I hope you enjoyed this brief spoiler of what you can expect.
	1: To kick it all off, Silver is also organizing a skinning contest on Discord.
	1: You can enter the contest by making a %C63 skin!
	1: You can create any character you want, just as long as at least the attack frame holds a firearm.
	
	WAIT 2
	MOVE 2, 75, 93
	WAIT 2
	2: The kind of firearm doesn't matter, it can be something traditional or scifi.
	2: %C63s will have access to all sorts of weaponry, from handguns, to sniper rifles, to science fiction energy blasters.	

	WAIT 2.0
	MOVE 3, 59, 85
	WAIT 2.0
	3: You can enter the contest as often as you'd like, however, you can only win one prize.
	3: The first three winners receive access to the %C27 and %C28 classes.
	3: The next seven winners can choose which one of those two classes they want.
	3: The other rules are on Discord on the Well of Souls server; an invite link is down below in the description.
	3: We hope to see you there!
	WAIT 4.0
	
	MOVE 1, -50, 50, 1
	MOVE 2, -50, 50, 1
	MOVE 3, -50, 50, 1
	MOVE 4, -50, 50, 1
	MOVE 6, -50, 50, 1
	
	BKGND gunslinger
	WAIT 2.0
	5: Wait, where did you all go?
	5: Oh...
	5: Crap, I should disappear too!
	WAIT 2.0
	MOVE 5, -25, 95, 2

	WAIT 3
	CALL 5098@soundstatic
	END
	

; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
;

; Am I still going to use silly comments lines? Mm... yeah, I guess I will be. Some quirks are hard to kill. :)