# This is the script file for Vikings of Midgard.  I've tried to document it as thouroughly as
# I can, but that's not always possible!  Whenever you see comments like these that start every 
# line with a (pound key) sign, they indicate that that line will not be read by the
# script itself.  So we can write whatever we want here!

# These used to go at the front of every script file way way WAY back when!
# They're dummied out for historical purposes.

#include, plotscr.hsd
#  include, viking.hsi
#include, scancode.hsi
include, utility.lib
include, rmzbifrost.hss
include, weather.hss


# Just because your scripts compile, doesn't mean that they will work!
# It's sort of like running a story through a spell check.
# Just because you didn't catch any spelling errors,
# Doesn't mean that what you wrote is grammatically correct!

# Because I'm an old fart, I use the "old way" of defining scripts
# This is mostly because of habit, but also because of the primary rule of coding
# Specifically "if it ain't broke, don't f*ck with it!"

define script (1,run,none)
define script (2,afterbattle,none)
define script (3,HPtab,none)
define script (4,MPtab,none)
define script (5,opening scene,none)
define script (6,inn,none)
define script (7,inn2,none)
define script (8,inn3,none)
define script (9,earthfiend,none)
define script (10,die in battle,none)
define script (11,cthulhu1,none)
define script (12,tulzcha,none)
define script (13,dagon,none)
define script (14,cthulhu,none)
define script (15,kyle,none)
define script (16,azathoth,none)
define script (17,credits,none)
define script (18,Bramget,none)
define script (19,warriorget,none)
define script (20,missionaryget,none)
define script (21,shamanget,none)
define script (22,rangerget,none)
define script (23,westernpit,none)
define script (24,easternpit,none)
define script (25,southernpit,none)
define script (26,firstpit,none)
define script (27,valkyrieget,none)
define script (28,grinlow,none)
define script (29,skaldget,none)
define script (30,whalepunch,none)
define script (31,whaleland,none)
define script (32,berserkerget,none)
define script (33,randomboxpuzzle,none)
define script (34,randomboxprize,none)
define script (35,enteralfheim,none)
define script (36,jint,none)
define script (37,thule1,none)
define script (38,thule2,none)
define script (39,alfheim1,none)
define script (40,niffbox,none)
define script (41,elfshouse1,none)
define script (42,alfheim2,none)
define script (43,alfheim3,none)
define script (44,alfheim4,none)
define script (45,jotunheim1,none)
define script (46,jotunheim2,none)
define script (47,stairsup,none)
define script (48,stairsdown,none)
define script (49,Gahn,none)
define script (50,JO,none)
define script (51,orlock,none)
define script (52,finalbrising,none)
define script (53,BramReturns,none)
define script (54,Frumpyback,none)
define script (55,Hel,none)
define script (56,vulpes,none)
define script (57,BramSLOW,none)
define script (58,NightSLEEP,none)
define script (59,OlafMANA,none)
define script (60,KittSLASH,none)
define script (61,FrumpForce,none)
define script (62,StyrgeWERE,none)
define script (63,antidote,none)
define script (64,Hildaback,none)
define script (65,housemaster,none)
define script (66,FrumpyLINGUE,none)
define script (67,FrumpyAWAKE,none)
define script (68,FrumpyNURSE,none)
define script (69,FrumpyLIFE,none)
define script (70,FrumpySUBLIME,none)
define script (71,Lyngvi,none)
define script (72,Freya,none)
define script (73,brising,none)
define script (74,NIGHTTHUNDER,none)
define script (75,Grue,none)
define script (76,MontereyPenguin,none)
define script (77,Triangletrap,none)
define script (78,Garm,none)
define script (79,Chainsaw Jack,none)
define script (80,Rell,none)
define script (81,Crimson,none)
define script (82,Josh,none)
define script (83,Walrus,none) 
define script (84,Surlaw,none)
define script (85,Deactivated,none)
define script (86,triangle1,none)
define script (87,triangle2,none)
define script (88,fiends1,none)
define script (89,fiends2,none)
define script (90,Hatifinal,none)
define script (91,zidane,none)
define script (92,EricSILENCE,none)
define script (93,BossIntroduction,none)
define script (94,Dogero,none)
define script (95,Dracula,none)
define script (96,Narvi,none)
define script (97,Shayna,none)
define script (98,Velius,none)
define script (99,Delvire,none)
define script (100,Sasha,none)
define script (101,Siva,none)
define script (102,Alex,none)
define script (103,Collies1,none)
define script (104,mindscrew,none)
define script (105,Ericback,none)
define script (106,misteroo,none)
define script (107,fourfiends,none)
define script (108,firesmash,none)
define script (109,icebrand,none)
define script (110,boltslash,none)
define script (111,utgard,none)
define script (112,delvirearena,none)
define script (113,arena,none)
define script (114,arenaHorace,none)
define script (115,arenacomrade,none)
define script (116,slimesalad,none)
define script (117,lowteir,none)
define script (118,midteir,none)
define script (119,upperteir,none)
define script (120,highteir,none)
define script (121,quarterfinals,none)
define script (122,semifinals,none)
define script (123,tunneler,none)
define script (124,crone,none)
define script (125,TELEPORT,none)
define script (126,tele0,none)
define script (127,tele1,none)
define script (128,tele2,none)
define script (129,tele3,none)
define script (130,tele4,none)
define script (131,tele5,none)
define script (132,tele6,none)
define script (133,tele7,none)
define script (134,tele8,none)
define script (135,tele9,none)
define script (136,tele10,none)
define script (137,skadi1,none)
define script (138,skadi2,none)
define script (139,olaf1,none)
define script (140,Delvire2,none)
define script (141,fafnir,none)
define script (142,Manafight,none)
define script (143,Cthulhu2,none)
define script (144,Collies2,none)
define script (145,Eikthymir,none)
define script (146,lifemist,none)
define script (147,Cthulhu3,none)
define script (148,thisisademo,none)
define script (149,Delvire3,none)
define script (150,DelvireBoat,none)
define script (151,Gisli,none)
define script (152,hatistory1,none)
define script (153,hatistory2,none)
define script (154,hatistory3,none)
define script (155,hatistory4,none)
define script (156,hatistory5,none)
define script (157,hatistory6,none)
define script (158,arenamu,none)
define script (159,hatifight1,none)
define script (160,hatifight2,none)
define script (161,god,none)
define script (162,Rachel2,none)
define script (163,skadi3,none)
define script (164,narvi2,none)
define script (165,cow,none)
define script (166,hissu,none)
define script (167,slayjotun,none)
define script (168,timtim,none)
define script (169,delvirefinal,none)
define script (170,weakstrike,none)
define script (171,manslay,none)
define script (172,darkrage,none)
define script (173,itsatrap,none)
define script (174,seethegate,none)
define script (175,intohelheim,none)
define script (176,vikitron,none)
define script (177,funkout,none)
define script (178,scoreboard,none)
define script (179,funkatronbest,none)
define script (180,funkatrongreat,none)
define script (181,funkatrongood,none)
define script (182,funkatronokay,none)
define script (183,funkatronpoor,none)
define script (184,funkatronbad,none)
define script (185,funkatronawful,none)
define script (186,OmegaWEAPON,none)
define script (187,OmegaWEAPONfinal,none)
define script (188,Enherdesert,none)
define script (189,HildaValia,none)
define script (190,Linnorm,none)
define script (191,TripCut,none)
define script (192,excalibur,none)
define script (193,void autorun,none)
define script (194,water autorun,none)
define script (195,tetracut,none)
define script (196,reaper,none)
define script (197,silencer,none)
define script (198,panopt1,none)
define script (199,panopt2,none)
define script (200,panopt3,none)
define script (201,panopt4,none)
define script (202,panopt5,none)
define script (203,panopt6,none)
define script (204,panopt7,none)
define script (205,panopt8,none)
define script (206,panopt9,none)
define script (207,kylevoid,none)
define script (208,defender,none)
define script (209,trueboss,none)
define script (210,ginga autorun,none)
define script (211,gahn1,none)
define script (212,gahn2,none)
define script (213,gahn3,none)
define script (214,jade,none)
define script (215,FINALE,none)

#That's a lot of scripts! But in truth there are actually MORE hidden in this file

# This is technically a script of sorts too, but it defines some very VERY
# important variables that may get called up in the future!

global variable, begin
	1,timer
	2,steve
	3,tyron
	4,boosh
	5,score
	6,keytimer
	7, next camera pixel x
	8, next camera pixel y
	10,highscore
	11,spot0
	12,spot1
	13,spot2
	14,spot3


end

	global variable(57, song start ms) 
	define constant(1, timer:song) 


# This next script has to do with whatever happens when the "x" key is held down

script,run,begin 
	 show no value

	if,begin 
		 key is pressed (key:x),or,key is pressed(joy:button3)
# change this to choose your own key. By default, holding "x" when walking will make you run
	end 
	then,begin 
		if (hero is walking (me)==false) 
		then,begin 
			set hero speed (me,10) 
# This basically states that if "x" is held down, you'll move a little faster
			if (checktag(tag:SPRINT)==on) then (set hero speed (me,20))
# This line shows that if the stated tag is on, you'll dash faster. This particular tag is set to the 
# Brigand's "Is Leader" bitset, so when the brigand is in charge, you'll run quite fast.
			if (checktag(tag:DASH)==on) then (set hero speed (me,20))
# This line is like the above lines in that if the tag is on, you'll run at a blazing 20 pixels per tick.
# That's one tile per tick!
		end 
	end 
	else,begin 
# This line states that if the player isn't holding "x", then the hero will only walk normally.
		if (hero is walking (me)==false) 
		then,begin 
			set hero speed (me,4) 
		end 
	end 
end 

# That seemed complicated, but when you break it down, it's not too hard!

# This next script has to do with what happens AFTER battles!
# Namely, it's checking to see if certain spell related tags are on,
# and if they are, it'll teach a particular hero some spells!

script,afterbattle,begin

# First a variable. It'll come up later on.
  	variable(i)

	if (checktag(tag:Photoheal1)) 	then 	(teach spell ((find hero(hero:Renard)),atk:Photoheal))
	if (checktag(tag:Siphon1)) 	then 	(teach spell ((find hero(hero:Renard)),atk:Siphon))
	if (checktag(tag:Lifedrain1)) 	then 	(teach spell ((find hero(hero:Renard)),atk:Lifedrain))
	if (checktag(tag:Crush1)) 	then 	(teach spell ((find hero(hero:Renard)),atk:Crush))
	if (checktag(tag:Maim1)) 	then 	(teach spell ((find hero(hero:Renard)),atk:Maim))
	if (checktag(tag:Dissolve1)) 	then 	(teach spell ((find hero(hero:Renard)),atk:Dissolve))
	if (checktag(tag:Greenfire1)) 	then 	(teach spell ((find hero(hero:Renard)),atk:Greenfire))
	if (checktag(tag:Purplhaze1)) 	then 	(teach spell ((find hero(hero:Renard)),atk:Purplhaze))
	if (checktag(tag:Icewave1)) 	then 	(teach spell ((find hero(hero:Renard)),atk:Icewave))
	if (checktag(tag:Explode1)) 	then 	(teach spell ((find hero(hero:Renard)),atk:Explode))
	if (checktag(tag:Barrier1)) 	then 	(teach spell ((find hero(hero:Renard)),atk:Barrier))
	if (checktag(tag:Supernova1)) 	then 	(teach spell ((find hero(hero:Renard)),atk:Supernova))

# That's quite a few spells, BUT we're not done. 
# If Renard has learned all his spells, we're going to give him
# A VERY special weapon as a reward for tracking them all down!
# This next tag check only goes through the others if it's off.

	if (checktag(tag:FOXSWORD)==off) then (

# And now here's the next tags. We're going to look through them in pairs to save space

		if ((checktag(tag:Photoheal1)==on) and (checktag(tag:Siphon1)==on)) then (
			if ((checktag(tag:Lifedrain1)==on) and (checktag(tag:Crush1)==on)) then (
				if ((checktag(tag:Maim1)==on) and (checktag(tag:Dissolve1)==on)) then (
					if ((checktag(tag:Greenfire1)==on) and (checktag(tag:Purplhaze1)==on)) then (
						if ((checktag(tag:Icewave1)==on) and (checktag(tag:Explode1)==on)) then (
							if ((checktag(tag:Barrier1)==on) and (checktag(tag:Supernova1)==on)) then (

# That's a big list of checks isn't it?

								set tag (tag:FOXSWORD,on)
								show textbox (3977), wait (7), wait for key (usekey), advance textbox
							)
						)
					)
				)
			)
		)
	)
# This next line specifically looks for a certain tag, and alters the damage cap
# This is mostly for backwards compatability, but also to help playtesters
# Who decide to skip to the second half of the game.

	if (checktag(tag:WORLDOFRUIN)) 	then 	( set damage cap (9999))


# Now we want to check and see if Eric's in the active group. Otherwise this does nothing.
	if (checktag(tag:SkaldInParty)) 	then 	(
# Here we're essentially looking at all hero positions 0,1,2 and 3.
    		for(i,0,3) do,begin
# If their current MP is less than or equal to Eric's Vigor..
      			if (get hero stat(i,stat:MP,current stat) <= (get hero stat (find hero (hero:Eric), stat:Vigor)) )
# Then the script will set their MP to whatever Eric's Vigor is.
      			then (set hero stat(i,stat:MP,(get hero stat (find hero (hero:Eric), stat:Vigor))))
		end
    	end

# Now we want to check and see if Frumpy's in the active group. Otherwise this does nothing.
	if (checktag(tag:MissionaryInParty)) 	then 	(
# Here we're essentially looking at all hero positions 0,1,2 and 3.
    		for(i,0,3) do,begin
# If their current HP is less than or equal to 0..
      			if (get hero stat(i,stat:HP,current stat) <= 0)
# Then the script will set their HP to 1.
      			then (set hero stat(i,stat:HP,1))
		end
    	end


end


script,HPtab,begin
# This script is short, and to the point.
# It will bring up a pickbox to choose the hero, then add 50 points to that hero's HP!
# Just be sure to link it to a textbox, and have an item call that textbox when used in the field.
	gain hero stat ((pickhero), stat:HP, 50, true)
 	items menu
end

script,MPtab,begin
# This script is short, and to the point.
# It will bring up a pickbox to choose the hero, then add 25 points to that hero's MP!
# Just be sure to link it to a textbox, and have an item call that textbox when used in the field.
 	Add To Stat 	((pickhero),stat:MP,25)
 	items menu
end

# That's a lot of utility scripts down, time for some actual storyline scripts!

script,opening scene,begin

# These lines stop all player control, but also stop the music 

 	suspend player,	suspend box advance, stop song, init weather

# These next lines force the first hero, Freki, to have some very powerful starting equipment.
# Note that you CAN go into your inventory afterwards and remove her gear to sell or
# Equip it on another hero!

 
 	force equip ((find hero (hero:Freki)),2,57)
 	force equip ((find hero (hero:Freki)),3,214)
 	force equip ((find hero (hero:Freki)),4,88)
 	force equip ((find hero (hero:Freki)),5,255)

# Taking off Freki's clothes is not only acceptable, it's optimal for speedrunning.

# This next part moves around some NPCs, so that the "POWERED BY OHRRPGCE" thing shows up
# Once they've moved into position, it plays a sound effect too!

	wait (30) 
	walk NPC (1,up,1), walk NPC (2,up,1), walk NPC (3,up,1)
	walk NPC (4,up,1), walk NPC (5,up,1), walk NPC (6,up,1)
	walk NPC (7,up,1), walk NPC (8,up,1), walk NPC (9,up,1), walk NPC (10,down,1)
	walk NPC (11,down,1), walk NPC (12,down,1), walk NPC (13,down,1), walk NPC (14,down,1),
 	walk NPC (15,down,1), walk NPC 	(16,down,1), walk NPC 	(17,down,1)
	wait for NPC (1),play sound (sfx:Menu8Bit,false,true)

# A bit after the logo, the music starts up and we pan the camera down by secretly
# Moving the hero south 20 tiles. Once there, we show some textboxes.

	wait (30),play song (song:GodsOfSpite)
	set hero speed (me,2) ,walk hero (me,down,20),wait for hero (me)
 	show textbox (586), wait (108), advance text box
 	show textbox (587), wait (108), advance text box
 	show textbox (588), wait (108), advance text box
 	show textbox (589), wait (108), advance text box
 	show textbox (590), wait (108), advance textbox

# Next up we're going to fade the screen to white. The RGB color values by default are
# A little WEIRD, but 63,63,63 translates to a pure white, so it's what we'll use.
# After the screen has faded out, we want to wait a bit for the game to catch up
# So that we can show the Title Screen for Vikings of Midgard

 	wait (10),fade screen out (63,63,63),wait (5)
 	show textbox (591), wait (5), fade screen in
 	wait (140),fade screen out (63,63,63), wait (5), advance textbox

# Then we fade the screen back out to white and wait a bit. 
# Next we're going to use a door (0) which has been set in the game to take
# Us to a particular point in the story.

 	use door (0), wait (2), fade screen in
	set hero speed (me,4)
	set hero direction (me,left),wait (5)
 	set hero direction (me,up), wait (5)
 	set hero direction (me,right), wait (5)
 	set hero direction (me,up),wait (5)

#The hero looks around a little, to take in their surroundings before walking north.

 	walk hero (me,up,4), wait for hero (me), wait (10)

# Though there's no real reason why we can't just walk north 10 tiles,
# There's a door in the way which will lead to a scene transition, and the brief pause
# Here is to give the player a little time to take everything in.

 	walk hero (me,up,6), wait (10)	

# This particular ordering of textbox showing will be one of the most prominent lines
# In the code, with small alterations to the textbox number or wait time.
# The wait time of 7 ticks isn't quite half a second, but is there so that
# The player doesn't accidentally hold down the spacebar/enter key and advances
# through the text so fast that they miss important information.

	show textbox (1), wait (7), wait for key (usekey), advance textbox
	show textbox (2), wait (7), wait for key (usekey), advance textbox
	show textbox (3), wait (7), wait for key (usekey), advance textbox
	show textbox (4), wait (7), wait for key (usekey), advance textbox
	show textbox (5), wait (7), wait for key (usekey), advance textbox

# In general, I like to leave a 5 tick wait between the end of a textbox,
# When an character on the screen moves, and the start of a new textbox.
# It isn't a hard rule, but it does tend to make the action flow a bit
# Smoother, and provides a visual cue that someone is talking. There will
# Be other ways to show how that works later on, but for now we're relying
# On this simple gimmick.

	wait (5), set NPC direction (44,left), wait (5)
	show textbox (6), wait (7), wait for key (usekey), advance textbox
	wait (5), set NPC direction (9,right), wait (5)
	show textbox (7), wait (7), wait for key (usekey), advance textbox
	show textbox (8), wait (7), wait for key (usekey), advance textbox
	wait (5), set NPC direction (9,down), wait (5)
	show textbox (3654), wait (7), wait for key (usekey), advance textbox
	show textbox (3655), wait (7), wait for key (usekey), advance textbox
	wait (5), set NPC direction (46,up), wait (5)
	show textbox (3656), wait (7), wait for key (usekey), advance textbox
	wait (5), walk NPC (43,down,1), wait for NPC (43)
	show textbox (3657), wait (7), wait for key (usekey), advance textbox
	wait (5), set NPC direction (45,up), set hero direction (me,left)
	set NPC direction (46,left), wait (5)
	show textbox (3658), wait (7), wait for key (usekey), advance textbox
	wait (10), stop song

# Now the music stops, and we know something's up. The NPCs on the screen also
# Jank around and face different directions to show they're looking for the
# Source of the disturbance too.

	show textbox 	(3659), wait (7), wait for key (usekey), advance textbox
	wait (5), set NPC direction (9,down), set hero direction (me,down), set NPC direction (44,down)
	set NPC direction (46,left), set NPC direction (45,right), walk NPC (43,up,1),set NPC direction (43,down)
	wait (5), set NPC direction (9,left), set hero direction (me,right), set NPC direction (44,right) 
	set NPC direction (46,down), set NPC direction (45,up) , set NPC direction (43,right)
	wait (5), set NPC direction (9,down), set hero direction (me,down), set NPC direction (44,down)
	set NPC direction (46,left), set NPC direction (45,right) , set NPC direction (43,down)
	wait (5), set NPC direction (9,right), set hero direction (me,left), set NPC direction (44,left) 
	set NPC direction (46,up), set NPC direction (45,down) , set NPC direction (43,left)
	wait (5), set NPC direction (9,down), set hero direction (me,down), set NPC direction (44,down) 
	set NPC direction (46,left), set NPC direction (45,right) , set NPC direction (43,down)

# At this point we need the camera itself to move. Earlier we relied on the hero themself
# Acting as the focus point, but right now we're going to move it by itself.
# Usually you'll also want to wait for the camera to catch up to where it's supposed to go
# Before resuming the action - though there are exceptions!
# This isn't one of those times!

 	wait (10), focus camera (33,7,2), wait for camera, wait (5)
	set hero direction (me,down)

# An Explosion! We want to move an NPC into a particular spot, play a sound effect,
# And then rotate that NPC through its individual frames to create an animation.

 	set NPC position (48,33,7), play sound (sfx:MediumExplosion8Bit,false,true)
	set NPC direction (48,up), set NPC frame (48,0), wait (2)
	set NPC direction (48,up), set NPC frame (48,0), wait (2)
	set NPC direction (48,right), set NPC frame (48,1), wait (2)
	set NPC direction (48,right), set NPC frame (48,1), wait (2)
	set NPC direction (48,down), set NPC frame (48,0), wait (2)
	set NPC direction (48,down), set NPC frame (48,1), wait (2)
	set NPC direction (48,left), set NPC frame (48,0), wait (2)
	set NPC direction (48,left), set NPC frame (48,1), wait (2)
	set NPC position (48,0,0)

# Cthulhu appears to crash the party! Note that the NPC ID's have swapped, so
# That Cthulhu now occupies the same location that the explosion did, while the
# Explosion sprite has been whisked off some some far off corner of the map.
# Out of sight, out of mind.

	set NPC position (47,33,7)
	play song (song:Vile)
	show textbox (3660), wait (7), wait for key (usekey), advance textbox

# I like to make my NPCs "turn" in the direction they're going to face, as if by
# Following stage directions. Though it's not a hard rule, when turning an NPC
# From left and right directions, they'll face down briefly as if to keep their face to
# The camera before facing their intended direction. Again, you don't NEED to do this,
# It's just a bit cleaner looking than simply making the character face into the direction
# That you want them to immediately. Also, more wait commands. 

	wait (5), set NPC direction (47,left), wait (5), set NPC direction (47,up), wait (5)
	show textbox (3661), wait (7), wait for key (usekey), advance textbox
	walk hero (me,left,1), wait for hero (me)
	walk hero (me,up,1), set hero direction (me,down), walk NPC (9,down,1),wait for hero (me)
	show textbox 	(3662), wait (7), wait for key (usekey), advance textbox
	walk NPC (43,down,1)
	show textbox (3663), wait (7), wait for key (usekey), advance textbox
	wait (5), set NPC direction (47,left), wait (5)
	set NPC direction (47,down), wait (5)
	show textbox (3664), wait (7), wait for key (usekey), advance textbox
	show textbox (3665), wait (7), wait for key (usekey), advance textbox
	show textbox (3666), wait (7), wait for key (usekey), advance textbox
	wait (5), set NPC direction (47,left), wait (5), set NPC direction (47,up), wait (5)
	show textbox (3667), wait (7), wait for key (usekey), advance textbox
	show textbox (3668), wait (7), wait for key (usekey), advance textbox
	show textbox (3669), wait (7), wait for key (usekey), advance textbox

# You'll usually want to put in a wait command when moving a hero or NPC
# Unless they're in a hurry!

	walk hero (me,down,1)
	show textbox (3670), wait (7), wait for key (usekey), advance textbox
	show textbox (3671), wait (7), wait for key (usekey), advance textbox
	show textbox (3672), wait (7), wait for key (usekey), advance textbox
	show textbox (3673), wait (7), wait for key (usekey), advance textbox
	wait (5), set NPC direction (47,left), wait (5),set NPC direction (47,down), wait (5)
	show textbox 	(3674), wait (7), wait for key (usekey), advance textbox
	stop song

# The explosion happens again, and we swap Cthulhu's sprite to the corner.
# Once the explosion's over, we can simply dump it back in the corner again and
# Forget about it. If for whatever reason you can put the player in a spot where they can 
# Ever see that corner, you may want to make the tiles there overhead tiles.

	set NPC position (47,0,0)
 	set NPC position (48,33,7), play sound (sfx:MediumExplosion8Bit,false,true)
	set NPC direction (48,up), set NPC frame (48,0), wait (2)
	set NPC direction (48,up), set NPC frame (48,0), wait (2)
	set NPC direction (48,right), set NPC frame (48,1), wait (2)
	set NPC direction (48,right), set NPC frame (48,1), wait (2)
	set NPC direction (48,down), set NPC frame (48,0), wait (2)
	set NPC direction (48,down), set NPC frame (48,1), wait (2)
	set NPC direction (48,left), set NPC frame (48,0), wait (2)
	set NPC direction (48,left), set NPC frame (48,1), wait (2)
	set NPC position (48,0,0)

# More textboxes and NPC movement. As I said, this is the bulk of the game's scripts.

	show textbox (3675), wait (7), wait for key (usekey), advance textbox
	wait (5), walk NPC (9,up,1), set NPC direction (9,down), wait for NPC (9), wait (5)
	wait (5), set NPC direction (9,down), set hero direction (me,right), set NPC direction (44,left), 
	set NPC direction (46,left), set NPC direction (45,right) , set NPC direction (43,right)
	walk hero (me,right,1), wait for hero (me), set hero direction (me,up)

# At this point we want the camera to focus back on the hero and then stick to them.
# Figure out where your hero position is, focus to that spot and wait for it to
# Catch up, then have it follow the hero again, like by default.

	focus camera (33,5,2), wait for camera, wait (5), camera follows hero (me)
	show textbox (3676), wait (7), wait for key (usekey), advance textbox
	show textbox (3677), wait (7), wait for key (usekey), advance textbox
	show textbox (3678), wait (7), wait for key (usekey), advance textbox
	show textbox (3679), wait (7), wait for key (usekey), advance textbox
	show textbox (3680), wait (7), wait for key (usekey), advance textbox

# All we're doing here is cleanup. We now need to return control back to the player!

	resume player,resume box advance
end

# Now for an inn script. In Vikings of Midgard, every innkeeper is exactly the
# Same distance from the beds. We want the hero to run (speed 10) to those beds
# Before the real magic begins!

script,inn,begin
	suspend player, suspend box advance
  	set hero speed (me,10), walk hero (me,left,7), wait for hero (me)
 	focus camera ((hero x (me)),(hero y (me)),4)
 	wait for hero (me), suspend caterpillar

# At this point we're going to do something you might've seen before in a few
# Final Fantasy games, where the party "comes out of" the hero who's on point.
# For this, we're going to make the game briefly make the other heroes follow
# The leader, and then turn off their ability to follow them. By default the
# Game is actually tracking their movement behind the scenes, so if we just
# Turned it on, they would appear shadowing the player's steps. 

	wait (2), set hero speed (2),set hero direction (me,down),wait (3)
 	set hero direction (1,down), set hero direction (2,down), set hero direction (3,down)
  	set hero speed (0,2), set hero speed (1,2), set hero speed (2,2), set hero speed (3,2), wait (2)
 	set caterpillar mode (on)

# Now we want them to appear in the stored x and y values that our "leader"
# Is standing at. It's quicker to do it this way, but you could actually
# Make the other heroes "appear" wherever you want.

	set hero position (1, (hero x (me)), (hero y (me)))
	set hero position (2, (hero x (me)), (hero y (me)))
	set hero position (3, (hero x (me)), (hero y (me)))

# The individual heroes in your party lineup also have their own values.
# By default the leader is "0", and everyone else in the active party
# Is numbered 1, 2, and 3 respectively. You can also refer to the leader as "me".

 	wait (4), walk hero (0,up,2), walk hero (1,up,2), walk hero (2,down,2), walk hero (3,down,2),wait (1)

 	walk hero (0,left,1), walk hero (1,right,1), walk hero (2,left,1), walk hero (3,right,1)
 	wait for hero (me)
 	walk hero (0,left,1), walk hero (1,right,1), walk hero (2,left,1), walk hero (3,right,1)

# You'll note that we're not waiting for a hero YET now. That's because they're moving "up"
# On the beds. You can fool around with their Z axis, which is how high "above" the tile they're
# Standing on. We also want to do this gradually enough, so a simple wait command at the end
# Of each step here will suffice for now.

 	set hero z (0, 2), set hero z (1, 2), set hero z (2, 2), set hero z (3, 2), wait (2)
 	set hero z (0, 4), set hero z (1, 4), set hero z (2, 4), set hero z (3, 4), wait (2)
 	set hero z (0, 6), set hero z (1, 6), set hero z (2, 6), set hero z (3, 6), wait (2)
 	set hero z (0, 8), set hero z (1, 8), set hero z (2, 8), set hero z (3, 8), wait (2)
 	set hero z (0, 10), set hero z (1, 10), set hero z (2, 10), set hero z (3, 10), wait (2)
 	set hero direction (0,down), set hero direction (1,down), set hero direction (2,down), set hero direction (3,down)

# If you don't specify some RGB color logic after a screen fade, then fading out defaults
# To black. Since this is a "sleep" script, allowing it to fade default to black is ok.
# We're also going to play a short sound effect - which in this case is a simple
# Musical theme that lasts a few seconds. Remember that seconds AREN'T ticks, and that
# There's a bit of wiggle room in between how long a tick lasts on different computers!

 	wait (5), fade screen out, stop song,wait (5) 
	play sound (sfx:sleep,false,true), wait (120)

# When the screen comes back, we want the game to play the music for the area. 
# Because each area is different, we want the "default" ambient music.

	play song (get ambient music), fade screen in,wait (5)

# Now the heroes get out of bed..

 	walk hero (0,right,1), walk hero (1,left,1), walk hero (2,right,1), walk hero (3,left,1)
 	set hero z (0, 8), set hero z (1, 8), set hero z (2, 8), set hero z (3, 8), wait (2)
 	set hero z (0, 6), set hero z (1, 6), set hero z (2, 6), set hero z (3, 6), wait (2)
 	set hero z (0, 4), set hero z (1, 4), set hero z (2, 4), set hero z (3, 4), wait (2)
 	set hero z (0, 2), set hero z (1, 2), set hero z (2, 2), set hero z (3, 2), wait (2)
 	set hero z (0, 0), set hero z (1, 0), set hero z (2, 0), set hero z (3, 0), wait (2)
 	wait (5)

# ..And do some morning excercises by spinning around..

 	set hero direction (0,down), set hero direction (1,down), set hero direction (2,down), set hero direction (3,down),wait (1)
 	set hero direction (0,left), set hero direction (1,left), set hero direction (2,left), set hero direction (3,left), wait (1)
 	set hero direction (0,up), set hero direction (1,up), set hero direction (2,up), set hero direction (3,up), wait (1)
 	set hero direction (0,right), set hero direction (1,right), set hero direction (2,right), set hero direction (3,right), wait (1)
 	set hero direction (0,down), set hero direction (1,down), set hero direction (2,down), set hero direction (3,down), wait (1)
 	set hero direction (0,left), set hero direction (1,left), set hero direction (2,left), set hero direction (3,left), wait (1)
 	set hero direction (0,up), set hero direction (1,up), set hero direction (2,up), set hero direction (3,up), wait (1)
 	set hero direction (0,right), set hero direction (1,right), set hero direction (2,right), set hero direction (3,right), wait (1)
 	set hero direction (0,down), set hero direction (1,down), set hero direction (2,down), set hero direction (3,down),wait (1)
 	set hero direction (0,left), set hero direction (1,left), set hero direction (2,left), set hero direction (3,left), wait (1)
 	set hero direction (0,up), set hero direction (1,up), set hero direction (2,up), set hero direction (3,up), wait (1)
 	set hero direction (0,right), set hero direction (1,right), set hero direction (2,right), set hero direction (3,right), wait (1)
 	set hero direction (0,down), set hero direction (1,down), set hero direction (2,down), set hero direction (3,down), wait (5)

# ..And then "jumping" in place to start the day.

 	set hero z (0, 5), set hero z (1, 5), set hero z (2, 5), set hero z (3, 5),wait (1)
 	set hero z (0, 10), set hero z (1, 10), set hero z (2, 10), set hero z (3, 10), wait (1)
 	set hero z (0, 15), set hero z (1, 15), set hero z (2, 15), set hero z (3, 15), wait (1)
 	set hero z (0, 20), set hero z (1, 20), set hero z (2, 20), set hero z (3, 20), wait (1)
 	set hero z (0, 15), set hero z (1, 15), set hero z (2, 15), set hero z (3, 15), wait(1)
 	set hero z (0, 10), set hero z (1, 10), set hero z (2, 10), set hero z (3, 10), wait (1)
 	set hero z (0, 5), set hero z (1, 5), set hero z (2, 5), set hero z (3, 5), wait (1)
 	set hero z (0, 0), set hero z (1, 0), set hero z (2, 0), set hero z (3, 0), wait (5)

# Now they reverse their direction and walk to the center point where they split off from.

 	set hero direction (0,down), set hero direction (1,down), set hero direction (2,down), set hero direction (3,down), wait (2)
 	walk hero (0,right,1), walk hero (1,left,1), walk hero (2,right,1), walk hero (3,left,1), wait (1)
 	walk hero (0,down,2), walk hero (1,down,2), walk hero (2,up,2), walk hero (3,up,2), wait for hero (me)

# Then we revert everything back to what it was. Our leader takes point again,
# The camera follows them, and control is returned back to the player.
	set caterpillar mode (off), wait (1),  camera follows hero (me),  set hero speed (me,4)
 	resume player, resume box advance, heal full party
end

# These next scripts are basically the same thing, but are essentially dummied out.
# At one point they were used for Alfheim and Thule, but since the one script now does it all..
# Remember - "if it ain't broke, don't f*ck with it!"

script,inn2,begin
 	wait (1)
end

script,inn3,begin
 	wait (1)
end
#Finally! Now time for some more scripts!

script,earthfiend,begin
 	suspend player, suspend box advance, suspend random enemies,remember party
# We don't want to run into any extra encounters, do we?
 	walk hero (me,left,4), wait for hero (me) , wait (1)
# These set the heroes to face up, and look up at the boss
 	set hero direction (0,up), set hero direction (1,up), set hero direction (2,up), set hero direction (3,up), wait (1)
# This sets the other party members to appear at the leader's position
 	set caterpillar mode (on), set hero position (1, 12, 9), set hero position (2, 12, 9), set hero position (3, 12, 9)
 	wait (1), suspend caterpillar
# These actions then cause the party to move a bit, so they can all be seen at once.
 	walk hero (me,up,1), walk hero (1,left,1), walk hero (2, right,1), wait for hero (me)
# Now, beacuse they've moved, we set the heroes on the side to all face the same direction.
 	set hero direction (1,up),set hero direction (2,up)
# Now it's time for some introductory dialogue.  Though its not shown here, Text box 83 has the 
# party leader say something.
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
# The previous set of commands makes the given hero "twitch" in place.  It's one way of showing
# that they're speaking.  It's not always needed, but here it's a good idea.
 	show textbox (83)
 	wait (7)
# I've found that the delay between just skipping through boxes is *ABOUT* 7-10 ticks.
# So, since we don't want the game to be too sensitive between when you press a key to
# advance a text box, we've a delay of 7 ticks before you can advance it.
 	wait for key (usekey)
 	advance text box
 	wait (5),walk hero (1,up,1), wait for hero (1)
# The next textbox has hero (1) saying something, so its only reasonable to indicate that
# by having whoever's in that slot move to indicate they're doing something.
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show textbox (84), wait (7), wait for key (usekey), advance text box
 	wait (5),walk hero (2,up,1),wait for hero (2)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
# Again, another textbox, this one having hero (2) say something, and move in some way to indicate it.
# It's not alway needed to have each hero move, or twich or whatever before they speak, but
# it does give the player the sense that what's being said on screen isn't just text, but
# being spoken by a character.  Many well known professional games do this too.
	show textbox (85), wait (7), wait for key (usekey), advance text box
# Now that talking is done, it's time for the enemy to attack!
 	wait (5), walk NPC (1,down,2)
# So he moves down to face the party first
 	wait for NPC (1), wait (5)
# ..Except he's kinda slow, so we want to wait a bit for him.
# This next script part was originally done by Mad Cacti.
# Truthfully, I have very little idea how it works, but it inverts all the colors on the
# Screen at once. It's very spiffy work! Luckily instead of copying the same code,
# We can store it in its own script, and call it for later like so..
	BossIntroduction
#Shub-Niggurath, the first major boss, can be found in-game at formation 22, so we call that right now.
 	fight formation (22)
# Since the boss is defeated, we have to make it vanish!  Set a tag to the NPC so it'll
# Vanish once the player beats it!
 	set tag (tag:ShubNiggurath, on)
 wait (5) walk hero (me,up,1), wait for hero (me)
# Now the party's going to face eachother to talk amoungst themselves.
 	set hero direction (me,right)
 	wait (5)
 	set hero direction (me,down),set hero direction (1,right), set hero direction (2,left)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (105), wait (7), wait for key (usekey), advance text box
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1) 
	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show textbox (106), wait (7), wait for key (usekey), advance text box
# And then shove all the heroes back into the leader again.
	walk hero (me,down,1), walk hero (1,right,1), walk hero (2,left,1), walk hero (3,up,1)
 	wait for hero (me), set caterpillar mode (off), resume caterpillar, wait (1)
# And cleanup again
	resume player, resume random enemies, resume box advance, encounters
end

# Let's do the "dying in battle" script.

script,die in battle,begin
# First a variable. It'll come up later on.
  	variable(i)
# We're checking to see if a tag is off, known as "DO NOT DIE"
# If it's off, that means the player can lose in a battle.
  	if(check tag(tag:DO NOT DIE)==OFF)
  	then,begin
# The music stops, it shows a background and plays a sad sound effect.
# It will wait for player imput to accept their loss, before fading out, 
# clearing up some loose ends before returning the player back to the Title Screen.
   		stop song, show backdrop (22),play sound (sfx:Gameover,false,true),wait for key (anykey),fade screen out (0,0,0),show map, gameover,end
# Otherwise, it'll do some weird stuff.
  	else,begin
# Here we're essentially looking at all hero positions 0,1,2 and 3.
    		for(i,0,3) do,begin
# If their current HP is less than or equal to 0..
      		if (get hero stat(i,stat:HP,current stat) <= 0)
# Then the script will set their HP to 1.
      		then (set hero stat(i,stat:HP,1))
    		end
  	end
end

script,cthulhu1,begin
 	suspend player, suspend box advance, suspend random enemies
 	walk hero (me,down,2),wait for hero (me),remember party
 	set caterpillar mode (on) ,set hero position (1, 46, 13) ,set hero position (2, 46, 13),set hero position (3, 46, 13), wait (1)
 	suspend caterpillar, walk hero (me,up,1), walk hero (1,left,1), walk hero (2, right,1), wait for hero (me)
# Now, beacuse they've moved, we set the heroes on the side to all face the same direction.
 	set hero direction (1,up), set hero direction (2,up),wait (5)
  	show textbox (107), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
	show textbox (108), wait (7), wait for key (usekey), advance text box
 	show textbox (109), wait (7), wait for key (usekey), advance text box
	show textbox (110), wait (7), wait for key (usekey), advance text box
 	wait (1), tweak palette (20,-20,20),fade screen in,wait (4)
 	set tag (tag:CTHULHU1, on),set NPC position (12,0,0)
 	set NPC position (28,46,10), play sound (sfx:MediumExplosion8Bit,false,true)
	set NPC direction (28,up), set NPC frame (28,0), wait (2)
	set NPC direction (28,up), set NPC frame (28,1), wait (2)
	set NPC direction (28,right), set NPC frame (28,0), wait (2)
	set NPC direction (28,right), set NPC frame (28,1), wait (2)
	set NPC direction (28,down), set NPC frame (28,0), wait (2)
	set NPC direction (28,down), set NPC frame (28,1), wait (2)
	set NPC direction (28,left), set NPC frame (28,0), wait (2)
	set NPC direction (28,left), set NPC frame (28,1), wait (2)
	set NPC position (28,0,0)
	wait (3), reset palette, fade screen in
	walk hero (3,down,1),wait for hero (3),set hero direction (3,left), set hero direction (me,right)
	wait (3), set hero direction (me,down), set hero direction (1,right), set hero direction (2,left), set hero direction (3,up)
 	wait (3), set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (597), wait (7), wait for key (usekey), advance text box
 	walk hero (me,down,1), walk hero (1,right,1), walk hero (2,left,1), walk hero (3,up,1), wait for hero (me)
 	set caterpillar mode (off), resume caterpillar, wait (1)
 	resume player, resume random enemies, resume box advance, encounters
end

script,Tulzcha,begin
 	suspend player, suspend box advance, suspend random enemies
 	walk hero (me,up,3), wait for hero (me),remember party
 	set caterpillar mode (on), set hero position (1, 21, 10), set hero position (2, 21, 10), set hero position (3, 21, 10)
 	wait (1), suspend caterpillar, walk hero (me,up,1), walk hero (1,left,1), walk hero (2, right,1), wait for hero (me)
# Now, beacuse they've moved, we set the heroes on the side to all face the same direction.
 	set hero direction (1,up), set hero direction (2,up), set hero direction (3,up), wait (1)
 	show textbox (118), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1) ,wait (1) ,set hero frame (me,0) ,wait (1)
 	set hero frame (me,1), wait (1) ,set hero frame (me,0),wait (1)
 	show textbox (119), wait (7), wait for key (usekey), advance text box
 	show textbox (120), wait (7), wait for key (usekey), advance text box
# The boss now has to freak out.  Since this character talks REALLY hyper, it should move fast
# Therefore its speed as an NPC is set to 4, but will get faster and faster.
# Also, we should have it move around a lot.  In this case, it circles around a bunch
# Before attacking the party.
 	wait (2), Alter NPC (10,NPCstat:move speed, 10)
 	walk NPC (10,up,1), wait for NPC (10),walk NPC (10,left,1), wait for NPC (10)
 	walk NPC (10,down,2), wait for NPC (10), 	walk NPC (10,right,2), wait for NPC (10)
 	walk NPC (10,up,2), wait for NPC (10), 	walk NPC (10,left,2), wait for NPC (10)
 	walk NPC (10,down,1), wait for NPC (10), 	walk NPC (10,right,2), wait for NPC (10)
 	walk NPC (10,up,1), wait for NPC (10), 	walk NPC (10,left,1), wait for NPC (10)
 	walk NPC (10,down,2), wait for NPC (10), 	walk NPC (10,right,1), wait for NPC (10)
 	walk NPC (10,up,1), wait for NPC (10), 	walk NPC (10,left,2), wait for NPC (10)
 	walk NPC (10,down,1), wait for NPC (10), 	walk NPC (10,right,1), wait for NPC (10)
 	walk NPC (10,up,2), wait for NPC (10), 	walk NPC (10,left,1), wait for NPC (10)
 	walk NPC (10,down,1), wait for NPC (10), 	walk NPC (10,right,2), wait for NPC (10)
 	walk NPC (10,up,1), wait for NPC (10), 	walk NPC (10,left,1), wait for NPC (10)
 	walk NPC (10,down,2), wait for NPC (10), 	walk NPC (10,right,1), wait for NPC (10)
 	walk NPC (10,up,2), wait for NPC (10), 	walk NPC (10,left,2), wait for NPC (10)
 	walk NPC (10,down,2), wait for NPC (10), 	walk NPC (10,right,1), wait for NPC (10)
	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
	show textbox (121), wait (7), wait for key (usekey), advance text box
 	show textbox (122), wait (7), wait for key (usekey), advance text box
	wait (3), BossIntroduction
 #After the nifty color inverting takes place, we've got a battle to fight!  
	fight formation (42)
 #Tulzcha, the second boss, can be found in-game at formation 42, so we call that right now.
	set tag (tag:Tulzcha, on)
 #Since the boss isn't there, we have to make it vanish!  Set a tag to the NPC so it'll
 #Vanish once the player beats it!
	wait (3),pan camera (down,1)
	walk hero (1,down,1), wait for hero (1), walk hero (1,right,1)
 	set hero direction (me,right), set hero direction (1,right), set hero direction (2,right), set hero direction (3,right)
  	show textbox (123), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (124), wait (7), wait for key (usekey), advance text box
 	show textbox (125), wait (7), wait for key (usekey), advance text box
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
	show textbox (126), wait (7), wait for key (usekey), advance text box
	show textbox (127), wait (7), wait for key (usekey), advance text box
#And then Cthulhu Explodes away again
	wait (1), tweak palette (20,-20,20), fade screen in, wait (4), set tag (tag:CTHULHU2, on)
 	set NPC position (17,24,10), play sound (sfx:MediumExplosion8Bit,false,true)
	set NPC direction (17,up), set NPC frame (17,0), wait (2)
	set NPC direction (17,up), set NPC frame (17,1), wait (2)
	set NPC direction (17,right), set NPC frame (17,0), wait (2)
	set NPC direction (17,right), set NPC frame (17,1), wait (2)
	set NPC direction (17,down), set NPC frame (17,0), wait (2)
	set NPC direction (17,down), set NPC frame (17,1), wait (2)
	set NPC direction (17,left), set NPC frame (17,0), wait (2)
	set NPC direction (17,left), set NPC frame (17,1), wait (2)
	set NPC position (17,0,0), 	wait (3), reset palette, fade screen in, wait (3)
 	walk hero (3,left,1), wait for hero (3) , wait (3)
 	set hero direction (me,down), set hero direction (3,right), set hero direction (2,left), set hero direction (1,up), wait (3)
	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
	show textbox (597), wait (7), wait for key (usekey), advance text box
	walk hero (me,down,1), walk hero (3,right,1), walk hero (2,left,1), walk hero (1,up,1)
	wait for hero (me), camera follows hero (me), set caterpillar mode (off), resume caterpillar
 	wait (1), resume player, resume random enemies, resume box advance, encounters
end

script,dagon,begin
 	suspend player, suspend box advance, suspend random enemies, remember party
 	walk hero (me,up,3), wait for hero (me), set caterpillar mode (on)
 	set hero position (1, 5, 55), set hero position (2, 5, 55), set hero position (3, 5, 55)
 	wait (1), suspend caterpillar
 	walk hero (me,up,1), walk hero (1,left,1), walk hero (2, right,1), wait for hero (me)
# Now, beacuse they've moved, we set the heroes on the side to all face the same direction.
 	set hero direction (1,up), set hero direction (2,up), set hero direction (3,up), wait (1)
 	show textbox (186), wait (7), wait for key (usekey), advance text box
# Instead of shuffling around, the hero will bounce a bit here to show who's talking.
 	set hero z (0, 5), wait (2), set hero z (0, 0), wait (2)
 	set hero z (0, 5), wait (2), set hero z (0, 0), wait (2)
 	show textbox (187), wait (7), wait for key (usekey), advance text box
 	show textbox (188), wait (7), wait for key (usekey), advance text box
 	set hero z (0, 5), wait (2), set hero z (0, 0), wait (2)
 	set hero z (0, 5), wait (2), set hero z (0, 0), wait (2)
 	show textbox (189), wait (7), wait for key (usekey), advance text box
 	show textbox (190), wait (7), wait for key (usekey), advance text box
 	set hero z (1, 5), wait (2), set hero z (1, 0), wait (2)
 	set hero z (1, 5), wait (2), set hero z (1, 0), wait (2)
 	show textbox (191), wait (7), wait for key (usekey), advance text box
 	show textbox (192), wait (7), wait for key (usekey), advance text box, wait (3) 
# Now we fight Dagon, the fiend of water.. or is it ice?
 	BossIntroduction , fight formation (67)
# Dagon, the third boss, can be found in-game at formation 67, so we call that right now.
 	set tag (tag:Fight Dagon, on)
# Since the boss isn't there, we have to make it vanish!  Set a tag to the NPC so it'll
# Vanish once the player beats it!
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show textbox (193), wait (7), wait for key (usekey), advance text box
# Of course, Cthulhu shows up after a boss is defeated, so we have to pan the camera
	focus camera (5,51,4), wait for camera
 	show textbox (194), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (195), wait (7), wait for key (usekey), advance text box
 	show textbox (196), wait (7), wait for key (usekey), advance text box
 	show textbox (197), wait (7), wait for key (usekey), advance text box
 	show textbox (198), wait (7), wait for key (usekey), advance text box
 	wait (1), tweak palette (20,-20,20), fade screen in, wait (4), set tag (tag:CTHULHU3, on)
 	set NPC position (22,5,50), play sound (sfx:MediumExplosion8Bit,false,true)
	set NPC direction (22,up), set NPC frame (22,0), wait (2)
	set NPC direction (22,up), set NPC frame (22,1), wait (2)
	set NPC direction (22,right), set NPC frame (22,0), wait (2)
	set NPC direction (22,right), set NPC frame (22,1), wait (2)
	set NPC direction (22,down), set NPC frame (22,0), wait (2)
	set NPC direction (22,down), set NPC frame (22,1), wait (2)
	set NPC direction (22,left), set NPC frame (22,0), wait (2)
	set NPC direction (22,left), set NPC frame (22,1), wait (2)
	set NPC position (22,0,1)
 	wait (3), reset palette, fade screen in, wait (3)
 	focus camera (5,54,4), wait for camera, wait (3), set hero direction (me,right)
 	walk hero (3,down,1), set hero direction (3,up), wait (3), camera follows hero (me)
 	set hero direction (me,down), set hero direction (1,right), set hero direction (2,left), set hero direction (3,up)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show textbox (199), wait (7), wait for key (usekey), advance text box
 	walk hero (me,down,1), walk hero (1,right,1), walk hero (2,left,1), walk hero (3,up,1), wait for hero (me)
 	set caterpillar mode (off), resume caterpillar, wait (1)
 	resume player, resume random enemies, resume box advance, reinstate party, encounters
end

script,cthulhu,begin
 	suspend player, suspend box advance, suspend random enemies,remember party
 	walk hero to y (me,72), wait for hero (me)
 	walk hero to x (me,8), wait for hero (me)
 	set hero direction (me,up)
 	set caterpillar mode (on), set hero position (1, 8, 72), set hero position (2, 8, 72), set hero position (3, 8, 72)
 	wait (1),suspend caterpillar
	walk hero (me,up,1), walk hero (1,left,1), walk hero (2, right,1), wait for hero (me)
# Now, beacuse they've moved, we set the heroes on the side to all face the same direction.
 	set hero direction (1,up), set hero direction (2,up), set hero direction (3,up), wait (1)
 	show textbox (305), wait (7), wait for key (usekey), advance text box
 	show textbox (306), wait (7), wait for key (usekey), advance text box
 	show textbox (307), wait (7), wait for key (usekey), advance text box
 	show textbox (308), wait (7), wait for key (usekey), advance text box,	wait (3)
 	BossIntroduction
# After the nifty color inverting takes place, we've got a battle to fight!  
 	fight formation (85)
# We start off facing off against Yog-Sothoth, the fiend of.. all the elements? 
	show textbox (309), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (310), wait (7), wait for key (usekey), advance text box
 	show textbox (311), wait (7), wait for key (usekey), advance text box
# Cthulhu threatens the party by approaching them
 	walk npc (11,down,1), show textbox (312), wait (7)
 	walk hero (me,down,1), walk hero (1,down,1), walk hero (2,down,1), walk hero (3,down,1)
 	set hero direction (me,up), set hero direction (1,up), set hero direction (2,up), set hero direction (3,up)
 	wait for hero (me), wait for key (usekey), advance text box
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show textbox (313), wait (7), wait for key (usekey), advance text box
 	show textbox (314), wait (7), wait for key (usekey), advance text box
 	show textbox (315), wait (7), wait for key (usekey), advance text box
 	BossIntroduction
# This is it, the fight against Cthulhu. And we're only halfway through?
 	fight formation (86)
 	show textbox (316), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (317), wait (7), wait for key (usekey), advance text box
 	show textbox (3978), wait (7), wait for key (usekey), advance text box
 	show textbox (3979), wait (7), wait for key (usekey), advance text box
 	show textbox (3980), wait (7), wait for key (usekey), advance text box
 	show textbox (3981), wait (7), wait for key (usekey), advance text box
 	show textbox (3982), wait (7), wait for key (usekey), advance text box
 	show textbox (3983), wait (7), wait for key (usekey), advance text box
 	show textbox (318), wait (7), wait for key (usekey), advance text box
 	wait (1), play sound (sfx:Nuclear,false,true)
 	tweak palette (20,-20,20), fade screen in, wait (4), set tag (tag:defeat Cthulhu, on)
 	set NPC position (62,8,70)
	set NPC direction (62,up), set NPC frame (62,0), pan camera (up,1,20), wait (2)
	set NPC direction (62,up), set NPC frame (62,1), pan camera (down,1,20), wait (2)
	set NPC direction (62,right), set NPC frame (62,0), pan camera (up,1,20), wait (2)
	set NPC direction (62,right), set NPC frame (62,1), pan camera (down,1,20), wait (2)
	set NPC direction (62,down), set NPC frame (62,0), pan camera (up,1,20), wait (2)
	set NPC direction (62,down), set NPC frame (62,1), pan camera (down,1,20), wait (2)
	set NPC direction (62,left), set NPC frame (62,0), pan camera (up,1,20), wait (2)
	set NPC direction (62,left), set NPC frame (62,1), pan camera (down,1,20), wait (2)
	set NPC position (62,0,0), wait for camera
 	wait (3), reset palette, fade screen in, wait (3)
 	set hero direction (me,right), walk hero (3,down,1), set hero direction (3,up), wait (3)
 	camera follows hero (me)
 	set hero direction (me,down), set hero direction (1,right), set hero direction (2,left), set hero direction (3,up)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show textbox (319), wait (7), wait for key (usekey), advance text box
 	walk hero (me,down,1), walk hero (1,right,1), walk hero (2,left,1), walk hero (3,up,1)
 	wait for hero (me), set caterpillar mode (off), resume caterpillar, wait (1)
 	resume player, resume random enemies, resume box advance,encounters
end

# This is for the showdown with the Einherjar Leader, Kyle.

script,kyle,begin
	remember party, suspend player, suspend box advance, suspend random enemies, resume NPC walls
 	walk hero to x (me,31), walk hero to y (me,121), wait for hero (me), set hero direction (me,up)
 	set caterpillar mode (on), set hero position (1, 31, 121), set hero position (2, 31, 121), set hero position (3, 31, 121)
 	wait (1), suspend caterpillar, walk hero (3,down,1), walk hero (1,left,1), walk hero (2, right,1)
 	wait for hero (3), wait for camera
# Now, beacuse they've moved, we set the heroes on the side to all face the same direction.
 	set hero direction (1,up), set hero direction (2,up), set hero direction (3,up), wait (1)
	play song (song: Nameless Sorcerer )
 	show textbox (494), wait (7), wait for key (usekey), advance text box
 	show textbox (495), wait (7), wait for key (usekey), advance text box
 	show textbox (496), wait (7), wait for key (usekey), advance text box
 	show textbox (497), wait (7), wait for key (usekey), advance text box
 	show textbox (498), wait (7), wait for key (usekey), advance text box,wait (4)
 	walk NPC (9,down,1), walk hero (me,down,1), walk hero (1,down,1), walk hero (2,down,1), walk hero (3,down,1)
 	set hero direction (me,up), set hero direction (1,up), set hero direction (2,up), set hero direction (3,up)
 	wait for hero (me), wait (3)
 	show textbox (499), wait (7), wait for key (usekey), advance text box
 	show textbox (500), wait (7), wait for key (usekey), advance text box
 	show textbox (501), wait (7), wait for key (usekey), advance text box
 	show textbox (502), wait (7), wait for key (usekey), advance text box
 	wait (4), greyscale palette, fade screen in, wait (10)
# The new boss fight effect!
 	BossIntroduction
# After the nifty color inverting takes place, we've got a battle to fight!  
 	fight formation (104)
	play song (song: An Unfortunate End )
	alter NPC (9,NPCstat:Picture, 347), alter NPC (9,NPCmovetype:walkinplace)
	resume NPCs, suspend obstruction
 	show textbox (505), wait (7), wait for key (usekey), advance text box
 	show textbox (506), wait (7), walk hero (me,up,1), wait for key (usekey), advance text box
 	show textbox (507), wait (7), walk hero (1,up,1), wait for key (usekey), advance text box
 	show textbox (508), wait (7), walk hero (2,up,1), wait for key (usekey), advance text box
 	show textbox (509), wait (7), walk hero (3,up,1), wait for key (usekey), advance text box
 	show textbox (510), wait (7), wait for key (usekey), advance text box
 	show textbox (511), wait (7), wait for key (usekey), advance text box
 	show textbox (512), wait (7), wait for key (usekey), advance text box
 	wait (7)
 	set hero direction (me,left), set hero direction (1,left), set hero direction (2,right), set hero direction (3,right)
 	wait (5)
 	walk NPC (9,down,1), walk hero (me,down,1), walk hero (1,down,1), walk hero (2,down,1), walk hero (3,down,1)
 	wait for hero (me), wait (5), stop song, wait (5)
 	tweak palette (-10,-10,-10), fade screen in, wait (5)
 	show text box (1763), wait (10), wait for key (use key), advance text box
 	wait (5), reset palette, fade screen in, wait (5)
	pan camera (up,1), wait for camera,wait (5)
 	set hero direction (me,left), set hero direction (1,left), set hero direction (2,right), set hero direction (3,right)
 	wait (5), set hero direction (me,up), set hero direction (1,up), set hero direction (2,up), set hero direction (3,up), wait (5)
# The menace of the Nameless Sorcerer comes forth.
 	play sound (sfx:BLASTER BEAM,false,true)
 	tweak palette (63,63,63),update palette, wait (2), reset palette, update palette
 	set tag (tag:suck1,on)
 	pancamera(up,1,20),waitforcamera, pancamera(down,2,20),waitforcamera
 	pancamera(up,2,20),waitforcamera, pancamera(down,1,20),waitforcamera 
 	pancamera(up,1,20),waitforcamera, pancamera(down,2,20),waitforcamera
 	pancamera(up,2,20),waitforcamera, pancamera(down,1,20),waitforcamera 
 	pancamera(up,1,20),waitforcamera, pancamera(down,2,20),waitforcamera
 	pancamera(up,2,20),waitforcamera, pancamera(down,1,20),waitforcamera 
 	wait (5), set NPC direction (9,left), wait (3), set NPC direction (9,up), wait (3)
 	show text box (1764), wait (10), wait for key (use key), advance text box
 	wait (5), tweak palette (-10,-10,-10), fade screen in, wait (5)
 	show text box (1765), wait (10), wait for key (use key), advance text box
 	show text box (1766), wait (10), wait for key (use key), advance text box
 	wait (5), reset palette, fade screen in, wait (5),play sound (sfx:BLASTER BEAM,false,true)
 	tweak palette (63,63,63),update palette, wait (2), reset palette, update palette
 	set tag (tag:suck2,on)
 	pancamera(up,1,20),waitforcamera, pancamera(down,2,20),waitforcamera
 	pancamera(up,2,20),waitforcamera, pancamera(down,1,20),waitforcamera 
 	pancamera(up,1,20),waitforcamera, pancamera(down,2,20),waitforcamera
 	pancamera(up,2,20),waitforcamera, pancamera(down,1,20),waitforcamera 
 	pancamera(up,1,20),waitforcamera, pancamera(down,2,20),waitforcamera
 	pancamera(up,2,20),waitforcamera, pancamera(down,1,20),waitforcamera , wait (5)
 	show text box (1767), wait (7), wait for key (use key), advance text box
 	set NPC direction (9,left), wait (3), set NPC direction (9,down), wait (5)
 	show text box (1768), wait (7), wait for key (use key), advance text box
 	wait (5), tweak palette (-10,-10,-10), fade screen in, wait (5)
 	show text box (1769), wait (10), wait for key (use key), advance text box
 	wait (5), reset palette, fade screen in, wait (5),play sound (sfx:BLASTER BEAM,false,true)
 	tweak palette (63,63,63),update palette, wait (2), reset palette, update palette
 	set tag (tag:suck3,on) , walk NPC (9,up,1), set NPC direction (9,right)
 	pancamera(up,1,20),waitforcamera, pancamera(down,2,20),waitforcamera
 	pancamera(up,2,20),waitforcamera, pancamera(down,1,20),waitforcamera 
 	pancamera(up,1,20),waitforcamera, pancamera(down,2,20),waitforcamera
 	pancamera(up,2,20),waitforcamera, pancamera(down,1,20),waitforcamera 
 	pancamera(up,1,20),waitforcamera, pancamera(down,2,20),waitforcamera
 	pancamera(up,2,20),waitforcamera, pancamera(down,1,20),waitforcamera , wait (5)
 	wait for NPC (9)
 	show text box (1770), wait (10), wait for key (use key), advance text box
 	wait (5), tweak palette (-10,-10,-10), fade screen in, wait (5)
 	show text box (1771), wait (10), wait for key (use key), advance text box
 	show text box (1772), wait (10), wait for key (use key), advance text box
 	wait (5), reset palette, fade screen in, wait (5), play sound (sfx:BLASTER BEAM,false,true)
 	tweak palette (63,63,63),update palette, wait (2), reset palette, update palette
 	walk NPC (9,up,1), set NPC direction (9,right)
 	pancamera(up,1,20),waitforcamera, pancamera(down,2,20),waitforcamera
 	pancamera(up,2,20),waitforcamera, pancamera(down,1,20),waitforcamera 
 	pancamera(up,1,20),waitforcamera, pancamera(down,2,20),waitforcamera
 	pancamera(up,2,20),waitforcamera, pancamera(down,1,20),waitforcamera
 	pancamera(up,1,20),waitforcamera, pancamera(down,2,20),waitforcamera
 	pancamera(up,2,20),waitforcamera, pancamera(down,1,20),waitforcamera , wait (5)
 	show text box (1773), wait (10), wait for key (use key), advance text box
 	wait (5), tweak palette (-10,-10,-10), fade screen in, wait (5)
 	show text box (1774), wait (10), wait for key (use key), advance text box
 	wait (5), reset palette, fade screen in, wait (5)
 	play sound (sfx:BLASTER BEAM,false,true)
 	tweak palette (63,63,63),update palette, wait (2), reset palette, update palette
 	walk NPC (9,up,1), set NPC direction (9,right)
 	pancamera(up,1,20),waitforcamera, pancamera(down,2,20),waitforcamera
 	pancamera(up,2,20),waitforcamera, pancamera(down,1,20),waitforcamera 
 	pancamera(up,1,20),waitforcamera, pancamera(down,2,20),waitforcamera
 	pancamera(up,2,20),waitforcamera, pancamera(down,1,20),waitforcamera 
 	pancamera(up,1,20),waitforcamera, pancamera(down,2,20),waitforcamera
 	pancamera(up,2,20),waitforcamera, pancamera(down,1,20),waitforcamera
 	fade screen out (63,63,63), wait (5)
 	set caterpillar mode (off), resume caterpillar, camera follows hero (me), wait (1)
 	use door (63), resume obstruction, wait (7), fade screen in
 	show textbox (513), wait (7), wait for key (usekey), advance text box
 	show textbox (514), wait (7), wait for key (usekey), advance text box
 	wait for hero (me), set caterpillar mode (on)
 	set hero position (1, 12, 14), set hero position (2, 12, 14), set hero position (3, 12, 14), wait (1)
 	suspend caterpillar
 	walk hero (me,up,1), walk hero (1,left,1), walk hero (2,right,1), walk hero (3,down,1), wait for hero (me) 
 	wait (3), set hero direction (me,right), set hero direction (1,down), set hero direction (2,down), set hero direction (3,right)
 	wait (3), set hero direction (me,down), set hero direction (1,right), set hero direction (2,left), set hero direction (3,up)
 	wait (3)
 	show textbox (515), wait (7), wait for key (usekey), advance text box
 	show textbox (516), wait (7), wait for key (usekey), advance text box
 	show textbox (517), wait (7), wait for key (usekey), advance text box
 	walk hero (me,down,1), walk hero (1,right,1), walk hero (2,left,1), walk hero (3,up,1)
 	wait for hero (me), set caterpillar mode (off), resume caterpillar, wait (1)
 	resume player, resume random enemies, resume box advance
end

# This USED to be the final boss...  now it's just a script that runs in the final dungeon - because every tile
# Saps your HP, and we don't want a visual indicator that it does.

script,azathoth,begin
	if,begin 
		key is pressed (key:x) 
# change this to choose your own key. By default, holding "x" when walking will make you run
	end 
	then,begin 
		if (hero is walking (me)==false) 
		then,begin 
			set hero speed (me,10) 
# This basically states that if "x" is held down, you'll move a little faster
			if (checktag(tag:SPRINT)==on) then (set hero speed (me,20))
# This line shows that if the stated tag is on, you'll dash faster. This particular tag is set to the 
# Brigand's "Is Leader" bitset, so when the brigand is in charge, you'll run quite fast.
			if (checktag(tag:DASH)==on) then (set hero speed (me,20))
# This line is like the above lines in that if the tag is on, you'll run at a blazing 20 pixels per tick.
# That's one tile per tick!
		end 
	end 
	else,begin 
# This line states that if the player isn't holding "x", then the hero will only walk normally.
		if (hero is walking (me)==false) 
		then,begin 
			set hero speed (me,4) 
		end 
	end 
end 

script,credits,begin
# This script was originally for the end credits that play after the epilogue.
# It was found to be slightly defective for some reason, so its contents
# Were moved into the epilogue script, where they now work fine.
# Sometimes scripting be like that.
end

script,Bramget,begin
 	suspend player, suspend box advance
 	focus camera (8,7,4), wait for camera
 	walk hero (me,down,2), wait for hero (me)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (601), wait (7), wait for key (usekey), advance text box
 	show textbox (602), wait (7), wait for key (usekey), advance text box
 	walk NPC (5,down,2), wait for NPC (5), wait (10)
 	walk NPC (5,right,2), set NPC direction (5,down), wait for NPC (5)
 	wait (10), walk NPC (5,right,2), set NPC direction (5,down)
 	wait for NPC (5), wait (10), walk NPC (5,down,1)
# Like Oolong, we wish for the most comfortable panties, and are rewarded!
 	show textbox (603), play sound (sfx:Soft_Airy_Swish,false,true)
 	wait (7), wait for key (usekey), advance text box
 	set hero z (me,5), wait (2),set hero z (me,10), wait (2)
 	set hero z (me,5), wait (2),set hero z (me,0), wait (2)
 	set hero direction (me,left), wait (3)
 	set hero direction (me,up), wait (3)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (604), wait (7), wait for key (usekey), advance text box
 	show textbox (605), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (606), wait (7), wait for key (usekey), advance text box
 	walk NPC (5,up,1), set NPC direction (5,down)
 	show textbox (607), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (608), wait (7), wait for key (usekey), advance text box
 	walk NPC (5,left,1), walk hero (me,right,1), wait for hero (me)
 	walk NPC (5,down,1), walk hero (me,up,1), wait for hero (me)
 	set NPC direction (5,right), set hero direction (me,left)
 	show textbox (609), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (610), wait (7), wait for key (usekey), advance text box
 	walk hero (me,left,1), wait for hero (me), walk hero (me,up,1), wait for hero (me)
 	walk NPC (5,right,1), wait for NPC (5), set NPC direction (5,up)
 	set hero direction (me,left), wait (4), set hero direction (me,down), wait (4)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (611), wait (7), wait for key (usekey), advance text box
 	add hero (hero:Bram), wait (4), fade screen out
 	wait (1), set tag(5,on), wait (3), set hero direction (me,up)
 	camera follows hero, swap out hero (hero:Freki), lock hero (hero:Freki)
 	wait (1), use door (0)
 	resume player, resume box advance
# Let's equip Bram with her initial gear! She has.. well rags mostly. 
 	force equip ((find hero (hero:Bram)),2,205)
 	force equip ((find hero (hero:Bram)),3,208)
 	force equip ((find hero (hero:Bram)),4,211)
 	remember party
end

script,warriorget,begin
# Time to get Kitt. 
	remember party, suspend player, suspend box advance
 	swap by position (0,find hero (hero:Bram))
 	set hero frame (me,1),wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (612), wait (7), wait for key (usekey), advance text box
 	walk hero (me,left,2), wait for hero (me)
 	set hero direction (me,down), wait (3), set hero direction (me,right), wait (3)
 	walk NPC (17,left,1)
 	show textbox (613), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (614), wait (7), wait for key (usekey), advance text box
	walk NPC (17,down,1)
 	show textbox (615), wait (7), wait for key (usekey), advance text box
 	set hero direction (me,down)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (616), wait (7), wait for key (usekey), advance text box
 	walk hero (me,down,1), wait for hero
 	walk hero (me,right,1), wait for hero
 	set NPC direction (17,left)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (617), wait (7), wait for key (usekey), advance text box
 	show textbox (618), wait (7), wait for key (usekey), advance text box
 	add hero (hero:Kitt), suspend obstruction
 	walk NPC (17,left,1), wait (4), resume obstruction
# Kitt doesn't start with anything special.
 	force equip ((find hero (hero:Kitt)),2,206)
 	force equip ((find hero (hero:Kitt)),3,209)
 	force equip ((find hero (hero:Kitt)),4,210)
 	wait (1), set tag(79,on), wait (3), set hero direction (me,down)
 	camera follows hero, wait (1)
 	fade screen in, resume player, resume box advance, reinstate party
end

script,missionaryget,begin
#Frumpy joins now. He's an expy of the Missionary from Eric the Viking.
	remember party, suspend player, suspend box advance
 	show textbox (619), wait (7), wait for key (usekey), advance text box
 	walk hero to x (me,42), wait for hero (me)
 	walk hero to y (me,28), wait for hero (me)
 	set caterpillar mode (on), set hero position (1, 42, 28)
 	wait (1), suspend caterpillar
 	walk hero (1,down,1), wait for hero (1)
 	set hero direction (me,right), set hero direction (1,right)
 	wait (2), focus camera (46,28,4), wait for camera
 	show textbox (620), wait (7), wait for key (usekey), advance text box 
 	show textbox (621), wait (7), wait for key (usekey), advance text box
 	focus camera (20,28,20), wait for camera , wait (10)
 	focus camera (46,28,20), wait for camera
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show textbox (622), walk hero (1,right,1), wait (7), wait for key (usekey), advance text box
 	walk NPC (18,down,1), wait for NPC (18)
 	walk NPC (18,left,2), set NPC direction (19,down), wait for NPC (18)
 	show textbox (623), wait (7), wait for key (usekey), advance text box
 	walk hero (me,right,1), set hero frame (me,1), wait (1)
 	set hero frame (me,0), wait (1), set hero frame (me,1), wait (1)
 	set hero frame (me,0), wait (1)
 	show textbox (624), wait (7), wait for key (usekey), advance text box
 	show textbox (625), wait (7), wait for key (usekey), advance text box
 	walk hero (1,up,1), suspend obstruction
 	walk NPC (18,left,2), wait for NPC (18)
 	set caterpillar mode (off), wait (5)
 	resume obstruction, resume caterpillar
 	wait (1), set tag(80,on), focus camera (43,28,4)
 	wait for camera, camera follows hero (me)
 	add hero (hero:Frumpy), wait (1)
 	resume player, resume box advance
# Frumpy comes with rags too. We haven't met anyone who has something special - yet
 	force equip ((find hero (hero:Frumpy)),2,205)
 	force equip ((find hero (hero:Frumpy)),3,207)
 	force equip ((find hero (hero:Frumpy)),4,212)
end

script,shamanget,begin
# We're getting Night next - the game's traditional elemental mage.
 	suspend player, suspend box advance, remember party
 	swap by position (0,find hero (hero:Bram))
 	swap by position (1,find hero (hero:Kitt))
 	swap by position (2,find hero (hero:Frumpy))
 	set caterpillar mode (on), set hero position (1, 10, 36), set hero position (2, 10, 36)
 	wait (1), suspend caterpillar, walk hero (1,down,1), walk hero (2,up,1), wait for hero (1)
 	set hero direction (me,right), set hero direction (1,right), set hero direction (2,right), wait (2)
 	show textbox (626), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (627), wait (7), wait for key (usekey), advance text box
 	walk hero (2,right,1), wait for hero (2)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show textbox (628), wait (7), wait for key (usekey), advance text box
 	set NPC direction (20, down), wait (5), set NPC direction (20,left), wait (5)
 	show textbox (629), wait (7), wait for key (usekey), advance text box
 	walk hero (1,right), wait for hero (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show textbox (630), wait (7), wait for key (usekey), advance text box
 	set hero direction (2,down)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show textbox (631), wait (7), wait for key (usekey), advance text box
 	show textbox (632), set hero z (me,5), wait (2)
 	set hero z (me,0), wait (2), set hero z (me,5), wait (2)
 	set hero z (me,0), wait (2), set hero z (me,5), wait (2)
 	set hero z (me,0), wait (2), wait for key (usekey), advance text box
 	show textbox (633), wait (7), wait for key (usekey), advance text box
 	walk hero (0,right,2), walk hero (1,left,1), wait for hero (0), walk hero (1,up,1)
 	walk hero (2,down,1), set NPC direction (20, down), wait (5)
 	set hero direction (2,right), set NPC direction (20,left), wait (5)
 	set hero direction (1,right), wait (2), show textbox (634), wait (7)
 	set hero direction (0,down), set hero direction (1,down)
 	set hero direction (2,down), set NPC direction (20,down)
 	wait (5), set hero direction (0,left), set hero direction (1,left), set hero direction (2,left)
 	set NPC direction (20,left), walk NPC (19,right,8), wait for key (usekey), advance text box
 	show textbox (635), wait (7), wait for key (usekey), advance text box
	walk hero (1,down,1) 
	show textbox (636), wait (7), wait for key (usekey), advance text box
 	walk NPC (20,down,2), wait for hero (1), walk hero (1,right,3), wait for NPC (20)
 	walk NPC (20,left,3), wait for NPC (20), walk hero (1,up,1), walk NPC (20,up,2)
 	wait for NPC (20), set hero direction (1,left), set NPC direction (20,left)
 	show textbox (637), wait (7), wait for key (usekey), advance text box
 	show textbox (638), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (639), wait (7), wait for key (usekey), advance text box
 	show textbox (640), wait (7), wait for key (usekey), advance text box
 	show textbox (641), wait (7), wait for key (usekey), advance text box
 	walk NPC (19,left,8), set hero frame (2,1), wait (1)
 	set hero frame (2,0), wait (1), set hero frame (2,1), wait (1)
 	set hero frame (2,0), wait (1)
 	show textbox (642), wait (7), wait for key (usekey), advance text box
 	suspend obstruction, wait (1), walk NPC (20,right,2), walk hero (1,left,1)
 	walk hero (2,right,1), wait for NPC (20)
 	swap by position (0,find hero (hero:Kitt)), set caterpillar mode (off)
 	wait (5), resume obstruction, resume caterpillar
 	wait (2), add hero (hero:Night), set tag (81,on)
 	resume player, resume box advance
# Night doesn't have anything noteworthy.
 	force equip ((find hero (hero:Night)),2,205)
 	force equip ((find hero (hero:Night)),3,207)
 	force equip ((find hero (hero:Night)),4,212), encounters
end

# Time to pick up Styrge. She joins just after defeating the first real boss.
# She's kind of a hybrid between a fighter, rogue, and mage,
# Who specializes in outright slaying many enemy types.
script,rangerget,begin
# We're going to start seeing this particular line a LOT from here on.
	remember party, suspend player, suspend box advance, suspend obstruction
 	walk NPC (23,left,2)
 	show textbox (643), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (644), wait (7), wait for key (usekey), advance text box
 	show textbox (645), wait (7), wait for key (usekey), advance text box
 	show textbox (646), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (647), wait (7), wait for key (usekey), advance text box
 	show textbox (648), wait (7), wait for key (usekey), advance text box
 	show textbox (649), wait (7), wait for key (usekey), advance text box
 	walk hero (me,right,1), walk NPC (23,left,1), wait for hero (me)
 	resume obstruction, wait (2), add hero (hero:Styrge)
 	set tag (82,on), resume player, resume box advance
# Styrge comes with some useful equipment but nothing noteworthy.
 	force equip ((find hero (hero:Styrge)),2,206)
 	force equip ((find hero (hero:Styrge)),3,208)
 	force equip ((find hero (hero:Styrge)),4,211), encounters
end

#This script is for falling into pits in Surtr's Temple that are to the west of you.
script,westernpit,begin
 	suspend player, suspend box advance
 	walk hero (me,left,3), wait for hero (me)
 	set hero direction (me,down), wait (10)
 	walk hero (me,down,1), wait (5)
 	set hero direction (me,up), walk hero (me,down,4)
 	set hero speed (me,10), wait for hero (me)
 	set hero direction (me,down), set hero speed (me,4)
 	resume player, resume box advance
end

#This script is for falling into pits in Surtr's Temple that are to the east of you.
script,easternpit,begin
 	suspend player, suspend box advance
 	walk hero (me,right,3), wait for hero (me)
 	set hero direction (me,down), wait (10)
 	walk hero (me,down,1), wait (5)
 	set hero direction (me,up), walk hero (me,down,4)
 	set hero speed (me,10), wait for hero (me)
 	set hero direction (me,down), set hero speed (me,4)
 	resume player, resume box advance
end

# This script is for the southernmost pit in Surtr's Temple. 
script,southernpit,begin
 	suspend player, suspend box advance
 	walk hero to y (me,56), wait for hero (me)
 	walk hero to x (me,51), wait for hero (me)
 	set hero direction (me,down), wait (10)
 	walk hero (me,down,1), wait (5)
 	set hero direction (me,up), walk hero (me,down,4)
 	set hero speed (me,10), wait for hero (me)
 	set hero direction (me,down), set hero speed (me,4)
 	resume player, resume box advance
end

# Final Pit script. This one's for the one on the first floor
# In the dead center of the temple.
script,firstpit,begin
 	suspend player, suspend box advance
 	walk hero to x (me,39), wait for hero (me)
 	set hero direction (me,down), wait (10)
 	set hero direction (me,up), walk hero (me,down,4)
 	set hero speed (me,10), wait for hero (me)
 	set hero direction (me,down), set hero speed (me,4)
 	resume player, resume box advance
end

# We're getting Hilda now. Hilda's a frontline fighter with buffs and way later,
# A healing spell that lets her compete with Frumpy as a competant medic.
# Functionally she's like a cross between FF4's Cecil AND Kain.
script,valkyrieget,begin
 	suspend player, suspend box advance, suspend random enemies,remember party
 	walk hero (me,down,1), wait for hero (me)
 	set hero direction (me,up), set caterpillar mode (on)
 	set NPC direction (5,down), set hero position (1, 21, 11), set hero position (2, 21, 11), set hero position (3, 21, 11)
 	wait (1), suspend caterpillar
 	walk hero (me,up,1), walk hero (1,left,1), walk hero (2, right,1), wait for hero (me)
# Now, beacuse they've moved, we set the heroes on the side to all face the same direction.
 	set hero direction (1,up), set hero direction (2,up), set hero direction (3,up), wait (1)
 	show textbox (651), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (652), wait (7), wait for key (usekey), advance text box
 	show textbox (653), wait (7), wait for key (usekey), advance text box
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show textbox (654), wait (7), wait for key (usekey), advance text box
 	show textbox (655), wait (7), wait for key (usekey), advance text box
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show textbox (656), wait (7), wait for key (usekey), advance text box
 	show textbox (657), wait (7), wait for key (usekey), advance text box
 	show textbox (658), wait (7), wait for key (usekey), advance text box
 	walk hero (1,right,1), walk hero (me,down,1), walk NPC (5,down,2), wait for NPC (5)
 	set hero direction (me,right), set hero direction (1,right)
 	set hero direction (3,right), set NPC direction (5,right), set hero direction (2,left)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show textbox (659), wait (7), wait for key (usekey), advance text box
 	show textbox (660), wait (7), wait for key (usekey), advance text box
 	walk hero (2,left,1), add hero (hero:Hilda), set tag (84,on)
 	wait (2), resume obstruction, set caterpillar mode (off)
 	resume caterpillar, resume player, resume box advance, resume random enemies
# Hilda comes with some decent starting gear already.
 	force equip ((find hero (hero:Hilda)),1,21)
 	force equip ((find hero (hero:Hilda)),2,58)
 	force equip ((find hero (hero:Hilda)),3,69)
 	force equip ((find hero (hero:Hilda)),4,149), encounters
end

script,grinlow,begin
	remember party, suspend player, suspend box advance, suspend random enemies
 	walk hero (me,down,1), wait for hero (me), walk hero to x (me,51)
 	focus camera (51,51,4), wait for hero (me), set caterpillar mode (on)
 	set hero position (1, 51, 51), set hero position (2, 51, 51), set hero position (3, 51, 51)
 	wait (1), suspend caterpillar, walk hero (1,left,1), walk hero (2,up,1)
 	walk hero (3,right,1), wait for hero (3)
 	set hero direction (me,down), set hero direction (1,down), set hero direction (2,down), set hero direction (3,down)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (679), wait (7), wait for key (usekey), advance text box
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show textbox (680), wait (7), wait for key (usekey), advance text box
 	show textbox (681), wait (7), wait for key (usekey), advance text box
 	set tag (86,on), wait (5), set hero direction (me,up)
 	set hero direction (1,up), set hero direction (2,up), set hero direction (3,up)
 	focus camera (51,49,4), wait for camera, wait (5)
 	walk NPC (11,down,1), wait for NPC (11)
 	show textbox (682), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (683), wait (7), wait for key (usekey), advance text box
 	show textbox (684), wait (7), wait for key (usekey), advance text box
 	show textbox (685), wait (7), wait for key (usekey), advance text box
 	show textbox (686), wait (7), wait for key (usekey), advance text box
 	wait (5), stop song, wait (5)
 	show textbox (687), wait (7), wait for key (usekey), advance text box
 	show textbox (688), wait (7), wait for key (usekey), advance text box
 	wait (5), tweak palette (-20,-20,-20), fade screen in, wait (4)
 	focus camera (51,51,4), wait for camera
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (689), wait (7), wait for key (usekey), advance text box
 	BossIntroduction, fight formation (119), set tag (87,on)
 	walk hero (me,down), wait for hero (me), set hero direction (me,left), set hero direction (2,left)
	wait (3), set hero direction (me,up), set hero direction (1,right) 
	set hero direction (2,down), set hero direction (3,left), wait (5)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show textbox (690), wait (7), wait for key (usekey), advance text box
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show textbox (691), wait (7), wait for key (usekey), advance text box
 	set hero direction (3,up), wait (5), walk hero (3,up,1)
 	wait for hero (3), focus camera (51,47,4), wait for camera
 	wait (15), focus camera (51,51,4), wait for camera
 	walk hero (3,down,1), wait for hero (3), set hero direction (3,left)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show textbox (692), wait (7), wait for key (usekey), advance text box
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show textbox (693), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (694), wait (7), wait for key (usekey), advance text box
 	walk hero (me,up,1), walk hero (1,right,1), walk hero (2,down,1)
 	walk hero (3,left,1), wait for hero (me), camera follows hero (me)
 	set caterpillar mode (off), resume caterpillar, wait (1)
 	resume player, resume random enemies, resume box advance, encounters
end

script,skaldget,begin
# Time to get Eric. He's a bard - his specialties are buffing the party,
# But he makes for a competant fighter in a pinch.
 	suspend player,remember party, suspend box advance, suspend random enemies
 	show textbox (695), wait (7), wait for key (usekey), advance text box
 	walk hero to y (me,9), wait for hero (me)
 	walk hero to x (me,17), wait for hero (me)
 	set caterpillar mode (on), set hero position (1, 17, 9)
 	set hero position (2, 17, 9), set hero position (3, 17, 9)
 	wait (1), suspend caterpillar
 	walk hero (1,left,1), walk hero (2,down,1), walk hero (3,right,1), walk NPC (4,down,7)
 	wait for hero (3), set hero direction (me,up)
 	set hero direction (1,up), set hero direction (2,up), set hero direction (3,up), suspend obstruction
 	show textbox (696), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (697), wait (7), wait for key (usekey), advance text box
 	show textbox (698), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (699), wait (7), wait for key (usekey), advance text box
 	show textbox (700), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (701), wait (7), wait for key (usekey), advance text box
 	show textbox (702), wait (7), wait for key (usekey), advance text box
 	walk NPC (4,down,2), walk hero (1,right,1), walk hero (2,up,1)
 	walk hero (3,left,1), wait for NPC (4), resume obstruction
 	set tag (88,on), add hero (hero:Eric)
 	set caterpillar mode (off), resume caterpillar, wait (1)
 	resume player, resume random enemies, resume box advance
# Eric comes equipped with Mithril type gear already equipped, so he's
# Ready to go from the start. He also starts out with a Lute in his relic slot
# Which lets him resist silence, so he's pretty handy!
 	force equip ((find hero (hero:Eric)),2,52)
 	force equip ((find hero (hero:Eric)),3,72)
 	force equip ((find hero (hero:Eric)),4,86)
 	force equip ((find hero (hero:Eric)),5,98), encounters
end


script,whalepunch,begin
# Ke ke ke ke ke ke
 	suspend player, suspend box advance, suspend random enemies, suspend NPCs, suspend obstruction
 	walk NPC (6,left,2), wait for NPC (6), wait (10)
 	set NPC speed (6,20), walk NPC (6,right,2), wait for NPC (6)
 	play sound (sfx:Crush8Bit,false,true), suspend hero walls
 	set hero speed (me,20), walk hero to x (me,56), set hero direction (me,left)
 	show textbox (711), wait (1), set hero z (me,10), wait (1)
 	set hero z (me,20), wait (1), set hero z (me,30), wait (1)
 	set hero z (me,40), wait (1), set hero z (me,50), wait (1)
 	set hero z (me,60), wait (1), set hero z (me,70), wait (1)
 	set hero z (me,80), wait (1), set hero z (me,90), wait (1)
 	set hero z (me,100), wait (1), set hero z (me,120), wait (1)
 	set hero z (me,130), wait for hero (me), wait (1), set hero z (me,120)
 	wait (1), set hero z (me,110), wait (1), set hero z (me,100)
 	wait (1), set hero z (me,90), wait (1), set hero z (me,80)
 	wait (1), set hero z (me,70), wait (1), set hero z (me,60)
 	wait (1), set hero z (me,50), wait (1), set hero z (me,40)
 	wait (1), set hero z (me,30), wait (1), set hero z (me,20)
 	wait (1), set hero z (me,10), wait (1), set hero z (me,0)
 	play sound (sfx:Collision8Bit,false,true)
 	wait (1), set hero z (me,10), wait (1), set hero z (me,20)
 	wait (1), set hero z (me,30), wait (1), set hero z (me,40)
 	wait (1), set hero z (me,30), wait (1), set hero z (me,20)
 	wait (1), set hero z (me,10), wait (1), set hero z (me,0)
 	play sound (sfx:Collision8Bit,false,true)
 	wait (1), set hero z (me,10), wait (1), set hero z (me,20)
 	wait (1), set hero z (me,30), wait (1), set hero z (me,20)
 	wait (1), set hero z (me,10), wait (1), set hero z (me,0)
 	play sound (sfx:Collision8Bit,false,true)
 	wait (1), set hero z (me,10), wait (1), set hero z (me,20)
 	wait (1), set hero z (me,10), wait (1), set hero z (me,0)
 	play sound (sfx:Collision8Bit,false,true)
 	wait (1), set hero z (me,10), wait (1), set hero z (me,0)
 	play sound (sfx:Collision8Bit,false,true)
 	wait (1), advance textbox, resume hero walls, wait (1)
 	resume player, resume random enemies, resume box advance, resume NPCs, resume obstruction, encounters
end

script,whaleland,begin
 	suspend player, suspend box advance, suspend random enemies
 	walk hero (me,left,1), wait for hero (me), suspend hero walls
 	walk hero (me,down,5), set hero direction (me,up), wait for hero (me)
 	resume hero walls, resume player, resume box advance, resume random enemies, encounters
end

script,berserkerget,begin
# Time to get Olaf in the group! He's a raw physical fighter, who can output
# Damage in far greater amounts than anyone else from start to finish.
 	suspend player, suspend box advance, suspend random enemies, suspend obstruction, remember party
 	show textbox (712), wait (7), wait for key (usekey), advance text box
 	show textbox (713), wait (7), wait for key (usekey), advance text box
 	walk hero to y (me,28), wait for hero (me), walk hero to x (me,29), wait for hero (me)
 	set hero direction (me,up), wait (10), walk hero (me,up,4), wait for hero (me)
 	swap by position (0,find hero (hero:Kitt)), swap by position (2,find hero (hero:Frumpy))
 	wait (2), walk hero (me,up,3), wait for hero (me), set caterpillar mode (on)
 	set hero position (1, 23, 27), set hero position (2, 23, 27), set hero position (3, 23, 27), wait (1)
 	suspend caterpillar, walk hero (1,left,1), walk hero (2,down,1), walk hero (3,right,1)
 	wait for hero (3), set hero direction (me,up), set hero direction (1,up), set hero direction (2,up)
 	set hero direction (3,up), wait (5), focus camera (23,26,4), wait for camera, set NPC direction (17,down)
 	show textbox (714), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (715), wait (7), wait for key (usekey), advance text box
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show textbox (716), wait (7), wait for key (usekey), advance text box
 	show textbox (717), walk NPC (12,left,1), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (718), wait (7), wait for key (usekey), advance text box
 	set NPC direction (12,down), set hero direction (me,down), set hero direction (1,right)
 	set hero direction (2,up), set hero direction (3,left)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show textbox (719), wait (7), wait for key (usekey), advance text box
 	show textbox (720), wait (7), wait for key (usekey), advance text box
 	walk NPC (12,right,1), wait for NPC (12), walk NPC (12,down,1), wait for NPC (12)
 	show textbox (721), wait (7), wait for key (usekey), advance text box
 	set hero direction (me,up), set hero direction (1,up), set hero direction (2,up), set hero direction (3,up)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show textbox (722), wait (7), wait for key (usekey), advance text box
 	show textbox (723), wait (7), wait for key (usekey), advance text box
 	BossIntroduction, fight formation (120), reinstate party
 	swap by position (0,find hero (hero:Kitt)), swap by position (2,find hero (hero:Frumpy))
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (724), wait (7), wait for key (usekey), advance text box
 	show textbox (725), wait (7), wait for key (usekey), advance text box
 	focus camera (23,27,4), walk NPC (20,up,3)
 	show textbox (726), wait (7), wait for key (usekey), set hero direction (me,left), set hero direction (1,right)
 	set hero direction (2,left), set hero direction (3,left), advance text box, wait (3)
 	set hero direction (me,down), set hero direction (1,down)
 	set hero direction (2,down), set hero direction (3,down), walk NPC (12,down,2)
 	show textbox (727), wait (7), wait for key (usekey), advance text box
 	walk NPC (17,down,1), show textbox (728), wait (7), wait for key (usekey), advance text box
 	set NPC direction (12,left), set hero direction (me,left), set hero direction (1,right)
 	set hero direction (2,left), set hero direction (3,left), wait (3)
 	set hero direction (me,up), set hero direction (1,up), set hero direction (2,up), set hero direction (3,up)
 	show textbox (729), wait (7), wait for key (usekey), advance text box
 	show textbox (730), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (731), wait (7), wait for key (usekey), advance text box
 	show textbox (732), wait (7), wait for key (usekey), advance text box
 	show textbox (733), wait (7), wait for key (usekey), advance text box
 	walk hero (1,right,1), walk hero (2,up,1), walk hero (3,left,1), walk NPC (12,down)
 	set tag (89,on), add hero (hero:Olaf), resume obstruction, set caterpillar mode (off)
 	resume caterpillar, wait (1), set hero direction (me,left), wait (5)
 	set hero direction (me,down), wait (5)
 	show textbox (734), wait (7), wait for key (usekey), advance text box
 	walk NPC (20,down,3), resume player, resume box advance 
	resume random enemies, camera follows hero (me), reinstate party
# Olaf actually comes equipped with a sword as a hat!
# Though silly, it means he starts off doing a LOT more damage than anyone else.
 	force equip ((find hero (hero:Olaf)),2,36)
 	force equip ((find hero (hero:Olaf)),3,67)
 	force equip ((find hero (hero:Olaf)),4,83)
 	force equip ((find hero (hero:Olaf)),5,92), encounters
end

script,randomboxpuzzle,begin
 	if (random(1,100) >= 50)   then (set tag(90,on)) else (set tag(90,off))
 	if (random(1,100) >= 50)   then (set tag(91,on)) else (set tag(91,off))
 	if (random(1,100) >= 50)   then (set tag(92,on)) else (set tag(92,off))
 	if (random(1,100) >= 50)   then (set tag(93,on)) else (set tag(93,off))
 	if (random(1,100) >= 50)   then (set tag(94,on)) else (set tag(94,off))
 	if (random(1,100) >= 50)   then (set tag(95,on)) else (set tag(95,off))
 	if (random(1,100) >= 50)   then (set tag(96,on)) else (set tag(96,off))
 	set tag (98,off),use door (8)
end

script,randomboxprize,begin
#Happens at Midnight, you get an apple!
 	if (system hour == 0) then (show text box (747))
#At 1 AM, you get 100 Gold
 	if (system hour == 1) then (show text box (748))
#At 2 AM, you get a jar of Honey!
 	if (system hour == 2) then (show text box (749))
#At 3 AM, you get a Soma Drop!
 	if (system hour == 3) then (show text box (750))
#At 4 AM, you get a Panacea!
 	if (system hour == 4) then (show text box (751))
#At 5 AM, you find a Throwing Dart!
 	if (system hour == 5) then (show text box (752))
#At 6 AM, you find 3 Meads!
 	if (system hour == 6) then (show text box (753), get item (1,3))
#At 7 AM, you get a sleeping bag!
 	if (system hour == 7) then (show text box (754))
#At 8 AM, you get 500 Gold!
 	if (system hour == 8) then (show text box (755))
#At 9 AM, you get 100 Gold and 1 Mead!
 	if (system hour == 9) then (show text box (756), get item (1,1))
#At 10 AM, you get 1 Apple and 1 Soma!
 	if (system hour == 10) then (show text box (757), get item (115,1), get item (116,1))
#at 11 AM, you get either a potion of vigor, or 100 gold!
 	if (system hour == 11) then (show text box (758))
#Happens at Midday, you get an apple!
 	if (system hour == 12) then (show text box (747))
#At 1 PM, you get 100 Gold
 	if (system hour == 13) then (show text box (748))
#At 2 PM, you get a jar of Honey!
 	if (system hour == 14) then (show text box (749))
#At 3 PM, you get a Soma Drop!
 	if (system hour == 15) then (show text box (750))
#At 4 PM, you get a Panacea!
 	if (system hour == 16) then (show text box (751))
#At 5 PM, you find a Throwing Dart!
 	if (system hour == 17) then (show text box (752))
#At 6 PM, you find 3 Meads!
 	if (system hour == 18) then (show text box (753), get item (1,3))
#At 7 PM, you get a sleeping bag!
 	if (system hour == 19) then (show text box (754))
#At 8 PM, you get 500 Gold!
 	if (system hour == 20) then (show text box (755))
#At 9 PM, you get 100 Gold and 1 Mead!
 	if (system hour == 21) then (show text box (756), get item (1,1))
#At 10 PM, you get 1 Apple and 1 Soma!
 	if (system hour == 22) then (show text box (757), get item (115,1), get item (116,1))
#at 11 PM, you get either a potion of vigor, or 100 gold!
 	if (system hour == 23) then (show text box (758))
end

script,enteralfheim,begin
 	suspend player, suspend box advance, suspend random enemies,remember party
 	swap by position (0,find hero (hero:Styrge)), set caterpillar mode (on)
 	set hero position (1, 10, 13), set hero position (2, 10, 13), set hero position (3, 10, 13)
 	wait (1), suspend caterpillar, walk hero (me,right,1)
 	walk hero (1,up,1), walk hero (2,left,1), walk hero (3,down,1)
 	wait for hero (me), set hero direction (me,down), set hero direction (1,right)
 	set hero direction (2,down), set hero direction (3,right), wait (5)
 	set hero direction (me,left), set hero direction (1,down), set hero direction (2,left)
 	set hero direction (3,up), wait (5)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (804), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (805), wait (7), wait for key (usekey), advance text box
 	walk hero (me,left,1), walk hero (1,down,1), walk hero (2,right,1)
 	walk hero (3,up,1), wait for hero (me), resume caterpillar
 	set caterpillar mode (off), resume player
 	resume box advance, resume random enemies,reinstate party, encounters
end

script, jint, begin
# And now we summon the jint of mah butt
	remember party, suspend player, suspend box advance, suspend random enemies
 	walk hero (me,up,2), wait for hero (me), set caterpillar mode (on)
 	set hero position (1, 47, 37), set hero position (2, 47, 37), set hero position (3, 47, 37)
 	wait (1), suspend caterpillar
 	walk hero (1,left,1), walk hero (2,down,1), walk hero (3,right,1), wait for hero (3)
 	set hero direction (me,up), set hero direction (1,up), set hero direction (2,up), set hero direction (3,up)
 	wait (5), focus camera (47,36,4), wait for camera, walk NPC (11,down,3), wait for NPC (11)
 	show textbox (818), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (819), wait (7), wait for key (usekey), advance text box
 	show textbox (820), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (821), wait (7), wait for key (usekey), advance text box
 	walk hero (1,up,1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show textbox (822), wait (7), wait for key (usekey), advance text box
 	show textbox (823), wait (7), wait for key (usekey), advance text box
 	walk hero (me,up,1), set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (824), wait (7), wait for key (usekey), advance text box
 	show textbox (825), wait (7), wait for key (usekey), advance text box
 	show textbox (826), wait (7), wait for key (usekey), advance text box
 	show textbox (827), wait (7), wait for key (usekey), advance text box
 	wait (5), stop song, wait (5)
 	show textbox (828), wait (7), wait for key (usekey), advance text box
 	show textbox (829), wait (7), wait for key (usekey), advance text box
 	wait (5), tweak palette (-20,-20,-20), fade screen in, wait (4)
 	focus camera (47,36,4), wait for camera, set hero frame (me,1), wait (1)
 	set hero frame (me,0), wait (1), set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (830), wait (7), wait for key (usekey), advance text box
 	walk hero (2,up,1), walk hero (3,up,1)
 	BossIntroduction, fight formation (121), set tag (99,on)
 	camera follows hero (me), walk hero (me,up,1)
 	set hero direction (me,down), set hero direction (1,right), set hero direction (3,left)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show textbox (831), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (832), wait (7), wait for key (usekey), advance text box
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show textbox (833), wait (7), wait for key (usekey), advance text box
 	walk NPC (13,right,9), wait for NPC (13), set NPC direction (13,down)
 	set hero direction (me,up), set hero direction (1,up), set hero direction (3,up)
 	show textbox (834), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (835), wait (7), wait for key (usekey), advance text box
 	show textbox (836), wait (7), wait for key (usekey), advance text box
 	show textbox (837), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (838), wait (7), wait for key (usekey), advance text box
 	show textbox (839), wait (7), wait for key (usekey), advance text box
 	show textbox (840), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (841), wait (7), wait for key (usekey), advance text box
 	show textbox (842), wait (7), wait for key (usekey), advance text box
 	walk hero (me,down,1), walk hero (1,right,1), walk hero (2,up,1), walk hero (3,left,1)
 	wait for hero (me), resume caterpillar, set caterpillar mode (off)
 	resume player, resume box advance, resume random enemies, use door (1), set tag (100,on), encounters
end

script,thule1,begin
# Party enters Thule to free the town from.. eh.
 	suspend player, suspend box advance, suspend random enemies, suspend obstruction, remember party
 	walk hero (me,down,1), wait for hero (me), swap by position (0,find hero (hero:Hilda))
 	swap by position (1,find hero (hero:Styrge)), swap by position (2,find hero (hero:Eric))
 	swap by position (3,find hero (hero:Frumpy)), set caterpillar mode (on)
 	walk NPC (9,left,8), set hero position (1, 13, 27), set hero position (2, 13, 27), set hero position (3, 13, 27)
 	set NPC position (5,13,27), set NPC position (6,13,27), set NPC position (7,13,27), set NPC position (8,13,27)
 	focus camera (13,27,4), wait for camera, wait (1), suspend caterpillar
 	walk NPC (8,left,1), walk NPC (6,down,1), wait for NPC (6), walk NPC (8,left,1)
 	walk NPC (6,left,1), walk NPC (7,left,1), walk NPC (5,down,1), wait for NPC (5)
 	walk NPC (8,left,1), walk NPC (6,left,1), walk NPC (7,left,1), walk NPC (5,left,1)
 	walk hero (1,up,1), walk hero (2,left,1), walk hero (3,down,1), wait for hero (3)
 	set hero direction (1,right), set hero direction (2,down), set hero direction (3,right)
 	set NPC direction (5,down), set NPC direction (6,down), set NPC direction (7,down)
 	set NPC direction (8,down), wait (5), set NPC direction (5,right)
 	set NPC direction (6,right), set NPC direction (7,right), set NPC direction (8,right)
 	set hero direction (me,right), set hero direction (2,right), wait (5)
# everyone should be in position now to do their talking?
 	show textbox (844), wait (7), wait for key (usekey), advance text box
 	show textbox (845), wait (7), wait for key (usekey), advance text box
 	walk NPC (9,right,8), set NPC direction (7,down)
 	show textbox (846), wait (7), wait for key (usekey), advance text box
 	set hero direction (3,down), wait (3), set hero direction (3,left), wait (3)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show textbox (847), wait (7), wait for key (usekey), advance text box
 	set NPC direction (7,right), set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show textbox (848), wait (7), wait for key (usekey), advance text box
 	set hero direction (0,down), set hero direction (3,up)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (849), wait (7), wait for key (usekey), advance text box
 	set NPC direction (5,down)
 	show textbox (850), wait (7), wait for key (usekey), advance text box
 	set hero direction (1,down), set NPC direction (5,right), wait (3), set NPC direction (5,up)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show textbox (851), wait (7), wait for key (usekey), advance text box
 	walk hero (me,right,1), walk hero (1,right,1), wait for hero (me)
 	set hero direction (1,left), set hero direction (me,left), set hero direction (2,right)
 	set hero direction (3,up), set NPC direction (5,right), set NPC direction (6,right)
 	set NPC direction (7,right), set NPC direction (8,right)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (852), wait (7), wait for key (usekey), advance text box
 	show textbox (853), wait (7), wait for key (usekey), advance text box
 	set NPC direction (6,down), wait (3), set NPC direction (6,left)
 	show textbox (854), wait (7), wait for key (usekey), advance text box
 	walk hero (2,right,1), wait for hero (2), set hero direction (2,down), wait (3)
 	set hero direction (2,left), set hero frame (1,1), wait (1)
 	set hero frame (1,0), wait (1), set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show textbox (855), wait (7), wait for key (usekey), advance text box
 	show textbox (856), wait (7), wait for key (usekey), advance text box
 	walk hero (me,right,8), walk hero (1,right,8), walk hero (2,right,8), walk hero (3,right,2)
 	wait for hero (3), wait (10), set hero direction (3,down), set NPC direction (5,right)
 	set NPC direction (6,right), set NPC direction (7,right), set NPC direction (8,right)
 	wait (3), set hero direction (3,left), wait (3)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show textbox (857), wait (7), wait for key (usekey), advance text box
 	walk NPC (7,right,2), wait (5)
 	show textbox (858), wait (7), wait for key (usekey), advance text box
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show textbox (859), wait (7), wait for key (usekey), advance text box
 	fade screen out, lock hero (hero:Kitt), lock hero (hero:Bram)
 	lock hero (hero:Olaf), lock hero (hero:Night), wait (2)
 	resume caterpillar, set caterpillar mode (off), resume player
 	resume box advance, resume random enemies, resume obstruction, set tag (101,on)
 	wait (1), camera follows hero (me), wait (4), fade screen in, encounters
end

script,thule2,begin
 	suspend player, suspend box advance, suspend random enemies, suspend obstruction, remember party
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (861), wait (7), wait for key (usekey), advance text box
 	show textbox (862), wait (7), wait for key (usekey), advance text box
# walk to doggy
 	walk hero to X (me,16), wait for hero (me), walk hero to Y (me,19), wait for hero (me)
 	set hero direction (me,right), wait (3), set hero position (1, 16, 19)
 	set hero position (2, 16, 19), set hero position (3, 16, 19), wait (1)
 	set caterpillar mode (on), suspend caterpillar, wait (1)
 	walk hero (1,up,1), walk hero (2,left,1), walk hero (3,down,1), wait for hero (3)
 	set hero direction (1,right), set hero direction (2,right), set hero direction (3,right)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (863), wait (7), wait for key (usekey), advance text box
# dogero jumps and turns
 	set NPC frame (1,0), wait (1), set NPC frame (1,1), wait (1)
 	set NPC frame (1,0), wait (1), set NPC frame (1,1), wait (1)
 	set NPC frame (1,0), wait (1), set NPC frame (1,1), wait (1)
 	set NPC direction (1,down), wait (3), set NPC direction (1,left), wait (3)
 	show textbox (864), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (865), wait (7), wait for key (usekey), advance text box
 	show textbox (866), wait (7), wait for key (usekey), advance text box
 	show textbox (867), wait (7), wait for key (usekey), advance text box, walk hero (me,right,1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (868), wait (7), wait for key (usekey), advance text box
 	walk hero (me,left,1), set hero direction (me,right)
 	show textbox (869), wait (7), wait for key (usekey), advance text box
 	show textbox (870), wait (7), wait for key (usekey), advance text box
 	walk NPC (1,left,1), wait for NPC (1)
 	show textbox (871), wait (7), wait for key (usekey), advance text box
 	set NPC direction (1,up), wait (3)
 	show textbox (872), wait (7), wait for key (usekey), advance text box
# walk bob down to fight too!
 	walk NPC (2,down,2), set hero direction (me,up), set hero direction (3,up), wait for NPC (2)
 	show textbox (873), wait (7), wait for key (usekey), advance text box
 	show textbox (874), wait (7), wait for key (usekey), advance text box
 	show textbox (875), wait (7), wait for key (usekey), advance text box
# walk chewie left to fight!
 	walk NPC (3,left,7), wait for NPC (2), set NPC direction (2,down), wait (3)
 	show textbox (876), wait (7), wait for key (usekey), advance text box
 	show textbox (877), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (878), wait (7), wait for key (usekey), advance text box
# fight with bobn chewie
 	wait (3), BossIntroduction, fight formation (109)
 	show textbox (879), wait (7), wait for key (usekey), advance text box
 	set NPC direction (1,left), set hero direction (me,right), set hero direction (3,right)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (880), wait (7), wait for key (usekey), advance text box
 	walk NPC (1, right,3), wait for NPC (1), walk NPC (1, down,10), walk NPC (3,down,1), wait for NPC (10)
 	show textbox (881), wait (7), wait for key (usekey), advance text box, set hero direction (me,up)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (882), wait (7), wait for key (usekey), advance text box
 	set hero direction (2,left), set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show textbox (883), wait (7), wait for key (usekey), advance text box
 	show textbox (884), wait (7), wait for key (usekey), advance text box
 	set hero direction (1,up), set hero direction (2,up), set hero direction (3,up), wait (5)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (885), wait (7), wait for key (usekey), advance text box
 	walk NPC (3,down,1), set hero direction (0,right), set hero direction (1,right) 
 	set hero direction (2,right), set hero direction (3,right)
 	show textbox (886), wait (7), wait for key (usekey), advance text box
 	walk NPC (3,down,4), wait for NPC (3), set hero direction (0,down), set hero direction (1,down)
 	set hero direction (2,down), set hero direction (3,down), walk NPC (3,down,10), wait for NPC (3)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show textbox (887), wait (7), wait for key (usekey), advance text box
 	set tag (tag:Thule2,on), walk NPC (2,up,2), walk hero (1,down,1), walk hero (2,right,1)
 	walk hero (3,up,1), wait for hero (me), resume caterpillar
 	set caterpillar mode (off), resume player, resume box advance
 	resume obstruction, resume random enemies, encounters
end

script,alfheim1,begin
	remember party, suspend random enemies, suspend player, suspend box advance, suspend NPCs, suspend obstruction
	walk hero to X (me,26), wait for hero (me), walk hero to Y (me,10), focus camera (26,11,4)
 	suspend caterpillar, wait (2), set hero direction (me,down), wait (2)
 	set caterpillar mode (on), set NPC position (11,26,18), set hero position (1, 26, 10)
 	set hero position (2, 26, 10), set hero position (3, 26, 10), walk NPC (11,up,6)
 	wait for NPC (11), set NPC position (12,26,12), set NPC position (13,26,12)
 	set NPC position (14,26,12), wait (1),remember party
 	swap by position (0,find hero (hero:Styrge)), swap by position (1,find hero (hero:Hilda))
 	swap by position (2,find hero (hero:Eric)), swap by position (3,find hero (hero:Frumpy))
 	wait (3), walk hero (1,up,1), walk hero (2,left,1), walk hero (3,right,1)
 	walk NPC (12,left,1), walk NPC (13,down,1), walk NPC (14,right,1), wait (3)
 	set hero direction (1,down), set hero direction (2,down), set hero direction (3,down)
 	set NPC direction (12,up), set NPC direction (13,up), set NPC direction (14,up), wait (1)
 	wait for hero (me), set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (895), wait (7), wait for key (usekey), advance text box
 	show textbox (896), wait (7), wait for key (usekey), advance text box
 	show textbox (897), wait (7), wait for key (usekey), advance text box
 	set hero Z (2,5), wait (1), set hero Z (2,0), wait (1), set hero Z (2,5), wait (1)
 	set hero Z (2,0), wait (1), set hero Z (2,5), wait (1), set hero Z (2,0), wait (1)
 	show textbox (898), wait (7), wait for key (usekey), advance text box
 	set hero Z (3,5), wait (1), set hero Z (3,0), wait (1), set hero Z (3,5), wait (1)
 	set hero Z (3,0), wait (1), set hero Z (3,5), wait (1), set hero Z (3,0), wait (1)
 	show textbox (899), wait (7), wait for key (usekey), advance text box
 	set NPC frame (12,0), wait (1), set NPC frame (12,1), wait (1)
 	set NPC frame (12,0), wait (1), set NPC frame (12,1), wait (1)
 	set NPC frame (12,0), wait (1), set NPC frame (12,1), wait (1)
 	show textbox (900), wait (7), wait for key (usekey), advance text box
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show textbox (901), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (902), wait (7), wait for key (usekey), advance text box
 	set NPC direction (11,left), wait (2)
 	show textbox (903), wait (7), wait for key (usekey), advance text box
 	set NPC direction (12,right), wait (2)
 	show textbox (904), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1) 
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (905), wait (7), wait for key (usekey), advance text box
 	set NPC direction (11,up), set NPC direction (12,up)
 	show textbox (906), wait (7), wait for key (usekey), advance text box
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show textbox (907), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (908), wait (7), wait for key (usekey), advance text box
 	fade screen out, focus camera (26,22,20),remember party
 	swap by position (0,find hero (hero:Styrge)), swap by position (1,find hero (hero:Olaf))
 	swap by position (2,find hero (hero:Eric)), swap by position (3,find hero (hero:Night))
 	wait (1), unlock hero (hero:Olaf), unlock hero (hero:Night)
 	lock hero (hero:Frumpy), lock hero (hero:Hilda), wait (2), stop song
 	set tag (tag:CTHULHU1, off), wait for camera, fade screen in, wait (1), play song (song:Vile)
 	set NPC direction (19,left), wait (3), set NPC direction (19,down), wait (3)
 	show textbox (909), wait (7), wait for key (usekey), advance text box
 	show textbox (910), wait (7), wait for key (usekey), advance text box
 	set NPC direction (16,right), set NPC direction (17,right), set NPC direction (19,right), wait (2)
 	show textbox (911), wait (7), wait for key (usekey), advance text box
 	show textbox (912), wait (7), wait for key (usekey), advance text box
 	show textbox (913), wait (7), wait for key (usekey), advance text box
 	show textbox (914), wait (7), wait for key (usekey), advance text box
 	set NPC direction (16,up), set NPC direction (17,up), set NPC direction (19,down), wait (1)
 	show textbox (915), wait (7), wait for key (usekey), advance text box
 	wait (2), tweak palette (20,-20,20), fade screen in, wait (4), set tag (tag:CTHULHU1, on)
 	set NPC position (36,26,20), play sound (sfx:MediumExplosion8Bit,false,true)
	set NPC direction (36,up), set NPC frame (36,0), wait (2)
	set NPC direction (36,up), set NPC frame (36,1), wait (2)
	set NPC direction (36,right), set NPC frame (36,0), wait (2)
	set NPC direction (36,right), set NPC frame (36,1), wait (2)
	set NPC direction (36,down), set NPC frame (36,0), wait (2)
	set NPC direction (36,down), set NPC frame (36,1), wait (2)
	set NPC direction (36,left), set NPC frame (36,0), wait (2)
	set NPC direction (36,left), set NPC frame (36,1), wait (2)
	set NPC position (36,0,1), wait (3), reset palette, fade screen in
 	walk NPC (18,up,2), wait for NPC (18), play song (song:Nameless Sorcerer)
 	set NPC direction (16,right), set NPC direction (17,right)
 	show textbox (916), wait (7), wait for key (usekey), advance text box
 	show textbox (917), wait (7), wait for key (usekey), advance text box
 	set NPC direction (18,left), wait (3), set NPC direction (18,down), wait (3)
 	show textbox (918), wait (7), wait for key (usekey), advance text box
 	show textbox (919), wait (7), wait for key (usekey), advance text box
 	show textbox (920), wait (7), wait for key (usekey), advance text box
 	set NPC direction (18,left), wait (3), set NPC direction (18,up), wait (3)
 	show textbox (921), wait (7), wait for key (usekey), advance text box, walk NPC (17,left,1)
 	show textbox (922), wait (7), wait for key (usekey), advance text box
 	show textbox (923), wait (7), wait for key (usekey), advance text box
 	show textbox (924), wait (7), wait for key (usekey), advance text box
 	show textbox (925), wait (7), wait for key (usekey), advance text box
 	fade screen out , wait (3), stop song, wait (2), set tag (104,on), wait (2)
 	camera follows hero (me), resume random enemies, resume player
 	resume obstruction, resume NPCs, resume box advance, resume caterpillar
 	set caterpillar mode (off), wait (4), play song (song:Life Returns), fade screen in, encounters
end

script,niffbox,begin
	remember party, suspend player, suspend box advance
 	show textbox (932), wait (7), wait for key (usekey), advance text box
 	focus camera (10,18,5), wait for camera, wait (10)
 	focus camera (12,28,5), wait for camera, wait (10)
 	focus camera (22,24,5), wait for camera, wait (5)
 	camera follows hero (me), resume box advance, resume player, encounters
end

script,elfshouse1,begin
 	suspend player, suspend box advance
 	walk hero to x (me,47), wait for hero (me), walk hero to y (me,7), wait for hero (me)
 	suspend caterpillar,remember party
 	swap by position (0,find hero (hero:Styrge)), swap by position (1,find hero (hero:Olaf))
 	swap by position (2,find hero (hero:Eric)) ,swap by position (3,find hero (hero:Night))
 	wait (1), set caterpillar mode (on), set hero position (1, 47, 7)
 	set hero position (2, 47, 7), set hero position (3, 47, 7), wait (2)
 	walk hero (me,up,1), walk hero (1,left,1), walk hero (2,right,1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (929), wait (7), wait for key (use key), advance text box
 	walk hero (3,down,1), wait for hero (3), wait (3)
 	set hero direction (me,left), set hero direction (1,down), set hero direction (2,down)
 	wait (3), set hero direction (me,down), wait (3)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show text box (930), wait (7), wait for key (use key), advance text box
 	walk hero (3,down,4), wait for hero (3), wait (3), walk hero (2,down,1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (931), wait (7), wait for key (use key), advance text box
 	set hero direction (2,left), wait (5), set hero direction (2,down), wait (5)
 	fade screen out, wait (1), swap by position (0,find hero (hero:Night))
 	swap out hero (hero:Styrge), swap out hero (hero:Olaf), swap out hero (hero:Eric), wait (1)
 	lock hero (hero:Styrge), lock hero (hero:Olaf), lock hero (hero:Eric), set caterpillar mode (off)
	set tag (tag:NightRain,on), remember party, wait (3), use door (15)
# This is the part where Night has her first heart to heart with Hati
	play song (song:Sleeping Buddha), pan camera (up,3), wait (10)
	show text box (4292), wait (7), wait for key (use key), advance text box
	wait (10), walk NPC (27,right,1), wait for NPC (27), wait (10)
	show text box (4293), wait (7), wait for key (use key), advance text box
	wait (10), walk NPC (27,right,1), wait for NPC (27), wait (10)
	show text box (4294), wait (7), wait for key (use key), advance text box
	show text box (4295), wait (7), wait for key (use key), advance text box
	wait (10), set NPC direction (27,down), wait (10)
	show text box (4296), wait (7), wait for key (use key), advance text box
	wait (10), walk NPC (27,down,1), wait for NPC (27), wait (10)
	show text box (4297), wait (7), wait for key (use key), advance text box
	show text box (4298), wait (7), wait for key (use key), advance text box
	wait (10), walk NPC (27,right,2), wait for NPC (27), wait (10)
	show text box (4299), wait (7), wait for key (use key), advance text box
	wait (10), set NPC direction (27,up), wait (10)
	wait (10), set NPC direction (27,left), wait (10)
	wait (10), fade screen out, wait (10), camera follows hero (me), wait (5)
	wait (5), walk hero (me,down,1), wait (5), fade screen in, wait (5) 
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (959), wait (7), wait for key (use key), advance text box
	set tag (tag:NightRain,off), 	resume box advance, resume player, resume NPCs, encounters
end

script,alfheim2,begin
	remember party, suspend box advance, suspend player
 	show text box (960), wait (7), wait for key (use key), advance text box, walk hero to y (me,21) 
	wait for hero (me), walk hero to x (me,47), wait for hero (me), set hero direction (me,up), wait (4)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (961), wait (7), wait for key (use key), advance text box
 	show text box (962), wait (7), wait for key (use key), advance text box
 	walk NPC (7,down,1), walk hero (me,down,1), set hero direction (me,up), wait for NPC (11)
 	show text box (963), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (964), wait (7), wait for key (use key), advance text box
 	set NPC direction (7,left), wait (4), set NPC direction (7,up), wait (4)
 	show text box (965), wait (7), wait for key (use key), advance text box
 	show text box (966), wait (7), wait for key (use key), advance text box, walk hero (me,up,1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (967), wait (7), wait for key (use key), advance text box, set NPC direction (7,left)
 	show text box (968), wait (7), wait for key (use key), advance text box
 	show text box (969), wait (7), wait for key (use key), advance text box
 	set NPC direction (7,down), wait (4)
 	show text box (970), wait (7), wait for key (use key), advance text box
 	show text box (971), wait (7), wait for key (use key), advance text box
 	tweak palette (-20,20,20), fade screen in, wait (4)
 	set tag (tag:HATI2, on), wait (3), set tag (tag:HATI2, off), wait (3)
 	set tag (tag:HATI2, on), wait (3), set tag (tag:HATI2, off), wait (3)
 	set tag (tag:HATI2, on), wait (3), set tag (tag:HATI2, off), wait (3)
 	set tag (tag:HATI2, on), wait (3), reset palette, fade screen in
 	walk hero (me,up,2), wait for hero (me), wait (4)
 	set hero direction (me,left), wait (4), set hero direction (me,right), wait (4)
 	set hero direction (me,left), wait (4), set hero direction (me,right), wait (4)
 	set hero direction (me,left), wait (4), set hero direction (me,right), wait (4)
 	walk NPC (6,down,6), wait for NPC (6), focus camera (47,17,4), wait for camera
 	show text box (972), wait (7), wait for key (use key), advance text box
 	set hero direction (me,left), wait (4), set hero direction (me,up), wait (4)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (973), wait (7), wait for key (use key), advance text box
 	show text box (974), wait (7), wait for key (use key), advance text box
 	show text box (975), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (976), wait (7), wait for key (use key), advance text box
 	show text box (977), wait (7), wait for key (use key), advance text box
 	stop song, wait (2)
 	show text box (978), wait (7), wait for key (use key), advance text box
 	show text box (979), wait (7), wait for key (use key), advance text box
 	wait (5), tweak palette (-20,-20,-20), fade screen in, walk NPC (8,right,10), wait for NPC (8)
 	show text box (980), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	remember party
# This just makes sure that Freki has some equipment in case you were sneaky and sold it earlier
 	force equip ((find hero (hero:Freki)),2,57)
 	force equip ((find hero (hero:Freki)),3,77)
 	force equip ((find hero (hero:Freki)),4,88)
 	force equip ((find hero (hero:Freki)),5,255)
 	swap in hero (hero:Freki), set hero direction (me,up), set NPC direction (8,up)
 	show text box (981), wait (7), wait for key (use key), advance text box
	remember party, wait (3), BossIntroduction
 	fight formation (122), set tag (tag:TRIANGLE, on), focus camera (47,19,4), swap out hero (hero:Freki)
 	show text box (984), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (985), wait (7), wait for key (use key), advance text box, walk NPC (6,up,6)
 	show text box (986), wait (7), wait for key (use key), advance text box
 	set hero direction (me,left), set NPC direction (8,right)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (987), wait (7), wait for key (use key), advance text box
 	show text box (988), wait (7), wait for key (use key), advance text box
 	show text box (989), wait (7), wait for key (use key), advance text box
 	walk NPC (8,left,2), wait for NPC (8), wait (4), set NPC direction (8,down)
 	wait (4), set NPC direction (8,right), wait (4)
 	show text box (990), wait (7), wait for key (use key), advance text box
 	fade screen out, swap by position (0,find hero (hero:Styrge)), swap out hero (hero:Night),remember party
 	camera follows hero (me), lock hero (hero:Night), use door (14), resume box advance
 	resume player, reinstate party, encounters
end

script,alfheim3,begin
	remember party, suspend player, suspend box advance, stop song
 	walk hero to Y (me,22), wait for hero (me), walk hero to X (me,61), wait for hero (me)
 	set hero direction (me,up), wait (5), play song (song:In Soft Reflection)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (1000), wait (7), wait for key (usekey), advance textbox
 	show textbox (1001), wait (7), wait for key (usekey), advance textbox
 	wait (5), fade screen out, wait (3), show textbox (1002), wait (2)
 	fade screen in, wait (7), wait for key (usekey), advance textbox
 	show textbox (1003), wait (7), wait for key (usekey), advance textbox
 	show textbox (1004), wait (7), wait for key (usekey), advance textbox
 	show textbox (1005), wait (7), wait for key (usekey), fade screen out
 	wait (3), advance textbox, wait (2), fade screen in
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (1006), wait (7), wait for key (usekey), advance textbox
 	set NPC position (10,61,24), set NPC direction (10,up), wait (3), walk NPC (10,up,1)
 	show textbox (1007), wait (7), wait for key (usekey), advance textbox
 	wait (5), set hero direction (me,left), wait (5), set hero direction (me,down), wait (3)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (1008), wait (7), wait for key (usekey), advance textbox
 	fade screen out, wait (2), swap in hero (hero:Olaf), swap in hero (hero:Eric)
 	swap in hero (hero:Night),remember party, wait (3), use door (14)
 	wait (1), set ambient music (song:Caliginous), wait (1)
 	save map state, resume player, resume box advance, encounters
end

script,alfheim4,begin
# This is the final fight with Mr Triangle
 	swap by position (0,find hero (hero:Styrge)), swap by position (1,find hero (hero:Olaf))
 	swap by position (2,find hero (hero:Night)), swap by position (3,find hero (hero:Eric))
 	suspend player, suspend box advance, suspend obstruction,remember party
 	walk hero (me,up,2), wait for hero (me), suspend caterpillar, set caterpillar mode (on)
 	set hero position (1, 14, 13), set hero position (2, 14, 13), set hero position (3, 14, 13), wait (2)
 	walk hero (me,left,1), walk hero (1,up,1), walk hero (2,down,1)
 	set hero direction (1,left), set hero direction (2,left), set hero direction (3,left)
 	wait for hero (me), walk NPC (14,right,11), wait for NPC (14)
 	show textbox (1017), wait (7), wait for key (usekey), advance textbox
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show textbox (1018), walk hero (1,left,1), wait (7), wait for key (usekey), advance textbox
 	show textbox (1019), wait (7), wait for key (usekey)
 	set NPC direction (14,down), wait (5), set NPC direction (14,left), wait (5)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (1020), wait (7), wait for key (usekey), advance textbox
 	set NPC direction (14,down), wait (5), set NPC direction (14,right), wait (5)
 	show textbox (1021), wait (7), wait for key (usekey), advance textbox
 	stop song, wait (2)
 	show text box (978), wait (7), wait for key (use key), advance text box
 	show text box (979), wait (7), wait for key (use key), advance text box
 	wait (5), BossIntroduction, fight formation (124)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1022), wait (7), wait for key (use key), advance text box
 	show text box (1023), wait (7), wait for key (use key), advance text box
 	show text box (1024), wait (7), wait for key (use key), advance text box
 	stop song, wait (2), walk hero (2,left,1)
 	show text box (978), wait (7), wait for key (use key), advance text box
 	show text box (979), wait (7), wait for key (use key), advance text box
 	wait (15), set NPC direction (14,left), wait (3), set NPC direction (14,right)
 	wait (3), set NPC direction (14,left), wait (3), set NPC direction (14,right)
 	wait (3), set NPC direction (14,left), wait (3)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (1025), wait (7), wait for key (use key), advance text box
 	set hero direction (1,down), set hero direction (2,up), set hero direction (me,down), wait (5)
 	set hero direction (me,right), set hero direction (1,right), set hero direction (2,right), wait (5)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1026), wait (7), wait for key (use key), advance text box
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (1027), set NPC direction (14,right), wait (7), wait for key (use key), advance text box
 	show text box (1028), wait (7), wait for key (use key), advance text box
 	wait (5), set hero direction (1,down), set hero direction (2,up), set hero direction (me,down)
 	wait (5), set hero direction (me,left), set hero direction (1,left), set hero direction (2,left)
 	wait (5), BossIntroduction, fight formation (125), set tag (tag:AlfheimFinish,on)
 	show text box (1030), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1031), wait (7), wait for key (use key), advance text box
 	show text box (1032), wait (7), wait for key (use key), advance text box
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (1033), wait (7), wait for key (use key), advance text box
 	show text box (1034), wait (7), wait for key (use key), advance text box
 	show text box (1035), wait (7), wait for key (use key), advance text box
 	walk hero (me,left,1), walk hero (1,left,2), walk hero (2,left,2)
 	walk hero (3,left,1), wait for hero (me), set hero direction (1,down)
 	set hero direction (2,up), wait (10), fade screen out, wait (5)
 	show text box (1036), wait (5), fade screen in, wait (7), wait for key (use key), advance text box
 	show text box (1037), wait (7), wait for key (use key), advance text box
 	show text box (1038), wait (7), wait for key (use key), fade screen out, wait (5), advance text box
 	show text box (1039), wait (5), fade screen in, wait (7), wait for key (use key), advance text box
 	show text box (1040), wait (7), wait for key (use key), advance text box
 	show text box (1041), wait (7), wait for key (use key), fade screen out, wait (5)
 	advance text box, wait (2), fade screen in, wait (5)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1042), wait (7), wait for key (use key), advance text box
 	show text box (1043), wait (7), wait for key (use key), advance text box
 	wait (5), stop song, wait (5), set NPC direction (14,down), wait (5)
 	show text box (1044), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1045), wait (7), wait for key (use key), advance text box
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show text box (1046), wait (7), wait for key (use key), advance text box
 	show text box (1047), wait (7), wait for key (use key), advance text box
 	fade screen out, wait (5), set hero position (0, 23, 26), set hero position (1, 22, 26)
 	set hero position (2, 24, 26), set hero position (3, 23, 25), set NPC position (14, 23, 28)
 	set NPC direction (14,down), wait (2), set hero direction (me,down)
 	set hero direction (1,down), set hero direction (2,down), set hero direction (3,down)
	alter NPC (14, NPCstat:picture,366) 

 	wait (2), fade screen in, wait (10), walk hero (me,down,1), wait for hero (me)
 	wait (10), set NPC position (19, 23, 28), wait (10)
 	walk NPC (14,down,3), walk NPC (19,down,3), wait for NPC (19), set tag (tag:TriangleDies, off), wait (3)
 	set tag (tag:TriangleDies, on), wait (3), set tag (tag:TriangleDies, off), wait (3)
 	set tag (tag:TriangleDies, on), wait (3), set tag (tag:TriangleDies, off), wait (3)
 	set tag (tag:TriangleDies, on), wait (10), set tag (tag:BurnOver, on), wait (3)
 	set hero direction (me,left), wait (3), set hero direction (me,up)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1048), wait (7), wait for key (use key), advance text box
 	show text box (1049), wait (7), wait for key (use key), advance text box
 	fade screen out, unlock hero (hero:Kitt), unlock hero (hero:Hilda), unlock hero (hero:Olaf)
 	unlock hero (hero:Styrge), unlock hero (hero:Eric), unlock hero (hero:Bram)
 	unlock hero (hero:Frumpy), unlock hero (hero:Night), wait (5)
 	resume caterpillar, set caterpillar mode (off), set tag (tag:HeroesRegained,on), use door (0)
 	fade screen in, resume obstruction
 	show text box (1050), wait (7), wait for key (use key), advance text box
 	resume box advance, resume player, encounters
end

script,jotunheim1,begin
# This one's the showdown with Housemaster on top of Mt. Jotun.
	remember party, suspend player, suspend box advance, suspend random enemies
 	walk hero (me,down,2), wait for hero (me), set caterpillar mode (on)
 	set hero position (1, 37, 26), set hero position (2, 37, 26), set hero position (3, 37, 26)
 	wait (1), suspend caterpillar, walk hero (me,up,1)
 	walk hero (1,left,1), walk hero (2, right,1), wait for hero (me)
# Now, beacuse they've moved, we set the heroes on the side to all face the same direction.
 	set hero direction (1,up), set hero direction (2,up), set hero direction (3,up)
 	show text box (1053), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1054), wait (7), wait for key (use key), advance text box
 	show text box (1055), wait (7), wait for key (use key), advance text box
 	wait (1), walk hero (1,up,1), wait for hero (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1056), wait (7), wait for key (use key), advance text box
 	show text box (1057), wait (7), wait for key (use key), advance text box
 	wait (1), walk hero (2,up,1), wait for hero (2)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (1058), wait (7), wait for key (use key), advance text box
 	show text box (1059), wait (7), wait for key (use key), advance text box
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show text box (1060), wait (7), wait for key (use key), advance text box
 	show text box (1061), wait (7), wait for key (use key), advance text box
 	wait (5), stop song, wait (5)
 	show textbox (828), wait (7), wait for key (usekey), advance text box
 	show textbox (829), wait (7), wait for key (usekey), advance text box
 	tweak palette (-20,-20,-20), fade screen in, wait (4)
 	show textbox (830), wait (7), wait for key (usekey), advance text box
# Housemaster throws Good Kitty at the party now.
 	wait (5), BossIntroduction, fight formation (126), stop song
 	show textbox (1064), wait (7), wait for key (usekey), advance textbox
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (1065), wait (7), wait for key (usekey), advance textbox
 	wait (10), play song (song:GodsOfSpite), wait (5)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (1066), wait (7), wait for key (usekey), advance textbox
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (1067), wait (7), wait for key (usekey), advance textbox
	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (1068), wait (7), wait for key (usekey), advance textbox
 	show textbox (1069), wait (7), wait for key (usekey), advance textbox
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (1070), wait (7), wait for key (usekey), advance textbox
 	show textbox (1071), wait (7), wait for key (usekey), advance textbox
 	set NPC direction (7,left), wait (5), set NPC direction (7,up), wait (5)
 	set NPC direction (7,right), wait (5), set NPC direction (7,down), wait (5)
 	set NPC direction (7,left), wait (4), set NPC direction (7,up), wait (4)
 	set NPC direction (7,right), wait (4), set NPC direction (7,down), wait (4)
 	set NPC direction (7,left), wait (3), set NPC direction (7,up), wait (3)
 	set NPC direction (7,right), wait (3), set NPC direction (7,down), wait (3)
 	set NPC direction (7,left), wait (2), set NPC direction (7,up), wait (2)
 	set NPC direction (7,right), wait (2), set NPC direction (7,down), wait (2)
 	set NPC direction (7,left), wait (1), set NPC direction (7,up), wait (1)
 	set NPC direction (7,right), wait (1), set NPC direction (7,down), wait (1)
 	set tag (tag:Jotun1,on), walk hero (me,down), walk hero (1,right), walk hero (2,left)
 	resume player, resume box advance, resume random enemys, set caterpillar mode (off), resume caterpillar, encounters
end



script,jotunheim2,begin
# Pretty sure this is the standoff with Cthulhu at the front of his keep
	remember party, suspend player, suspend box advance, suspend random enemies
 	set tag (tag:CTHULHU1, off), walk hero (me,down,2), wait for hero (me)
 	set caterpillar mode (on), set hero position (1, 6, 9), set hero position (2, 6, 9)
 	set hero position (3, 6, 9), wait (1), suspend caterpillar
 	walk hero (me,up,1), walk hero (1,left,1), walk hero (2, right,1), wait for hero (me)
# Now, beacuse they've moved, we set the heroes on the side to all face the same direction.
 	set hero direction (1,up), set hero direction (2,up), set hero direction (3,up)
 	wait (5), focus camera (6,6,4), wait for camera, wait (5)
 	walk NPC (5,right,1), walk NPC (6,left,1), walk NPC (3,down,1)
 	wait for NPC (3), walk NPC (6,down,2), walk NPC (5,down,2), walk NPC (3,down,2),walk NPC (4,down,3)
 	wait for NPC (3), wait (5), walk NPC (4,left,1), set NPC direction (4,down), wait for NPC (4)
 	show textbox (1072), wait (7), wait for key (usekey), advance textbox 
 	set hero frame (0, 0), wait (1), set hero frame (0, 1), wait (1)
 	set hero frame (0, 0), wait (1), set hero frame (0, 1), wait (1)
 	show textbox (1073), wait (7), wait for key (usekey), advance textbox
 	show textbox (1074), wait (7), wait for key (usekey), advance textbox
 	set hero frame (0, 0), wait (1), set hero frame (0, 1), wait (1)
 	set hero frame (0, 0), wait (1), set hero frame (0, 1), wait (1)
 	show textbox (1075), wait (7), wait for key (usekey), advance textbox
 	show textbox (1076), wait (7), wait for key (usekey), advance textbox
 	set hero frame (0, 0), wait (1), set hero frame (0, 1), wait (1)
 	set hero frame (0, 0), wait (1), set hero frame (0, 1), wait (1)
 	show textbox (1077), wait (7), wait for key (usekey), advance textbox
 	show textbox (1078), wait (7), wait for key (usekey), advance textbox
 	show textbox (1079), wait (7), wait for key (usekey), advance textbox
 	wait (2), tweak palette (20,-20,20), fade screen in, wait (4), set tag (tag:CTHULHU1, on)
 	set NPC position (9,6,4), play sound (sfx:MediumExplosion8Bit,false,true)
	set NPC direction (9,up), set NPC frame (9,0), wait (2)
	set NPC direction (9,up), set NPC frame (9,1), wait (2)
	set NPC direction (9,right), set NPC frame (9,0), wait (2)
	set NPC direction (9,right), set NPC frame (9,1), wait (2)
	set NPC direction (9,down), set NPC frame (9,0), wait (2)
	set NPC direction (9,down), set NPC frame (9,1), wait (2)
	set NPC direction (9,left), set NPC frame (9,0), wait (2)
	set NPC direction (9,left), set NPC frame (9,1), wait (2)
	set NPC position (9,0,0), wait (3), reset palette, fade screen in
 	show textbox (1080), wait (7), wait for key (usekey), advance textbox
 	show textbox (1081), wait (7), wait for key (usekey), advance textbox
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (1082), wait (7), wait for key (usekey), advance textbox
 	show textbox (1083), wait (7), wait for key (usekey), advance textbox
 	show textbox (1084), wait (7), wait for key (usekey), advance textbox
 	show textbox (1085), wait (7), wait for key (usekey), advance textbox
 	wait (5), stop song, wait (5), set NPC direction (6,right)
 	set NPC direction (5,left), walk NPC (4,right,1), set NPC direction (4,up)
 	show textbox (1086), wait (7), wait for key (usekey), advance textbox
 	wait for NPC (4), walk NPC (5,up,2), walk NPC (6,up,2), wait for NPC (6)
 	walk NPC (5,left,1), walk NPC (6,right,1), wait for NPC (6), wait (5)
 	walk NPC (4,up,2), wait for NPC (4), wait (5), fade screen out
 	wait (5), resume random enemys, resume caterpillar, set caterpillar mode (off), wait (5)
 	show text box (1087), wait (5), fade screen in, wait (20), fade screen out
 	wait (2), camera follows hero (me), advance textbox, wait (1)
 	fade screen in, play song (song:The Winding Road), resume box advance, resume player, encounters
end

script,stairsup,begin
 	set tag (tag:stairs,on), suspend player, suspend box advance, walk hero (me,up,5)
	play sound (sfx:UpStairs,false,true)
 	walk hero (me,left,5), wait for hero (me), walk hero (me,left,2), wait for hero (me)
 	set tag (tag:stairs,off), resume player, resume box advance
end

script,stairsdown,begin
 	set tag (tag:stairs,on), suspend player, suspend box advance, walk hero (me,right,1)
 	wait for hero (me), walk hero (me,down,5),play sound (sfx:DownStairs,false,true)
 	walk hero (me,right,5), wait for hero (me), walk hero (me,right,1), wait for hero (me)
 	set tag (tag:stairs,off), resume player, resume box advance
end

script,Gahn,begin
 	suspend player, suspend box advance, focus camera (5,45,4)
 	walk hero (me,down,1), set hero direction (me,up)
 	wait for hero (me), walk hero (me,left,1), set hero direction (me,up), wait for hero (me)
 	set NPC direction (26,left), wait (5), set NPC direction (26,up), wait (5)
 	show textbox (1088), wait (7), wait for key (usekey), advance textbox
 	show textbox (1089), wait (7), wait for key (usekey), advance textbox
 	walk NPC (26,left,2), wait for NPC (26), walk NPC (26,up,2), wait for NPC (26)
 	focus camera (5,50,4), wait for camera, camera follows hero (me)
 	set hero direction (me,right), wait (2), set hero direction (me,down), wait (2)
 	set tag (tag:gahn,on), resume player, resume box advance, encounters
end

script,JO,begin
	remember party, suspend player, suspend box advance
 	walk hero to Y (me,52), wait for hero (me), walk hero to X (me,30), wait for hero (me)
 	set hero direction (me,up), focus camera (30,46,4), wait for camera
 	show textbox (1090), wait (7), wait for key (usekey), advance textbox
 	show textbox (1091), wait (7), wait for key (usekey), advance textbox
 	show textbox (1092), wait (7), wait for key (usekey), advance textbox
 	show textbox (1093), wait (7), wait for key (usekey), advance textbox
 	show textbox (1094), wait (7), wait for key (usekey), advance textbox
 	focus camera (30,52,4), wait for camera, set tag (tag:jo,on)
 	resume box advance, resume player, camera follows hero (me), encounters
end

script,orlock,begin
	remember party, suspend player, suspend box advance
 	walk hero to x (me,83), wait for hero (me), walk hero to y (me,4), wait for hero (me)
 	set hero direction (me,up), suspend NPCs, suspend NPC walls
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (1095), wait (7), wait for key (usekey), advance textbox 
 	walk NPC (32,down,3), wait for NPC (32), wait (4), BossIntroduction
 	fight formation (127), set tag (tag:orlock,on), resume NPC walls
 	resume box advance, wait (1), tweak palette (10,0,0), update palette
 	play sound (sfx:Wind,false,true), wait (10), reset palette, fade screen in
 	teach spell ((find hero(hero:Night)),atk:Drainer)
 	show textbox (1249), wait (7), wait for key (usekey), advance textbox 
 	resume NPCs, resume player, resume box advance, encounters
end

script,finalbrising,begin
 	suspend player, suspend box advance, suspend NPCs, suspend obstruction, remember party
 	show text box (2731), wait (7), wait for key (use key), advance text box
 	walk hero to y (me,71), wait for hero (me), walk hero to x (me,8), wait for hero (me)
 	wait (2), suspend caterpillar, set caterpillar mode (on)
 	set hero position (1, 8, 71), set hero position (2, 8, 71), set hero position (3, 8, 71)
 	wait (2), walk hero (me,down,1), walk hero (1,left,1), walk hero (2,right,1), walk hero (3,up,1)
 	wait for hero (me), set hero direction (me,left), set hero direction (1,down), set hero direction (2,down), set hero direction (3,left)
 	wait (4), set hero direction (me,up), set hero direction (1,right), set hero direction (2,left), set hero direction (3,down)
 	wait (4), set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1096), wait (7), wait for key (usekey), advance textbox
 	show text box (1097), wait (7), wait for key (usekey), advance textbox, walk NPC to y (30,74)
 	set hero direction (me,left), set hero direction (1,down), set hero direction (2,down), wait (4)
 	set hero direction (me,down), wait (4), set tag (tag:gahn,off), set tag (tag:jo,off)
 	wait for NPC (30), wait (2), set NPC position (26, 8, 74), set NPC position (27, 8, 74), wait (1)
 	walk NPC (26,left,1), walk NPC (27,right,1), wait (5), set NPC direction (26,up), set NPC direction (27,up)
 	wait (5), walk hero (2,down,1), wait for hero (2)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (1098), wait (7), wait for key (usekey), advance textbox
 	show text box (1099), wait (7), wait for key (usekey), advance textbox
 	walk hero (1,down,1), wait for hero (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1100), wait (7), wait for key (usekey), advance textbox
 	show text box (1101), wait (7), wait for key (usekey), advance textbox
 	show text box (1102), wait (7), wait for key (usekey), advance textbox
 	show text box (1103), wait (7), wait for key (usekey), advance textbox
 	walk hero (3,down,1), wait for hero (3)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show text box (1104), wait (7), wait for key (usekey), advance textbox
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1105), wait (7), wait for key (usekey), advance textbox
 	walk NPC (30,up,1), wait for NPC (30)
 	show text box (1106), wait (7), wait for key (usekey), advance textbox
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1107), wait (7), wait for key (usekey), advance textbox
 	walk NPC (26,up,1), wait for NPC (26)
 	show text box (1108), wait (7), wait for key (usekey), advance textbox
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1109), wait (7), wait for key (usekey), advance textbox
 	walk NPC (27,up,1), wait for NPC (27)
 	show text box (1110), wait (7), wait for key (usekey), advance textbox
 	wait (4), fade screen out, wait (2)
 	show text box (1111), wait (2), greyscale palette, wait (2), fade screen in
 	wait (7), wait for key (usekey), advance textbox
 	show text box (1112), wait (7), wait for key (usekey), advance textbox
 	walk NPC (30,down), walk NPC (26,down), walk NPC (27,down)
 	show text box (1113), wait (7), set NPC direction (30,up), set NPC direction (26,up)
 	set NPC direction (27,up), wait for key (usekey), advance textbox
 	show text box (1114), wait (7), wait for key (usekey), fade screen out
 	wait (2), advance textbox, wait (2), reset palette
 	wait (2), fade screen in, wait (2)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1115), wait (7), wait for key (usekey), advance textbox
 	show text box (1116), wait (7), wait for key (usekey), advance textbox
 	walk NPC (33,up,1), wait for NPC (33), walk NPC (33,right,3), wait for NPC (33)
 	set NPC direction (33,up), play sound (sfx:Soft_Airy_Swish,false,true)
# Yoink!
 	wait (3), walk NPC (33,left,2), wait for NPC (33)
 	set hero direction (me,left), set hero direction (2,left), set NPC direction (26,left)
 	set NPC direction (27,left), set NPC direction (30,left), walk NPC (33,down,2)
 	wait for NPC (33), set hero direction (me,down), set hero direction (2,down)
 	set NPC direction (26,down), set NPC direction (27,down), set NPC direction (30,down), walk NPC (33,down,10)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1117), walk hero (me,down,1), wait (7), wait for key (usekey), advance textbox
 	show text box (1118), wait (7), wait for key (usekey), advance textbox
 	show text box (1119), wait (7), wait for key (usekey), advance textbox
 	walk hero (me,down,5), walk hero (1,down,5), walk hero (2,down,5), walk hero (3,down,5)
 	walk NPC (26,down,5), walk NPC (27,down,5), walk NPC (30,down,5), wait (10)
 	fade screen out, wait for hero (me), camera follows hero (me)
 	use door (55), resume NPCs, resume obstruction, set tag (tag:gahn,on), set tag (tag:jo,on)
 	wait (20), wait for key (anykey), wait (2), fade screen out, wait (1)
# Making Preparations for the midgame now.
 	swap by position (0,find hero (hero:Freki)), wait (1), set hero picture (0,17,insidebattle) 
 	wait (1), swap out hero (hero:Kitt), swap out hero (hero:Styrge), swap out hero (hero:Bram)
 	swap out hero (hero:Eric), swap out hero (hero:Hilda), swap out hero (hero:Olaf)
 	swap out hero (hero:Night), swap out hero (hero:Frumpy), wait (1)
 	lock hero (hero:Kitt), lock hero (hero:Styrge), lock hero (hero:Bram), lock hero (hero:Eric)
 	lock hero (hero:Hilda), lock hero (hero:Olaf), lock hero (hero:Night), lock hero (hero:Frumpy)
	set hero picture (find hero (hero:Freki),288,outsidebattle),set hero picture (find hero (hero:Kitt),18,insidebattle)
	set hero picture (find hero (hero:Kitt),289,outsidebattle),set hero picture (find hero (hero:Styrge),20,insidebattle)
	set hero picture (find hero (hero:Styrge),290,outsidebattle),set hero picture (find hero (hero:Eric),26,insidebattle)
	set hero picture (find hero (hero:Eric),291,outsidebattle),set hero picture (find hero (hero:Bram),24,insidebattle)
	set hero picture (find hero (hero:Bram),292,outsidebattle),set hero picture (find hero (hero:Hilda),19,insidebattle)
	set hero picture (find hero (hero:Hilda),293,outsidebattle),set hero picture (find hero (hero:Olaf),25,insidebattle)
	set hero picture (find hero (hero:Olaf),294,outsidebattle),set hero picture (find hero (hero:Frumpy),22,insidebattle)
	set hero picture (find hero (hero:Frumpy),295,outsidebattle)
 	walk hero (me,up,1), wait for hero (me), use door (1), wait (5), focus camera (6,20,4)
 	wait for camera , wait (2), walk hero (me,up,1), set hero direction (me,down)
 	show text box (1120), wait (7), wait for key (usekey), advance textbox
 	focus camera (6,9,4), walk NPC to y (1,9), wait for camera
 	tweak palette (-30,5,5), update palette, wait (1), reset palette, update palette, wait (1)
 	show text box (1121), wait (7), wait for key (usekey), advance textbox, set NPC direction (1,left), wait (2)
 	set NPC direction (1,right), wait (2), set NPC direction (1,left), wait (2)
 	set NPC direction (1,right), wait (2), set NPC direction (1,up), wait (2)
 	show text box (1122), wait (7), wait for key (usekey), advance textbox
 	tweak palette (-30,5,5), update palette, wait (1), reset palette, update palette, wait (1)
 	show text box (1123), wait (7), wait for key (usekey), advance textbox
 	tweak palette (-30,5,5), update palette, wait (1), reset palette, update palette
 	wait (1), pancamera(up,1,20),waitforcamera, pancamera(down,2,20),waitforcamera
 	pancamera(up,2,20),waitforcamera, pancamera(down,1,20),waitforcamera 
 	show text box (1124), wait (7), wait for key (usekey), advance textbox
 	show text box (1125), wait (7), wait for key (usekey), advance textbox
 	tweak palette (-30,5,5), update palette, wait (1), reset palette, update palette, wait (1)
 	show text box (1126), wait (7), wait for key (use key), advance text box
 	show text box (1127), wait (7), wait for key (use key), advance text box
 	show text box (1128), wait (7), wait for key (use key), advance text box
 	tweak palette (-30,5,5), update palette, wait (1)
 	reset palette, update palette, wait (1)
 	pancamera(up,1,20),waitforcamera, pancamera(down,2,20),waitforcamera
 	pancamera(up,2,20),waitforcamera, pancamera(down,1,20),waitforcamera 
 	show text box (1129), wait (7), wait for key (use key), advance text box
 	show text box (1130), wait (7), wait for key (use key), advance text box
 	tweak palette (-30,5,5), update palette, wait (1)
 	reset palette, update palette, wait (1), tweak palette (-30,5,5)
 	update palette, wait (1), reset palette, update palette
 	wait (1), tweak palette (-30,5,5), update palette
 	wait (1), reset palette, update palette, wait (1)
 	show text box (1131), wait (7), wait for key (use key), advance text box
 	stop song, play sound (sfx:Nuclear,false,true), show text box (1132)
 	wait (7), pancamera(up,1,20),waitforcamera, pancamera(down,2,20),waitforcamera
 	pancamera(up,2,20),waitforcamera, pancamera(down,1,20),waitforcamera 
 	pancamera(up,1,20),waitforcamera, pancamera(down,2,20),waitforcamera
 	pancamera(up,2,20),waitforcamera, pancamera(down,1,20),waitforcamera 
 	pancamera(up,1,20),waitforcamera, pancamera(down,2,20),waitforcamera
 	pancamera(up,2,20),waitforcamera, pancamera(down,1,20),waitforcamera 
 	fade screen out (63,63,63), wait (45), advance text box
# On this day, the world was changed forever. Hati and the rest of the Helborne
# Escape from their prison to ravage the world.
 	set tag (tag:WORLDOFRUIN,on), set damage cap (9999), wait (1), fade screen in
 	play song (song:Nameless Sorcerer), wait (5), walk NPC (3,down,1), wait for NPC (3)
 	show text box (1133), wait (7), unlock hero (hero:Freki), wait for key (use key), advance text box
 	walk NPC to y (6,10), wait for NPC (6), walk NPC (6,right,1), wait for NPC (6), set NPC direction (6,up)
 	show text box (1134), wait (7), wait for key (use key), advance text box
 	show text box (3364), wait (7), wait for key (use key), advance text box
 	show text box (3365), wait (7), wait for key (use key), advance text box
 	show text box (3366), wait (7), wait for key (use key), advance text box
 	show text box (3367), wait (7), wait for key (use key), advance text box
 	show text box (3368), wait (7), wait for key (use key), advance text box
	wait (5),  set NPC direction (3,left), wait (5)
 	show text box (3369), wait (7), wait for key (use key), advance text box
 	show text box (3370), wait (7), wait for key (use key), advance text box
 	show text box (3371), wait (7), wait for key (use key), advance text box
 	show text box (3372), wait (7), wait for key (use key), advance text box
	wait (5),  set NPC direction (3,down), wait (5)
 	show text box (3373), wait (7), wait for key (use key), advance text box
 	show text box (3378), wait (7), wait for key (use key), advance text box
 	show text box (3379), wait (7), wait for key (use key), advance text box
 	show text box (3380), wait (7), wait for key (use key), advance text box
 	show text box (3374), wait (7), wait for key (use key), advance text box
 	show text box (3375), wait (7), wait for key (use key), advance text box
 	show text box (3376), wait (7), wait for key (use key), advance text box
 	show text box (3377), wait (7), wait for key (use key), advance text box
 	suspend obstruction, walk NPC (3, up, 2), set NPC direction (3,down), wait for NPC (3)
 	Alter NPC (3,NPCstat:move speed, 20), walk NPC (3, down, 4), pancamera(down,2,4),waitforcamera
 	wait for NPC (3), play sound (sfx:Crush8Bit,false,true)
 	pancamera(up,1,20),waitforcamera, pancamera(down,2,20),waitforcamera
 	pancamera(up,2,20),waitforcamera, pancamera(down,1,20),waitforcamera 
 	pancamera(up,1,20),waitforcamera, pancamera(down,2,20),waitforcamera
 	pancamera(up,2,20),waitforcamera, pancamera(down,1,20),waitforcamera 
 	pancamera(up,1,20),waitforcamera, pancamera(down,2,20),waitforcamera
 	pancamera(up,2,20),waitforcamera, pancamera(down,1,20),waitforcamera 
 	wait (2), Alter NPC (3,NPCstat:move speed, 4), Alter NPC (6,NPCstat:picture,122)
 	walk NPC (3,up,1), set NPC direction (3,down), wait for NPC (3), wait (2)
 	walk NPC (3,down,1), wait for NPC (3), walk NPC (3,down,2)
 	walk NPC (6,down,2), wait for NPC (3), walk NPC (6,right,2)
 	set NPC direction (3,right), wait for NPC (6), set NPC direction (3,down), resume obstruction
 	show text box (3381), wait (7), wait for key (use key), advance text box
 	walk NPC (2,down,3), walk NPC (4,down,3), focus camera (6,12,4)
 	walk NPC (5,up,8), walk NPC (7,up,8), walk NPC (8,up,8), wait for NPC (5)
 	show text box (1135), wait (7), wait for key (use key), advance text box
 	show text box (1136), wait (7), wait for key (use key), advance text box
 	show text box (1137), wait (7), wait for key (use key), advance text box, walk NPC (4,down,1)
 	show text box (1138), wait (7), wait for key (use key), walk NPC (2,down,1), advance text box
 	show text box (1139), wait (7), wait for key (use key), advance text box
 	set NPC direction (5,left), wait (3)
 	show text box (1140), wait (7), wait for key (use key), advance text box
 	walk NPC (8,up,1), wait for NPC (8)
 	show text box (1141), wait (7), wait for key (use key), advance text box
 	show text box (1142), wait (7), wait for key (use key), advance text box, set NPC direction (5,up)
 	show text box (1143), wait (7), wait for key (use key), advance text box
 	wait (2), play sound (sfx:Soft_Airy_Swish,false,true), set NPC position (5,6,7)
 	focus camera (6,9,4), wait for camera, set NPC direction (2,up), set NPC direction (3,up)
 	set NPC direction (4,up), wait (5), walk NPC (7,up,1)
 	show text box (1161), wait (7), wait for key (use key), advance text box
 	show text box (1162), wait (7), wait for key (use key), advance text box
 	set NPC direction (5,right), wait (4), set NPC direction (5,down), wait (4)
 	show text box (1144), wait (7), wait for key (use key), advance text box
 	show text box (1145), wait (7), wait for key (use key), advance text box
 	wait (5), fade screen out (63,63,63), wait (1), set tag (tag:GATE1,on)
 	wait (1), fade screen in, wait (5) , focus camera (6,12,4), wait for camera
 	set NPC direction (2,down), set NPC direction (3,down), set NPC direction (4,down), wait (5)
 	show text box (1146), wait (7), wait for key (use key), advance text box, set NPC direction (4,left)
 	show text box (1147), wait (7), wait for key (use key), advance text box, set NPC direction (2,right)
 	show text box (1148), wait (7), wait for key (use key), advance text box, wait (3)
 	set NPC direction (4,down), wait (3), set NPC direction (4,right), wait (3)
 	show text box (1149), wait (7), wait for key (use key), advance text box
 	wait (3), set NPC direction (3,right), wait (3)
 	show text box (1150), wait (7), wait for key (use key), advance text box
 	wait (5), fade screen out, wait (2)
 	show text box (1151), wait (2), fade screen in, wait (10)
 	wait for key (use key), fade screen out, wait (2), advance text box
# Freki now finds herself naked in bed - with bandages.
 	set hero z (0, 15), walk hero (me,up,1), wait for hero (me), camera follows hero (me), wait (1)
# Freki's back finally, and should still be equipped with whatever she had in the "final battle".
# While substandard at this point, it should be enough to get by with for a while.
	set hero picture (find hero (hero:Freki),302,outsidebattle), set hero direction (me,down)
 	wait (1), use door (4), set hero z (0, 15), stop song, wait (30)
	show text box (3409), wait (7), wait for key (use key), advance text box,	wait (15)
	show text box (3410), wait (7), wait for key (use key), advance text box
	set hero speed (me,1) ,walk hero (me,right,1), wait (2), set hero z (0, 12), wait (2), set hero z (0,9), wait (2)
 	set hero z (0, 6), wait (2), set hero z (0,3), wait (2), set hero z (0, 0), wait (2) , wait for hero (me)
	show text box (3411), wait (7), wait for key (use key), advance text box
	wait (5), set hero direction (me,down), wait (5)
	wait (5), set hero direction (me,left), wait (5)
	wait (5), set hero direction (me,down), wait (5)
	wait (5), set hero direction (me,right), wait (5)
	wait (5), set hero direction (me,down), wait (5)
	show text box (3412), wait (7), wait for key (use key), advance text box
	walk NPC (1,up,3)wait for NPC (1)
	show text box (1152), wait (7), wait for key (use key), advance text box,	wait (10)
	show text box (3856), wait (7), wait for key (use key), advance text box ,	wait (10)
	wait (2), set NPC direction (1,down),	wait (2), set NPC direction (1,left)
	wait (2), set NPC direction (1,up),	wait (2), set NPC direction (1,right)
	wait (2), set NPC direction (1,down),	wait (2), set NPC direction (1,left)
	wait (2), set NPC direction (1,up),	wait (2), set NPC direction (1,right)
	wait (2), set NPC direction (1,down),	wait (2), set NPC direction (1,left)
	wait (2), set NPC direction (1,up),	wait (2), set NPC direction (1,right)
	wait (2), set NPC direction (1,down)
	show text box (3413), wait (7), wait for key (use key), advance text box ,	wait (30)
	show text box (1153), wait (7), wait for key (use key), advance text box
	wait (30), set hero speed (me,1),walk hero (me,down,2), wait for hero (me)
	show text box (1154), wait (7), wait for key (use key), advance text box
	show text box (1155), wait (7), wait for key (use key), advance text box
	set hero speed (me,1),	walk hero (me,right,1), wait for hero (me), walk NPC (1,up,1), wait for NPC (1)
	show text box (1156), wait (7), wait for key (use key), advance text box
	set hero speed (me,1),	walk hero (me,right,1), wait for hero (me), walk NPC (1,right,1), wait for NPC (1)
	set hero speed (me,1),	walk hero (me,right,1), wait for hero (me), walk NPC (1,right,1), wait for NPC (1)
	pan camera (right,1,1), set hero speed (me,1), walk hero (me,right,1), wait for hero (me) , wait for camera
	show text box (4398), wait (7), wait for key (use key), advance text box
	show text box (4399), wait (7), wait for key (use key), advance text box
	wait (5), set NPC direction (1,down)
	wait (5), set NPC direction (1,left), wait (5)
	show text box (4400), wait (7), wait for key (use key), advance text box
	pan camera (left,3,2), walk NPC (1,left,1), wait for NPC (1)
	show text box (4401), wait (7), wait for key (use key), advance text box
	show text box (4402), wait (7), wait for key (use key), advance text box, wait for camera

	show text box (1157), wait (7), wait for key (use key), advance text box
	set hero speed (me,1),	walk hero (me,up,1), wait for hero (me)
	show text box (1158), wait (7), wait for key (use key), advance text box
	set hero speed (me,1),	walk hero (me,right,2)
	show text box (1159), wait (7), wait for key (use key), advance text box ,wait for hero (me)
	show text box (1160), wait (7), wait for key (use key), advance text box 
	set hero speed (me,1),	walk hero (me,up,1), wait for hero (me),resume NPCs
	show text box (3414), wait (7), wait for key (use key), advance text box 
	wait (10), set NPC position (12,10,20), wait (10)
	show text box (3415), wait (7), wait for key (use key), advance text box 
	wait (10), set hero direction (me,left)
	show text box (3416), wait (7), wait for key (use key), advance text box ,	wait (10)
	show text box (3417), wait (7), wait for key (use key), advance text box 
	wait (10), set NPC direction (1,down), wait (10)
	show text box (3418), wait (7), wait for key (use key), advance text box 
# Now we get some actual clothes.
	fade screen out, set hero picture (find hero (hero:Freki),288,outsidebattle), camera follows hero (me)
 	resume obstruction,set NPC direction (1,up), set hero direction (me,up)
	wait (10), set hero position (me,27,5), set NPC position (1,28,5), wait (5), fade screen in
	show text box (3419), wait (7), wait for key (use key), advance text box 
	show text box (3420), wait (7), wait for key (use key), advance text box 
	show text box (3421), wait (7), wait for key (use key), advance text box 
	show text box (3422), wait (7), wait for key (use key), advance text box 
	set NPC direction (1,left)
	show text box (3423), wait (7), wait for key (use key), advance text box 
	set NPC direction (8,left)
	show text box (3424), wait (7), wait for key (use key), advance text box 
	show text box (3425), wait (7), wait for key (use key), advance text box 	
	show text box (3426), wait (7), wait for key (use key), advance text box 
	set NPC direction (8,down), set NPC direction (1,up)
	show text box (3427), wait (7), wait for key (use key), advance text box 
	show text box (3428), wait (7), wait for key (use key), advance text box 
	show text box (3429), wait (7), wait for key (use key), advance text box 
	set NPC direction (8,left)
	show text box (3430), wait (7), wait for key (use key), advance text box 
	set NPC direction (8,down)
	show text box (3431), wait (7), wait for key (use key), advance text box 
	walk NPC (8,left,2), wait for NPC (8), walk NPC (8,down,2)
	set NPC direction (1,left), set hero direction (me,left), wait for NPC (8)
	set NPC direction (8,right)
	show text box (3432), wait (7), wait for key (use key), advance text box 
	show text box (3433), wait (7), wait for key (use key), advance text box 
	show text box (3434), wait (7), wait for key (use key), advance text box 
	show text box (3435), wait (7), wait for key (use key), advance text box 
	resume player
	show text box (3436), wait (7), wait for key (use key), advance text box 
	suspend player
	show text box (3437), wait (7), wait for key (use key), advance text box
	show text box (3438), wait (7), wait for key (use key), advance text box 
	walk NPC (8,up,2), wait for NPC (8), walk NPC (8,right,2)
	set NPC direction (1,up), set hero direction (me,up), wait for NPC (8)
	set NPC direction (8,down) 
	show text box (3439), wait (7), wait for key (use key), advance text box 
	show text box (3440), wait (7), wait for key (use key), advance text box 
	show text box (3441), wait (7), wait for key (use key), advance text box 
	wait (5), add hero (hero:Renard), wait (5)
	show text box (3442), wait (7), wait for key (use key), advance text box 
	fade screen out (63,63,63), wait (7),  set tag (tag:AddFox,on), wait (3)
 	wait (1), resume caterpillar, set caterpillar mode (off)
 	resume box advance,fade screen in, resume player
# Renard finally joins up, and his equipment selection is a bit odd. He's the only
# One of the mages who can equip helmets instead of hats, so he's slightly tankier
# And he can also use runic broadswords. He comes with some gear that resists
# A few elemental attacks, and a relic that resists both stun and slow effects.
 	force equip ((find hero (hero:Renard)),2,237)
 	force equip ((find hero (hero:Renard)),3,77)
 	force equip ((find hero (hero:Renard)),4,157)
 	force equip ((find hero (hero:Renard)),5,100)
	remember party, encounters
end

script,BramReturns,begin
 	suspend player, suspend box advance, swap by position (0,find hero (hero:Freki)), swap by position (1,find hero (hero:Renard))
 	set caterpillar mode (on), suspend caterpillar, walk hero (me,left,1), walk hero (1,down,1)
 	wait for hero (me), set hero direction (me,down), wait (5)
 	set hero direction (1,left), set hero direction (me,right), wait (5)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1169), wait (7), wait for key (use key), advance text box
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1165), wait (7), wait for key (use key), advance text box
 	show text box (1166), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1167), wait (7), wait for key (use key), advance text box
 	wait (5), set hero direction (1,down), wait (3), set hero direction (1,right)
 	wait (10), walk hero (1,down,1), wait for hero (1)
 	set hero direction (1,right), wait (10)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1168), wait (7), wait for key (use key), advance text box
 	walk hero to y (me,5), walk hero to x (1,12), wait for hero (me)
 	walk hero to x (me,12), wait for hero (me), wait (5)
# Party enters the otehr room to find Bram there
 	wait (5), walk hero (1,up,1), wait for hero (1), set hero direction (1,right)
 	pan camera (right,1,2), wait for camera, wait (5)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1170), wait (7), wait for key (use key), advance text box, set NPC direction (2,left)
 	show text box (1171), wait (7), wait for key (use key), advance text box
 	walk hero (me,right,1), wait for hero (me), set hero frame (me,1), wait (1)
 	set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1172), wait (7), wait for key (use key), advance text box
 	set NPC direction (2,down), wait (5), set NPC direction (2,right), wait (5)
 	walk NPC (2,right,1), wait for NPC (2), wait (5)
 	show text box (1173), wait (7), wait for key (use key), advance text box
 	wait (5), set NPC direction (2,down), wait (5), set NPC direction (2,left), wait (5)
 	show text box (1174), wait (7), wait for key (use key), advance text box
 	show text box (1175), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1176), wait (7), wait for key (use key), advance text box
	suspend obstruction, walk NPC (2,left,2), walk hero (1,down,1)
 	wait for hero (1), walk hero (1,right,1), wait for NPC (2)
	resume obstruction, wait (3), set tag (tag:Bramreturns,on), set caterpillar mode (off)
 	resume caterpillar, camera follows hero (me), resume box advance, resume player
 	unlock hero (hero:Bram), swap by position (2,find hero (hero:Bram)), remember party, encounters
end

script,Frumpyback,begin
 	suspend player, suspend box advance, swap by position (0,find hero (hero:Freki))
 	swap by position (1,find hero (hero:Renard)), swap by position (2,find hero (hero:Bram)),remember party
 	walk hero to Y (me,28), wait for hero (me), walk hero to X (me,42), wait for hero (me)
 	set hero position (1, 42, 28), set hero position (2, 42, 28), set hero position (3, 40, 29)
 	set caterpillar mode (on), suspend caterpillar, focus camera (39,28,4)
 	walk hero (1,down,1), walk hero (2,down,2), wait for hero (1), set hero direction (1,left), wait (5)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (1181), wait (7), wait for key (use key), advance text box
 	show text box (1182), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1183), wait (7), wait for key (use key), advance text box
 	walk hero (me,left,1), walk hero (1,left,1), walk hero (2,left,1)
 	show text box (1184), wait (7), wait for key (use key), advance text box
 	show text box (1185), wait (7), wait for key (use key), advance text box
 	show text box (1186), wait (7), wait for key (use key), advance text box
 	show text box (1187), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1188), wait (7), wait for key (use key), advance text box
 	show text box (1189), wait (7), wait for key (use key), advance text box
 	swap by position (3,find hero (hero:Frumpy)), unlock hero (hero:Frumpy)
 	set tag (tag:Frumpyreturns,on), wait (3),remember party
# Now we fight Odin, Thor, and Loki...  but...
 	BossIntroduction , fight formation (128)
 	show text box (1190), wait (7), wait for key (use key), advance text box
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1191), wait (7), wait for key (use key), advance text box
 	walk hero (me,up,1), walk hero (1,up,1), walk hero (2,up,1), wait for hero (me)
 	walk hero (me,left,1), walk hero (1,up,1), walk hero (2,up,1), walk hero (3,right,1)
 	wait for hero (me), walk hero (me,left,1), walk hero (1,left,1), walk hero (2,up,1), walk hero (3,up,1)
 	wait for hero (me), walk hero (me,left,1), walk hero (1,left,1), walk hero (2,left,1)
 	walk hero (3,up,1), wait for hero (me), walk hero (me,left,1), walk hero (1,left,1)
 	walk hero (2,left,1), walk hero (3,left,1), wait for hero (me), set NPC direction (23,up)
 	set NPC direction (24,up), walk NPC (22,right,3), show text box (1192), wait (7), wait for NPC (22)
 	set NPC direction (22,down), wait (2), set NPC direction (22,left), wait for key (use key), advance text box
 	set hero direction (me,down), set hero direction (1,down), set hero direction (2,down), set hero direction (3,down), wait (5)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1193), wait (7), wait for key (use key), advance text box, set hero direction (me,right)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1194), wait (7), wait for key (use key), advance text box, set hero direction (3,left)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show text box (1195), wait (7), wait for key (use key), advance text box
 	walk hero (1,left,1), walk hero (2,left,1), walk hero (3,left,1), wait for hero (3)
 	walk hero (2,left,1), walk hero (3,left,1), wait for hero (3), walk hero (3,left,1)
 	wait for hero (3), set caterpillar mode (off), resume caterpillar, focus camera (37,27,4)
 	wait for camera, camera follows hero (me), wait (5)
 	set hero direction (me,down), wait (5), set hero direction (me,left), wait (5)
 	walk hero (me,left,2), wait for hero (me), set NPC direction (24,left), set NPC direction (23,left)
 	walk hero (me,down,1), wait for hero (me), walk hero (me,left,7), wait for hero (me)
 	walk hero (me,up,3), wait for hero (me), walk hero (me,left,4), wait for hero (me)
 	walk hero (me,up,6), wait for hero (me), walk hero (me,left,7), wait for hero (me)
 	walk hero (me,up,3), wait for hero (me), walk hero (me,left,2), wait for hero (me)
 	wait (5), pan camera (left,1), wait for camera, wait (5)
 	show text box (1196), wait (7), wait for key (use key), advance text box
 	suspend obstruction, walk hero (me,left,1), wait for hero (me), resume obstruction
 	set tag (tag:Frumpyover,on), camera follows hero, resume box advance, resume player, encounters
end

script,Hel,begin
	remember party, suspend player, suspend box advance
 	walk hero to y (me,24), wait for hero (me)
 	walk hero to x (me,12), wait for hero (me)
 	set hero direction (me,up), stop song
 	show text box (1197), wait (7), wait for key (use key), advance text box
 	focus camera (12,22,4), wait for camera, suspend obstruction
 	set NPC position (4,12,24), wait (1), walk NPC (4,up,3), wait for NPC (4)
 	wait (2), fade screen out, wait (2), resume obstruction
 	set tag (tag:HelAlive,on), wait (2), fade screen in, play song (song:Vile)
 	wait (2), set caterpillar mode (on)
 	set hero position (1,12,24), set hero position (2,12,24), set hero position (3,12,24)
 	suspend caterpillar, wait (3)
 	walk hero (1,down,1), walk hero (2,down,1), walk hero (3,down,1), wait for hero (1)
 	walk hero (1,left,1), walk hero (2,right,1), wait for hero (1)
 	set hero direction (1,up), set hero direction (2,up), set hero direction (3,up), wait (3)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1198), wait (7), wait for key (use key), advance text box
 	show text box (1199), wait (7), wait for key (use key), advance text box
 	show text box (1200), wait (7), wait for key (use key), advance text box
 	walk NPC (1,down,1), wait (4)
 	show text box (1201), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1202), wait (7), wait for key (use key), advance text box
 	show text box (1203), wait (7), wait for key (use key), advance text box
 	show text box (1204), wait (7), wait for key (use key), advance text box
 	show text box (1205), wait (7), wait for key (use key), advance text box
 	show text box (1206), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1207), wait (7), wait for key (use key), advance text box
 	show text box (1208), wait (7), wait for key (use key), advance text box
 	show text box (1209), wait (7), wait for key (use key), advance text box
 	show text box (1210), wait (7), wait for key (use key), advance text box
#baddle
 	BossIntroduction, fight formation (99), stop song, wait (10)
 	Alter NPC (0,NPCstat:picture,126), wait (10), play song (song:An Unfortunate End)
 	show text box (1211), wait (7), wait for key (use key), advance text box
 	wait (5), walk hero (2,up,1), wait for hero (2), wait (5)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (1212), wait (7), wait for key (use key), advance text box
 	wait (5), Alter NPC (0,NPCstat:picture,89), wait (5)
 	show text box (1213), wait (7), wait for key (use key), advance text box
 	wait (5), walk hero (1,up,1), wait for hero (1), wait (5)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1214), wait (7), wait for key (use key), advance text box
 	wait (15)
 	show text box (1215), wait (7), wait for key (use key), advance text box
 	wait (10), Alter NPC (0,NPCstat:picture,126), wait (10)
 	show text box (1216), wait (7), wait for key (use key), advance text box
 	wait (10), fade screen out, wait (2), set tag (tag:DefeatHel,on)
 	wait (2), fade screen in
 	show text box (1217), wait (7), wait for key (use key), advance text box
 	wait (5), walk hero (me,up,1), wait for hero (me)
 	set hero direction (me,left), wait (3), set hero direction (me,down)
 	set hero direction (1,right), set hero direction (2,left) , wait (3)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1218), wait (7), wait for key (use key), advance text box
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1219), wait (7), wait for key (use key), advance text box
 	walk hero (me,down,1), walk hero (1,right,1), walk hero (2,left,1)
 	walk hero (3,up,1), pan camera (down,2), wait for camera
 	camera follows hero (me), wait (2)
 	set caterpillar mode (off), resume caterpillar, resume player, resume box advance, encounters
end

script,vulpes,begin
 	suspend player, suspend box advance, focus camera (7,3,4), wait for camera
 	show text box (1222), wait (7), wait for key (use key), advance text box
 	play sound (sfx:YAP,false,true), set NPC direction (1,down), wait (10)
 	set NPC direction (1,up), wait (3), focus camera (7,7,4), wait for camera
 	resume box advance, resume player, camera follows hero (me)
end

script,bramSLOW,begin
 	suspend player, suspend box advance,remember party
 	swap by position (0,find hero (hero:Bram)), teach spell ((find hero(hero:Bram)),82)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1223), wait (7), wait for key (use key), advance text box
 	set NPC direction (0,right), wait (3)
 	show text box (1224), wait (7), wait for key (use key), advance text box
 	play sound (sfx:YAP,false,true), set NPC direction (1,down), wait (10)
 	set NPC direction (1,up), wait (3), set NPC direction (0,down)
 	tweak palette (10,0,0), update palette, play sound (sfx:bubbles,false,true), wait (10)
 	reset palette, fade screen in
 	show text box (1225), wait (7), wait for key (use key), advance text box
 	resume box advance, resume player,reinstate party
end

script,NightSLEEP,begin
 	suspend player, suspend box advance,remember party
 	swap by position (0, find hero (hero:Night)), teach spell ((find hero(hero:Night)),atk:Slumber)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1226), wait (7), wait for key (use key), advance text box
 	play sound (sfx:Select8Bit,false,true), show backdrop (30), wait (10)
 	show text box (1227), wait (7), wait for key (use key), advance text box
 	play sound (sfx:YAP,false,true), set NPC direction (1,down), wait (10)
 	set NPC direction (1,up), wait (3), set NPC direction (0,down), wait (1)
 	play sound (sfx:Select8Bit,false,true), show map, wait (3)
 	tweak palette (10,0,0), update palette, play sound (sfx:Heal8bit,false,true)
 	wait (10), reset palette, fade screen in
 	show text box (1228), wait (7), wait for key (use key), advance text box
 	resume player, resume box advance,reinstate party
end

script,OlafMANA,begin
 	suspend player, suspend box advance,remember party
 	swap by position (0, find hero (hero:Olaf)), teach spell ((find hero(hero:Olaf)),atk:Mana Rage)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1229), wait (7), wait for key (use key), advance text box, set NPC direction (0,left)
 	show text box (1230), wait (7), wait for key (use key), advance text box
 	set hero direction (me,right), play sound (sfx:YAP,false,true), set NPC direction (1,down), wait (10)
 	set NPC direction (1,up), wait (3), set NPC direction (0,down), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1231), wait (7), wait for key (use key), advance text box
 	wait (3), tweak palette (0,10,0), update palette, play sound (sfx:Metal_Hit,false,true)
 	wait (10), reset palette, fade screen in
 	show text box (1232), wait (7), wait for key (use key), advance text box
 	resume box advance, resume player, reinstate party
end

script,KittSLASH,begin
 	suspend player, suspend box advance,remember party
 	swap by position (0, find hero (hero:Kitt)), teach spell ((find hero(hero:Kitt)),atk:Slash All)
 	tweak palette (63,63,63), update palette, wait (1), set tag (tag:ROACHES,on), reset palette
 	update palette, wait (1), set hero direction (me,right), wait (3)
 	set hero direction (me,down), wait (3), focus camera (7,5,4), wait for camera 
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1235), wait (7), wait for key (use key), advance text box
 	show text box (1236), wait (7), wait for key (use key), advance text box
 	play sound (sfx:YAP,false,true), set NPC direction (1,down), wait (10)
 	set NPC direction (1,up), wait (3)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1237), wait (7), wait for key (use key), advance text box
 	play sound (sfx:Soft_Airy_Swish,false,true), set hero position (me,4,7), wait (3)
 	play sound (sfx:Soft_Airy_Swish,false,true), set hero position (me,8,5), wait (3)
 	play sound (sfx:Soft_Airy_Swish,false,true), set hero position (me,4,5), wait (3)
 	play sound (sfx:Soft_Airy_Swish,false,true), set hero position (me,10,4), wait (3)
 	play sound (sfx:Soft_Airy_Swish,false,true), set hero position (me,8,7), wait (3)
 	play sound (sfx:Soft_Airy_Swish,false,true), set hero position (me,6,4), wait (3)
 	play sound (sfx:Soft_Airy_Swish,false,true), set hero position (me,10,6), wait (3)
 	play sound (sfx:Soft_Airy_Swish,false,true), set hero position (me,7,5), wait (3)
 	camera follows hero (me), wait (1), set tag (tag:ROACHES,off), tweak palette (10,0,0)
 	update palette, play sound (sfx:Soft_Airy_Swish,false,true), wait (10), reset palette, fade screen in
 	show text box (1238), wait (7), wait for key (use key), advance text box
 	resume player, resume box advance,reinstate party
end

script,FrumpForce,begin
 	suspend player, suspend box advance,remember party
 	walk hero to x (me,9), walk hero to y (me,13)
 	wait for hero (me), set caterpillar mode (on), suspend caterpillar
 	swap by position (0, find hero (hero:Kitt)), swap by position (1, find hero (hero:Bram))
 	swap by position (2, find hero (hero:Frumpy)), swap by position (3, find hero (hero:Night))
 	teach spell ((find hero(hero:Frumpy)),atk:Force)
 	set hero position (1,9,13), set hero position (2,9,13), set hero position (3,9,13)
 	wait (2), walk hero (me,up,1), walk hero (1,left,1)
 	walk hero (2,right,1), walk hero (3,down,1), wait for hero (me)
 	set hero direction (me,left), set hero direction (1,down)
 	set hero direction (2,down), set hero direction (3,left)
 	wait (4), set hero direction (me,down), set hero direction (1,right)
 	set hero direction (2,left), set hero direction (3,up), wait (4)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (1239), wait (7), wait for key (use key), advance text box
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show textbox (1240), wait (7), wait for key (use key), advance text box
 	walk hero to x (1,3), wait for hero (1), walk hero to y (1,10), wait for hero (1)
 	walk hero (1,left,1), wait for hero (1), wait (10), walk hero (1,right,1) 
	wait for hero (1), walk hero (1,up,5), wait for hero (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show textbox (1241), wait (7), wait for key (use key), advance text box
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show textbox (1242), wait (7), wait for key (use key), advance text box
 	walk hero to y (1,13), wait for hero (1), set hero direction (1,right)
 	set hero direction (me,left), set hero direction (2,left) 
 	set hero direction (3,left), set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show textbox (1243), wait (7), wait for key (use key), advance text box
 	walk NPC to y (6,11), wait for NPC (6), set hero direction (1,up), wait (2)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show textbox (1244), wait (7), wait for key (use key), advance text box
 	walk hero (2,left,2), wait for hero (2)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show textbox (1245), wait (7), wait for key (use key), advance text box
 	play sound (sfx:Wind,false,true), fade screen out (63,63,63), wait (5)
 	set tag (tag:FORCE,on), wait (10), fade screen in, wait (5)
 	tweak palette (10,0,0), update palette, play sound (sfx:Wind,false,true)
 	wait (10), reset palette, fade screen in
 	show text box (1246), wait (7), wait for key (use key), advance text box
 	walk hero (2,right,2), walk hero to x (1,8), wait for hero (1)
 	set hero direction (me,down), set hero direction (1,right)
 	set hero direction (2,left), set hero direction (3,up)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show textbox (1247), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (1248), wait (7), wait for key (use key), advance text box
 	walk hero (me,down,1), walk hero (1,right,1), walk hero (2,left,1), walk hero (3,up,1)
 	wait for hero (me), resume caterpillar, set caterpillar mode (off)
 	resume box advance, resume player, encounters
end

script,StyrgeWERE,begin
	remember party, suspend player, suspend box advance, swap by position (0, find hero (hero:Styrge))
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show textbox (1250), wait (7), wait for key (use key), advance text box
 	set NPC direction (22,right), wait (5), set NPC direction (22,down), wait (5)
 	play sound (sfx:Growl,false,true), wait (15)
# baddle
 	BossIntroduction, fight formation (146), swap by position (0, find hero (hero:Styrge))
 	set tag (tag:WERERED,on), wait (10), fade screen in, wait (5)
 	tweak palette (10,0,0), update palette, play sound (sfx:Growl,false,true), wait (10)
 	reset palette, fade screen in
 	show text box (1251), wait (7), wait for key (use key), advance text box
 	teach spell ((find hero(hero:Styrge)),atk:Were Bust)
 	show text box (1252), wait (7), wait for key (use key), advance text box
 	show text box (1253), wait (7), wait for key (use key), advance text box
 	show text box (1254), wait (7), wait for key (use key), advance text box
 	resume player, resume box advance,reinstate party, encounters
end

script,antidote,begin
	remember party, suspend player, suspend box advance, set caterpillar mode (on)
 	suspend caterpillar, swap by position (0, find hero (hero:Styrge))
 	swap by position (1, find hero (hero:Frumpy)), set hero position (1,60,21), set hero position (2,1,1)
 	set hero position (3,1,1), wait (2), walk hero (1,down,1), wait for hero (1), set hero direction (1,right), wait (2)
 	show text box (1259), wait (7), wait for key (use key), advance text box, wait (5)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1260), wait (7), wait for key (use key), advance text box
# Teach styrge Unvenom
 	tweak palette (0,0,10), update palette, play sound (sfx:Heal8 Bit,false,true)
 	teach spell ((find hero(hero:Styrge)),atk:Unvenom), wait (10), reset palette, fade screen in
 	show text box (1261), wait (7), wait for key (use key), advance text box
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1262), wait (7), wait for key (use key), advance text box
# Teach Frumpy Antidote
 	tweak palette (0,0,10), update palette, play sound (sfx:Heal8 Bit,false,true)
 	teach spell ((find hero(hero:Frumpy)),atk:Antidote)
 	wait (10), reset palette, fade screen in
 	show text box (1263), wait (7), wait for key (use key), advance text box
 	show text box (1264), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1265), wait (7), wait for key (use key), advance text box
 	walk hero (1,up), wait for hero (1), wait (1), resume caterpillar
 	set caterpillar mode (off), resume box advance, resume player, reinstate party, encounters
end

script,Hildaback,begin
	remember party, suspend player, suspend box advance, suspend caterpillar
 	swap by position (0, find hero (hero:Freki)), swap by position (1, find hero (hero:Renard))
 	swap by position (2, find hero (hero:Bram)), swap by position (3, find hero (hero:Frumpy))
 	wait (1), set hero position(1, 3, 25), set hero position(2, 3, 25), set hero position(3, 3, 25)
 	wait (1), set caterpillar mode (on), wait (1), walk hero (1,left,1) 
	walk hero (2,down,1), walk hero (3,right,1), wait for hero (1), set hero direction (1,up)
 	set hero direction (2,up), set hero direction (3,up), wait (2)
 	show text box (1267), wait (7), wait for key (use key), advance text box
 	set hero direction (1,right)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1268), wait (7), wait for key (use key), advance text box
 	set hero direction (3,left)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show text box (1269), wait (7), wait for key (use key), advance text box
 	set hero direction (1,up), set hero direction (3,up)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	suspend map music
 	show text box (1270), wait (7), wait for key (use key), advance text box
 	show text box (1271), wait (7), wait for key (use key), advance text box
# Off to Valhalla for a cut scene
 	fade screen out, wait (2), greyscale palette, teleport to map (1, 33, 1)
 	wait (2), focus camera (33,6,4), wait for camera
 	play song (song:In Soft Reflection), fade screen in
 	show text box (1272), wait (7), wait for key (use key), advance text box
 	walk NPC (23,down,4), wait for NPC (23), wait (20), walk NPC (23,up,4)
 	walk NPC (24,up,4), walk NPC (25,up,4), walk NPC (26,up,4), walk NPC (27,up,4)
 	wait for NPC (23), walk NPC (23,right,2), set NPC direction (23,left)
 	show text box (1273), wait (7), wait for key (use key), advance text box
 	show text box (1274), wait (7), wait for key (use key), advance text box
 	walk NPC (25,up,1), wait for NPC (25)
 	show text box (3995), wait (7), wait for key (use key), advance text box
 	show text box (3996), wait (7), wait for key (use key), advance text box
 	show text box (3997), wait (7), wait for key (use key), advance text box
 	show text box (3998), wait (7), wait for key (use key), advance text box
 	show text box (1275), wait (7), wait for key (use key), advance text box
	wait (5), set NPC direction (25,left)
	wait (5), set NPC direction (25,down), wait (5)
 	show text box (3999), wait (7), wait for key (use key), advance text box
 	show text box (4000), wait (7), wait for key (use key), advance text box
# The action returns to Gnipahellir
 	fade screen out, wait (2), reset palette, camera follows hero (me)
 	wait (2), teleport to map (43, 3, 25), wait (2)
 	set hero position (1,2,25), set hero position (2,3,26), set hero position (3,4,25)
 	set NPC direction (0,down), wait (2), fade screen in, wait (5)
 	show text box (1276), wait (7), wait for key (use key), advance text box
 	resume map music
 	show text box (1277), wait (7), suspend obstruction, wait for key (use key)
 	advance text box, walk NPC (0,down,1), walk hero (1,right,1)
 	walk hero (2,up,1), walk hero (3,left,1), wait for hero (1)
 	unlock hero (hero:Hilda), set tag (tag:Hildareturns,on), resume obstruction
 	resume player, resume box advance, resume caterpillar
 	set caterpillar mode (off),reinstate party, encounters
end

script,housemaster,begin
	remember party, suspend player, suspend box advance
 	walk hero to y (me,11), wait for hero (me)
 	walk hero to x (me,39), wait for hero (me)
 	set hero direction (me,up), swap by position (0, find hero (hero:Hilda))
 	swap by position (1, find hero (hero:Freki)), swap by position (2, find hero (hero:Bram))
 	swap by position (3, find hero (hero:Renard)),remember party, set caterpillar mode (on)
 	suspend caterpillar, set hero position (1,39,11), set hero position (2,39,11)
 	set hero position (3,39,11), wait (1), walk hero (1,left,1)
 	walk hero (2,right,1), walk hero (3,down,1), wait for hero (3)
 	set hero direction (1,up), set hero direction (2,up), set hero direction (3,up)
 	focus camera (39,8,4), wait for camera , walk NPC (1,down,1), wait for NPC (1)
 	show text box (1278), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1279), wait (7), wait for key (use key), advance text box
 	walk hero (1,left,2), walk hero (2,right,2), walk hero (me,left,1)
 	walk hero (3,up,1), walk hero (3,right,1), wait for hero (1)
 	show text box (1280), walk hero (1,up,2), walk hero (2,up,2)
 	walk hero (me,left,2), walk hero (3,right,2), wait for hero (1)
 	walk hero (1,left,1), walk hero (2,right,1), walk hero (me,up,2)
 	walk hero (3,up,2), wait for hero (me), walk hero (1,up,2)
 	walk hero (2,up,2), walk hero (me,left,1), walk hero (3,right,1)
 	wait for hero (1), advance textbox
 	show textbox (1281), walk hero (1,left,1), walk hero (2,right,1)
 	walk hero (me,up,2), walk hero (3,up,2), wait for hero (1)
 	walk hero (1,up,3), walk hero (2,up,3), wait for hero (1)
 	set hero direction (me,right), set hero direction (3,left)
 	walk hero (1,right,1), walk hero (2,left,1), wait for hero (1)
 	advance textbox, set NPC direction (1,left), wait (3)
 	set NPC direction (1,right), wait (3), set NPC direction (1,left), wait (3)
 	set NPC direction (1,right), wait (3), set NPC direction (1,left)
 	show text box (1282), wait (7), wait for key (use key), advance text box
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show text box (1283), wait (7), wait for key (use key), advance text box
 	show text box (1284), wait (7), wait for key (use key), advance text box
 	wait (5), stop song, wait (5)
 	show textbox (828), wait (7), wait for key (usekey), advance text box
 	show textbox (829), wait (7), wait for key (usekey), advance text box
 	wait (5), tweak palette (-20,-20,-20), fade screen in, wait (4)
 	show textbox (830), wait (7), wait for key (usekey), advance text box
# The new boss fight effect!
 	BossIntroduction  ,fight formation (156), stop song
 	show text box (1285), wait (7), wait for key (use key), advance text box
 	show text box (1286), wait (7), wait for key (use key), advance text box
 	walk NPC (1,left,1), wait for NPC (1), walk NPC (1,up,1)
 	wait for NPC (1), set NPC direction (1,left), wait (3)
 	set NPC speed (1,10), set NPC direction (1,down), wait (3)
 	suspend NPC walls, suspend obstruction, pan camera (down,2)
 	walk NPC (1,down,7), wait (5)
 	show text box (1287), wait (7), wait for NPC (1), walk NPC (4,up,2)
 	advance text box, wait for NPC (4), play sound (sfx:Crush8Bit,false,true)
 	set NPC speed (1,20), walk NPC (1,up,1), set NPC direction (1,left)
 	wait for NPC (1), walk NPC (1,up,1), set NPC direction (1,up)
 	wait for NPC (1), walk NPC (1,up,1), set NPC direction (1,right)
 	wait for NPC (1), walk NPC (1,up,1), set NPC direction (1,down)
 	wait for NPC (1), walk NPC (1,up,1), set NPC direction (1,left)
 	wait for NPC (1), walk NPC (1,up,1), set NPC direction (1,up)
 	wait for NPC (1), walk NPC (1,up,1), set NPC direction (1,right)
 	wait for NPC (1), walk NPC (1,up,1), set NPC direction (1,down)
 	wait for NPC (1), set NPC direction (1,left), wait (3)
 	set NPC direction (1,up), wait (3), set NPC direction (1,right), wait (3)
 	set NPC direction (1,down), wait (3), walk NPC (1,down,1), wait for NPC (1)
 	wait (1), set NPC speed (1,4), pan camera (up,2), walk NPC (5,right,1), walk NPC (4,left,1)
 	wait for NPC (5), walk NPC (5, up, 3), walk NPC (4,up,1), wait for NPC (5), wait for NPC (4)
 	show text box (1288), wait (7), wait for key (use key), advance text box
 	walk NPC (1,right,1), wait for NPC (1), set NPC direction (1,down)
 	show text box (1289), wait (7), wait for key (use key), advance text box
 	BossIntroduction, fight formation (157), unlock hero (hero:Olaf)
 	show text box (1290), wait (7), wait for key (use key), advance text box
 	wait (5), fade screen out, wait (3)
 	show text box (1293), wait (3), fade screen in, wait (7)
 	wait for key (use key), advance text box
 	show text box (1294), wait (7), wait for key (use key), advance text box
 	show text box (1295), wait (7), wait for key (use key), advance text box
 	show text box (1296), wait (7), wait for key (use key), fade screen out
 	wait (2), advance text box, wait (3), fade screen in, wait (2)
 	show text box (1291), wait (7), wait for key (use key), advance text box
 	show text box (1292), wait (7), wait for key (use key), advance text box
 	play sound (sfx:Electricity,false,true), walk NPC (10,down,3), walk NPC (11,down,3)
 	walk NPC (12,down,3), walk NPC (13,down,3), wait for NPC (10)
 	walk NPC (10,left,1), walk NPC (11,up,1), walk NPC (12,right,1), walk NPC (13,down,1), wait for NPC (10)
# the dance of electricity!
 	play sound (sfx:Electricity,false,true), walk NPC (10,up,1), walk NPC (10,right,1)
 	walk NPC (11,right,1), walk NPC (11,down,1), walk NPC (12,left,1), walk NPC (12,down,1)
 	walk NPC (13,left,1), walk NPC (13,up,1), wait for NPC (10), walk NPC (10,right,1)
 	walk NPC (10,down,1), walk NPC (11,left,1), walk NPC (11,down,1), walk NPC (12,left,1)
 	walk NPC (12,up,1), walk NPC (13,up,1), walk NPC (13,right,1), wait for NPC (10)
 	walk NPC (10,left,1), walk NPC (10,down,1), walk NPC (11,left,1), walk NPC (11,up,1)
 	walk NPC (12,up,1), walk NPC (12,right,1), walk NPC (13,right,1), walk NPC (13,down,1)
 	wait for NPC (10), walk NPC (10,left,1), walk NPC (10,up,1), walk NPC (11,up,1)
 	walk NPC (11,right,1), walk NPC (12,right,1), walk NPC (12,down,1), walk NPC (13,down,1)
 	walk NPC (13,left,1), wait for NPC (10), play sound (sfx:Electricity,false,true)
 	walk NPC (10,up,1), walk NPC (10,right,1), walk NPC (11,right,1), walk NPC (11,down,1)
 	walk NPC (12,left,1), walk NPC (12,down,1), walk NPC (13,left,1), walk NPC (13,up,1)
 	wait for NPC (10), walk NPC (10,right,1), walk NPC (10,down,1), walk NPC (11,left,1)
 	walk NPC (11,down,1), walk NPC (12,left,1), walk NPC (12,up,1), walk NPC (13,up,1)
 	walk NPC (13,right,1), wait for NPC (10), walk NPC (10,left,1), walk NPC (10,down,1)
 	walk NPC (11,left,1), walk NPC (11,up,1), walk NPC (12,up,1), walk NPC (12,right,1)
 	walk NPC (13,right,1), walk NPC (13,down,1), wait for NPC (10), walk NPC (10,left,1)
 	walk NPC (10,up,1), walk NPC (11,up,1), walk NPC (11,right,1), walk NPC (12,right,1)
 	walk NPC (12,down,1), walk NPC (13,down,1), walk NPC (13,left,1), wait for NPC (10)
 	play sound (sfx:Electricity,false,true), walk NPC (10,up,1), walk NPC (10,right,1)
 	walk NPC (11,right,1), walk NPC (11,down,1), walk NPC (12,left,1), walk NPC (12,down,1)
 	walk NPC (13,left,1), walk NPC (13,up,1), wait for NPC (10), walk NPC (10,right,1)
 	walk NPC (10,down,1), walk NPC (11,left,1), walk NPC (11,down,1), walk NPC (12,left,1)
 	walk NPC (12,up,1), walk NPC (13,up,1), walk NPC (13,right,1), wait for NPC (10)
 	walk NPC (10,left,1), walk NPC (10,down,1), walk NPC (11,left,1), walk NPC (11,up,1)
 	walk NPC (12,up,1), walk NPC (12,right,1), walk NPC (13,right,1), walk NPC (13,down,1)
 	wait for NPC (10), walk NPC (10,left,1), walk NPC (10,up,1), walk NPC (11,up,1)
 	walk NPC (11,right,1), walk NPC (12,right,1), walk NPC (12,down,1), walk NPC (13,down,1)
 	walk NPC (13,left,1), wait for NPC (10), play sound (sfx:lightning,false,true)
 	walk NPC (10,right,3), walk NPC (11,down,3), walk NPC (12,left,3), walk NPC (13,up,3)
 	wait for NPC (13), fade screen out (63,63,63), wait (10)
 	resume obstruction, resume NPC walls, set tag (tag:Housemaster,on)
 	wait (10), fade screen in, wait (5)
 	show textbox (1297), wait (7), wait for key (usekey), advance textbox
 	wait (3), fade screen out, wait (1)
 	resume box advance, resume caterpillar, set hero direction (me,down)
 	set caterpillar mode (off), camera follows hero, set tag (tag:Gnipaover,on)
 	use door (7), resume player, encounters
end

script,FrumpyLINGUE,begin
	remember party, suspend player, suspend box advance
 	swap by position (0, find hero (hero:Frumpy)), wait (3)
 	set hero frame (me,1), wait (1)
 	set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1)
 	set hero frame (me,0), wait (1)
 	show text box (1306), wait (7), wait for key (use key), advance text box
 	show text box (1307), wait (7), wait for key (use key), advance text box
 	BossIntroduction, fight formation (158), swap by position (0, find hero (hero:Frumpy))
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1308), wait (7), wait for key (use key), advance text box
 	show text box (1309), wait (7), wait for key (use key), advance text box
 	tweak palette (0,0,10), update palette, play sound (sfx:Menu8Bit,false,true)
 	teach spell ((find hero(hero:Frumpy)),atk:Lingue), wait (10), reset palette, fade screen in
 	show text box (1310), wait (7), wait for key (use key), advance text box
 	fade screen out (63,63,63), wait (1), set tag (tag:Frumling,on), wait (1)
 	resume box advance, wait (2), fade screen in, wait (2), resume player,reinstate party, encounters
end

script,FrumpyAWAKE,begin
	remember party, suspend player, suspend box advance
 	swap by position (0, find hero (hero:Frumpy)), wait (1)
 	walk hero to x (me,38), walk hero to y (me,16), wait for hero (me)
 	set hero frame (me,1), wait (1)
 	set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1)
 	set hero frame (me,0), wait (1)
 	show text box (1312), wait (7), wait for key (use key), advance text box
 	show text box (1313), wait (7), wait for key (use key), advance text box
 	BossIntroduction, fight formation (159), swap by position (0, find hero (hero:Frumpy))
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1314), wait (7), wait for key (use key), advance text box
 	show text box (1315), wait (7), wait for key (use key), advance text box
 	tweak palette (0,0,10), update palette, play sound (sfx:Menu8Bit,false,true)
 	teach spell ((find hero(hero:Frumpy)),atk:Awake), wait (10), reset palette, fade screen in
 	show text box (1316), wait (7), wait for key (use key), advance text box
 	fade screen out (63,63,63), wait (1), set tag (tag:Frumawak,on), wait (1)
 	resume box advance, wait (2), fade screen in
 	wait (2), resume player,reinstate party, encounters
end

script,FrumpyNURSE,begin
	remember party, suspend player, suspend box advance
 	swap by position (0, find hero (hero:Frumpy)), wait (1)
 	walk hero to x (me,24), walk hero to y (me,41), wait for hero (me), wait (3)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1318), wait (7), wait for key (use key), advance text box
 	show text box (1319), wait (7), wait for key (use key), advance text box
 	BossIntroduction, fight formation (160), swap by position (0, find hero (hero:Frumpy))
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1320), wait (7), wait for key (use key), advance text box
 	show text box (1321), wait (7), wait for key (use key), advance text box
 	tweak palette (0,0,10), update palette, play sound (sfx:Heal8Bit,false,true)
 	teach spell ((find hero(hero:Frumpy)),atk:Nurse), wait (10), reset palette, fade screen in
 	show text box (1322), wait (7), wait for key (use key), advance text box
 	fade screen out (63,63,63), wait (1), set tag (tag:Frumnurs,on)
 	wait (1), resume box advance, wait (2)
 	fade screen in, wait (2), resume player,reinstate party, encounters
end

script,FrumpyLIFE,begin
	remember party, suspend player, suspend box advance
 	swap by position (0, find hero (hero:Frumpy)), wait (1)
 	walk hero to x (me,17), walk hero to y (me,41), wait for hero (me), wait (3)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1334), wait (7), wait for key (use key), advance text box
 	show text box (1335), wait (7), wait for key (use key), advance text box
 	play song (song:Vile)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1336), wait (7), wait for key (use key), advance text box
 	show text box (1337), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1338), wait (7), wait for key (use key), advance text box
 	BossIntroduction, fight formation (161)
 	swap by position (0, find hero (hero:Frumpy))
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1339), wait (7), wait for key (use key), advance text box
 	show text box (1340), wait (7), wait for key (use key), advance text box
 	wait (1), play sound (sfx:lightning,false,true)
 	pancamera(up,1,20),waitforcamera, pancamera(down,2,20),waitforcamera
 	pancamera(up,2,20),waitforcamera, pancamera(down,1,20),waitforcamera 
 	pancamera(up,1,20),waitforcamera, pancamera(down,2,20),waitforcamera
 	pancamera(up,2,20),waitforcamera, pancamera(down,1,20),waitforcamera 
 	camera follows hero (me), fade screen out (63,63,63), wait (1)
 	set tag (tag:Frumlife,on), wait (1), fade screen in, wait (2)
 	tweak palette (0,0,10), update palette, play sound (sfx:Heal8Bit,false,true)
 	teach spell ((find hero(hero:Frumpy)),atk:Life), wait (10), reset palette, fade screen in
 	show text box (1341), wait (7), wait for key (use key), advance text box
 	fade screen out (63,63,63), wait (1), resume box advance
 	wait (2), fade screen in, wait (2), resume player,reinstate party, encounters
end

script,FrumpySUBLIME,begin
	remember party, suspend player, suspend box advance
 	show text box (1344), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1345), wait (7), wait for key (use key), advance text box
 	show text box (1346), wait (7), wait for key (use key), advance text box
 	BossIntroduction, fight formation (162), wait (2)
 	tweak palette (0,10,0), update palette, play sound (sfx:Metal_Hit,false,true)
 	teach spell ((find hero(hero:Frumpy)),atk:Sublime), set tag (tag:sublime,on)
 	wait (10), reset palette, fade screen in
 	show text box (1347), wait (7), wait for key (use key), advance text box
 	show text box (1348), wait (7), wait for key (use key), advance text box
 	show text box (1349), wait (7), wait for key (use key), advance text box
 	show text box (1350), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1351), wait (7), wait for key (use key), advance text box
 	resume box advance, resume player,reinstate party, encounters
end

# script of scripts, it's time to fight Fenrir
script, Lyngvi, begin

#NPC 3 is Fenrir, 5 and 6 are Skoll and Hati respectively
 	suspend player, suspend box advance, suspend random enemys, suspend hero walls
 	swap by position (0, find hero (hero:Freki)), wait (3)
 	suspend caterpillar, set hero direction (1,up), set hero direction (2,up)
 	set hero direction (3,up), wait (2), focus camera (16,13,4)
 	set caterpillar mode (on), set hero position (1, 16, 13), set hero position (2, 16, 13)
 	set hero position (3, 16, 13), wait (2), walk hero (me,up,1), walk hero (1,left,1)
 	walk hero (2,right,1), walk hero (3,down,1), wait for hero (me)
 	set hero direction (me,left), set hero direction (1,down), set hero direction (2,down)
 	set hero direction (3,left), wait (4), set hero direction (me,down)
 	set hero direction (1,right), set hero direction (2,left), set hero direction (3,up)
 	wait (4), set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1362), wait (7), wait for key (use key), advance text box
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1363), wait (7), wait for key (use key), advance text box
 	walk hero (me,up,1), wait for hero (me), set hero direction (1,up)
 	walk hero (me,left,2), wait for hero (me), walk hero (me,up,1)
 	wait for hero (me), focus camera (14,8,2)
 	set NPC frame (6,1), wait (1), set NPC frame (6,0), wait (1)
 	set NPC frame (6,1), wait (1), set NPC frame (6,0), wait (1)
 	show text box (1364),wait for camera, 	set hero position (1, 0, 0), set hero position (2, 0, 0) 
	set hero position (3, 0, 0), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1365), wait (7), wait for key (use key), advance text box
 	set NPC frame (6,1), wait (1), set NPC frame (6,0), wait (1)
 	set NPC frame (6,1), wait (1), set NPC frame (6,0), wait (1)
 	show text box (1366), wait (7), wait for key (use key), advance text box
 	wait (5), stop song, wait (10)
 	show text box (1367), pancamera(up,1,20),waitforcamera
 	pancamera(down,2,20),waitforcamera, pancamera(up,2,20),waitforcamera
 	pancamera(down,1,20),waitforcamera , wait (7), wait for key (use key), advance text box
 	wait (3), set NPC direction (6,left), wait (3)
 	set NPC direction (6,up), wait (3)
 	set NPC frame (6,1), wait (1), set NPC frame (6,0), wait (1)
 	set NPC frame (6,1), wait (1), set NPC frame (6,0), wait (1)
 	show text box (1368), wait (7), wait for key (use key), advance text box
	set NPC frame (3,1), wait (1), set NPC frame (3,0), wait (1)
 	set NPC frame (3,1), wait (1), set NPC frame (3,0), wait (1)
 	show text box (1369), wait (7), wait for key (use key), advance text box
 	walk NPC (6,right,2),walk NPC (5,left,1), wait for NPC (6), set NPC direction (6,down)
 	set NPC direction (5,down), wait (3), set NPC direction (6,left), set NPC direction (5,right), wait (3)
 	set NPC frame (6,1), wait (1), set NPC frame (6,0), wait (1)
 	set NPC frame (6,1), wait (1), set NPC frame (6,0), wait (1)
 	show text box (1370), wait (7), wait for key (use key), advance text box
	set NPC frame (3,1), wait (1), set NPC frame (3,0), wait (1)
 	set NPC frame (3,1), wait (1), set NPC frame (3,0), wait (1)
 	show text box (1371), wait (7), wait for key (use key), advance text box
 	stop song, wait (10), walk hero (me,up,1), wait for hero (me), wait (5) 
	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1372), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1373), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1374), wait (7), wait for key (use key), advance text box
 	set NPC frame (6,1), wait (1), set NPC frame (6,0), wait (1)
 	set NPC frame (6,1), wait (1), set NPC frame (6,0), wait (1)
 	show text box (1375), wait (7), wait for key (use key), advance text box
	set NPC frame (3,1), wait (1), set NPC frame (3,0), wait (1)
 	set NPC frame (3,1), wait (1), set NPC frame (3,0), wait (1)
 	show text box (1376), wait (7), wait for key (use key), advance text box
 	show text box (1377), wait (7), wait for key (use key), advance text box
 	fade screen out, wait (2), show text box (1378), wait (2)
 	fade screen in, wait (7), wait for key (usekey), advance textbox
 	show text box (1379), wait (7), wait for key (use key), advance text box
 	show text box (1380), wait (7), wait for key (use key), advance text box
 	show text box (1381), wait (7), wait for key (use key), fade screen out
 	wait (2) ,advance text box, wait (2), fade screen in, wait (2)
 	set NPC frame (3,1), wait (1), set NPC frame (3,0), wait (1)
 	set NPC frame (3,1), wait (1), set NPC frame (3,0), wait (1)
 	show text box (1382), wait (7), wait for key (use key), advance text box
 	show text box (1383), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1384), wait (7), wait for key (use key), advance text box
 	set hero position (1, 13, 14), set hero position (2, 15, 14), set hero position (3, 14, 15)
 	wait (2), lock hero (hero:Freki), walk hero to y (1,10), walk hero to y (2,10)
 	walk hero to y (3,10), wait for hero (3)
 	show text box (1385), wait (7), wait for key (use key), advance text box
 	use shop (shop:Before Combat), wait (5),remember party
 	stop song, BossIntroduction , fight formation (2), stop song
 	swap by position (0, find hero (hero:Freki)), unlock hero (hero:Freki)
	set NPC frame (3,1), wait (1), set NPC frame (3,0), wait (1)
 	set NPC frame (3,1), wait (1), set NPC frame (3,0), wait (1)
 	show text box (1386), wait (7), wait for key (use key), advance text box
 	wait (15),	set NPC frame (3,1), wait (1), set NPC frame (3,0), wait (1)
 	set NPC frame (3,1), wait (1), set NPC frame (3,0), wait (1)
 	show text box (1387), wait (7), wait for key (use key), advance text box 
 	walk hero (1,down,5), walk hero (2,down,5), walk hero (3,down,5), wait (15)
 	show text box (1388), pancamera(up,1,20),waitforcamera
 	pancamera(down,2,20),waitforcamera, pancamera(up,2,20),waitforcamera
 	pancamera(down,1,20),waitforcamera , wait (7), wait for key (use key), advance text box
 	wait (5), walk NPC (6,down,10), walk NPC (5,right,4), wait for NPC (5), walk NPC (5,down,10), wait for NPC (5)
 	tweak palette (-10,-20,-10), fade screen in, wait (3)
 	play sound (sfx:earthquake,false,true) , pancamera(up,1,20),waitforcamera
 	pancamera(down,2,20),waitforcamera, pancamera(up,2,20),waitforcamera
 	pancamera(down,1,20),waitforcamera , pancamera(left,1,20),waitforcamera
 	pancamera(right,2,20),waitforcamera, pancamera(left,2,20),waitforcamera
 	pancamera(right,1,20),waitforcamera 
 	pan camera (up,1,20), pan camera (right,1,20), wait for camera
 	pan camera (down,2,20), pan camera (left,2,20), wait for camera
 	pan camera (up,2,20), pan camera (right,2,20), wait for camera
 	pan camera (down,1,20), pan camera (left,1,20), wait for camera
 	play sound (sfx:earthquake,false,true) , pancamera(up,1,20),waitforcamera
 	pancamera(down,2,20),waitforcamera, pancamera(up,2,20),waitforcamera
 	pancamera(down,1,20),waitforcamera , pancamera(left,1,20),waitforcamera
 	pancamera(right,2,20),waitforcamera, pancamera(left,2,20),waitforcamera
 	pancamera(right,1,20),waitforcamera 
 	pan camera (up,1,20), pan camera (right,1,20), wait for camera
 	pan camera (down,2,20), pan camera (left,2,20), wait for camera
 	pan camera (up,2,20), pan camera (right,2,20), wait for camera
 	pan camera (down,1,20), pan camera (left,1,20), wait for camera
 	play sound (sfx:nuclear,false,true) , pancamera(up,1,20),waitforcamera
 	pancamera(down,2,20),waitforcamera, pancamera(up,2,20),waitforcamera
 	pancamera(down,1,20),waitforcamera , pancamera(left,1,20),waitforcamera
 	pancamera(right,2,20),waitforcamera, pancamera(left,2,20),waitforcamera
 	pancamera(right,1,20),waitforcamera 
 	pan camera (up,1,20), pan camera (right,1,20), wait for camera
 	pan camera (down,2,20), pan camera (left,2,20), wait for camera
 	pan camera (up,2,20), pan camera (right,2,20), wait for camera
 	pan camera (down,1,20), pan camera (left,1,20), wait for camera
 	fade screen out (63,63,63), wait (1), set tag (tag:FENRIRBREAK,on)
 	wait for sound (sfx:nuclear), wait (4), reset palette, fade screen in, wait (4)
	set ambient music (song:In Soft Reflection), save map state (mapstate:all)
  	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1389), wait (7), wait for key (use key), advance text box 
 	show text box (1390), wait (7), wait for key (use key), advance text box 
 	show text box (1391), wait (7), wait for key (use key), advance text box 
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1392), wait (7), wait for key (use key), advance text box 
 	show text box (1393), wait (7), wait for key (use key), advance text box 
 	show text box (1394), wait (7), wait for key (use key), advance text box 
 	show text box (1395), wait (7), wait for key (use key), advance text box 
 	show text box (1403), wait (7), wait for key (use key), advance text box 
	wait (5), focus camera (14,9,2), wait for camera
 	camera follows hero (me), resume caterpillar, set caterpillar mode (off)
 	resume box advance, resume player, resume hero walls, encounters
end





script,Freya,begin
	remember party,suspend player,suspend box advance
	show text box (383), wait (7), wait for key (use key), advance text box
	fade screen out, wait (5)
	swap by position (0,find hero (hero:Freki)), set hero direction (me,up)
	use door (18), wait (5)
	show text box (3293), wait (7), wait for key (use key), advance text box 
	walk NPC (13,down,2), wait for NPC (13), set NPC direction (13,left)
	show text box (3294), wait (7), wait for key (use key), advance text box 
	show text box (3295), wait (7), wait for key (use key), advance text box 
	set NPC direction (0,right)
	show text box (3296), wait (7), wait for key (use key), advance text box 
	show text box (3297), wait (7), wait for key (use key), advance text box 
	walk NPC (13,right,7), wait (10)
	show text box (3298), wait (7), wait for key (use key), advance text box
	show text box (3299), wait (7), wait for key (use key), advance text box 
	set NPC direction (0,down), wait (5), set NPC direction (0,left), wait (5)
	show text box (3300), wait (7), wait for key (use key), advance text box  
	set NPC direction (0,down)
	show text box (3301), wait (7), wait for key (use key), advance text box  
	show text box (3302), wait (7), wait for key (use key), advance text box  
	show text box (3303), wait (7), wait for key (use key), advance text box  
	set NPC direction (0,left), set NPC direction (14,left), set NPC direction (11,down)
	show text box (3304), wait (7), wait for key (use key), advance text box  
	show text box (3305), wait (7), wait for key (use key), advance text box 
	set NPC direction (0,down), set NPC direction (11,right)
	show text box (3306), wait (7), wait for key (use key), advance text box
	show text box (3307), wait (7), wait for key (use key), advance text box
	wait (5), fade screen out, wait (5)
	show text box (3308), wait (2), fade screen in, wait (5)
	 wait for key (use key), advance text box 
	show text box (3309), wait (7), wait for key (use key), advance text box 
 	show text box (3310), wait (7), wait for key (use key), advance text box 
	show text box (3311), wait (7), wait for key (use key), fade screen out
	wait (5), advance text box, wait (5), fade screen in, wait (5)
 	walk NPC (11,right,1)
	show text box (3312), wait (7), wait for key (use key), advance text box 
	show text box (3313), wait (7), wait for key (use key), advance text box 
	show text box (3314), wait (7), wait for key (use key), advance text box 
	wait (5), fade screen out, wait (5)
	show text box (3315), wait (2),fade screen in, wait (5)
	 wait for key (use key), advance text box 
	show text box (3316), wait (7), wait for key (use key), advance text box 
	show text box (3317), wait (7), wait for key (use key), fade screen out
	wait (5), advance text box, wait (5), fade screen in, wait (5)
	show text box (3318), wait (7), wait for key (use key), advance text box 
	show text box (3319), wait (7), wait for key (use key), advance text box 
	show text box (3320), wait (7), wait for key (use key), advance text box 
	show text box (3321), wait (7), wait for key (use key), advance text box 
	wait (5), fade screen out, wait (5)
	show text box (3322), wait (2),fade screen in, wait (5)
	 wait for key (use key), advance text box 
	show text box (3323), wait (7), wait for key (use key), fade screen out
	wait (5), advance text box, wait (5), fade screen in, wait (5)
	show text box (3324), wait (7), wait for key (use key), advance text box 
	set NPC direction (11,down), set hero direction (me,left), set NPC direction (14,left)
	show text box (3325), wait (7), wait for key (use key), advance text box 
	show text box (3326), wait (7), wait for key (use key), advance text box 
	wait (5), set NPC direction (15,right), wait (5)
	show text box (3327), wait (7), wait for key (use key), advance text box 
	show text box (3328), wait (7), wait for key (use key), advance text box 
	show text box (3329), wait (7), wait for key (use key), advance text box 
	show text box (3330), wait (7), wait for key (use key), advance text box 
 	show text box (3331), wait (7), wait for key (use key), advance text box 
	set hero direction (me,up), set NPC direction (11,right), set NPC direction (14,up)
	show text box (3332), wait (7), wait for key (use key), advance text box 
	show text box (3333), wait (7), wait for key (use key), advance text box 
	show text box (3334), wait (7), wait for key (use key), advance text box 
	walk NPC (12,right,1), wait for NPC (12)
	show text box (3335), wait (7), wait for key (use key), advance text box 
	suspend hero walls
	fade screen out, wait (2),walk hero (me,up,1), wait for hero (me), resume hero walls
	set tag (tag:Speak with Freya, on), encounters
	wait (10), fade screen in,resume box advance, resume player
end

script,brising,begin
 	suspend player,	bifrostbeam (0)
 	fade screen out (63,63,63), wait (1), teleport to map (map:Bifrost Tesseract,26,44), reset palette
 	wait (1), fade screen in,	bifrostbeam (1)
	resume player, encounters, resume npcs
end

script,NIGHTTHUNDER,begin
 	suspend player,remember party, suspend box advance
 	swap by position (0, find hero (hero:Night)), teach spell ((find hero(hero:Night)),atk:Thunder)
 	set hero frame (me,1), wait (1)
 	set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1)
 	set hero frame (me,0), wait (1)
 	show text box (1440), wait (7), wait for key (use key), advance text box
 	show text box (1441), wait (7), wait for key (use key), advance text box
 	show text box (1442), wait (7), wait for key (use key), advance text box
 	show text box (1443), wait (7), wait for key (use key), advance text box
 	show text box (1444), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1)
 	set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1)
 	set hero frame (me,0), wait (1)
 	show text box (1445), wait (7), wait for key (use key), advance text box
 	show text box (1446), wait (7), wait for key (use key), advance text box
 	wait (3), tweak palette (10,0,0), update palette
 	play sound (sfx:ChargedLightningAttack8Bit,false,true), wait (10)
 	reset palette, fade screen in
 	show text box (1447), wait (7), wait for key (use key), advance text box
 	show text box (1448), wait (7), wait for key (use key), advance text box
 	play sound (sfx:lightning,false,true), fade screen out (63,63,63), wait (20)
 	set tag (tag:ThorLake2,on), wait (2), fade screen in
	reinstate party, resume box advance, resume player, encounters
end


script,Grue,begin
	remember party, suspend player, suspend box advance
 	BossIntroduction, fight formation (173)
 	resume player, resume box advance
end

script,MontereyPenguin,begin
	remember party, suspend player, suspend box advance
 	BossIntroduction  , fight formation (169)
 	resume player, resume box advance
end

script,Triangletrap,begin
	remember party, suspend player, suspend box advance
 	BossIntroduction, fight formation (59)
 	resume player, resume box advance
end

script,Garm,begin
	remember party, suspend player,suspend box advance
	 BossIntroduction, fight formation (98)
	 resume player, resume box advance
end

script,Chainsaw Jack,begin
	remember party, suspend player, suspend box advance
 	BossIntroduction, fight formation (105)
 	set tag (tag:stickman,on), resume player, resume box advance
end

script,Rell,begin
	remember party, suspend player, suspend box advance
 	swap by position (2, find hero (hero:Eric)), suspend caterpillar 
 	wait (1), set caterpillar mode (on), set hero position (1, 40, 17)
 	set hero position (2, 40, 17), set hero position (3, 40, 17)
 	wait (1), suspend caterpillar , walk hero (1,left), walk hero (2,right)
 	walk hero (3,up), wait for hero (1)
 	set hero direction (1,down), set hero direction (2,down), set hero direction (3,down)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (1940), wait (7), wait for key (use key), advance text box
 	show text box (1941), wait (7), wait for key (use key), advance text box
 	show text box (1942), wait (7), wait for key (use key), advance text box
 	show text box (1943), wait (7), wait for key (use key), advance text box
 	BossIntroduction, set tag (tag:RELLFIGHT,on), fight formation (106)
 	swap by position (2, find hero (hero:Eric)), wait (3), tweak palette (0,10,0)
 	update palette, play sound (sfx:DrainMagic,false,true)
 	teach spell ((find hero(hero:Eric)),atk:Rally), wait (10), reset palette, fade screen in
 	show text box (1944), wait (7), wait for key (use key), advance text box 
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (1945), wait (7), wait for key (use key), advance text box
 	walk hero (1,right,1), walk hero (2,left,1), walk hero (3,down,1)
 	wait for hero (3), set caterpillar mode (off), wait (1)
 	resume player, resume caterpillar,reinstate party , resume box advance, encounters
end

script,Crimson,begin
	remember party, suspend player, suspend box advance
 	walk hero (me,down,1), wait for hero (me)
 	show text box (2088), wait (7), wait for key (use key), advance text box
 	set hero direction (me,right)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2089), wait (7), wait for key (use key), advance text box
 	walk NPC (15,left,3), wait for NPC (3)
 	show text box (574), wait (7), wait for key (use key), advance text box
 	BossIntroduction , fight formation (107), set tag (tag:IrregularDefeated,on)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2090), wait (7), wait for key (use key), advance text box
 	stop song, fade screen out, wait (1)
 	show text box (2087), wait (2), fade screen in
 	wait (7), wait for key (use key), fade screen out
 	wait (1), advance text box, wait (2)
 	teleport to map (16,8,66), stop song, wait (1), fade screen in
 	play song (song:Vile), focus camera (8,71,4), wait for camera
 	show text box (2091), wait (7), wait for key (use key), advance text box
 	show text box (2092), wait (7), wait for key (use key), advance text box
 	show text box (2093), wait (7), wait for key (use key), advance text box
 	walk NPC (11,down,1), wait for NPC (11)
 	show text box (2094), wait (7), wait for key (use key), advance text box
 	tweak palette (-5,-10,-10), fade screen in, wait (5)
 	set NPC position (37,8,72), play sound (sfx:FlameMagic,false,true), wait (5)
 	set hero direction (me,down), reset palette, fade screen in, wait (5)
 	show text box (2095), wait (7), wait for key (use key), advance text box
 	show text box (2096), wait (7), wait for key (use key), advance text box
 	show text box (2097), wait (7), wait for key (use key), advance text box
 	tweak palette (15,0,0), update palette, wait (3), reset palette, update palette, wait (1)
 	show text box (2098), wait (7), wait for key (use key), advance text box
 	tweak palette (-5,-10,-10), play sound (sfx:FlameMagic,false,true), Alter NPC (37,NPCstat:picture,113)
 	Alter NPC (37,NPCstat:palette,10), fade screen in, wait (5), set NPC position (37,1,1)
 	wait (3), reset palette, fade screen in, wait (3), stop song
 	wait (2), set NPC position (30,8,79), walk NPC (30,up,7), wait for NPC (30)
 	set NPC position (26,8,72)  #Dogero 
	set NPC position (27,8,72)  #Housemaster
 	walk NPC (26,left), walk NPC (27,right), wait for NPC (16)
 	set NPC direction (26,up), set NPC direction (27,up)
 	show text box (2099), wait (7), wait for key (use key), advance text box
 	show text box (2100), wait (7), wait for key (use key), advance text box
 	walk NPC (11,up,1), set NPC direction (11,down)
 	show text box (2101), wait (7), wait for key (use key), advance text box
 	walk NPC (30,up,1), wait for NPC (30)
 	show text box (2102), wait (7), wait for key (use key), advance text box
 	show text box (2103), wait (7), wait for key (use key), advance text box
 	wait (4), set NPC direction (30,left), wait (4)
 	show text box (2104), wait (7), wait for key (use key), advance text box
 	set NPC direction (26,right)
 	show text box (2105), wait (7), wait for key (use key), advance text box
 	walk NPC (26,down,10), wait (4), walk NPC (11,down,1), wait for NPC (11)
 	show text box (2106), wait (7), wait for key (use key), advance text box
 	set NPC direction (30,left), wait (2), set NPC direction (30,down), wait (2)
 	show text box (2107), wait (7), wait for key (use key), advance text box
 	show text box (2108), wait (7), wait for key (use key), advance text box
 	wait (5), walk NPC (30,down,10), walk NPC (27,down,10)
 	wait (5), walk NPC (11,down,1), wait for NPC (11)
 	show text box (2109), wait (7), wait for key (use key), advance text box 
 	show text box (2110), wait (7), wait for key (use key), advance text box 
 	fade screen out, wait (1), camera follows hero (me), wait (1)
 	teleport to map (6,10,54), wait (1), fade screen in
 	resume player, resume box advance, encounters
end

script,Josh,begin
	remember party, suspend player, suspend box advance
 	BossIntroduction , fight formation (108)
 	resume player, resume box advance
end

script,Walrus,begin
	remember party, suspend player, suspend box advance
 	BossIntroduction, fight formation (110)
 	resume player, resume box advance
end

script,Surlaw,begin
	remember party, suspend player, suspend box advance
 	BossIntroduction, fight formation (111)
 	resume player, resume box advance
end

script,Deactivated,begin
	remember party, suspend player, suspend box advance, wait (1)
 	swap by position (0, find hero (hero:Bram)), swap by position (1, find hero (hero:Styrge))
 	set caterpillar mode (on), set hero position (1, 58, 30)
 	set hero position (2, 2, 2), set hero position (3, 3, 3)
 	wait (1), suspend caterpillar , walk hero (1,left,1), wait for hero (1)
 	set hero direction (1,down), wait (3), set hero direction (1,right), wait (3)
 	teach spell ((find hero(hero:Bram)),atk:Beam)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1449), wait (7), wait for key (use key), advance text box
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1450), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1451), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1452), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1453), wait (7), wait for key (use key), advance text box
 	play sound (sfx:Soft_Airy_Swish,false,true) 
 	show text box (1454), wait (7), wait for key (use key), advance text box
 	wait (3), tweak palette (10,0,0), update palette
 	play sound (sfx:Beam Attack,false,true), wait (10), reset palette, fade screen in
 	show text box (1455), wait (7), wait for key (use key), advance text box
 	set hero direction (me,down), wait (3), set hero direction (me,left), wait (3)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1456), wait (7), wait for key (use key), advance text box
 	play sound (sfx:Beam Attack,false,true), wait (10)
 	set hero direction (me,down), wait (2), set hero direction (me,right), wait (2)
 	BossIntroduction, fight formation (177)
 	swap by position (0, find hero (hero:Bram)), swap by position (1, find hero (hero:Styrge))
 	set tag (tag:deactivated,on), wait (3), tweak palette (10,0,0)
 	update palette, play sound (sfx:Beam Attack,false,true)
 	teach spell ((find hero(hero:Styrge)),atk:Mechbane), wait (10), reset palette, fade screen in
 	show text box (1460), wait (7), wait for key (use key), advance text box
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1457), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1458), wait (7), wait for key (use key), advance text box
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1459), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1461), wait (7), wait for key (use key), advance text box
 	walk hero (1,right,1), wait for hero (1), set caterpillar mode (off)
 	resume caterpillar,reinstate party, resume player, resume box advance, encounters
end


script,triangle1,begin
 	suspend player, suspend box advance,remember party 
 	focus camera (8,14,4), wait for camera, wait (3)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1469), wait (7), wait for key (use key), advance text box
 	walk NPC (0,down,7), wait (3), walk NPC (2,left,1), wait for NPC (2)
 	wait (3), set NPC direction (2,up)
 	set NPC frame (2,1), wait (1), set  NPC frame (2,0), wait (1)
 	set  NPC frame (2,1), wait (1), set  NPC frame (2,0), wait (1)
 	show text box (1470), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1471), wait (7), wait for key (use key), advance text box
 	walk hero (me,down,2), walk NPC (2,up,2), wait for hero (me)
 	set hero direction (me,right), set NPC direction (2,left)
 	set NPC frame (2,1), wait (1), set  NPC frame (2,0), wait (1)
 	set  NPC frame (2,1), wait (1), set  NPC frame (2,0), wait (1)
 	show text box (1472), wait (7), wait for key (use key), advance text box
 	show text box (1473), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1474), wait (7), wait for key (use key), advance text box
 	set NPC direction (2,down), wait (5), set NPC direction (2,right), wait (5)
 	set NPC frame (2,1), wait (1), set  NPC frame (2,0), wait (1)
 	set  NPC frame (2,1), wait (1), set  NPC frame (2,0), wait (1)
 	show text box (1475), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1476), wait (7), wait for key (use key), advance text box
 	set NPC frame (2,1), wait (1), set  NPC frame (2,0), wait (1)
 	set  NPC frame (2,1), wait (1), set  NPC frame (2,0), wait (1)
 	show text box (1477), wait (7), wait for key (use key), advance text box
 	suspend obstruction, wait (1), walk NPC (2,left,1)
 	wait for NPC (2), camera follows hero (me), unlock hero (hero:Styrge), encounters
 	set tag (tag:Styrgerejoins,on), resume box advance, resume player, resume obstruction
end

script,triangle2,begin
	remember party, suspend player, suspend box advance
 	suspend NPCs, focus camera (53,26,4), wait for camera
 	swap by position (0, find hero (hero:Styrge)), wait (1)
 	set caterpillar mode (on), set hero position (1, 53, 29)
 	set hero position (2, 53, 29), set hero position (3, 53, 29)
 	wait (1), suspend caterpillar , walk hero (1,left,1)
 	walk hero (2,right,1), walk hero (me,up,1), wait for hero (me)
 	set hero direction (1,up), set hero direction (2,up), wait (3)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1478), wait (7), wait for key (use key), advance text box
  	set NPC frame (9,1), wait (1), set  NPC frame (9,0), wait (1)
 	set  NPC frame (9,1), wait (1), set  NPC frame (9,0), wait (1)
 	show text box (1479), wait (7), wait for key (use key), advance text box
 	wait (5), set NPC direction (9,left), wait (5), set NPC direction (9,down)
 	show text box (1480), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1481), wait (7), wait for key (use key), advance text box
 	set NPC frame (9,1), wait (1), set  NPC frame (9,0), wait (1)
 	set  NPC frame (9,1), wait (1), set  NPC frame (9,0), wait (1)
 	show text box (1482), wait (7), wait for key (use key), advance text box
 	play song (song:Vile), fade screen out (63,63,63), wait (1)
 	Alter NPC (9,NPCstat:picture,4), Alter NPC (9,NPCstat:palette,147), wait (1)
 	fade screen in, wait (5)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1483), wait (7), wait for key (use key), advance text box
 	set NPC frame (9,1), wait (1), set  NPC frame (9,0), wait (1)
 	set  NPC frame (9,1), wait (1), set  NPC frame (9,0), wait (1)
 	show text box (1484), wait (7), wait for key (use key), advance text box
 	show text box (1485), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1486), wait (7), wait for key (use key), advance text box
 	set NPC frame (9,1), wait (1), set  NPC frame (9,0), wait (1)
 	set  NPC frame (9,1), wait (1), set  NPC frame (9,0), wait (1)
 	show text box (1487), wait (7), wait for key (use key), advance text box
 	walk NPC (9,down,1), wait for NPC (9)
 	set NPC frame (9,1), wait (1), set  NPC frame (9,0), wait (1)
 	set  NPC frame (9,1), wait (1), set  NPC frame (9,0), wait (1)
 	show text box (1488), wait (7), wait for key (use key), advance text box
 	walk hero (me,up,1), wait for hero (me)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1489), wait (7), wait for key (use key), advance text box
 	show text box (1490), wait (7), wait for key (use key), advance text box
 	fade screen out, wait (1)
 	show text box (1491), wait (1), fade screen in, wait (7), wait for key (usekey)
 	show text box (1492), wait (7), wait for key (use key), fade screen out
 	wait (1), advance text box, wait (1), fade screen in, wait (3)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1493), wait (7), wait for key (use key), advance text box
 	show text box (1494), wait (7), wait for key (use key), advance text box
 	set NPC frame (9,1), wait (1), set  NPC frame (9,0), wait (1)
 	set  NPC frame (9,1), wait (1), set  NPC frame (9,0), wait (1)
 	show text box (1495), wait (7), wait for key (use key), advance text box
 	walk hero (1,up,1), wait for hero (1), set hero frame (1,1), wait (1)
 	set hero frame (1,0), wait (1), set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1496), wait (7), wait for key (use key), advance text box
 	set NPC frame (9,1), wait (1), set  NPC frame (9,0), wait (1)
 	set  NPC frame (9,1), wait (1), set  NPC frame (9,0), wait (1)
 	show text box (1497), wait (7), wait for key (use key), advance text box
 	walk hero (2,up,1), wait for hero (2)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (1498), wait (7), wait for key (use key), advance text box
 	set NPC frame (9,1), wait (1), set  NPC frame (9,0), wait (1)
 	set  NPC frame (9,1), wait (1), set  NPC frame (9,0), wait (1)
 	show text box (1499), wait (7), wait for key (use key), advance text box
 	walk hero (3,up,1), wait for hero (3)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show text box (1500), wait (7), wait for key (use key), advance text box
 	set NPC direction (9,left), wait (5), set NPC direction (9,up), wait (5)
 	set NPC frame (9,1), wait (1), set  NPC frame (9,0), wait (1)
 	set  NPC frame (9,1), wait (1), set  NPC frame (9,0), wait (1)
 	show text box (1501), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1502), wait (7), wait for key (use key), advance text box
 	set NPC frame (9,1), wait (1), set  NPC frame (9,0), wait (1)
 	set  NPC frame (9,1), wait (1), set  NPC frame (9,0), wait (1)
 	show text box (1503), wait (7), wait for key (use key), advance text box
 	set NPC direction (9,left), wait (3), set NPC direction (9,down), wait (3)
 	show text box (1504), wait (7), wait for key (use key), advance text box
 	BossIntroduction, fight formation (193), swap by position (0, find hero (hero:Styrge))
 	Alter NPC (9,NPCstat:picture,253), Alter NPC (9,NPCstat:palette,296)
 	show text box (3857), wait (7), wait for key (use key), advance text box
	suspend obstruction, suspend NPC walls,set npc position (9,0,0)
	set npc position (12,53,26),set npc position (13,53,26),set npc position (14,53,26),set npc position (15,53,26),
	set npc position (16,53,26),set npc position (17,53,26),set npc position (18,53,26),set npc position (19,53,26),
	set npc position (20,53,26),set npc position (21,53,26),set npc position (22,53,26),set npc position (23,53,26),
 	play sound (sfx:BossDeath,false,true)
	walk NPC (12,left,20), walk NPC (13,up,20), walk NPC (14,right,20), walk NPC (15,down,20)
	walk NPC (16,left,20), walk NPC (17,up,20), walk NPC (18,right,20), walk NPC (19,down,20)
	walk NPC (20,left,20), walk NPC (20,up,20), walk NPC (21,right,20), walk NPC (21,up,20)
	walk NPC (22,left,20), walk NPC (22,down,20), walk NPC (23,right,20), walk NPC (23,down,20)
	wait for NPC (23), set tag (tag:Guiltdefeated,on)
 	resume NPCs, resume obstruction, resume NPC walls
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1505), wait (7), wait for key (use key), advance text box
 	tweak palette (10,10,10), play sound (sfx:Heal8Bit,false,true)
 	force equip (0,slot:weapon,item:Forseti), wait (1), delete item (item:Cursed,1)
 	wait (1), reset palette, fade screen in
 	show text box (1506), wait (7), wait for key (use key), advance text box
 	wait (5), fade screen out (63,63,63), wait (2)
 	focus camera (50,15,4), wait for camera, set caterpillar mode (off), resume caterpillar
 	set hero position (me, 47, 15), set hero direction (me,right), fade screen in
 	show text box (1507), wait (7), wait for key (use key), advance text box
 	show text box (1508), wait (7), wait for key (use key), advance text box
 	show text box (1509), wait (7), wait for key (use key), advance text box
 	show text box (3522), wait (7), wait for key (use key), advance text box
 	show text box (3523), wait (7), wait for key (use key), advance text box
 	show text box (3524), wait (7), wait for key (use key), advance text box
 	show text box (3525), wait (7), wait for key (use key), advance text box
 	show text box (3526), wait (7), wait for key (use key), advance text box
 	show text box (3527), wait (7), wait for key (use key), advance text box
 	show text box (3528), wait (7), wait for key (use key), advance text box
 	show text box (3529), wait (7), wait for key (use key), advance text box
 	show text box (3530), wait (7), wait for key (use key), advance text box
 	show text box (1510), wait (7), wait for key (use key), advance text box
 	wait (5), fade screen out, wait (1)
 	camera follows hero (me), wait (1), use door (3),play song (song:Asgard)
 	show text box (3531), wait (7), wait for key (use key), advance text box
 	show text box (3532), wait (7), wait for key (use key), advance text box
 	show text box (3533), wait (7), wait for key (use key), advance text box
 	show text box (3534), wait (7), wait for key (use key), advance text box
 	show text box (3535), wait (7), wait for key (use key), advance text box
 	show text box (3536), wait (7), wait for key (use key), advance text box
 	show text box (3537), wait (7), wait for key (use key), advance text box
	walk NPC (20,right,2), wait for NPC (20), walk NPC (20,up,1), wait for NPC (20)
	walk NPC (20,right,2), wait for NPC (20), walk NPC (20,up,1), wait for NPC (20)
	set NPC direction (17,left), set NPC direction (18,left)
 	show text box (3538), wait (7), wait for key (use key), advance text box
	wait (5),set NPC direction (17,right), set NPC direction (18,right), wait (5)
 	show text box (3539), wait (7), wait for key (use key), advance text box
	walk NPC (20,right,3), wait for NPC (20), walk NPC (20,up,1), wait for NPC (20)
	walk NPC (20,right,3), wait for NPC (20), walk NPC (20,down,2), wait for NPC (20)
	walk NPC (20,right,2), wait for NPC (20), set NPC direction (20,down)
 	show text box (3540), wait (7), wait for key (use key), advance text box
 	show text box (3541), wait (7), wait for key (use key), advance text box
 	show text box (3542), wait (7), wait for key (use key), advance text box
	wait (5), set NPC direction (20,left), wait (5)
 	show text box (3543), wait (7), wait for key (use key), advance text box
	wait (5), set NPC direction (17,down), wait (5)
 	show text box (3544), wait (7), wait for key (use key), advance text box
	wait (40),  show text box (3545), wait (7), wait for key (any key), advance text box
	fade screen out, wait (5), 	set tag (tag:BATH,on)
	walk hero (me,up,1), set hero direction (me,down)
	wait (5), use door (24), fade screen in
	reinstate party, resume box advance, resume NPCs, resume player, encounters
end

script,fiends1,begin
	remember party, suspend player, suspend box advance, focus camera (9,79,4)
 	wait for camera, wait (5)
 	show text box (1511), wait (7), wait for key (use key), advance text box, encounters
 	focus camera (9,85,4), wait for camera, camera follows hero (me), resume box advance, resume player
end

script,fiends2,begin
	remember party, suspend player, suspend box advance, wait (5)
 	set hero direction (me,left), wait (5)
 	set hero direction (me,right), wait (5), set hero direction (me,left), wait (5)
 	set hero direction (me,right), wait (5), set hero direction (me,left), wait (5)
 	set hero direction (me,right), wait (5), set hero direction (me,down)
 	show text box (1512), wait (7), wait for key (use key), advance text box
 	resume box advance, resume player, resume random enemies, resume obstruction, encounters
end

script,Hatifinal,begin
	remember party, suspend player, suspend NPCs, suspend box advance
 	set NPC frame (9,1), wait (1), set  NPC frame (9,0), wait (1)
 	set  NPC frame (9,1), wait (1), set  NPC frame (9,0), wait (1)
 	show text box (1513), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1514), wait (7), wait for key (use key), advance text box
 	set NPC frame (9,1), wait (1), set  NPC frame (9,0), wait (1)
 	set  NPC frame (9,1), wait (1), set  NPC frame (9,0), wait (1)
 	show text box (1515), wait (7), wait for key (use key), advance text box
 	wait (5), set NPC direction (9,right)
 	wait (5), set NPC direction (9,up), wait (5)
 	set NPC frame (9,1), wait (1), set  NPC frame (9,0), wait (1)
 	set  NPC frame (9,1), wait (1), set  NPC frame (9,0), wait (1)
 	show text box (1516), wait (7), wait for key (use key), advance text box
 	show text box (1517), wait (7), wait for key (use key), advance text box
 	show text box (1518), wait (7), wait for key (use key), advance text box
 	set NPC direction (9,right)
 	show text box (1519), wait (7), wait for key (use key), advance text box
 	show text box (1520), wait (7), wait for key (use key), advance text box
# hati goes to the moon now
 	play sound (sfx:wind,false,true), fade screen out (63,63,63), wait (15)
 	camera follows hero (me), swap by position (0, find hero (hero:Night))
 	swap out hero (hero:Kitt), swap out hero (hero:Styrge), swap out hero (hero:Bram)
 	swap out hero (hero:Eric), swap out hero (hero:Hilda), swap out hero (hero:Olaf)
 	swap out hero (hero:Frumpy), swap out hero (hero:Freki), swap out hero (hero:Renard)
	remember party, wait (5),remember party, use door (6)
 	wait (3), walk NPC (0,right,3), wait for NPC (0), wait (5)
 	set NPC frame (0,1), wait (1), set  NPC frame (0,0), wait (1)
 	set  NPC frame (0,1), wait (1), set  NPC frame (0,0), wait (1)
 	show text box (1521), wait (7), wait for key (use key), advance text box
 	wait (5), set NPC direction (0,up), wait (10)
 	set NPC direction (0,right), wait (3)
 	set NPC frame (0,1), wait (1), set  NPC frame (0,0), wait (1)
 	set  NPC frame (0,1), wait (1), set  NPC frame (0,0), wait (1)
 	show text box (1522), wait (7), wait for key (use key), advance text box
 	wait (10), stop song, walk NPC (0,right,1), wait for NPC (0), wait (3)
 	set NPC frame (0,1), wait (1), set  NPC frame (0,0), wait (1)
 	set  NPC frame (0,1), wait (1), set  NPC frame (0,0), wait (1)
 	show text box (1523), wait (7), wait for key (use key), advance text box
 	wait (10), play song (song:In Soft Reflection), wait (10)
 	set NPC direction (1,right), wait (10)
 	set NPC frame (1,1), wait (1), set  NPC frame (1,0), wait (1)
 	set  NPC frame (1,1), wait (1), set  NPC frame (1,0), wait (1)
 	show text box (1524), wait (7), wait for key (use key), advance text box
 	show text box (1525), wait (7), wait for key (use key), advance text box
 	set NPC direction (1,down), wait (3), set NPC direction (1,left), wait (3)
 	set NPC frame (1,1), wait (1), set  NPC frame (1,0), wait (1)
 	set  NPC frame (1,1), wait (1), set  NPC frame (1,0), wait (1)
 	show text box (1526), wait (7), wait for key (use key), advance text box
 	walk NPC (1,left,1)
 	show text box (1527), wait (7), wait for key (use key), advance text box
 	wait (5), walk NPC (0,right,1), wait for NPC (0), wait (3)
 	set NPC frame (0,1), wait (1), set  NPC frame (0,0), wait (1)
 	set  NPC frame (0,1), wait (1), set  NPC frame (0,0), wait (1)
 	show text box (1528), wait (7), wait for key (use key), advance text box
 	set NPC frame (1,1), wait (1), set  NPC frame (1,0), wait (1)
 	set  NPC frame (1,1), wait (1), set  NPC frame (1,0), wait (1)
 	show text box (1529), wait (7), wait for key (use key), advance text box
 	set NPC frame (0,1), wait (1), set  NPC frame (0,0), wait (1)
 	set  NPC frame (0,1), wait (1), set  NPC frame (0,0), wait (1)
 	show text box (1530), wait (7), wait for key (use key), advance text box
 	set NPC direction (0,down), wait (3), set NPC direction (0,left), wait (3)
 	set NPC frame (0,1), wait (1), set  NPC frame (0,0), wait (1)
 	set  NPC frame (0,1), wait (1), set  NPC frame (0,0), wait (1)
 	show text box (1531), wait (7), wait for key (use key), advance text box
 	show text box (1532), wait (7), wait for key (use key), advance text box
 	show text box (1533), wait (7), wait for key (use key), advance text box
 	walk NPC (1,left,1), wait for NPC (1)
 	set NPC frame (1,1), wait (1), set  NPC frame (1,0), wait (1)
 	set  NPC frame (1,1), wait (1), set  NPC frame (1,0), wait (1)
 	show text box (1534), wait (7), wait for key (use key), advance text box
 	set NPC direction (0,down), wait (3), set NPC direction (0,right), wait (3)
 	set NPC frame (0,1), wait (1), set  NPC frame (0,0), wait (1)
 	set  NPC frame (0,1), wait (1), set  NPC frame (0,0), wait (1)
 	show text box (1535), wait (7), wait for key (use key), advance text box
 	fade screen out, wait (2), set NPC position (0, 14, 6), set NPC position (1, 13, 6)
 	set NPC direction (0,left), set NPC direction (1,right), wait (2)
 	fade screen in, wait (5), set NPC frame (0,1), wait (1)
 	set  NPC frame (0,0), wait (1), set  NPC frame (0,1), wait (1)
 	set  NPC frame (0,0), wait (1), set NPC frame (1,1), wait (1)
 	set  NPC frame (1,0), wait (1), set  NPC frame (1,1), wait (1)
 	set  NPC frame (1,0), wait (1), set NPC frame (1,1), wait (1)
 	set  NPC frame (1,0), wait (1), set  NPC frame (1,1), wait (1)
 	set  NPC frame (1,0), wait (1), set NPC frame (0,1), wait (1)
 	set NPC direction (1,up), wait (7), set NPC direction (1,right), wait (5)
 	fade screen out, wait (2), set NPC position (0, 2, 8)
 	set NPC position (1, 2, 7), set NPC direction (0,up), set NPC direction (1,down)
 	wait (2), fade screen in, wait (5), walk NPC (5,up,4), wait (5)
 	set NPC direction (0,right), set NPC direction (1,right)
 	wait for NPC (5), play sound (sfx:Beam Attack,false,true), wait (10)
 	set NPC direction (0,up), set NPC direction (1,down), wait (10) 
 	set NPC direction (0,right), set NPC direction (1,right), wait (3)
 	walk NPC (0,right,1), walk NPC (1,right,1), wait for NPC (0)
 	walk NPC (5,right,1), wait for NPC (5), wait (3)
 	set NPC direction (0,up), set NPC direction (1,down), wait (10) 
 	set NPC direction (0,right), set NPC direction (1,right), wait (3)
 	set NPC frame (5,1), wait (1), set  NPC frame (5,0), wait (1)
 	set  NPC frame (5,1), wait (1), set  NPC frame (5,0), wait (1)
 	play sound (sfx:Beam Attack,false,true), wait (10)
 	walk NPC (0,right,5), walk NPC (1,right,1), walk NPC (5,right,5)
 	wait for NPC (5), walk NPC (5,down,4), wait (3)
 	set NPC direction (0,down), wait for NPC (5), wait (3)
 	fade screen out, wait (2), set NPC position (0, 7, 5), set NPC position (1, 8, 5)
 	set NPC direction (0,up), set NPC direction (1,up) 
 	set NPC position (3, 0, 2), set NPC direction (3,right)
 	wait (2), fade screen in, wait (2), walk NPC (3,right,3), wait for NPC (3)
 	walk NPC (3,right,2), walk NPC (3,up,1), wait for NPC (3), walk NPC (3,right,3)
 	wait for NPC (3), walk NPC (3,right,2), walk NPC (3,down,1), wait for NPC (3)
 	walk NPC (3,right,3), wait for NPC (3), wait (5), Alter NPC (3,NPCstat:move speed,5)
 	set NPC position (4, 15, 2), wait (3), walk NPC (3,left,10), walk NPC (4,left,10)
 	wait for NPC (3), fade screen out, wait (2), set NPC position (0, 12, 4)
 	set NPC position (1, 8, 5), set NPC direction (0,left), set NPC direction (1,right) 
 	wait (2), set NPC position (3, 0, 11), set NPC position (4, 1, 11), wait (2)
 	fade screen in, Alter NPC (0,NPCstat:move speed,2), Alter NPC (1,NPCstat:move speed,2)
 	wait (5), walk NPC (0,up,2), set NPC direction (0,left)
 	wait for NPC (0), wait (2), walk NPC (0,down,2)
 	set NPC direction (0,left), wait for NPC (0), wait (5)
 	walk NPC (1,up,2), set NPC direction (1,right), wait for NPC (1)
 	wait (2), walk NPC (1,down,2), set NPC direction (1,right)
 	wait for NPC (1), wait (5), walk NPC (0,up,2)
 	set NPC direction (0,left), wait for NPC (0), wait (2)
 	walk NPC (0,down,2), set NPC direction (0,left), wait for NPC (0)
 	wait (5), walk NPC (1,up,2), set NPC direction (1,right)
 	wait for NPC (1), wait (2), walk NPC (1,down,2)
 	set NPC direction (1,right), wait for NPC (1), wait (5), walk NPC (0,up,4)
 	set NPC direction (0,left), wait for NPC (0), wait (5)
 	set NPC direction (0,down), wait (2), Alter NPC (0,NPCstat:move speed,4)
 	Alter NPC (1,NPCstat:move speed,5), walk NPC (1,right,4), wait for NPC (1)
 	set NPC direction (1,up), wait (5)
 	set NPC frame (0,1), wait (1), set  NPC frame (0,0), wait (1)
 	set  NPC frame (0,1), wait (1), set  NPC frame (0,0), wait (1) 
 	walk NPC (1,up,2), wait for NPC (1), wait (1)
 	walk NPC (1,down,2), set NPC direction (1,up), wait for NPC (1)
 	wait (1) , walk NPC (1,up,2), wait for NPC (1)
 	wait (1), walk NPC (1,down,2), set NPC direction (1,up)
 	wait for NPC (1), wait (1) , walk NPC (1,up,2)
 	wait for NPC (1), wait (1), walk NPC (1,down,2)
 	set NPC direction (1,up), wait for NPC (1), fade screen out
 	wait (2), set NPC position (0, 7, 6), set NPC position (1, 8, 6)
 	set NPC direction (0,up), set NPC direction (1,up), wait (2)
 	fade screen in, wait (2), walk NPC (1,up,1), wait for NPC (1)
 	set NPC frame (1,1), wait (1), set  NPC frame (1,0), wait (1)
 	set  NPC frame (1,1), wait (1), set  NPC frame (1,0), wait (1)
 	show text box (1536), wait (7), wait for key (use key), advance text box
 	set NPC frame (0,1), wait (1), set  NPC frame (0,0), wait (1)
 	set  NPC frame (0,1), wait (1), set  NPC frame (0,0), wait (1)
 	show text box (1537), wait (7), wait for key (use key), advance text box
 	wait (3), set NPC direction (1,left), wait (3)
 	set NPC frame (1,1), wait (1), set  NPC frame (1,0), wait (1)
 	set  NPC frame (1,1), wait (1), set  NPC frame (1,0), wait (1)
 	show text box (1538), wait (7), wait for key (use key), advance text box
 	walk NPC (0,up,1), wait for NPC (0), set NPC direction (0,right)
 	set NPC frame (0,1), wait (1), set  NPC frame (0,0), wait (1)
 	set  NPC frame (0,1), wait (1), set  NPC frame (0,0), wait (1)
 	show text box (1539), wait (7), wait for key (use key), advance text box
 	set NPC frame (0,1), wait (1), set  NPC frame (0,0), wait (1)
 	set  NPC frame (0,1), wait (1), set  NPC frame (0,0), wait (1)
 	show text box (1540), wait (7), wait for key (use key), advance text box
 	set NPC frame (1,1), wait (1), set  NPC frame (1,0), wait (1)
 	set  NPC frame (1,1), wait (1), set  NPC frame (1,0), wait (1)
 	show text box (1541), wait (7), wait for key (use key), advance text box
# It's time to fight Hati one more time, and regain Night for good!
 	BossIntroduction, fight formation (195)
# Congrats! You did it!
	wait (3), tweak palette (10,0,0), update palette
 	play sound (sfx:ChargedSonicBoomAttack8Bit,false,true)
 	wait (10), reset palette, fade screen in
	show text box (3976), wait (7), wait for key (use key), advance text box
#You gon get a lotta magic now
# Specifically, Fire3, Ice3, Bolt3, and Flare
	 show text box (3973), wait (7), wait for key (use key), advance text box
	 show text box (3974), wait (7), wait for key (use key), advance text box
	 show text box (3975), wait (7), wait for key (use key), advance text box
	 show text box (1542), wait (7), wait for key (use key), advance text box
# also you're going to get the Laevetain, Night's best rod
	show text box (3764), wait (7), wait for key (use key), advance text box
 	teach spell ((find hero(hero:Night)),atk:Exploder)
 	teach spell ((find hero(hero:Night)),atk:Blaster)
 	teach spell ((find hero(hero:Night)),atk:Freezer)
 	teach spell ((find hero(hero:Night)),atk:Flare)
 	show text box (3765), wait (7), wait for key (use key), advance text box
 	set NPC frame (0,1), wait (1), set  NPC frame (0,0), wait (1)
 	set  NPC frame (0,1), wait (1), set  NPC frame (0,0), wait (1)
 	show text box (3766), wait (7), wait for key (use key), advance text box
 	show text box (3767), wait (7), wait for key (use key), advance text box
 	wait (5), set NPC direction (0,down), wait (5)
 	show text box (3768), wait (7), wait for key (use key), advance text box
 	wait (5), set NPC direction (0,right), wait (5)
 	show text box (1543), wait (7), wait for key (use key), advance text box
 	set NPC frame (1,1), wait (1), set  NPC frame (1,0), wait (1)
 	set  NPC frame (1,1), wait (1), set  NPC frame (1,0), wait (1)
 	show text box (1544), wait (7), wait for key (use key), advance text box
 	set NPC frame (0,1), wait (1), set  NPC frame (0,0), wait (1)
 	set  NPC frame (0,1), wait (1), set  NPC frame (0,0), wait (1)
 	show text box (1545), wait (7), wait for key (use key), advance text box
 	wait (5), fade screen out (63,63,63), wait (15)
	set hero picture (find hero (hero:Night),23,insidebattle),set hero palette (find hero (hero:Night),346,insidebattle)
	set hero picture (find hero (hero:Night),315,outsidebattle),set hero palette (find hero (hero:Night),346,outsidebattle)
	set hero picture (find hero (hero:Night),163,hero portrait),set hero palette (find hero (hero:Night),346,hero portrait)
 	wait (5), walk hero (me,right,1), wait (5), use door (1), wait (2)
 	set NPC position (15,0,0), focus camera (27,13, 10), wait for camera
	set hero position (me,29,11), set hero direction (me,left), wait (5)
 	fade screen in, wait (1), walk NPC (10,right,1)
 	show text box (3551), wait (7), wait for key (use key), advance text box
 	show text box (3552), wait (7), wait for key (use key), advance text box
 	show text box (3553), wait (7), wait for key (use key), advance text box
	set hero direction ( me, down)
 	show text box (3554), wait (7), wait for key (use key), advance text box
 	show text box (3555), wait (7), wait for key (use key), advance text box
	set hero direction ( me, left)
 	show text box (3556), wait (7), wait for key (use key), advance text box
 	show text box (3557), wait (7), wait for key (use key), advance text box
 	show text box (3558), wait (7), wait for key (use key), advance text box
 	show text box (3559), wait (7), wait for key (use key), advance text box
 	show text box (3560), wait (7), wait for key (use key), advance text box
	walk hero (me,left,1)
 	show text box (3561), wait (7), wait for key (use key), advance text box
 	show text box (3562), wait (7), wait for key (use key), advance text box
 	show text box (3563), wait (7), wait for key (use key), advance text box
 	show text box (3564), wait (7), walk NPC (16,left,2), wait for NPC (16)
	walk NPC (16,down,2), wait for NPC (16)
	walk NPC (16,left,3), wait for NPC (16)
	set hero direction (me,down), set NPC direction (10,down), set NPC direction (11,down)
	set NPC direction (12,down), set NPC direction (13,down)
	set NPC direction (14,down), set NPC direction (17,down)
	walk NPC (16,down, 5) wait for key (use key), advance text box
 	show text box (3565), wait (7), wait for key (use key), advance text box
	fade screen out, wait (5),  set tag (tag:nightback,on), camera follows hero (me),
	wait (5), fade screen in, wait (5)
 	show text box (1050), wait (7), wait for key (use key), advance text box
 	resume random enemies, resume obstruction,resume player,resume box advance, encounters, resume NPCs
end

script,zidane,begin
	remember party, show textbox (1547), wait (16), walk hero (me,down,3)
 	walk NPC (25,down,3), wait for NPC (25), walk NPC (25,up,3)
 	wait for NPC (25), resume random enemies, resume obstruction
end

script,EricSILENCE,begin
	remember party, suspend player, suspend box advance
	swap by position (0, find hero (hero:Eric)), wait (1)
 	show text box (1577), wait (7), wait for key (usekey), advance text box
 	show text box (1578), wait (7), wait for key (usekey), advance text box
 	set hero direction (me,down), wait (10)
 	set hero z (me,5), wait (2),set hero z (me,10), wait (2)
 	set hero z (me,5), wait (2), set hero z (me,0), wait (2)
 	set hero direction (me,up), wait (5)
 	show text box (1579), wait (7), wait for key (usekey), advance text box
 	wait (1), set tag (tag:EricSilen,on), wait (1)
 	fade screen in, wait (2), tweak palette (10,0,0), update palette
 	teach spell ((find hero(hero:Eric)),atk:Silence), wait (10), reset palette, fade screen in
 	show text box (1580), wait (7), wait for key (use key), advance text box
 	fade screen out (63,63,63), wait (1), resume box advance, wait (2)
 	fade screen in, wait (2), resume player
 	resume random enemies, resume obstruction,reinstate party
end

# Note that this will NOW also swap the party around to whoever you previously had!

script, BossIntroduction,begin
 #The new boss fight effect!
 	show text box (1361)
 	play sound (sfx:WARNING,false,true) 
 	wait (20)
 	advance textbox
 	Variable (var1) 
 	Variable (var2) 
 #This next script part was originally done by Mad Cacti.
 #Truthfully, I have no idea what's going on here.
 #Seriously.  But you should always try to indicate to the player that something BIG is coming.
 	wait (3) 
 	For (var1,0,2,1) 
 	Do(for(var2,0,255,1) 
 	Do(Write color (var2,var1,63--read color (var2,var1)))) 
 	Fade screen in 
 	wait (1)
 	reset palette
 #After the nifty color inverting takes place, we've got a battle to fight!  
	swap by name (hero by slot(0),spot0)
	swap by name (hero by slot(1),spot1)
	swap by name (hero by slot(2),spot2)
	swap by name (hero by slot(3),spot3)
end

script,Dogero,begin
	remember party, suspend player, suspend box advance
 	walk hero to y (me,22), wait for hero (me)
 	walk hero to x (me,12) , wait for hero (me)
 	wait (3), pan camera (down,1), set caterpillar mode (on)
 	set hero position (1, 12, 22), set hero position (2, 12, 22)
 	set hero position (3, 12, 22), wait (1), suspend caterpillar 
 	wait (1), walk hero (1,left,1), walk hero (2,right,1)
 	walk hero (3,down,1), wait for hero (1), set hero direction (0,up)
 	set hero direction (1,up), set hero direction (2,up), set hero direction (3,up)
 	set NPC frame (6,1), wait (1), set  NPC frame (6,0), wait (1)
 	set  NPC frame (6,1), wait (1), set  NPC frame (6,0), wait (1)
 	show text box (1554), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1555), wait (7), wait for key (use key), advance text box
 	set NPC frame (6,1), wait (1), set  NPC frame (6,0), wait (1)
 	set  NPC frame (6,1), wait (1), set  NPC frame (6,0), wait (1)
 	show text box (1556), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1557), wait (7), wait for key (use key), advance text box
 	set NPC frame (6,1), wait (1), set  NPC frame (6,0), wait (1)
 	set  NPC frame (6,1), wait (1), set  NPC frame (6,0), wait (1)
 	show text box (1558), wait (7), wait for key (use key), advance text box
 	show text box (1559), wait (7), wait for key (use key), advance text box
 	set NPC direction (6,left), wait (5), set NPC direction (6,up), wait (5)
 	set NPC frame (6,1), wait (1), set  NPC frame (6,0), wait (1)
 	set  NPC frame (6,1), wait (1), set  NPC frame (6,0), wait (1)
 	show text box (1560), wait (7), wait for key (use key), advance text box
 	show text box (1561), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1562), wait (7), wait for key (use key), advance text box
 	set NPC direction (6,left), wait (5), set NPC direction (6,down), wait (5)
 	set NPC frame (6,1), wait (1), set  NPC frame (6,0), wait (1)
 	set  NPC frame (6,1), wait (1), set  NPC frame (6,0), wait (1)
 	show text box (1563), wait (7), wait for key (use key), advance text box
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (1564), wait (7), wait for key (use key), advance text box
 	show text box (1565), wait (7), wait for key (use key), advance text box
# Mila joins in on the fun!
 	walk NPC (7,up,9)
 	show text box (1566), wait (7), wait for key (use key), advance text box
 	walk NPC (9,left,3), set hero direction (2,right)
 	set hero direction (3,down), wait for NPC (7)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (1567), wait (7), wait for key (use key), advance text box
 	set NPC frame (6,1), wait (1), set  NPC frame (6,0), wait (1)
 	set  NPC frame (6,1), wait (1), set  NPC frame (6,0), wait (1)
 	show text box (1568), wait (7), wait for key (use key), advance text box
 	show text box (1569), wait (7), wait for key (use key), advance text box
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1570), wait (7), wait for key (use key), advance text box
 	wait (10), set NPC direction (6,left), wait (5)
 	walk NPC (6,left,1), wait for NPC (6)
 	set NPC frame (6,1), wait (1), set  NPC frame (6,0), wait (1)
 	set  NPC frame (6,1), wait (1), set  NPC frame (6,0), wait (1)
 	show text box (1571), wait (7), wait for key (use key), advance text box
 	set hero direction (1,left), walk NPC (8,right,4)
 	walk NPC (6,right,1), wait for NPC (6), set NPC direction (6,down) 
 	set NPC frame (7,1), wait (1), set  NPC frame (7,0), wait (1)
 	set  NPC frame (7,1), wait (1), set  NPC frame (7,0), wait (1)
 	show text box (1595), wait (7), wait for key (use key), advance text box
 	set NPC frame (6,1), wait (1), set  NPC frame (6,0), wait (1)
 	set  NPC frame (6,1), wait (1), set  NPC frame (6,0), wait (1)
 	show text box (1596), wait (7), wait for key (use key), advance text box
 	set NPC frame (6,1), wait (1), set  NPC frame (6,0), wait (1)
 	set  NPC frame (6,1), wait (1), set  NPC frame (6,0), wait (1)
 	show text box (1597), wait (7), wait for key (use key), advance text box
 	BossIntroduction, fight formation (87), play song (song:In Soft Reflection)
 	wait (5), Alter NPC (6,NPCstat:picture,156), Alter NPC (6,NPCstat:palette,82)
 	set hero direction (1,up), set hero direction (2,up), set hero direction (3,up)
	set NPC frame (6,1), wait (1), set  NPC frame (6,0), wait (1)
 	set  NPC frame (6,1), wait (1), set  NPC frame (6,0), wait (1)
 	show text box (1598), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (1599), wait (7), wait for key (use key), advance text box
 	wait (4), set NPC direction (6,up), wait (4)
 	show text box (1600), wait (7), wait for key (use key), advance text box
 	walk NPC (7, left,2), wait for NPC (7), walk NPC (7,up,4)
 	wait for NPC (7), set NPC direction (7,right)
 	set NPC frame (7,1), wait (1), set  NPC frame (7,0), wait (1)
 	set  NPC frame (7,1), wait (1), set  NPC frame (7,0), wait (1)
 	show text box (1601), wait (7), wait for key (use key), advance text box
 	show text box (1602), wait (7), wait for key (use key), advance text box
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (1603), wait (7), wait for key (use key), advance text box
 	wait (4), set NPC direction (6,down), wait (4)
 	show text box (1604), wait (7), wait for key (use key), advance text box
 	show text box (1605), wait (7), wait for key (use key), advance text box
 	show text box (1606), wait (7), wait for key (use key), advance text box
 	wait (4), set NPC direction (6,up), wait (4)
 	show text box (1607), wait (7), wait for key (use key), advance text box
 	wait (4), Alter NPC (6,NPCstat:move speed,2), tweak palette (0,0,10)
 	play sound (sfx:wind,false,true), fade screen in, Alter NPC (6,NPCstat:picture,145)
 	Alter NPC (6,NPCstat:palette,3), suspend NPC walls, wait (3)
 	reset palette, pan camera (up,4), walk NPC (6,up,1)
 	set NPC direction (6,down), wait for NPC (6), walk NPC (6,up,1)
 	walk NPC (6,right,1), set NPC direction (6,left), wait for NPC (6)
 	walk NPC (6,up,1), set NPC direction (6,up), wait for NPC (6)
 	walk NPC (6,up,1), walk NPC (6,right,1)
 	set NPC direction (6,right), wait for NPC (6)
 	Alter NPC (6,NPCstat:picture,157), Alter NPC (6,NPCstat:palette,3)
 	set NPC direction (6,down), pan camera (right,4), wait (1)
 	walk NPC (6,right,1), set NPC direction (6,left), wait for NPC (6)
 	wait (1), walk NPC (6,right,1), set NPC direction (6,up)
 	wait for NPC (6), wait (1), walk NPC (6,right,1)
 	set NPC direction (6,right), wait for NPC (6), wait (1)
 	Alter NPC (6,NPCstat:picture,29), Alter NPC (6,NPCstat:palette,60)
 	walk NPC (6,right,1), set NPC direction (6,down), wait for NPC (6)
 	wait (1), walk NPC (6,right,1), set NPC direction (6,left)
 	wait for NPC (6), wait (1), walk NPC (6,right,1)
 	set NPC direction (6,right), wait for NPC (6), wait (1)
 	walk NPC (6,right,1), set NPC direction (6,up), wait for NPC (6)
 	wait (8), fade screen in, wait (8), pan camera (down,4)
 	wait for camera, pan camera (left,4), wait for camera
 	set NPC frame (7,1), wait (1), set  NPC frame (7,0), wait (1)
 	set  NPC frame (7,1), wait (1), set  NPC frame (7,0), wait (1)
 	show text box (1608), wait (7), wait for key (use key), advance text box
 	show text box (1609), wait (7), wait for key (use key), advance text box
 	set NPC direction (7,down), set NPC frame (7,1), wait (1), set  NPC frame (7,0), wait (1)
 	set  NPC frame (7,1), wait (1), set  NPC frame (7,0), wait (1)
 	show text box (1610), wait (7), wait for key (use key), advance text box
 	set NPC frame (8,1), wait (1), set  NPC frame (8,0), wait (1)
 	set  NPC frame (8,1), wait (1), set  NPC frame (8,0), wait (1)
 	show text box (1611), wait (7), wait for key (use key), advance text box
 	wait (1), fade screen out, wait (1), set caterpillar mode (off), resume caterpillar
 	camera follows hero (me), set tag (tag:Dogeroend,on), wait (1), fade screen in, resume player
 	resume box advance, resume random enemies, resume obstruction, resume NPC walls, wait (1), encounters
end

# This script is for fighting Vlad the Hamster

script,Dracula,begin
	remember party, suspend player, suspend box advance
 	walk hero to y (me,10), wait for hero (me), walk hero to x (me,10), wait for hero (me)
 	focus camera (10,7,2), set caterpillar mode (on), set hero position (1, 10, 10)
 	set hero position (2, 10, 10), set hero position (3, 10, 10)
 	wait (1), suspend caterpillar , wait (1), walk hero (me,left,1)
 	walk hero (3,right,1), wait for hero (me), walk hero (1,left,1)
 	walk hero (2,right,1), walk hero (me,left,1), walk hero (3,right,1)
 	wait for hero (me), walk hero (me,left,1), walk hero (3,right,1)
 	wait for hero (me), wait for camera, set hero direction (0,up)
 	set hero direction (1,up), set hero direction (2,up), set hero direction (3,up)
 	set NPC frame (2,1), wait (1), set  NPC frame (2,0), wait (1)
 	set  NPC frame (2,1), wait (1), set  NPC frame (2,0), wait (1)
 	show text box (1612), wait (7), wait for key (use key), advance text box
 	set NPC frame (1,1), wait (1), set  NPC frame (1,0), wait (1)
 	set  NPC frame (1,1), wait (1), set  NPC frame (1,0), wait (1)
 	show text box (1613), wait (7), wait for key (use key), advance text box
 	show text box (1614), wait (7), wait for key (use key), advance text box
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (1615), wait (7), wait for key (use key), advance text box
 	wait (7), show text box (1616)
# WHAT IS A MAN?!
 	suspend NPC walls, suspend obstruction, wait (2)
 	set NPC position (3, 10, 5), wait (1), walk NPC (3,up,1), walk NPC (3,right,1)
 	wait for NPC (3), walk NPC (3,down,1), walk NPC (3,right,1), wait for NPC (3)
 	walk NPC (3,down,2), advance text box, play sound (sfx:Ice Crash,false,true)
 	Alter NPC (2,NPCstat:picture,159), set NPC direction (2,up)
 	walk NPC (3,down,1), set NPC direction (3,left), wait for NPC (3)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show text box (1617), wait (7), wait for key (use key), advance text box
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1618), wait (7), wait for key (use key), advance text box
 	walk NPC (1,down,1), wait for NPC (1)
 	show text box (1619), wait (7), wait for key (use key), advance text box
 	BossIntroduction, fight formation (203), fight formation (204)
 	fight formation (205), fight formation (206)
 	show text box (1620), wait (7), wait for key (use key), advance text box
 	BossIntroduction, fight formation (208),remember party
 	swap by position (0, find hero (hero:Frumpy)), play song (song:An Unfortunate End)
 	show text box (3770), wait (7), wait for key (use key), advance text box
 	show text box (3771), wait (7), wait for key (use key), advance text box
 	show text box (3772), wait (7), wait for key (use key), advance text box
 	show text box (3773), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (3774), wait (7), wait for key (use key), advance text box
 	show text box (3775), wait (7), wait for key (use key), advance text box
 	play sound (sfx:earthquake,false,true) , pancamera(up,1,20),waitforcamera
 	pancamera(down,2,20),waitforcamera, pancamera(up,2,20),waitforcamera
 	pancamera(down,1,20),waitforcamera , pancamera(left,1,20),waitforcamera
 	pancamera(right,2,20),waitforcamera, pancamera(left,2,20),waitforcamera
 	pancamera(right,1,20),waitforcamera 
 	pan camera (up,1,20), pan camera (right,1,20), wait for camera
 	pan camera (down,2,20), pan camera (left,2,20), wait for camera
 	pan camera (up,2,20), pan camera (right,2,20), wait for camera
 	pan camera (down,1,20), pan camera (left,1,20), wait for camera
 	fade screen out (63,63,63), wait (1)
 	set tag (tag:Dracula,on), wait (1), set hero position (me, 10, 10)
 	resume caterpillar, set caterpillar mode (off), camera follows hero (me)
 	wait (4), fade screen in, wait (4)
 	tweak palette (10,0,0), update palette, play sound (sfx:Heal8Bit,false,true)
 	teach spell ((find hero(hero:Frumpy)),atk:Smite), wait (10), reset palette, fade screen in
 	show text box (1622), wait (7), wait for key (use key), advance text box
 	resume NPC walls, resume obstruction, resume player
 	resume box advance, encounters
end 

script,Narvi,begin
	remember party, fight formation (198), wait (1)
 	if (checktag(tag:Cure2)) 	then 	(
 		wait (4), suspend player, suspend box advance
 		tweak palette (0,0,10),update palette
 		play sound (sfx:Heal8Bit,false,true)
 		teach spell ((find hero(hero:Frumpy)),atk:Care2)
 		wait (10), reset palette, fade screen in
 		show text box (1623),wait (7), wait for key (use key), advance text box
 		resume player, resume random enemies, resume obstruction, resume box advance
	)
 	else (wait (1)), encounters
end

script,Shayna,begin
	remember party, suspend player, suspend box advance
 	suspend NPCs, swap by position (0, find hero (hero:Hilda))
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1625), wait (7), wait for key (use key), advance text box
 	set NPC frame (1,1), wait (1), set  NPC frame (1,0), wait (1)
 	set  NPC frame (1,1), wait (1), set  NPC frame (1,0), wait (1)
 	show text box (1626), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1627), wait (7), wait for key (use key), advance text box
 	show text box (1628), wait (7), wait for key (use key), advance text box
 	BossIntroduction, fight formation (164), wait (4)
 	swap by position (0, find hero (hero:Hilda)), tweak palette (10,0,0), update palette
 	play sound (sfx:Ice Crash,false,true), teach spell ((find hero(hero:Hilda)),atk:Ice Age) 
	wait (10), reset palette, fade screen in
 	show text box (1629), wait (7), wait for key (use key), advance text box
 	set NPC frame (1,1), wait (1), set  NPC frame (1,0), wait (1)
 	set  NPC frame (1,1), wait (1), set  NPC frame (1,0), wait (1)
 	show text box (1630), wait (7), wait for key (use key), advance text box
 	set tag (tag:Shayna,on), resume player, resume box advance
 	resume NPCs, resume random enemies, resume obstruction
	reinstate party, encounters
end

script,Velius,begin
	remember party, fight formation (209), wait (1)
 	if (checktag(tag:Fire2)) 	then 	(
 		wait (4), suspend player, suspend box advance
 		tweak palette (10,0,0), update palette
 		play sound (sfx:MediumExplosion8Bit,false,true)
 		teach spell ((find hero(hero:Night)),atk:Sunder)
 		wait (10), reset palette, fade screen in
 		show text box (1632), wait (7), wait for key (use key), advance text box
 		resume player, resume random enemies
 		resume obstruction, resume box advance, encounters
		)
 	else (wait (1))
end


script,Delvire,begin
	remember party,fight formation (210),wait (1)
 	if (checktag(tag:Flee)) 	then 	(
 		wait (4), suspend player, suspend box advance
 		tweak palette (0,10,0), update palette
 		play sound (sfx:Soft_Airy_Swish,false,true)
 		teach spell ((find hero(hero:Bram)),atk:Flee)
 		wait (10), reset palette, fade screen in
 		show text box (1634), wait (7), wait for key (use key), advance text box
 		resume player, resume random enemies
 		resume obstruction, resume box advance, encounters
		)
 	else (wait (1))
end

script,Sasha,begin
	remember party,fight formation (211),wait (1)
 	if (checktag(tag:Heal2)) 	then 	(
		wait (4) , suspend player,suspend box advance
 		tweak palette (0,0,10), update palette
 		play sound (sfx:Heal8Bit,false,true)
 		teach spell ((find hero(hero:Frumpy)),atk:Nurse2)
 		wait (10), reset palette, fade screen in
 		show text box (1633), wait (7), wait for key (use key), advance text box
 		resume player, resume random enemies
 		resume obstruction, resume box advance, encounters
		)
 	else (wait (1))
 	resume random enemies, resume obstruction
end

script,Siva,begin
remember party
 	fight formation (212)
 	wait (1)
 	if (checktag(tag:Bandage)) 	then 	(
 		wait (4), suspend player, suspend box advance
 		tweak palette (0,0,10), update palette
 		play sound (sfx:Heal8Bit,false,true)
 		teach spell ((find hero(hero:Styrge)),atk:Bandage)
 		wait (10), reset palette, fade screen in
 		show text box (1635), wait (7), wait for key (use key), advance text box
 		resume player, resume box advance
		)
 	else (wait (1))
 	resume random enemies, resume obstruction, encounters
end

script,Alex,begin
remember party
 	fight formation (213)
 	wait (1)
 	if (checktag(tag:Rush)) 	then 	(
 		wait (4), suspend player, suspend box advance
 		tweak palette (10,0,0), update palette
 		play sound (sfx:MediumExplosion8Bit,false,true)
 		teach spell ((find hero(hero:Olaf)),atk:Rush)
 		wait (10), reset palette, fade screen in
 		show text box (1636), wait (7), wait for key (use key), advance text box
 		resume player, resume box advance
		)
 	else (wait (1))
 	resume random enemies, resume obstruction, encounters
end

script,Collies1,begin
	remember party, suspend player, suspend box advance
 	tweak palette (10,0,10), update palette, swap by position (0, find hero (hero:Night))
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1638), wait (7), wait for key (use key), advance text box
 	swap out hero (hero:Styrge), swap out hero (hero:Olaf), swap out hero (hero:Eric)
 	wait (5),remember party
 	set hero direction (me,left), wait (3), set hero direction (me,right), wait (3)
 	set hero direction (me,left), wait (3), set hero direction (me,right), wait (3)
 	show text box (1639), wait (7), wait for key (use key), advance text box
 	wait (5), set hero direction (me,down), wait (3)
 	walk hero (me,left,2), wait for hero (me), wait (5)
 	set hero direction (me,down), wait (5)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1640), wait (7), wait for key (use key), advance text box
 	BossIntroduction, fight formation (214), tweak palette (10,0,0), update palette
 	play sound (sfx:Ice Crash,false,true), teach spell ((find hero(hero:Night)),atk:Winter)
 	wait (3), reset palette, update palette
 	show text box (1637), wait (7), wait for key (use key), advance text box
 	wait (1), swap in hero (hero:Styrge), swap in hero (hero:Olaf)
 	swap in hero (hero:Eric), set caterpillar mode (on)
 	set hero position (1, 7, 10), set hero position (2, 8, 10)
 	set hero position (3, 8, 9), wait (1), suspend caterpillar 
 	wait (1), walk hero (1,right,4), walk hero (2,right,4)
 	walk hero (3,right,4), wait for hero (3)
 	show text box (1641), wait (7), wait for key (use key), advance text box
 	wait (2), set hero direction (me,left), wait (2)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1642), wait (7), wait for key (use key), advance text box
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show text box (1643), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1644), wait (7), wait for key (use key), advance text box
 	show text box (4300), wait (7), wait for key (use key), advance text box
 	wait (5), fade screen out, wait (2), resume caterpillar
 	reset palette, set caterpillar mode (off), wait (1)
 	swap by position (0, find hero (hero:Olaf)), swap by position (1, find hero (hero:Styrge))
 	swap by position (2, find hero (hero:Eric)), swap by position (3, find hero (hero:Night))
	remember party, resume box advance, wait (2), fade screen in
 	wait (2), resume player, resume random enemies, resume obstruction, encounters
end

script,mindscrew,begin
	remember party, suspend player, suspend box advance
 	set caterpillar mode (on), resume caterpillar, wait (1), fade screen out, wait (2)
 	swap by position (0, find hero (hero:Freki)), swap by position (1, find hero (hero:Bram))
 	swap by position (2, find hero (hero:Renard)), use door (7), show textbox (1650)
 	walk hero (me,down,1), wait for hero (me), walk hero (me,left,9)
 	fade screen in, wait for hero (me), wait (5), wait for key (usekey), advance textbox
 	suspend caterpillar, set hero direction (me,down), set hero direction (1,down)
 	wait (3), set hero direction (me,right), set hero direction (1,right), wait (3)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1651), wait (7), wait for key (use key), advance text box
 	wait (5), set hero direction (1,up), wait (10)
 	set hero direction (1,left), wait (5), set hero direction (1,right), wait (5)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1652), wait (7), wait for key (use key), advance text box
 	set hero frame (0,0), wait (1), set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1653), wait (7), wait for key (use key), advance text box
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (1654), wait (7), wait for key (use key), advance text box
 	walk hero (1,up,1), wait for hero (1), walk hero (1,left,1), wait for hero (1)
 	wait (3), set hero direction (1,down), wait (3)
 	set hero direction (me,right), set hero direction (1,right), wait (3)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (1655), wait (7), wait for key (use key), advance text box
 	show text box (1656), wait (7), wait for key (use key), advance text box
 	show text box (1657), wait (7), wait for key (use key), advance text box
 	wait (3), set hero direction (2,down), wait (5), walk hero (2,down,1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (1658), wait (7), wait for key (use key), advance text box
 	wait (3), set hero direction (2,left), wait (3)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (1659), wait (7), wait for key (use key), advance text box
 	walk hero (2,up,1), wait for hero (2), set hero direction (2,left)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (1660), wait (7), wait for key (use key), advance text box
 	wait (15), set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1661), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1662), wait (7), wait for key (use key), advance text box
 	set hero direction (1,down), set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1663), wait (7), wait for key (use key), advance text box
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (1664), wait (7), wait for key (use key), advance text box
 	wait (5), items menu, wait (5)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1665), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1666), wait (7), wait for key (use key), advance text box
 	set hero direction (1,down), wait (2), set hero direction (0,up)
 	set hero direction (1,left), wait (2), walk hero (1,left,4)
 	set hero direction (0,left), wait for hero (1), wait (5)
# the laws of the universe mean nothing!
 	play sound (sfx:Blizzard Loop,false,true), fade screen out (63,63,63),wait (65)
 	set tag (tag:Riftfix,on), wait (5), fade screen in
 	wait (5), set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1667), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1668), wait (7), wait for key (use key), advance text box
 	wait (5), fade screen out, walk hero (me,up,1)
 	wait for hero (me), walk hero (me,left,4), wait for hero (me)
 	resume caterpillar, reset palette, set caterpillar mode (off)
 	wait (1), resume box advance, fade screen in
 	resume player, resume random enemies, resume obstruction, encounters
end

script,Ericback,begin
	remember party, suspend player, suspend box advance, suspend random enemies
 	set caterpillar mode (on), set hero position (1, 24, 33), set hero position (2, 24, 33)
 	set hero position (3, 24, 33), wait (1), suspend caterpillar 
 	pan camera (left,3,4), wait (1), walk hero (me,left,1)
 	walk hero (1,down,1), walk hero (2,up,1), wait for hero (me)
 	set hero direction (me,left), set hero direction (1,left), set hero direction (2,left)
 	set hero direction (3,left) , wait for camera
 	set NPC frame (2,1), wait (1), set NPC frame (2,0), wait (1)
 	set NPC frame (2,1), wait (1), set NPC frame (2,0), wait (1)
 	show text box (1775), wait (7), wait for key (use key), advance text box, wait (5)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1776), wait (7), wait for key (use key), advance text box
 	set NPC direction (2,down), wait (5), set NPC direction (2,right), wait (5)
 	set NPC frame (2,1), wait (1), set NPC frame (2,0), wait (1)
 	set NPC frame (2,1), wait (1), set NPC frame (2,0), wait (1)
 	show text box (1777), wait (7), wait for key (use key), advance text box
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1778), wait (7), wait for key (use key), advance text box
 	set NPC frame (2,1), wait (1), set NPC frame (2,0), wait (1)
 	set NPC frame (2,1), wait (1), set NPC frame (2,0), wait (1)
 	show text box (1779), wait (7), wait for key (use key), advance text box
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (1780), wait (7), wait for key (use key), advance text box
 	set NPC frame (2,1), wait (1), set NPC frame (2,0), wait (1)
 	set NPC frame (2,1), wait (1), set NPC frame (2,0), wait (1)
 	show text box (1781), wait (7), wait for key (use key), advance text box
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show text box (1782), wait (7), wait for key (use key), advance text box
 	walk NPC (2,right,1), wait (4)
 	show text box (1783), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1784), wait (7), wait for key (use key), advance text box
 	set NPC frame (2,1), wait (1), set NPC frame (2,0), wait (1)
 	set NPC frame (2,1), wait (1), set NPC frame (2,0), wait (1)
 	show text box (1785), wait (7), wait for key (use key), advance text box
 	show text box (1786), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1787), wait (7), wait for key (use key), advance text box,suspend obstruction
 	set NPC frame (2,1), wait (1), set NPC frame (2,0), wait (1)
 	set NPC frame (2,1), wait (1), set NPC frame (2,0), wait (1)
 	show text box (1788), wait (7), wait for key (use key), advance text box
 	pan camera (right,2,4), walk NPC (2,right,3), walk hero (3,left,1)
 	walk hero (1,up,1), wait for hero (1), walk hero (1,left,1)
 	walk hero (2,down,1), wait for hero (2), walk hero (2,left,1), wait for hero (2)
 	camera follows hero (me), resume random enemies, resume obstruction
 	resume box advance, resume player, resume caterpillar, wait (1)
 	set caterpillar mode (off), set tag (tag:Ericback,on), wait (1), encounters
end

# Now we fight Misteroo
# I mean Billy

script,misteroo,begin
	remember party, suspend player, suspend box advance
 	suspend random enemies, walk hero (me,left,3), wait for hero (me)
 	set caterpillar mode (on), set hero position (1, 13, 6), set hero position (2, 13, 6)
 	set hero position (3, 13, 6), wait (1), suspend caterpillar 
 	pan camera (left,3,4), wait (1), walk hero (me,left,1)
 	walk hero (1,down,1), walk hero (2,up,1), wait for hero (me)
 	set hero direction (me,left), set hero direction (1,left)
 	set hero direction (2,left), set hero direction (3,left) 
 	wait for camera, wait (5), set NPC direction (4,down), wait (5)
 	set NPC direction (4,right), wait (5)
 	set NPC frame (4,1), wait (1), set NPC frame (4,0), wait (1)
 	set NPC frame (4,1), wait (1), set NPC frame (4,0), wait (1)
 	show text box (1789), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1790), wait (7), wait for key (use key), advance text box
 	set NPC frame (4,1), wait (1), set NPC frame (4,0), wait (1)
 	set NPC frame (4,1), wait (1), set NPC frame (4,0), wait (1)
 	show text box (1791), wait (7), wait for key (use key), advance text box
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1792), wait (7), wait for key (use key), advance text box
 	walk NPC (4,right,1), wait for NPC (4)
 	set NPC frame (4,1), wait (1), set NPC frame (4,0), wait (1)
 	set NPC frame (4,1), wait (1), set NPC frame (4,0), wait (1)
 	show text box (1793), wait (7), wait for key (use key), advance text box
 	show text box (1794), wait (7), wait for key (use key), advance text box
 	wait (5), set NPC direction (4,down), wait (5)
 	set NPC direction (4,left), wait (5)
 	set NPC frame (4,1), wait (1), set NPC frame (4,0), wait (1)
 	set NPC frame (4,1), wait (1), set NPC frame (4,0), wait (1)
 	show text box (1795), wait (7), wait for key (use key), advance text box
 	walk NPC (4,left,1), wait for NPC (4), wait (5)
 	set NPC frame (4,1), wait (1), set NPC frame (4,0), wait (1)
 	set NPC frame (4,1), wait (1), set NPC frame (4,0), wait (1)
 	show text box (1796), wait (7), wait for key (use key), advance text box
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show text box (1797), wait (7), wait for key (use key), advance text box
 	set NPC direction (4,down), wait (3), set NPC direction (4,right), wait (3)
 	set NPC frame (4,1), wait (1), set NPC frame (4,0), wait (1)
 	set NPC frame (4,1), wait (1), set NPC frame (4,0), wait (1)
 	show text box (1798), wait (7), wait for key (use key), advance text box
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (1799), wait (7), wait for key (use key), advance text box
 	set NPC frame (4,1), wait (1), set NPC frame (4,0), wait (1)
 	set NPC frame (4,1), wait (1), set NPC frame (4,0), wait (1)
 	show text box (1800), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1801), wait (7), wait for key (use key), advance text box
 	walk NPC (4,right,2), wait for NPC (4)
 	set NPC frame (4,1), wait (1), set NPC frame (4,0), wait (1)
 	set NPC frame (4,1), wait (1), set NPC frame (4,0), wait (1)
 	show text box (1802), wait (7), wait for key (use key), advance text box
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show text box (1803), wait (7), wait for key (use key), advance text box
 	pan camera (right,3,4), walk hero (1,up,1), walk hero (2,down,1)
 	walk hero (me,right,1), wait for hero (me), wait (1)
 	resume caterpillar, wait (1), set caterpillar mode (off), wait for camera
 	camera follows hero (me), wait (1), walk hero to x (me,22), wait for hero (me)
 	set NPC position (4,14,15), wait (1), walk hero (me,down,7)
 	walk NPC (4,right,7), wait for hero (me), set hero direction (me,left)
 	set NPC frame (4,0), wait (1), set NPC frame (4,1), wait (1)
 	set NPC frame (4,0), wait (1), set NPC frame (4,1), wait (1)
 	show text box (1804), wait (7), wait for key (use key), advance text box
 	walk hero to y (me,6), wait for hero (me), walk hero to x (me,30), wait for hero (me)
 	walk hero to y (me,14), wait for hero (me), walk hero (me,left,3), wait for hero (me)
 	walk hero to y (me,23), walk NPC to y (4,23), wait for NPC (4), walk NPC to x (4,24)
 	wait for hero (me), set hero direction (me,left)
 	set NPC frame (4,0), wait (1), set NPC frame (4,1), wait (1)
 	set NPC frame (4,0), wait (1), set NPC frame (4,1), wait (1)
 	show text box (1805), wait (7), wait for key (use key), advance text box
 	walk hero to x (me,33), wait for hero (me), walk hero (me,up,2)
 	wait for hero (me), walk hero to x (me,39), wait for hero (me)
 	set hero direction (me,down)
 	show text box (1806), wait (7), wait for key (use key), advance text box
 	suspend obstruction, set NPC position (4,29,33), play sound (sfx:earthquake,false,true)
 	walk hero (me,down,1), walk NPC (5,down,1)
 	wait for hero (me), walk hero (me,down,1)
 	walk NPC (5,down,1) , wait for hero (me)
 	walk hero (me,down,1),  walk NPC (5,down,1), wait for hero (me)
 	walk hero (me,down,1), walk NPC (5,down,1), wait for hero (me)
 	walk hero (me,down,1),  walk NPC (5,down,1), wait for hero (me)
 	walk hero (me,down,1), walk NPC (5,down,1), wait for hero (me)
 	walk hero (me,down,1), walk NPC (5,down,1), wait for hero (me)
 	walk hero (me,down,1), walk NPC (5,down,1), walk NPC (12,right,1), wait for hero (me)
 	walk NPC (5,right,1), walk hero (me,down,3), wait for hero (me)
 	resume obstruction, walk NPC (4,right,2), wait for NPC (4)
 	walk hero (me,left,4), walk NPC (4,up,1), set NPC direction (4,right)
 	walk NPC (4,right,2), wait for hero (me), set caterpillar mode (on)
 	set hero position (1, 35, 32), set hero position (2, 35, 32), set hero position (3, 35, 32)
 	wait (1), suspend caterpillar , pan camera (left,1,2)
 	walk hero (1,up,1), walk hero (2,down,1), walk hero (3,right,1)
 	wait for hero (1), set hero direction (1,left)
 	set hero direction (2,left), set hero direction (3,down), wait (1)
 	set hero direction (3,left), wait (5)
 	set NPC frame (4,0), wait (1), set NPC frame (4,1), wait (1)
 	set NPC frame (4,0), wait (1), set NPC frame (4,1), wait (1)
 	show text box (1807), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1808), wait (7), wait for key (use key), advance text box
 	set NPC frame (4,1), wait (1), set NPC frame (4,0), wait (1)
 	set NPC frame (4,1), wait (1), set NPC frame (4,0), wait (1)
 	show text box (1809), wait (7), wait for key (use key), advance text box
 	set NPC direction (4,down), wait (3), set NPC direction (4,left), wait (3)
 	stop song, tweak palette (-2,-2,-2), fade screen in, wait (2)
 	tweak palette (-2,-2,-2), fade screen in, wait (2)
 	tweak palette (-2,-2,-2), fade screen in, wait (2)
 	tweak palette (-2,-2,-2), fade screen in, wait (2)
 	set NPC direction (4,down), wait (5), set NPC direction (4,right), wait (5)
 	set NPC frame (4,1), wait (1), set NPC frame (4,0), wait (1)
 	set NPC frame (4,1), wait (1), set NPC frame (4,0), wait (1)
 	show text box (1810), wait (7), wait for key (use key), advance text box
 	set NPC frame (4,1), wait (1), set NPC frame (4,0), wait (1)
 	set NPC frame (4,1), wait (1), set NPC frame (4,0), wait (1)
 	show text box (1811), wait (7), wait for key (use key), advance text box
 	show text box (1812), wait (7), wait for key (use key), advance text box
 	BossIntroduction, fight formation (224), play song (Song:Humoresque)
	set NPC position (4,0,0),set NPC position (7,33,32),set NPC position (6,31,24)
 	show text box (3786), wait (7), wait for key (use key), advance text box
 	show text box (3787), wait (7), wait for key (use key), advance text box
 	show text box (3788), wait (7) 
	walk NPC (7,up,1), wait for NPC (7), walk NPC (7,left,2), wait for NPC(7)
	walk NPC (7,down,1), wait for NPC (7), walk NPC (7,right,2), wait for NPC(7)
	walk NPC (7,up,1), wait for NPC (7), walk NPC (7,left,2), wait for NPC(7)
	walk NPC (7,down,2), wait for NPC (7), walk NPC (7,right,1), wait for NPC(7)
	walk NPC (7,up,2), wait for NPC (7), walk NPC (7,left,1), wait for NPC(7)
	walk NPC (7,down,1), wait for NPC (7), walk NPC (7,right,2), wait for NPC(7)
	walk NPC (7,up,1), wait for NPC (7), walk NPC (7,left,2), wait for NPC(7)
	walk NPC (7,down,2), wait for NPC (7), walk NPC (7,right,1), wait for NPC(7)
	walk NPC (7,up,2), wait for NPC (7), walk NPC (7,left,1), wait for NPC(7)
	advance text box, suspend NPCs
	suspend NPC walls,suspend obstruction, show text box (3789), wait (7) 
	walk NPC (6,down,7), wait for NPC (6), set NPC position (7,0,0),resume NPC walls, resume obstruction
 	play sound (sfx:earthquake,false,true) , advance textbox, stop song, resume NPCs
 	pancamera(up,1,20),waitforcamera, pancamera(down,2,20),waitforcamera
 	pancamera(up,2,20),waitforcamera, pancamera(down,1,20),waitforcamera 
 	pancamera(left,1,20),waitforcamera, pancamera(right,2,20),waitforcamera
 	pancamera(left,2,20),waitforcamera, pancamera(right,1,20),waitforcamera 
 	pan camera (up,1,20), pan camera (right,1,20), wait for camera
 	pan camera (down,2,20), pan camera (left,2,20), wait for camera
 	pan camera (up,2,20), pan camera (right,2,20), wait for camera
 	pan camera (down,1,20), pan camera (left,1,20), wait for camera
#arfenhouse!
 	wait (40)
 	show text box (3790), wait (7), wait for key (use key), advance text box
 	play song (Song:In Soft Reflection), set tag (tag:Billybeat,on)
 	show text box (1813), set NPC position (15,29,33), walk NPC (15,right,2)
 	wait for NPC (15), walk NPC (15,up,1), set NPC direction (15,right)
 	walk NPC (15,right,2), wait for NPC (15)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1814), wait (7), wait for key (use key), advance text box
 	walk hero (1,down,1), walk hero (2,up,1), walk hero (3,left,1)
 	wait (2), wait (1), resume caterpillar, wait (1)
 	set caterpillar mode (off), wait (1)
 	swap by position (0, find hero (hero:Eric)) 
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1815), wait (7), wait for key (use key), advance text box
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	show text box (1816), wait (7), wait for key (use key), advance text box
 	set hero direction (me,down), wait (2)
 	set hero direction (me,right), wait (2)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1817), wait (7), wait for key (use key), advance text box
 	set hero direction (me,down), walk NPC (15,down,2), wait for NPC (15), wait (10)
 	set NPC direction (15,right), wait (3), set NPC direction (15,up), wait (3)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	show text box (1818), wait (7), wait for key (use key), advance text box
 	walk NPC (15,up,2), wait for NPC (15), set NPC direction (15,right), set hero direction (me,left)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	show text box (1819), wait (7), wait for key (use key), advance text box
 	wait (15), set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	show text box (1820), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1821), wait (7), wait for key (use key), advance text box
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	show text box (1822), wait (7), wait for key (use key), advance text box
 	show text box (1823), wait (7), wait for key (use key), advance text box
 	set hero direction (me,down), wait (5), walk hero (me,down,1), wait for hero (me)
 	show text box (1824), wait (7), wait for key (use key), advance text box
 	set NPC direction (15,down), set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	show text box (1825), wait (7), wait for key (use key), advance text box
 	walk NPC (15,down,1), wait for NPC (15), set hero direction (me,left)
 	set NPC direction (15,right), wait (5)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	show text box (1826), wait (7), wait for key (use key), advance text box
 	show text box (1827), wait (7), wait for key (use key), advance text box
 	fade screen out (63,63,63), wait (1), camera follows hero (me)
 	set NPC position (15,0,0), wait (2), fade screen in, wait (3)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1828), wait (7), wait for key (use key), advance text box
 	resume random enemies, resume obstruction, resume box advance
 	resume player, resume caterpillar, set caterpillar mode (off)
 	wait (1),reinstate party, encounters
end

script,fourfiends,begin
	remember party, suspend player, suspend box advance
 	walk hero (me,up,2), wait for hero (me), tweak palette (-5,-10,-5)
 	fade screen in, wait (5) , set NPC position (10,32,71)
 	play sound (sfx:TornadoMagic,false,true), wait (2)
 	reset palette, fade screen in, wait (5)
 	show text box (1829), wait (7), wait for key (use key), advance text box
 	tweak palette (-5,-10,-10), fade screen in, set NPC position (12,31,72)
 	play sound (sfx:FlameMagic,false,true), set hero direction (me,left), wait (2)
 	reset palette, fade screen in, wait (5)
 	show text box (1830), wait (7), wait for key (use key), advance text box
 	tweak palette (-10,-10,-5), fade screen in, set NPC position (13,33,72)
 	play sound (sfx:FreezeMagic,false,true), set hero direction (me,up), wait (2)
 	set hero direction (me,right), wait (2), reset palette, fade screen in, wait (5)
 	show text box (1831), wait (7), wait for key (use key), advance text box
 	tweak palette (-10,-5,-10), fade screen in, wait (5)
 	set NPC position (11,32,73), play sound (sfx:ThunderMagic,false,true), wait (5)
 	set hero direction (me,down), reset palette, fade screen in, wait (5)
 	show text box (1832), wait (7), wait for key (use key), advance text box
 	set hero direction (me,left), wait (3), set hero direction (me,up)
 	show text box (1833), wait (7), wait for key (use key), advance text box
 	show text box (1834), wait (7), wait for key (use key), advance text box
 	show text box (1835), wait (7), wait for key (use key), advance text box
 	show text box (1836), wait (7), wait for key (use key), advance text box
 	show text box (1837), wait (7), wait for key (use key), advance text box
 	show text box (1838), wait (7), wait for key (use key), advance text box
 	show text box (1839), wait (7), wait for key (use key), advance text box
 	show text box (1840), wait (7), wait for key (use key), advance text box
 	show text box (1841), wait (7), wait for key (use key), advance text box
 	show text box (1842), wait (7), wait for key (use key), advance text box
 	show text box (1843), wait (7), wait for key (use key), advance text box
 	show text box (1844), wait (7), wait for key (use key), advance text box
 	show text box (1845), wait (7), wait for key (use key), advance text box
 	show text box (1846), wait (7), wait for key (use key), advance text box
 	wait (10)
 	show text box (1847), wait (7), wait for key (use key), advance text box
 	show text box (1848), wait (7), wait for key (use key), advance text box
 	BossIntroduction, fight formation (194)
#The four fiends are defeated, and vanish away forever!
 	stop song, wait (3)
 	show text box (1849), wait for key (use key), advance text box
 	tweak palette (-10,-5,-10), play sound (sfx:ThunderMagic,false,true)
 	Alter NPC (11,NPCstat:picture,118), Alter NPC (11,NPCstat:palette,111)
 	fade screen in, wait (5), set NPC position (11,1,1), wait (3)
 	reset palette, fade screen in, wait (5)
 	show text box (1850), wait (7), wait for key (use key), advance text box
 	tweak palette (-10,-10,-5), play sound (sfx:FreezeMagic,false,true)
 	Alter NPC (13,NPCstat:picture,145), Alter NPC (13,NPCstat:palette,3)
 	fade screen in, wait (5), set NPC position (13,1,1)
 	wait (3), reset palette, fade screen in
 	show text box (1851), wait (7), wait for key (use key), advance text box
 	tweak palette (-5,-10,-10), play sound (sfx:FlameMagic,false,true)
 	Alter NPC (12,NPCstat:picture,113), Alter NPC (12,NPCstat:palette,10)
 	fade screen in, wait (5), set NPC position (12,1,1)
 	wait (3), reset palette, fade screen in
 	show text box (1852), wait (7), wait for key (use key), advance text box
 	tweak palette (-5,-10,-5) , play sound (sfx:TornadoMagic,false,true)
 	Alter NPC (10,NPCstat:picture,138), Alter NPC (10,NPCstat:palette,8)
 	fade screen in, wait (5) , set NPC position (10,1,1)
 	wait (5), reset palette, fade screen in, wait (5)
 	play song (Song:Grim Determination), resume random enemies
 	resume obstruction, resume box advance, resume player
 	resume caterpillar, set caterpillar mode (off), wait (1), encounters
end


script,firesmash,begin
	remember party, suspend player, suspend box advance
 	suspend random enemies, focus camera (23,48,4)
 	swap by position (0,find hero (hero:Kitt))
 	wait for camera, wait (10), walk hero to y (me,50), wait for hero (me)
 	walk hero to x (me,22), wait for hero (me)
 	walk hero (me,up,2), wait for hero (me), set hero direction (me,right)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1862), wait (7), wait for key (use key), advance text box
 	set NPC direction (15,left), set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	show text box (1853), wait (7), wait for key (use key), advance text box
 	walk hero (me,left,1), set hero direction (me,right)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1854), wait (7), wait for key (use key), advance text box
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	show text box (1855), wait (7), wait for key (use key), advance text box
 	wait (5), set NPC direction (15,up), wait (5)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	show text box (1856), wait (7), wait for key (use key), advance text box
 	set NPC direction (15,right)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	show text box (1857), wait (7), wait for key (use key), advance text box
 	set NPC direction (15,down), wait (3), set NPC direction (15,left), wait (3)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	show text box (1858), wait (7), wait for key (use key), advance text box
 	wait (5), walk NPC (15,left,1), wait for NPC (15)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	show text box (1859), wait (7), wait for key (use key), advance text box
 	wait (2), tweak palette (10,0,0), update palette
 	play sound (sfx:FlameMagic,false,true), teach spell ((find hero(hero:Kitt)),atk:Firesmash)
 	wait (10), reset palette, fade screen in
 	show text box (1860), wait (7), wait for key (use key), advance text box
 	walk NPC (15,down,8), wait (5), walk hero (me,right,1), wait for hero (me)
 	set hero direction (me,down)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1861), wait (7), wait for key (use key), pan camera (left,1)
 	wait for camera, advance text box, camera follows hero (me), set tag (tag:firesmash,on)
 	resume random enemies, resume obstruction, resume box advance
 	resume player, resume caterpillar, set caterpillar mode (off)
 	wait (1),reinstate party, encounters
end


script,icebrand,begin
	remember party, suspend player, suspend box advance
 	suspend random enemies, focus camera (41,35,4)
 	swap by position (0,find hero (hero:Kitt))
 	walk hero to x (me,41), wait for hero (me), walk hero to y (me,35), wait for hero (me)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1863), wait (7), wait for key (use key), advance text box
 	set NPC frame (24,1), wait (1), set NPC frame (24,0), wait (1)
 	set NPC frame (24,1), wait (1), set NPC frame (24,0), wait (1)
 	show text box (1864), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1865), wait (7), wait for key (use key), advance text box
 	wait (3), set NPC direction (24,right), wait (3)
 	set NPC frame (24,1), wait (1), set NPC frame (24,0), wait (1)
 	set NPC frame (24,1), wait (1), set NPC frame (24,0), wait (1)
 	show text box (1866), wait (7), wait for key (use key), advance text box
 	set hero direction (me,left), set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1867), wait (7), wait for key (use key), advance text box
 	wait (15), set NPC frame (24,1), wait (1), set NPC frame (24,0), wait (1)
 	set NPC frame (24,1), wait (1), set NPC frame (24,0), wait (1)
 	show text box (1868), wait (7), wait for key (use key), advance text box
 	walk NPC (24,right,1), wait for NPC (24)
 	show text box (1869), wait (7), wait for key (use key), advance text box
 	wait (2), tweak palette (10,0,0), update palette
 	play sound (sfx:FreezeMagic,false,true)
 	teach spell ((find hero(hero:Kitt)),atk:Icebrand)
 	wait (10), reset palette, fade screen in
 	show text box (1870), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1871), wait (7), wait for key (use key), advance text box
 	walk NPC (24,down,2), wait for NPC (24), walk NPC (24,right,1)
 	set hero direction (me,down), wait for NPC (24), wait (3)
 	set NPC direction (24,up), set NPC frame (24,1)
 	wait (1), set NPC frame (24,0), wait (1)
 	set NPC frame (24,1), wait (1), set NPC frame (24,0), wait (1)
 	show text box (1872), wait (7), wait for key (use key), advance text box
 	set NPC direction (24,left), wait (3), walk NPC (24,down,6)
 	wait for NPC (24), camera follows hero (me), set tag (tag:icebrand,on)
 	resume random enemies, resume obstruction, resume box advance
 	resume player, resume caterpillar, set caterpillar mode (off)
 	wait (1),reinstate party, encounters
end

script,boltslash,begin
	remember party, suspend player, suspend box advance
 	suspend random enemies, swap by position (0,find hero (hero:Kitt))
 	walk hero to y (me,3), wait for hero (me), walk hero to x (me,61), wait for hero (me)
 	set hero direction (me,up), wait (3)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1874), wait (7), wait for key (use key), advance text box
 	set NPC direction (9,left), wait (5), set NPC direction (9,down), wait (5)
 	walk hero (me,left,1), walk NPC (9,left,1)
 	set hero direction (me,up), set NPC direction (9,down)
 	wait for hero (me), wait (3), walk hero (me,right,1)
 	walk NPC (9,right,1), set hero direction (me,up), set NPC direction (9,down)
 	wait for hero (me), wait (3), walk hero (me,left,1)
 	walk NPC (9,left,1), set hero direction (me,up), set NPC direction (9,down)
 	wait for hero (me), wait (3), walk hero (me,right,1)
 	walk NPC (9,right,1), set hero direction (me,up), set NPC direction (9,down)
 	wait for hero (me), wait (3), walk hero (me,left,1)
 	walk NPC (9,left,1), set hero direction (me,up), set NPC direction (9,down)
 	wait for hero (me), wait (3), walk hero (me,right,1)
 	walk NPC (9,right,1), set hero direction (me,up), set NPC direction (9,down)
 	wait for hero (me), wait (3)
 	set NPC frame (9,1), wait (1), set NPC frame (9,0), wait (1)
 	set NPC frame (9,1), wait (1), set NPC frame (9,0), wait (1)
 	show text box (1875), wait (7), wait for key (use key), advance text box
	walk hero (me,left,1), set hero direction (me,right)
 	wait for hero (me), walk NPC (9,down,8), wait (8)
 	walk hero (me,right,1), wait for hero (me)
 	walk hero (me, up,1), wait for hero (me)
 	wait for NPC (9), wait (1), walk NPC (9,up,6), wait for NPC (9)
 	set hero direction (me,left), wait (2), set hero direction (me,down), wait (2)
 	set NPC frame (9,1), wait (1), set NPC frame (9,0), wait (1)
 	set NPC frame (9,1), wait (1), set NPC frame (9,0), wait (1)
 	show text box (1876), wait (7), wait for key (use key), advance text box
 	wait (2), tweak palette (10,0,0), update palette
 	play sound (sfx:ThunderMagic,false,true)
 	teach spell ((find hero(hero:Kitt)),atk:Boltslash)
 	wait (10), reset palette, fade screen in
 	show text box (1877), wait (7), wait for key (use key), advance text box
 	walk NPC (9,down,6), wait for NPC (9), wait (5)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1878), wait (7), wait for key (use key), advance text box
 	camera follows hero (me), set tag (tag:boltslash,on), resume random enemies
 	resume obstruction, resume box advance, resume player
 	resume caterpillar, set caterpillar mode (off), wait (1)
	reinstate party, encounters
end

script,utgard,begin
	remember party, suspend player, suspend box advance
 	swap by position (1,find hero (hero:Olaf))
 	swap by position (2,find hero (hero:Bram))
 	set NPC direction (0,left), wait (2)
 	set NPC direction (0,down), wait (2)
 	set NPC frame (0,1), wait (1), set NPC frame (0,0), wait (1)
 	set NPC frame (0,1), wait (1), set NPC frame (0,0), wait (1)
 	show text box (1881), wait (7), wait for key (use key), advance text box
 	wait for hero (me), set caterpillar mode (on), set hero position (1, 8, 17)
 	set hero position (2, 8, 17), set hero position (3, 8, 17), wait (1)
 	suspend caterpillar , pan camera (up,2,4), wait (1)
 	walk hero (me,up,1), walk hero (1,left,1), walk hero (2,right,1)
 	wait for hero (me), set hero direction (me,up), set hero direction (1,up)
 	set hero direction (2,up), set hero direction (3,up) , wait for camera, wait (5)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1882), wait (7), wait for key (use key), advance text box
 	walk NPC (0,down,1), wait for NPC (0)
 	set NPC frame (0,1), wait (1), set NPC frame (0,0), wait (1)
 	set NPC frame (0,1), wait (1), set NPC frame (0,0), wait (1)
 	show text box (1883), wait (7), wait for key (use key), advance text box
 	walk hero (1,up,1), wait for hero (me)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1884), wait (7), wait for key (use key), advance text box
 	wait (2), set hero direction (me,left) , set hero direction (2,left)
  	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1885), wait (7), wait for key (use key), advance text box
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1886), wait (7), wait for key (use key), advance text box
 	set NPC frame (0,1), wait (1), set NPC frame (0,0), wait (1)
 	set NPC frame (0,1), wait (1), set NPC frame (0,0), wait (1)
 	show text box (1887), wait (7), wait for key (use key), advance text box
 	walk hero (2,up,1), wait for hero (2), walk hero (me,up,1)
 	walk hero (1,up,1), walk hero (2,up,1), walk hero (3,up,1)
 	wait for hero (me), pan camera (up,8,4), wait for camera 
 	set NPC frame (0,1), wait (1), set NPC frame (0,0), wait (1)
 	set NPC frame (0,1), wait (1), set NPC frame (0,0), wait (1)
 	show text box (1888), wait (7), suspend obstruction, wait for key (use key), advance text box 
 	walk NPC (0,up,8), walk hero (me,up,8), walk hero (1,up,8)
 	walk hero (2,up,8), walk hero (3,up,8), wait for hero (me)
 	set NPC frame (2,1), wait (1), set NPC frame (2,0), wait (1)
 	set NPC frame (2,1), wait (1), set NPC frame (2,0), wait (1)
 	show text box (1889), wait (7), wait for key (use key), advance text box 
 	set NPC frame (0,1), wait (1), set NPC frame (0,0), wait (1)
 	set NPC frame (0,1), wait (1), set NPC frame (0,0), wait (1)
 	show text box (1890), wait (7), wait for key (use key), advance text box
 	set NPC frame (2,1), wait (1), set NPC frame (2,0), wait (1)
 	set NPC frame (2,1), wait (1), set NPC frame (2,0), wait (1)
 	show text box (1891), wait (7), wait for key (use key), advance text box 
 	show text box (1892), wait (7), wait for key (use key), advance text box 
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (1893), wait (7), wait for key (use key), advance text box
 	wait (10), play sound (sfx:Delvire,false,true)
 	show text box (1894), wait (7), wait for key (use key), advance text box
 	wait (10), set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (1895), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1896), wait (7), wait for key (use key), advance text box
 	wait (1), walk hero (1,right,1), walk hero (2,left,1)
 	walk hero (3,up,1), walk NPC (0,down,1), wait for NPC (0), wait (1)
 	camera follows hero (me), set tag (tag:utgard,on),  resume random enemies
 	resume obstruction, resume box advance, resume player
 	resume caterpillar, set caterpillar mode (off), wait (1)
	reinstate party, encounters
end

script,delvirearena,begin
	remember party, suspend player, suspend box advance
 	stop song, wait (5), set NPC position (3,6,5)
 	play sound (sfx:Delvire,false,true) , wait (3)
 	set NPC direction (3,right), set hero direction (me,left)
 	set NPC frame (3,1), wait (1), set NPC frame (3,0), wait (1)
 	set NPC frame (3,1), wait (1), set NPC frame (3,0), wait (1)
 	show text box (1903), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1904), wait (7), wait for key (use key), advance text box
 	set NPC frame (3,1), wait (1), set NPC frame (3,0), wait (1)
 	set NPC frame (3,1), wait (1), set NPC frame (3,0), wait (1)
 	show text box (1905), wait (7), wait for key (use key), advance text box
 	show text box (1906), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1907), wait (7), wait for key (use key), advance text box
 	set NPC position (3,10,5), play sound (sfx:Delvire,false,true) , wait (3)
 	set NPC direction (3,down), set hero direction (me,up)
 	set NPC frame (3,1), wait (1), set NPC frame (3,0), wait (1)
 	set NPC frame (3,1), wait (1), set NPC frame (3,0), wait (1)
 	show text box (1908), wait (7), wait for key (use key), advance text box
 	show text box (1909), wait (7), wait for key (use key), advance text box
 	camera follows hero (me), set tag (tag:DelvireBrag,on), resume random enemies
 	resume obstruction, resume box advance, resume player
 	resume caterpillar, set caterpillar mode (off), wait (1)
end


script,arena,begin
 	suspend player, suspend box advance
 	open menu (menu:UTGARD ARENA)
 	wait (1), resume player, resume box advance
end

script,arenaHorace,begin
	 fight formation (230)
end

script,arenacomrade,begin
	 fight formation (225)
end

script,slimesalad,begin
	 fight formation (227)
end

script,lowteir,begin
	 if (checktag(tag:STARTARENA) == off) then ( suspend player
	 	suspend box advance, fade screen out, wait (2)
	 	set hero position (me,34,5), wait (2), set NPC position (35,34,10), set NPC direction (35,down)
	 	wait (3), fade screen in, wait (10)
	 	show text box (3443), wait (7), wait for key (use key), advance text box
	 	show text box (3444), wait (7), wait for key (use key), advance text box
	 	show text box (3445), wait (7), wait for key (use key), advance text box
		wait (10), set NPC direction (20,left), wait (20)
		show text box (3446), wait (7), wait for key (use key), advance text box
		wait (10),set NPC direction (17,right)
		show text box (3447), wait (7), wait for key (use key), advance text box
		show text box (3448), wait (7), wait for key (use key), advance text box
		show text box (3449), wait (7), wait for key (use key), advance text box
		set NPC direction (13,right), set NPC direction (41,right), set NPC direction (12,right)
		set NPC direction (22,left)
 		show text box (328), wait (7), wait for key (use key), advance text box
		set NPC direction (21,right)
 		show text box (3450), wait (7), wait for key (use key), advance text box
		set NPC direction (14,left), set NPC direction (16,left), set NPC direction (17,left)
 		show text box (3451), wait (7), wait for key (use key), advance text box
 		show text box (3452), wait (7), wait for key (use key), advance text box
		wait (5),set NPC direction (41,right), wait (5)
 		show text box (3453), wait (7), wait for key (use key), advance text box
		set NPC direction (17,right),set NPC direction (20,right), set NPC direction (13,right)
		set NPC direction (14,right),set NPC direction (16,right), set NPC direction (12,right)
		wait (5), walk NPC (22,left,1), wait for NPC (22)
 		show text box (3454), wait (7), wait for key (use key), advance text box, wait (20)
		show text box (3455), wait (7), wait for key (use key), advance text box
		show text box (3456), wait (7), wait for key (use key), advance text box
		show text box (3457), wait (7), wait for key (use key), advance text box
		set NPC direction (12,down)
		show text box (3458), wait (7), wait for key (use key), advance text box
 		focus camera (34,10,2), wait for camera
		show text box (3459), wait (7), wait for key (use key), advance text box
		show text box (3460), wait (7), wait for key (use key), advance text box
		show text box (3461), wait (7), wait for key (use key), advance text box
		fade screen out, show text box (2593), stop song
		wait (5), fade screen in, wait(5),wait for key (use key), advance text box
 		show text box (2594), wait (7), wait for key (use key), advance text box
 		show text box (2595), wait (7), wait for key (use key), advance text box
 		show text box (2596), wait (7), wait for key (use key), fade screen out
		wait (5),advance text box,stop song, wait (5), fade screen in
		show text box (3462), wait (7), wait for key (use key), advance text box
		wait (15), set NPC direction (35,left), wait (5)
		show text box (3463), wait (7), wait for key (use key), advance text box
		wait (5), set NPC direction (35,down), wait (5)
		set NPC direction (35,right), wait (5)
		show text box (3464), wait (7), wait for key (use key), advance text box
		wait (5), set NPC direction (35,down), wait (5)
		set NPC direction (35,left), wait (5)
		set NPC direction (35,up), wait (5)
		show text box (3465), wait (7), wait for key (use key), advance text box
 		fade screen out, wait (10), fight formation (231)
 		wait (10), camera follows hero (me), use door (9)
 		fade screen in, set tag (tag:STARTARENA,on), set tag (tag:LOWTEIR,on)
		)
	else ( fight formation (231), set tag (tag:LOWTEIR,on)
	)
end

script,midteir,begin
	 fight formation (232)
	 set tag (tag:MIDTEIR,on)
end

script,upperteir,begin
	 fight formation (233)
	 set tag (tag:UPPERTEIR,on)
end

script,highteir,begin
	 fight formation (234)
	 set tag (tag:HIGHTEIR,on)
end

script,quarterfinals,begin
	 fight formation (235)
	 set tag (tag:QUARTERFINALS,on)
end

script,semifinals,begin
	remember party, fight formation (236), set tag (tag:SEMIFINALS,on)
 	suspend player, suspend box advance, fade screen out
 	wait (2), set hero position (me,34,5)
 	swap by position (0,find hero (hero:Olaf)), wait (2)
# Thor
 	set NPC position (21,31,10), set NPC direction (21,right)
# Olaf
 	set NPC position (16,36,10),set NPC direction (16,left)
# Frumpy
 	set NPC position (20,38,9), set NPC direction (20,left)
# Freki
 	set NPC position (12,37,11), set NPC direction (12,left)
 	wait (3), fade screen in, wait (10)
 	focus camera (34,10,2), wait for camera
 	set NPC frame (21,1), wait (1), set NPC frame (21,0), wait (1)
 	set NPC frame (21,1), wait (1), set NPC frame (21,0), wait (1)
 	show text box (1974), wait (7), wait for key (use key), advance text box
 	show text box (1975), wait (7), wait for key (use key), advance text box
 	set NPC frame (16,1), wait (1), set NPC frame (16,0), wait (1)
 	set NPC frame (16,1), wait (1), set NPC frame (16,0), wait (1)
 	show text box (1976), wait (7), wait for key (use key), advance text box
 	set NPC frame (20,1), wait (1), set NPC frame (20,0), wait (1)
 	set NPC frame (20,1), wait (1), set NPC frame (20,0), wait (1)
 	show text box (1977), wait (7), wait for key (use key), advance text box
 	set NPC frame (21,1), wait (1), set NPC frame (21,0), wait (1)
 	set NPC frame (21,1), wait (1), set NPC frame (21,0), wait (1)
 	show text box (1978), wait (7), wait for key (use key), advance text box
 	set NPC frame (16,1), wait (1), set NPC frame (16,0), wait (1)
 	set NPC frame (16,1), wait (1), set NPC frame (16,0), wait (1)
 	show text box (1979), wait (7), wait for key (use key), advance text box
 	set NPC frame (21,1), wait (1), set NPC frame (21,0), wait (1)
 	set NPC frame (21,1), wait (1), set NPC frame (21,0), wait (1)
 	show text box (1980), wait (7), wait for key (use key), advance text box
 	walk NPC (12,left,1), wait for NPC (12), set NPC frame (12,1), wait (1)
 	set NPC frame (12,0), wait (1), set NPC frame (12,1), wait (1), set NPC frame (12,0), wait (1)
 	show text box (1981), wait (7), wait for key (use key), advance text box
 	set NPC direction (16,down), set NPC direction (12,up) 
	set NPC frame (12,1), wait (1), set NPC frame (12,0), wait (1)
 	set NPC frame (12,1), wait (1), set NPC frame (12,0), wait (1)
 	show text box (1982), wait (7), wait for key (use key), advance text box
 	walk NPC (21,right,2), wait for NPC (11)
 	set NPC frame (21,1), wait (1), set NPC frame (21,0), wait (1)
 	set NPC frame (21,1), wait (1), set NPC frame (21,0), wait (1)
 	show text box (1983), wait (7), wait for key (use key), advance text box
 	set NPC direction (12,left), set NPC direction (16,left)
 	set NPC frame (12,1), wait (1), set NPC frame (12,0), wait (1)
 	set NPC frame (12,1), wait (1), set NPC frame (12,0), wait (1)
 	show text box (1984), wait (7), wait for key (use key), advance text box
 	set NPC frame (16,1), wait (1), set NPC frame (16,0), wait (1)
 	set NPC frame (16,1), wait (1), set NPC frame (16,0), wait (1)
 	show text box (1985), wait (7), wait for key (use key), advance text box
 	walk NPC (20,left,1), wait for NPC (20)
 	set NPC frame (20,1), wait (1), set NPC frame (20,0), wait (1)
 	set NPC frame (20,1), wait (1), set NPC frame (20,0), wait (1)
 	show text box (1986), wait (7), wait for key (use key), advance text box
 	set NPC direction (16,down), set NPC frame (16,1), wait (1)
 	set NPC frame (16,0), wait (1),set NPC frame (16,1)
 	wait (1), set NPC frame (16,0), wait (1)
 	show text box (1987), wait (7), wait for key (use key), advance text box
 	set NPC frame (21,1), wait (1), set NPC frame (21,0), wait (1)
 	set NPC frame (21,1), wait (1), set NPC frame (21,0), wait (1)
 	show text box (1988), wait (7), wait for key (use key), advance text box
 	set NPC direction (16,left), set NPC frame (16,1)
 	wait (1), set NPC frame (16,0), wait (1)
 	set NPC frame (16,1), wait (1), set NPC frame (16,0), wait (1)
 	show text box (1989), wait (7), wait for key (use key), advance text box
 	set NPC frame (21,1), wait (1), set NPC frame (21,0), wait (1)
 	set NPC frame (21,1), wait (1), set NPC frame (21,0), wait (1)
 	show text box (1990), wait (7), wait for key (use key), advance text box
 	walk NPC (12,right,1), set NPC direction (12,left), wait for NPC (12)
 	set NPC frame (21,1), wait (1), set NPC frame (21,0), wait (1)
 	set NPC frame (21,1), wait (1), set NPC frame (21,0), wait (1)
 	show text box (1991), wait (7), wait for key (use key), advance text box
 	walk NPC (21,down,4), walk NPC (16,down,4), wait for NPC (21)
 	set NPC direction (12,down), set NPC direction (20,down)
 	walk NPC (21,down,4), walk NPC (16,down,4), wait for NPC (21), wait (5)
 	set NPC frame (12,1), wait (1), set NPC frame (12,0), wait (1)
 	set NPC frame (12,1), wait (1), set NPC frame (12,0), wait (1)
 	show text box (1992), wait (7), wait for key (use key), advance text box
 	set NPC frame (20,1), wait (1), set NPC frame (20,0), wait (1)
 	set NPC frame (20,1), wait (1), set NPC frame (20,0), wait (1)
 	show text box (1993), wait (7), wait for key (use key), advance text box
 	fade screen out, wait (2), play sound (sfx:nuclear,false,true) 
 	wait (40), camera follows hero (me), use door (9), fade screen in
  	teach spell ((find hero(hero:Olaf)),atk:GigaFist)
 	show text box (1994), wait (7), wait for key (use key), advance text box 
 	resume box advance, resume player,reinstate party
end

script,tunneler,begin
 	suspend player, suspend box advance, suspend random enemys, suspend caterpillar 
	remember party, play sound (sfx:earthquake,false,true) 
 	pancamera(up,1,20),waitforcamera, pancamera(down,2,20),waitforcamera
 	pancamera(up,2,20),waitforcamera, pancamera(down,1,20),waitforcamera 
 	pancamera(left,1,20),waitforcamera, pancamera(right,2,20),waitforcamera
 	pancamera(left,2,20),waitforcamera, pancamera(right,1,20),waitforcamera 
 	pan camera (up,1,20), pan camera (right,1,20), wait for camera
 	pan camera (down,2,20), pan camera (left,2,20), wait for camera
 	pan camera (up,2,20), pan camera (right,2,20), wait for camera
 	pan camera (down,1,20), pan camera (left,1,20), wait for camera
 	camera follows hero, swap by position (0,find hero (hero:Kitt))
 	swap by position (1,find hero (hero:Bram)), swap by position (2,find hero (hero:Frumpy))
 	swap by position (3,find hero (hero:Night)),remember party
 	set caterpillar mode (on), set hero position (1, 36, 16), set hero position (2, 36, 16)
 	set hero position (3, 36, 16), wait (1), suspend caterpillar , wait (1)
 	walk hero (me,up,1), walk hero (1,left,1), walk hero (2,right,1)
 	set hero direction (3,down), wait for hero (me)
 	show text box (1913), wait (7), wait for key (use key), advance text box
 	show text box (1914), wait (7), wait for key (use key), advance text box
 	show text box (1915), wait (7), wait for key (use key), advance text box
 	play sound (sfx:earthquake,false,true) , pancamera(up,1,20),waitforcamera
 	pancamera(down,2,20),waitforcamera, pancamera(up,2,20),waitforcamera
 	pancamera(down,1,20),waitforcamera , pancamera(left,1,20),waitforcamera
 	pancamera(right,2,20),waitforcamera, pancamera(left,2,20),waitforcamera
 	pancamera(right,1,20),waitforcamera 
 	pan camera (up,1,20), pan camera (right,1,20), wait for camera
 	pan camera (down,2,20), pan camera (left,2,20), wait for camera
 	pan camera (up,2,20), pan camera (right,2,20), wait for camera
 	pan camera (down,1,20), pan camera (left,1,20), wait for camera
 	set hero direction (me,up), set hero direction (1,up), set hero direction (2,up)
 	set hero direction (3,up)  , camera follows hero (me)
 	show text box (1916), wait (7), wait for key (use key), advance text box
 	BossIntroduction, fight formation (237)
 	set hero direction (me,down), set hero direction (1,right)
 	set hero direction (2,left), set hero direction (3,up)
 	show text box (1917), wait (7), wait for key (use key), advance text box
 	show text box (1918), wait (7), wait for key (use key), advance text box
 	show text box (1919), wait (7), wait for key (use key), advance text box
 	play sound (sfx:StormMagic,false,true), set hero direction (me,right), wait (1)
 	set hero direction (me,up), wait (1)
 	set hero direction (me,left), wait (1), set hero direction (me,down), wait (1)
 	set hero direction (me,right), wait (1), set hero direction (me,up), wait (1)
 	set hero direction (me,left), wait (1), set hero direction (me,down), wait (1)
 	set hero direction (me,right), wait (1), set hero direction (me,up), wait (1)
 	set hero direction (me,left), wait (1), set hero direction (me,down), wait (1)
 	set hero direction (me,right), wait (1), set hero direction (me,up), wait (1)
 	set hero direction (me,left), wait (1), set hero direction (me,down), wait (1)
 	tweak palette (10,0,0), update palette
 	teach spell ((find hero(hero:Kitt)),atk:Spinslash), wait (3)
 	reset palette, update palette
 	show text box (1920), wait (7), wait for key (use key), advance text box, wait (1)
 	show text box (1921), wait (7), wait for key (use key), advance text box
 	show text box (1922), wait (7), wait for key (use key), advance text box
 	walk hero (me,down,1), walk hero (1,right,1), walk hero (2,left,1)
 	wait for hero (me), resume random enemies, resume obstruction, resume box advance
 	resume player, resume caterpillar, set caterpillar mode (off), wait (1), encounters
end


# A script that teaches Night how to cast a poison spell.

script,crone,begin
	remember party, suspend player, suspend box advance, suspend NPCs, wait (1)
 	swap by position (0,find hero (hero:Night))
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1928), wait (7), wait for key (use key), advance text box
 	set NPC frame (12,1), wait (1), set NPC frame (12,0), wait (1)
 	set NPC frame (12,1), wait (1), set NPC frame (12,0), wait (1)
 	show text box (1929), wait (7), wait for key (use key), advance text box
 	show text box (1930), wait (7), wait for key (use key), advance text box
 	show text box (1931), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1932), wait (7), wait for key (use key), advance text box
 	set NPC frame (12,1), wait (1), set NPC frame (12,0), wait (1)
 	set NPC frame (12,1), wait (1), set NPC frame (12,0), wait (1)
 	show text box (1933), wait (7), wait for key (use key), advance text box
 	fade screen out, wait (5), play sound (sfx:Mistress,false,true)
 	wait (30), fade screen in, wait (1), tweak palette (10,0,0), update palette
 	play sound (sfx:DrainMagic,false,true)
 	teach spell ((find hero(hero:Night)),atk:Venomer)
 	wait (3), reset palette, update palette
 	show text box (1934), wait (7), wait for key (use key), advance text box
 	show text box (1935), wait (7), wait for key (use key), advance text box, wait (1)
 	set NPC frame (12,1), wait (1), set NPC frame (12,0), wait (1)
 	set NPC frame (12,1), wait (1), set NPC frame (12,0), wait (1)
 	show text box (1936), wait (7), wait for key (use key), advance text box
 	set tag (tag:Crone,on), resume player, resume box advance, resume NPCs
reinstate party
end


script,TELEPORT,begin
	 suspend player ,suspend box advance
	 open menu (menu:Boundless Ocean)
	 wait (1) ,resume player,resume box advance
end

script,Tele0,begin
 	suspend player,	bifrostbeam(0)
 	fade screen out (63,63,63), wait (1),	use door (0), reset palette, 	wait (1)
 	wait (1), fade screen in,	bifrostbeam (1)
	resume player, encounters
end

script,Tele1,begin
  	suspend player,	bifrostbeam(0)
 	fade screen out (63,63,63), wait (1),	use door (1), reset palette, 	wait (1)
 	wait (1), fade screen in,	bifrostbeam (1)
	resume player, encounters
end

script,Tele2,begin
 	suspend player,	bifrostbeam(0)
 	fade screen out (63,63,63), wait (1),	use door (2), reset palette, 	wait (1)
 	wait (1), fade screen in,	bifrostbeam (1)
	resume player, encounters
end

script,Tele3,begin
 	suspend player,	bifrostbeam(0)
 	fade screen out (63,63,63), wait (1),	use door (3), reset palette, 	wait (1)
 	wait (1), fade screen in,	bifrostbeam (1)
	resume player, encounters
end

script,Tele4,begin
 	suspend player,	bifrostbeam(0)
 	fade screen out (63,63,63), wait (1),	use door (4), reset palette, 	wait (1)
 	wait (1), fade screen in,	bifrostbeam (1)
	resume player, encounters
end

script,Tele5,begin
 	suspend player,	bifrostbeam(0)
 	fade screen out (63,63,63), wait (1),	use door (5), reset palette, 	wait (1)
 	wait (1), fade screen in,	bifrostbeam (1)
	resume player, encounters
end

script,Tele6,begin
 	suspend player,	bifrostbeam(0)
 	fade screen out (63,63,63), wait (1),	use door (6), reset palette, 	wait (1)
 	wait (1), fade screen in,	bifrostbeam (1)
	resume player, encounters
end

script,Tele7,begin
 	suspend player,	bifrostbeam(0)
 	fade screen out (63,63,63), wait (1),	use door (7), reset palette, 	wait (1)
 	wait (1), fade screen in,	bifrostbeam (1)
	resume player, encounters
end

script,Tele8,begin
 	suspend player,	bifrostbeam(0)
 	fade screen out (63,63,63), wait (1),	use door (8), reset palette, 	wait (1)
 	wait (1), fade screen in,	bifrostbeam (1)
	resume player, encounters
end

script,Tele9,begin
 	suspend player,	bifrostbeam(0)
 	fade screen out (63,63,63), wait (1),	use door (9), reset palette, 	wait (1)
 	wait (1), fade screen in,	bifrostbeam (1)
	resume player, encounters
end

script,Tele10,begin
 	suspend player,	bifrostbeam(0)
 	fade screen out (63,63,63), wait (1),	use door (10), reset palette, 	wait (1)
 	wait (1), fade screen in,	bifrostbeam (1)
	resume player, encounters
end

script,Skadi1,begin
	remember party
 	suspend player, suspend box advance, suspend NPCs, wait (1)
 	swap by position (0,find hero (hero:Frumpy))
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1948), wait (7), wait for key (use key), advance text box
 	show text box (1949), wait (7), wait for key (use key), advance text box
 	show text box (1950), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1951), wait (7), wait for key (use key), advance text box
 	show text box (1952), resume player, resume box advance, resume NPCs
	reinstate party, encounters
end

# After rescuing Skadi's sister, you'll earn Harm 2.. er, Force 2.
script,Skadi2,begin
	remember party
 	suspend player, suspend box advance, suspend NPCs
 	swap by position (0,find hero (hero:Frumpy))
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	tweak palette (0,0,10), update palette, play sound (sfx:Heal8Bit,false,true)
 	wait (10), reset palette, fade screen in
 	show text box (1955), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1956), wait (7), wait for key (use key), advance text box
 	show text box (1957), wait (7), wait for key (use key), advance text box
 	wait (1), tweak palette (10,0,0), update palette
 	play sound (sfx:EnemyDeath,false,true)
 	wait (10), reset palette, fade screen in
 	show text box (1959), wait (7), wait for key (use key), advance text box
 	teach spell ((find hero(hero:Frumpy)),atk:Force2)
 	show text box (1958), wait (7), wait for key (use key), advance text box
 	wait (4), fade screen out (63,63,63), wait (5)
 	set tag (tag:Skadi2,on), wait (3), fade screen in, wait (1)
 	resume player, resume box advance, resume NPCs
	reinstate party, encounters
end

script,olaf1,begin
	remember party, suspend player, suspend box advance
 	swap by position (0,find hero (hero:Olaf)), swap by position (1,find hero (hero:Kitt))
 	swap by position (2,find hero (hero:Frumpy)), wait (1)
 	set caterpillar mode (on), set hero position (1, 32, 36), set hero position (2, 32, 36), set hero position (3, 1, 1)
 	wait (1), suspend caterpillar, wait (1), walk hero (1,left,1)
 	walk hero (2,right,1), wait for hero (2)
 	set hero direction (2,down), wait (2), set hero direction (2,left), wait (2)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (1960), wait (7), wait for key (use key), advance text box
 	set hero direction (1,down), set hero direction (me,down), wait (3)
 	set hero direction (1,right), set hero direction (me,right)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1961), wait (7), wait for key (use key), advance text box
# Olaf is wearing a sword for a helmet! How can this be?!
 	equip menu (find hero(hero:Olaf))
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (1962), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1963), wait (7), wait for key (use key), advance text box, wait (10)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (1964), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1965), wait (7), wait for key (use key), advance text box
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1966), wait (7), wait for key (use key), advance text box
 	show text box (1967), wait (7), wait for key (use key), advance text box, wait (10)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (1968), wait (7), wait for key (use key), advance text box
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1969), wait (7), wait for key (use key), advance text box
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (1970), wait (7), wait for key (use key), advance text box
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (1971), wait (7), wait for key (use key), advance text box
 	wait (10), set hero direction (2,down), wait (10)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (1972), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1973), wait (7), wait for key (use key), advance text box
 	walk hero (1,right,1), walk hero (2,left,1), wait for hero (1)
 	resume random enemies, resume obstruction, resume box advance
 	resume player, resume caterpillar, set caterpillar mode (off)
 	wait (1),reinstate party, encounters
end

script,Delvire2,begin
 	suspend player,remember party, swap by position (0,find hero (hero:Bram))
 	suspend box advance, suspend NPCs, suspend obstruction
 	wait (2), stop song, greyscale palette
 	update palette, play sound (sfx:Ice Crash,false,true), wait (2)
 	focus camera (15,33,4), wait (4), walk NPC (36,left,3) 
 	wait for NPC (36), wait for camera, set NPC direction (36,down)
 	wait (5), play sound (sfx:Delvire,false,true), wait (20)
 	walk NPC (36,down,7), focus camera (15,37,4), wait for NPC (36)
 	walk NPC (36,right,2), wait for NPC (36), set NPC direction (36,down)
 	play sound (sfx:Soft_Airy_Swish,false,true), camera follows hero (me)
 	wait (3), walk NPC (36,up,1), set NPC direction (36,down)
 	wait for NPC (36), reset palette, wait (2), fade screen in, wait (2)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1995), wait (7), wait for key (use key), advance text box
 	set hero direction (me,left), wait (2), set hero direction (me,up)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1996), wait (7), wait for key (use key), advance text box
 	set NPC frame (36,1), wait (1), set NPC frame (36,0), wait (1)
 	set NPC frame (36,1), wait (1), set NPC frame (36,0), wait (1)
 	show text box (1997), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (1998), wait (7), wait for key (use key), advance text box
 	set NPC frame (36,1), wait (1), set NPC frame (36,0), wait (1)
 	set NPC frame (36,1), wait (1), set NPC frame (36,0), wait (1)
 	show text box (1999), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2000), wait (7), wait for key (use key), advance text box
 	set NPC frame (36,1), wait (1), set NPC frame (36,0), wait (1)
 	set NPC frame (36,1), wait (1), set NPC frame (36,0), wait (1)
 	show text box (2001), wait (7), wait for key (use key), advance text box
 	tweak palette (40,-10,-10), update palette, wait (2)
 	reset palette, greyscale palette, fade screen in, wait (2)
 	set NPC frame (36,1), wait (1), set NPC frame (36,0), wait (1)
 	set NPC frame (36,1), wait (1), set NPC frame (36,0), wait (1)
 	show text box (2002), wait (7), wait for key (use key), advance text box
 	walk NPC (36,down,1), wait for NPC (36), wait (10)
 	set NPC frame (36,1), wait (1), set NPC frame (36,0), wait (1)
 	set NPC frame (36,1), wait (1), set NPC frame (36,0), wait (1)
 	show text box (2003), wait (7), wait for key (use key), advance text box
 	show text box (2004), wait (7), wait for key (use key), advance text box
 	set NPC frame (36,1), wait (1), set NPC frame (36,0), wait (1)
 	set NPC frame (36,1), wait (1), set NPC frame (36,0), wait (1)
 	show text box (2005), wait (7), wait for key (use key), advance text box
 	set NPC direction (36,right), wait (2), set NPC direction (36,up), wait (2)
 	show text box (2006), wait (7), wait for key (use key), advance text box
 	show text box (2007), wait (7), wait for key (use key), advance text box
 	set NPC direction (36,right), wait (3), set NPC direction (36,down)
 	set NPC frame (36,1), wait (1), set NPC frame (36,0), wait (1)
	set NPC frame (36,1), wait (1), set NPC frame (36,0), wait (1)
 	show text box (2008), wait (7), wait for key (use key), advance text box
 	walk NPC (36,up,1), set NPC direction (36,down)
 	set NPC frame (36,1), wait (1), set NPC frame (36,0), wait (1)
 	set NPC frame (36,1), wait (1), set NPC frame (36,0), wait (1)
 	show text box (2009), wait (7), wait for key (use key), advance text box, wait (10)
 	set NPC frame (36,1), wait (1), set NPC frame (36,0), wait (1)
 	set NPC frame (36,1), wait (1), set NPC frame (36,0), wait (1)
 	show text box (2010), wait (7), wait for key (use key), advance text box
 	teach spell ((find hero(hero:Bram)),atk:Red Shift)
 	walk NPC (36,right,10), wait for NPC (36), reset palette
 	fade screen in, wait (5), set tag (tag:Delvire2,on)
 	set hero direction (me,left), wait (10), set hero direction (me,up), wait (2)
 	set hero direction (me,right), wait (10), set hero direction (me,up), wait (2)
 	set hero direction (me,left), wait (10), set hero direction (me,up), wait (2)
 	set hero direction (me,right), wait (10), set hero direction (me,down), resume random enemies
 	resume obstruction, resume box advance, resume NPCs
 	resume player, resume caterpillar, set caterpillar mode (off)
 	wait (1),reinstate party, encounters
end

script,fafnir,begin
remember party
 suspend player
 swap by position (0,find hero (hero:Hilda))
 suspend box advance
 suspend random enemies
 stop song
 walk hero to x (me,52) 
 wait for hero (me)
 walk hero to y (me, 9)
 wait for hero (me)
 walk hero (me,right,1)
 wait for hero (me)
 walk hero (me,up,1)
 wait for hero (me)
 set hero direction (me,right)
 tweak palette (0,-5,-5)
 fade screen in
 show text box (2011)
 wait (7)
 wait for key (use key)
 advance text box
 reset palette
 fade screen in
 set hero frame (0,1)
 wait (1)
 set hero frame (0,0)
 wait (1)
 set hero frame (0,1)
 wait (1)
 set hero frame (0,0)
 wait (1)
 show text box (2012)
 wait (7)
 wait for key (use key)
 advance text box
 show text box (2013)
 wait (7)
 wait for key (use key)
 advance text box
 tweak palette (0,-5,-5)
 fade screen in
 show text box (2014)
 wait (7)
 wait for key (use key)
 advance text box
 reset palette
 fade screen in
 set hero direction (me,left)
 set hero frame (0,1)
 wait (1)
 set hero frame (0,0)
 wait (1)
 set hero frame (0,1)
 wait (1)
 set hero frame (0,0)
 wait (1)
 show text box (2015)
 wait (7)
 wait for key (use key)
 advance text box
 tweak palette (0,-5,-5)
 fade screen in
 show text box (2016)
 wait (7)
 wait for key (use key)
 advance text box
 reset palette
 fade screen in
 set hero direction (me,down)
 wait (3)
 set hero direction (me,right)
 set hero frame (0,1)
 wait (1)
 set hero frame (0,0)
 wait (1)
 set hero frame (0,1)
 wait (1)
 set hero frame (0,0)
 wait (1)
 show text box (2017)
 wait (7)
 wait for key (use key)
 advance text box
 tweak palette (0,-5,-5)
 fade screen in
 show text box (2018)
 wait (7)
 wait for key (use key)
 advance text box
 reset palette
 fade screen in
 set hero direction (me,down)
 boss introduction
 fight formation (238)
 swap by position (0,find hero (hero:Hilda))
 set tag (tag:Fafnir1,on)

 set hero frame (0,1)
 wait (1)
 set hero frame (0,0)
 wait (1)
 set hero frame (0,1)
 wait (1)
 set hero frame (0,0)
 wait (1)
 show text box (2019)
 wait (7)
 wait for key (use key)
 advance text box
 resume box advance
 resume random enemies
 resume player
reinstate party, encounters
end


script,Manafight,begin
remember party
 suspend player
 suspend box advance
 fade screen out
 wait (2)
 set hero position (me,34,5)
 swap by position (0,find hero (hero:Olaf))
 swap by position (1,find hero (hero:Hilda))
 swap by position (2,find hero (hero:Freki))
 swap by position (3,find hero (hero:Kitt))
 wait (2)
 #Managarm
 set NPC position (22,31,11)
 set NPC direction (22,right)
 #Olaf
 set NPC position (16,37,11)
 set NPC direction (16,left)
 #Frumpy
 set NPC position (20,39,10)
 set NPC direction (20,left)
 #Kitt
 set NPC position (13,37,12)
 set NPC direction (13,left)
 #Freki
 set NPC position (12,38,9)
 set NPC direction (12,left)
 #Hilda
 set NPC position (14,37,10)
 set NPC direction (14,left)
 #Bram
 set NPC position (17,38,13)
 set NPC direction (17,left)
 #Renard
 set NPC position (41,39,12)
 set NPC direction (41,left)

 wait (3)
 fade screen in
 wait (10)
 focus camera (34,12,2)
 wait for camera
 set NPC frame (22,1)
 wait (1)
 set NPC frame (22,0)
 wait (1)
 set NPC frame (22,1)
 wait (1)
 set NPC frame (22,0)
 wait (1)
 show text box (2020)
 wait (7)
 wait for key (use key)
 advance text box
 set NPC frame (16,1)
 wait (1)
 set NPC frame (16,0)
 wait (1)
 set NPC frame (16,1)
 wait (1)
 set NPC frame (16,0)
 wait (1)
 show text box (2021)
 wait (7)
 wait for key (use key)
 advance text box
 set NPC frame (22,1)
 wait (1)
 set NPC frame (22,0)
 wait (1)
 set NPC frame (22,1)
 wait (1)
 set NPC frame (22,0)
 wait (1)
 show text box (2022)
 wait (7)
 wait for key (use key)
 advance text box
 set NPC frame (16,1)
 wait (1)
 set NPC frame (16,0)
 wait (1)
 set NPC frame (16,1)
 wait (1)
 set NPC frame (16,0)
 wait (1)
 show text box (2023)
 wait (7)
 wait for key (use key)
 advance text box
 set NPC frame (22,1)
 wait (1)
 set NPC frame (22,0)
 wait (1)
 set NPC frame (22,1)
 wait (1)
 set NPC frame (22,0)
 wait (1)
 show text box (2024)
 wait (7)
 wait for key (use key)
 advance text box
 set NPC frame (16,1)
 wait (1)
 set NPC frame (16,0)
 wait (1)
 set NPC frame (16,1)
 wait (1)
 set NPC frame (16,0)
 wait (1)
 show text box (2025)
 wait (7)
 wait for key (use key)
 advance text box
 set NPC frame (13,1)
 wait (1)
 set NPC frame (13,0)
 wait (1)
 set NPC frame (13,1)
 wait (1)
 set NPC frame (13,0)
 wait (1)
 show text box (2026)
 wait (7)
 wait for key (use key)
 advance text box
 show text box (2027)
 wait (7)
 wait for key (use key)
 advance text box
 show text box (2028)
 wait (7)
 wait for key (use key)
 advance text box
 set NPC frame (14,1)
 wait (1)
 set NPC frame (14,0)
 wait (1)
 set NPC frame (14,1)
 wait (1)
 set NPC frame (14,0)
 wait (1)
 show text box (2029)
 wait (7)
 wait for key (use key)
 advance text box
 show text box (2030)
 wait (7)
 wait for key (use key)
 advance text box
 set NPC frame (20,1)
 wait (1)
 set NPC frame (20,0)
 wait (1)
 set NPC frame (20,1)
 wait (1)
 set NPC frame (20,0)
 wait (1)
 show text box (2031)
 wait (7)
 wait for key (use key)
 advance text box
 set NPC frame (12,1)
 wait (1)
 set NPC frame (12,0)
 wait (1)
 set NPC frame (12,1)
 wait (1)
 set NPC frame (12,0)
 wait (1)
 show text box (2032)
 wait (7)
 wait for key (use key)
 advance text box
 set NPC frame (22,1)
 wait (1)
 set NPC frame (22,0)
 wait (1)
 set NPC frame (22,1)
 wait (1)
 set NPC frame (22,0)
 wait (1)
 show text box (2033)
 wait (7)
 wait for key (use key)
 advance text box

# Time to fight Managarm, keeper of Thor's Hammer Mjolnir!

 boss introduction
 fight formation (97)
 swap by position (0,find hero (hero:Olaf))
 swap by position (1,find hero (hero:Hilda))
 swap by position (2,find hero (hero:Freki))
 swap by position (3,find hero (hero:Kitt))
#Managarm is defeated at last

 stop song
 set NPC frame (16,1)
 wait (1)
 set NPC frame (16,0)
 wait (1)
 set NPC frame (16,1)
 wait (1)
 set NPC frame (16,0)
 wait (1)
 show text box (2034)
 wait (7)
 wait for key (use key)
 advance text box
 set NPC frame (22,1)
 wait (1)
 set NPC frame (22,0)
 wait (1)
 set NPC frame (22,1)
 wait (1)
 set NPC frame (22,0)
 wait (1)
 show text box (2035)
 wait (7)
 wait for key (use key)
 advance text box
 show text box (2036)
 wait (7)
 wait for key (use key)
 advance text box
 set NPC direction (22,down)
 wait (5)
 set NPC direction (22,left)
 wait (10)
 set NPC frame (22,1)
 wait (1)
 set NPC frame (22,0)
 wait (1)
 set NPC frame (22,1)
 wait (1)
 set NPC frame (22,0)
 wait (1)
 show text box (2037)
 wait (7)
 wait for key (use key)
 advance text box
 wait (10)
 set NPC frame (22,1)
 wait (1)
 set NPC frame (22,0)
 wait (1)
 set NPC frame (22,1)
 wait (1)
 set NPC frame (22,0)
 wait (1)
 show text box (2038)
 wait (7)
 wait for key (use key)
  set NPC direction (22,down)
 wait (5)
 set NPC direction (22,right)
 set NPC frame (22,1)
 wait (1)
 set NPC frame (22,0)
 wait (1)
 set NPC frame (22,1)
 wait (1)
 set NPC frame (22,0)
 wait (1)
 show text box (2039)
 wait (7)
 wait for key (use key)
 advance text box
 show text box (2040)
 wait (7)
 wait for key (use key)
 advance text box
 wait (5)
 fade screen out
 wait (1)
 show text box (2041)
 wait (2)
 fade screen in
 wait (7)
 wait for key (use key)
 advance text box 
 show text box (2042)
 wait (7)
 wait for key (use key)
 fade screen out
 wait (1)
 advance text box
 wait (2)
 fade screen in
 set NPC frame (22,1)
 wait (1)
 set NPC frame (22,0)
 wait (1)
 set NPC frame (22,1)
 wait (1)
 set NPC frame (22,0)
 wait (1)
 show text box (2043)
 wait (7)
 wait for key (use key)
 advance text box
 show text box (2044)
 wait (7)
 wait for key (use key)
 advance text box

 wait (5)
 fade screen out
 wait (1)
 show text box (2045)
 wait (2)
 fade screen in
 wait (7)
 wait for key (use key)
 advance text box 
 show text box (2046)
 wait (7)
 wait for key (use key)
 advance text box
 show text box (2047)
 wait (7)
 wait for key (use key)
 advance text box
 show text box (2048)
 wait (7)
 set NPC direction (22,left)
 wait for key (use key)
 fade screen out
 wait (1)
 advance text box
 wait (2)
 fade screen in
 wait (5)
 set NPC frame (22,1)
 wait (1)
 set NPC frame (22,0)
 wait (1)
 set NPC frame (22,1)
 wait (1)
 set NPC frame (22,0)
 wait (1)
 show text box (2049)
 wait (7)
 wait for key (use key)
 advance text box
  set NPC direction (22,down)
 wait (5)
 set NPC direction (22,right)
 set NPC frame (22,1)
 wait (1)
 set NPC frame (22,0)
 wait (1)
 set NPC frame (22,1)
 wait (1)
 set NPC frame (22,0)
 wait (1)
 show text box (2050)
 wait (7)
 wait for key (use key)
 advance text box
 walk NPC (22,right,4)
 wait for NPC (22)
 set NPC frame (22,1)
 wait (1)
 set NPC frame (22,0)
 wait (1)
 set NPC frame (22,1)
 wait (1)
 set NPC frame (22,0)
 wait (1)
 show text box (2051)
 wait (7)
 wait for key (use key)
 advance text box
 wait (2)
 walk NPC (16,left,2)
 wait for NPC (16)
 wait (10)
 walk NPC (22,down,2)
 set NPC direction (16,down)
 set NPC frame (16,1)
 wait (1)
 set NPC frame (16,0)
 wait (1)
 set NPC frame (16,1)
 wait (1)
 set NPC frame (16,0)
 wait (1)
 show text box (2052)
 wait (7)
 wait for key (use key)
 advance text box
 set NPC frame (22,1)
 wait (1)
 set NPC frame (22,0)
 wait (1)
 set NPC frame (22,1)
 wait (1)
 set NPC frame (22,0)
 wait (1)
 show text box (2053)
 wait (7)
 wait for key (use key)
 advance text box
 set NPC direction (22,right)
 set NPC frame (22,1)
 wait (1)
 set NPC frame (22,0)
 wait (1)
 set NPC frame (22,1)
 wait (1)
 set NPC frame (22,0)
 wait (1)
 show text box (2054)
 wait (7)
 wait for key (use key)
 advance text box
 set NPC frame (16,1)
 wait (1)
 set NPC frame (16,0)
 wait (1)
 set NPC frame (16,1)
 wait (1)
 set NPC frame (16,0)
 wait (1)
 show text box (2055)
 wait (7)
 wait for key (use key)
 advance text box
 wait (5)
 set NPC direction (22,up)
 wait (5)
 set NPC frame (22,1)
 wait (1)
 set NPC frame (22,0)
 wait (1)
 set NPC frame (22,1)
 wait (1)
 set NPC frame (22,0)
 wait (1)
 show text box (2056)
 wait (7)
 wait for key (use key)
 advance text box
 fade screen out
 wait (1)
 camera follows hero (me)
 use door (9)
 advance text box 
 resume box advance
 resume player
 fade screen in
reinstate party
end

script,Cthulhu2,begin
	remember party, suspend player, suspend box advance
 	stop song, fade screen out, wait (1)
 	show text box (2087), wait (2), fade screen in, wait (7)
 	wait for key (use key), fade screen out, wait (1), advance text box
 	wait (2), teleport to map (16,8,66), stop song, wait (1), fade screen in
 	play song (song:Vile), focus camera (8,71,4), wait for camera
 	show text box (2075), wait (7), wait for key (use key), advance text box
 	show text box (2076), wait (7), wait for key (use key), advance text box
 	walk NPC (11,down,1)
 	show text box (2077), wait (7), wait for key (use key), advance text box
 	tweak palette (-10,-5,-10), fade screen in, wait (5)
 	set NPC position (36,8,72), play sound (sfx:ThunderMagic,false,true)
 	wait (5), set hero direction (me,down), reset palette
 	fade screen in, wait (5)
 	show text box (2078), wait (7), wait for key (use key), advance text box
 	show text box (2079), wait (7), wait for key (use key), advance text box
 	show text box (2080), wait (7), wait for key (use key), advance text box
 	tweak palette (0,15,0), update palette, wait (3)
 	reset palette, update palette, wait (1)
 	show text box (2081), wait (7), wait for key (use key), advance text box
 	show text box (2082), wait (7), wait for key (use key), advance text box
 	set NPC direction (11,left), wait (3), set NPC direction (11,up)
 	show text box (2083), wait (7), wait for key (use key), advance text box
 	set NPC direction (11,left), wait (3), set NPC direction (11,down)
 	show text box (2084), wait (7), wait for key (use key), advance text box
 	tweak palette (-10,-5,-10), fade screen in, wait (5)
 	set NPC position (36,1,1), play sound (sfx:ThunderMagic,false,true)
 	wait (5), set hero direction (me,down), reset palette, fade screen in
 	wait (5), walk NPC (11,down,1)
 	show text box (2085), wait (7), wait for key (use key), advance text box
 	show text box (2086), wait (7), wait for key (use key), advance text box
 	fade screen out, wait (1), camera follows hero (me)
 	wait (1), teleport to map (4,52,48), wait (1)
 	fade screen in, resume player, resume box advance
end

Script,Collies2,begin
	remember party, suspend player, suspend box advance, suspend NPCs
 	swap by position (0,find hero (hero:Styrge)), swap by position (1,find hero (hero:Hilda))
 	swap by position (2,find hero (hero:Eric)), swap by position (3,find hero (hero:Frumpy))
 	show text box (2112), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2113), wait (7), wait for key (use key), advance text box
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	show text box (2114), wait (7), wait for key (use key), advance text box
 	show text box (2115), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2116), wait (7), wait for key (use key), advance text box
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	show text box (2117), wait (7), wait for key (use key), advance text box
 	show text box (2118), wait (7), wait for key (use key), advance text box
 	fade screen out, wait (1)
 	show text box (2119) , wait (2), fade screen in, wait (7), wait for key (usekey), advance textbox
 	show text box (2120), wait (7), wait for key (use key), advance text box
 	show text box (2121), wait (7), wait for key (use key), advance text box
 	show text box (2122), wait (7), wait for key (use key), advance text box
 	show text box (2123), wait (7), wait for key (use key), advance text box
 	show text box (2124), wait (7), wait for key (use key), fade screen out
 	wait (2), set caterpillar mode (on), advance text box, wait (2)
 	set hero direction (me,up), teleport to map (30,38,36)
 	play song (song:Melting Away), suspend caterpillar, wait (1)
 	set hero position (1, 40, 35), set hero direction (1,left)
 	set hero position (2, 35, 35), set hero direction (2,right)
 	set hero position (3, 36, 37), set hero direction (3,up)
 	wait (2), fade screen in, wait (2)
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	show text box (2125), wait (7), wait for key (use key), advance text box
 	show text box (2126), wait (7), wait for key (use key), advance text box
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (2127), wait (7), wait for key (use key), advance text box
 	set NPC direction (23,right)
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	show text box (2128), wait (7), wait for key (use key), advance text box
 	show text box (2129), wait (7), wait for key (use key), advance text box
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (2130), wait (7), wait for key (use key), advance text box
 	set NPC direction (23,down), wait (5)
 	set NPC direction (23,left), set NPC frame (23,1)
 	wait (1), set NPC frame (23,0)
 	wait (1), set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	show text box (2131), wait (7), wait for key (use key), advance text box
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (2132), wait (7), wait for key (use key), advance text box
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	show text box (2133), wait (7), wait for key (use key), advance text box
 	show text box (2134), wait (7), wait for key (use key), advance text box, wait (5)
 	show text box (2135), wait (7), wait for key (use key), advance text box
 	wait (5), set NPC direction (23,up)
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	show text box (2136), wait (7), wait for key (use key), advance text box
 	show text box (2137), wait (7), wait for key (use key), advance text box
 	walk hero (2,right,1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (2138), wait (7), wait for key (use key), advance text box
 	set NPC direction (23,left)
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	show text box (2139), wait (7), wait for key (use key), advance text box
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (2140), wait (7), wait for key (use key), advance text box
 	set NPC direction (23,down), wait (5), set NPC direction (23,right)
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	show text box (2141), wait (7), wait for key (use key), advance text box
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show text box (2142), wait (7), wait for key (use key), advance text box
 	fade screen out, wait (2), teleport to map (17,16,21)
 	play song (song:Asgard), wait (1), suspend caterpillar
 	wait (1), set hero position (1, 16, 21), set hero direction (1,left)
 	set hero position (2, 17, 28), set hero direction (2,left)
 	set hero position (3, 16, 21), set hero position (3,up)
 	wait (2), fade screen in, wait (2), focus camera (16,28,4)
 	wait for camera, wait (2), set hero position (me, 8, 27)
 	set NPC position (23,7,27), set NPC direction (23,right)
 	walk hero (me,right,6), wait for hero (me)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2143), wait (7), wait for key (use key), advance text box
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (2144), wait (7), wait for key (use key), advance text box
 	walk hero (me,right,1), wait for hero (me), walk hero (me,down,1), wait for hero (me)
 	set hero direction (me,right), wait (5)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2145), wait (7), wait for key (use key), advance text box
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (2146), wait (7), wait for key (use key), advance text box
 	show text box (2147), wait (7), wait for key (use key), advance text box
 	show text box (2148), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2149), wait (7), wait for key (use key), advance text box
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (2150), wait (7), wait for key (use key), advance text box
 	show text box (2151), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2152), wait (7), wait for key (use key), advance text box
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (2153), wait (7), wait for key (use key), advance text box
 	show text box (2154), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2155), wait (7), wait for key (use key), advance text box
 	show text box (2156), wait (7), wait for key (use key), advance text box
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (2157), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2158), wait (7), wait for key (use key), advance text box
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (2159), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2160), wait (7), wait for key (use key), advance text box
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (2161), wait (7), wait for key (use key), advance text box
 	show text box (2162), wait (7), wait for key (use key), advance text box
 	show text box (2163), wait (7), wait for key (use key), advance text box
 	focus camera (11,28,4), wait (10), wait for camera
 	walk NPC (23,right,4), wait for NPC (23), walk NPC (23,down,5)
 	wait for NPC (23), fade screen out, wait (2)
 	camera follows hero (me), wait (2), tweak palette (-5,-5,0)
 	teleport to map (30,37,30), play song (song:Helheim's Ruin), wait (2)
 	fade screen in, focus camera (37,35,4), wait (10)
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	show text box (2164), wait (7), wait for key (use key), advance text box
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	show text box (2165), wait (7), wait for key (use key), advance text box
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	show text box (2166), wait (7), wait for key (use key), advance text box
 	wait (5), set NPC direction (23,left), wait (5)
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	show text box (2167), wait (7), wait for key (use key), advance text box
 	walk NPC (23,left,10), wait (20), fade screen out (63,63,63)
 	wait (1), reset palette, wait (1), set NPC position (24,38,35)
 	set NPC direction (7,down), wait (4), tweak palette (-5,-5,0)
 	set NPC position (23,1,2), wait (1), fade screen in
 	wait (10), walk NPC (24,down,1), wait for NPC (24)
	set NPC direction (24,left), wait (5)
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	show text box (2168), wait (7), wait for key (use key), advance text box
 	wait (5), set NPC direction (24,down), wait (5)
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	show text box (2169), wait (7), wait for key (use key), advance text box
 	focus camera (37,30,4), wait for camera, wait (1)
 	camera follows hero (me), wait (2), fade screen out, reset palette
 	teleport to map (17,16,21), play song (song:Asgard), suspend caterpillar
 	focus camera (16,21,4), wait for camera, wait (1)
 	set hero position (0, 15, 28), set hero direction (1,right)
 	set hero position (1, 16, 21), set hero direction (1,left)
 	set hero position (2, 17, 28), set hero direction (2,left)
 	set hero position (3, 16, 21), set hero position (3,up)
 	wait (2), fade screen in, wait (2), focus camera (16,28,4)
 	wait for camera, wait (2), set NPC direction (23,right)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2170), wait (7), wait for key (use key), advance text box
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (2171), wait (7), wait for key (use key), advance text box
 	show text box (2172), wait (7), wait for key (use key), advance text box
 	show text box (2173), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2174), wait (7), wait for key (use key), advance text box
	show text box (2175), wait (7), wait for key (use key), advance text box
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (2176), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2177), wait (7), wait for key (use key), advance text box
 	show text box (2178), wait (7), wait for key (use key), advance text box 
 	set hero position (3, 8, 27), wait (2), walk hero (3,right,7)
 	show text box (2179), wait (7), wait for key (use key), wait for hero (3), advance text box
 	wait (10), stop song
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show text box (2180), wait (7), wait for key (use key), advance text box
 	set hero direction (me,down), set hero direction (3,down), wait (5)
 	walk hero (3,right,1), wait for hero (3), set hero direction (3,down), wait (5)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show text box (2181), wait (7), wait for key (use key), advance text box
 	wait (3), set hero direction (2,down), wait (3)
 	play song (song:In Soft Reflection), resume NPCs
 	wait (1), set NPC position (26,17,28), put hero (2,0,1)
 	wait (5), set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2182), wait (7), wait for key (use key), advance text box
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show text box (2183), wait (7), wait for key (use key), advance text box
 	show text box (2184), wait (7), wait for key (use key), advance text box
 	show text box (2185), wait (7), wait for key (use key), advance text box
 	wait (5), set hero direction (me,right), wait (5)
 	show text box (2186), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2187), wait (7), wait for key (use key), advance text box
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show text box (2188), wait (7), wait for key (use key), advance text box
 	walk hero (3,left,3), set hero direction (me,up), wait for hero (3)
 	wait (3), set hero direction (3,down), wait (3), set hero direction (3,right)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show text box (2189), wait (7), wait for key (use key), advance text box
 	show text box (2190), wait (7), wait for key (use key), advance text box
 	tweak palette (0,0,10), update palette
 	play sound (sfx:Heal8Bit,false,true)
 	teach spell ((find hero(hero:Frumpy)),atk:Ease)
 	teach spell ((find hero(hero:Frumpy)),atk:Care3)
 	teach spell ((find hero(hero:Eric)),atk:Idun Poem)
 	wait (3), reset palette, update palette
 	show text box (2191), wait (7), wait for key (use key), advance text box
 	show text box (2192), wait (7), wait for key (use key), advance text box
 	show text box (2193), wait (7), wait for key (use key), advance text box
 	fade screen out, camera follows hero (me), resume caterpillar
 	resume NPCs, set hero direction (me,down), resume random enemies
 	resume obstruction, resume box advance, resume player
 	resume caterpillar, set caterpillar mode (off), use door (5)
 	wait (1), set tag (tag:Thule3,on), wait (2), encounters
end 

script,Eikthymir,begin
	remember party, suspend player, swap by position (0,find hero (hero:Hilda)), suspend box advance
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2200), wait (7), wait for key (usekey), advance text box
 	show text box (2201), wait (7), wait for key (usekey), advance text box
 	show text box (2202), wait (7), wait for key (usekey), advance text box
 	show text box (2203), wait (7), wait for key (usekey), advance text box
 	show text box (2204), wait (7), wait for key (usekey), advance text box
 	show text box (2205), wait (7), wait for key (usekey), advance text box
 	set tag (tag:BuckText,on), resume box advance, resume player,reinstate party
end

script,lifemist,begin
	remember party, suspend player, swap by position (0,find hero (hero:Hilda))
 	suspend box advance, tweak palette (0,0,10), update palette
 	play sound (sfx:Heal8Bit,false,true), wait (3), reset palette, fade screen in
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2210), wait (7), wait for key (usekey), advance text box
 	show text box (2211), wait (7), wait for key (usekey), advance text box
 	show text box (2212), wait (7), wait for key (usekey), advance text box
	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2213), wait (7), wait for key (usekey), advance text box
 	show text box (2214), wait (7), wait for key (usekey), advance text box
 	tweak palette (0,0,10), update palette, play sound (sfx:Heal8Bit,false,true)
 	wait (3), reset palette, fade screen in
 	show text box (2215), wait (7), wait for key (usekey), advance text box
 	teach spell ((find hero(hero:Hilda)),atk:Life Mist), set tag (tag:Thule5,on)
 	resume box advance, resume player,reinstate party
end

script,Cthulhu3,begin
	remember party, suspend player, suspend box advance
 	stop song, fade screen out, wait (1)
 	show text box (2087), wait (2), fade screen in, wait (7)
 	wait for key (use key), fade screen out, wait (1), advance text box
 	wait (2), teleport to map (16,8,66), stop song, wait (1)
 	fade screen in, play song (song:Vile), focus camera (8,71,4), wait for camera
 	show text box (2226), wait (7), wait for key (usekey), advance text box, set NPC direction (9,up)
 	show text box (2227), wait (7), wait for key (usekey), advance text box
 	tweak palette (-10,-10,-10), fade screen in, wait (5)
 	set NPC position (39,8,72), play sound (sfx:StormMagic,false,true)
 	wait (5), reset palette, fade screen in, wait (5)
 	show text box (2228), wait (7), wait for key (use key), advance text box
 	show text box (2229), wait (7), wait for key (usekey), advance text box
 	wait (3), walk NPC (11,down,2), wait for NPC (11), wait (3)
 	show text box (2230), wait (7), wait for key (usekey), advance text box
 	tweak palette (-10,-10,-10), fade screen in, wait (5)
 	play sound (sfx:TornadoMagic,false,true), Alter NPC (39,NPCstat:picture,157)
 	Alter NPC (39,NPCstat:palette,3), wait (5), reset palette, fade screen in, wait (5)
 	show text box (2231), wait (7), wait for key (usekey), advance text box
 	show text box (2232), wait (7), wait for key (usekey), advance text box
 	show text box (2233), wait (7), wait for key (usekey), advance text box
 	show text box (2234), wait (7), wait for key (usekey), advance text box
 	wait (3), set NPC direction (11,right), wait (10)
 	walk NPC (11,right,1), wait (5), set NPC direction (11,down), wait (1)
 	show text box (2235), wait (7), wait for key (usekey), advance text box
 	show text box (2236), wait (7), wait for key (usekey), advance text box
 	show text box (2237), wait (7), wait for key (usekey), advance text box
 	walk NPC (11,left,1), wait for NPC (11), set NPC direction (11,down)
 	show text box (2238), wait (7), wait for key (usekey), advance text box
 	show text box (2239), wait (7), wait for key (usekey), advance text box
 	show text box (2240), wait (7), wait for key (usekey), advance text box
 	fade screen out, wait (1), advance text box, wait (2)
 	stop song, fade screen out, wait (5)
 	camera follows hero (me), set hero direction (me,up)
 	wait (3), teleport to map (8,30,55), wait (1)
 	fade screen in, wait (1), resume player, resume box advance, encounters
end

# This script has been dummied out. Long ago it used to explain that
# This game was a demo, but that's no longer the case in the full release!

script,thisisademo,begin
 	stop song
end

script,Delvire3,begin
	remember party, suspend player, swap by position (0,find hero (hero:Bram))
 	suspend box advance, suspend NPCs, suspend obstruction
 	wait (2), stop song, greyscale palette, update palette
 	play sound (sfx:Ice Crash,false,true), wait (2), focus camera (31,22,4)
 	wait (4), walk NPC (0,right,2) , wait for NPC (0)
 	wait for camera, set NPC direction (0,down), wait (5), play sound (sfx:Delvire,false,true)
 	show text box (2248), wait (7), wait for key (usekey), advance text box
 	wait (20), walk NPC (0,down,1)
 	show text box (2249), wait (7), wait for key (usekey), advance text box
 	show text box (2250), wait (7), wait for key (usekey), advance text box
 	wait (5), set NPC direction (0,left), wait (5)
 	show text box (2251), wait (7), wait for key (usekey), advance text box
 	wait (5), set NPC direction (0,down), wait (5)
 	show text box (2252), wait (7), wait for key (usekey), advance text box, wait (10)
 	show text box (2253), wait (7), wait for key (usekey), advance text box
 	show text box (2254), wait (7), wait for key (usekey), advance text box
 	show text box (2255), wait (7), wait for key (usekey), advance text box
 	set NPC direction (0,left), wait (3), walk NPC (0,up,1), wait (15)
 	show text box (2256), wait (7), wait for key (usekey), advance text box, walk NPC (0,left,10)
 	show text box (2257), wait (7), wait for key (usekey), advance text box
 	wait for NPC (0), wait (5), walk NPC (0,right,10), wait for NPC (0)
 	walk NPC (0,down,2), wait for NPC (0), wait (2)
 	play sound (sfx:Soft_Airy_Swish,false,true) , wait (2)
 	walk NPC (0,up,2), wait for NPC (0), walk NPC (0,left,10)
 	wait for NPC (0), pan camera (down,3,4), wait for camera
 	camera follows hero (me), set tag (tag:Delvireironwood,on), reset palette
 	fade screen in, resume player, play song (get ambient music)
 	resume box advance, resume NPCs, resume obstruction, wait (2),reinstate party
end

script,DelvireBoat,begin
	remember party, suspend player, swap by position (0,find hero (hero:Bram))
 	suspend box advance, suspend NPCs, suspend obstruction, wait (2)
 	show text box (2265), wait (7), wait for key (usekey), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2266), wait (7), wait for key (usekey), advance text box
 	set NPC frame (2,1), wait (1), set NPC frame (2,0), wait (1)
 	set NPC frame (2,1), wait (1), set NPC frame (2,0), wait (1)
 	show text box (2267), wait (7), wait for key (usekey), advance text box
 	set hero direction (me,down), pan camera (down,3), wait for camera
 	wait (15), pan camera (up,3)
 	wait for camera, camera follows hero (me), wait (15)
 	show text box (2268), wait (7), wait for key (usekey), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2269), wait (7), wait for key (usekey), advance text box
 	set NPC frame (2,1), wait (1), set NPC frame (2,0), wait (1)
 	set NPC frame (2,1), wait (1), set NPC frame (2,0), wait (1)
 	show text box (2270), wait (7), wait for key (usekey), advance text box
 	show text box (2271), wait (7), wait for key (usekey), advance text box
 	wait (2), stop song, greyscale palette, update palette
 	play sound (sfx:Ice Crash,false,true), wait (2)
 	walk hero (me,down,1), set hero direction (me,up), walk NPC (2,down,1)
 	wait for NPC (2), set NPC position (2,27,22), set NPC direction (2,right)
 	play sound (sfx:KirbyStyleLaser,false,true), wait (4)
 	set NPC position (2,27,24), set NPC direction (2,down)
 	play sound (sfx:KirbyStyleLaser,false,true), wait (4)
 	set NPC direction (2,right), set NPC position (2,29,24)
 	play sound (sfx:KirbyStyleLaser,false,true), wait (4)
 	set NPC position (2,31,24), play sound (sfx:KirbyStyleLaser,false,true)
 	wait (4), set hero direction (me,right)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2272), wait (7), wait for key (usekey), advance text box
 	reset palette, tweak palette (0,10,0), update palette
 	play sound (sfx:Heal8Bit,false,true), wait (3), reset palette, fade screen in
 	show text box (2275), wait (7), wait for key (usekey), advance text box
 	teach spell ((find hero(hero:Bram)),atk:Hasten), set NPC frame (2,1)
 	wait (1), set NPC frame (2,0), wait (1)
 	set NPC frame (2,1), wait (1), set NPC frame (2,0), wait (1)
 	show text box (2273), wait (7), wait for key (usekey), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2274), wait (7), wait for key (usekey), advance text box
 	set NPC direction (2,up), wait (4), set NPC direction (2,left), 
 	set NPC frame (2,1), wait (1), set NPC frame (2,0)
 	wait (1), set NPC frame (2,1), wait (1), set NPC frame (2,0), wait (1)
 	show text box (2276), wait (7), wait for key (usekey), advance text box
 	show text box (2277), wait (7), wait for key (usekey), advance text box
 	set NPC direction (2,down), wait (5), walk NPC (2, right,4)
 	wait for NPC (2), set tag (tag:Delvireboatscene,on), reset palette
 	fade screen in, resume player, play song (get ambient music)
 	resume box advance, resume NPCs, resume obstruction, wait (2),reinstate party
end

script,Gisli,begin
	remember party, suspend player, swap by position (0,find hero (hero:Olaf))
 	suspend box advance, suspend NPCs, suspend obstruction, wait (2)
 	show text box (2281), wait (7), wait for key (usekey), advance text box
 	fade screen out, wait (5), focus camera (8,29,20), wait for camera, fade screen in
 	set NPC frame (0,1), wait (1), set NPC frame (0,0), wait (1)
 	set NPC frame (0,1), wait (1), set NPC frame (0,0), wait (1)
 	show text box (2284), wait (7), wait for key (usekey), advance text box
 	set NPC direction (8,right), wait (4), set NPC direction (8,down)
 	set NPC frame (8,1), wait (1), set NPC frame (8,0), wait (1)
 	set NPC frame (8,1), wait (1), set NPC frame (8,0), wait (1)
 	show text box (2285), wait (7), wait for key (usekey), advance text box
 	set NPC frame (7,1), wait (1), set NPC frame (7,0), wait (1)
 	set NPC frame (7,1), wait (1), set NPC frame (7,0), wait (1)
 	show text box (2286), wait (7), wait for key (usekey), advance text box
 	set NPC direction (9,down), wait (4), walk NPC (9,left,1)
 	set NPC frame (9,1), wait (1), set NPC frame (9,0), wait (1)
 	set NPC frame (9,1), wait (1), set NPC frame (9,0), wait (1)
 	show text box (2287), wait (7), wait for key (usekey), advance text box
 	set NPC direction (0,down)
 	set NPC frame (0,1), wait (1), set NPC frame (0,0), wait (1)
 	set NPC frame (0,1), wait (1), set NPC frame (0,0), wait (1)
 	show text box (2288), wait (7), wait for key (usekey), advance text box
 	set NPC direction (0,right)
 	set NPC frame (0,1), wait (1), set NPC frame (0,0), wait (1)
 	set NPC frame (0,1), wait (1), set NPC frame (0,0), wait (1)
 	show text box (2289), wait (7), wait for key (usekey), advance text box
 	set NPC frame (7,1), wait (1), set NPC frame (7,0), wait (1)
 	set NPC frame (7,1), wait (1), set NPC frame (7,0), wait (1)
 	show text box (2290), wait (7), wait for key (usekey), advance text box
 	walk NPC (8,down,1), wait for NPC (8), set NPC direction (8,right)
 	set NPC frame (8,1), wait (1), set NPC frame (8,0), wait (1)
 	set NPC frame (8,1), wait (1), set NPC frame (8,0), wait (1)
 	show text box (2291), wait (7), wait for key (usekey), advance text box
 	set NPC direction (7,down), set NPC direction (0,down), wait (4)
 	set NPC direction (0,left), set NPC direction (7,right)
 	show text box (2292), wait (7), wait for key (usekey), advance text box
 	set NPC direction (0,right), set NPC frame (0,1), wait (1), set NPC frame (0,0), wait (1)
 	set NPC frame (0,1), wait (1), set NPC frame (0,0), wait (1)
 	show text box (2293), wait (7), wait for key (usekey), advance text box
 	set NPC direction (7,down), wait (4)
 	set NPC direction (7,left), set NPC frame (7,1), wait (1), set NPC frame (7,0), wait (1)
 	set NPC frame (7,1), wait (1), set NPC frame (7,0), wait (1)
 	show text box (2294), wait (7), wait for key (usekey), advance text box, set NPC direction (10,right)
 	show text box (2295), wait (7), wait for key (usekey), advance text box, set NPC frame (7,0), wait (1)
 	set NPC frame (7,1), wait (1), set NPC frame (7,0), wait (1)
 	show text box (2296), wait (7), wait for key (usekey), advance text box
 	set NPC frame (9,1), wait (1), set NPC frame (9,0), wait (1)
 	set NPC frame (9,1), wait (1), set NPC frame (9,0), wait (1)
 	show text box (2297), wait (7), wait for key (usekey), advance text box, set NPC frame (7,0), wait (1)
 	set NPC frame (7,1), wait (1), set NPC frame (7,0), wait (1)
 	show text box (2298), wait (7), wait for key (usekey), advance text box
 	set NPC frame (8,1), wait (1), set NPC frame (8,0), wait (1)
 	set NPC frame (8,1), wait (1), set NPC frame (8,0), wait (1)
 	show text box (2299), wait (7), wait for key (usekey), advance text box
 	set NPC frame (7,0), wait (1), set NPC frame (7,1), wait (1), set NPC frame (7,0), wait (1)
 	show text box (2300), wait (7), wait for key (usekey), advance text box
 	set NPC direction (0,down), wait (4), set NPC direction (0,right)
 	set NPC frame (0,1), wait (1), set NPC frame (0,0), wait (1)
 	set NPC frame (0,1), wait (1), set NPC frame (0,0), wait (1)
 	show text box (2302), wait (7), wait for key (usekey), advance text box
 	tweak palette (10,0,0), update palette, play sound (sfx:Crush8Bit,false,true)
 	wait (3), reset palette, fade screen in
 	show text box (2301), wait (7), wait for key (usekey), advance text box
 	teach spell ((find hero(hero:Olaf)),atk:Charge), fade screen out
 	wait (5), camera follows hero (me), use door (7)
 	set tag (tag:Gisli,on), reset palette, fade screen in
 	resume player, play song (get ambient music), resume box advance, resume NPCs
 	resume obstruction, wait (2),reinstate party
end

script,hatistory1,begin
 	suspend player, suspend box advance, suspend NPCs, suspend obstruction, wait (2)
 	set NPC frame (1,1), wait (1), set NPC frame (1,0), wait (1)
 	set NPC frame (1,1), wait (1), set NPC frame (1,0), wait (1)
 	show text box (2304), wait (7), wait for key (usekey), advance text box
 	wait (3), set NPC direction (1,left), wait (3), set NPC direction (1,up), wait (3)
 	show text box (2305), wait (7), wait for key (usekey), advance text box
 	show text box (2306), wait (7), wait for key (usekey), advance text box
 	wait (3), set NPC direction (1,left), wait (3), set NPC direction (1,down), wait (3)
 	show text box (2307), wait (7), wait for key (usekey), advance text box
 	walk NPC (1,down,6), wait (10)
 	show text box (2333), wait (7), wait for key (usekey), advance text box
 	show text box (2334), wait (7), wait for key (usekey), advance text box
 	wait (2), wait for NPC (1), set NPC position (1,9,27)
 	set NPC direction (1,right), resume player
 	resume box advance, resume NPCs, resume obstruction
end

script,hatistory2,begin
 	suspend player, suspend box advance, suspend NPCs, suspend obstruction, wait (2)
 	set NPC frame (1,1), wait (1), set NPC frame (1,0), wait (1)
 	set NPC frame (1,1), wait (1), set NPC frame (1,0), wait (1)
 	show text box (2308), wait (7), wait for key (usekey), advance text box, wait (10)
 	show text box (2309), wait (7), wait for key (usekey), advance text box
 	walk NPC (1,right,1), wait for NPC (1), wait (5)
 	show text box (2310), wait (7), wait for key (usekey), advance text box
 	show text box (2311), wait (7), wait for key (usekey), advance text box
 	walk NPC (1,right,8), wait (10), set hero direction (me,right), wait (5)
 	show text box (2335), wait (7), wait for key (usekey), advance text box
 	wait for NPC (1), set NPC position (1,35,15)
 	set NPC direction (1,right), resume player
 	resume box advance, resume NPCs, resume obstruction
end

script,hatistory3,begin
 	suspend player, suspend box advance, suspend NPCs
 	set hero direction (me,right), suspend obstruction, wait (2)
 	set NPC frame (1,1), wait (1), set NPC frame (1,0), wait (1)
 	set NPC frame (1,1), wait (1), set NPC frame (1,0), wait (1)
 	show text box (2336), wait (7), wait for key (usekey), advance text box
 	show text box (2312), wait (7), wait for key (usekey), advance text box
 	show text box (2313), wait (7), wait for key (usekey), advance text box
 	show text box (2314), wait (7), wait for key (usekey), advance text box
 	set NPC direction (1,down)
 	show text box (2315), wait (7), wait for key (usekey), advance text box
 	walk NPC (1,right,8), wait (4)
 	show text box (2331), wait (7), wait for key (usekey), advance text box
 	wait for NPC (1), set NPC position (1,50,29), set NPC direction (1,down)
 	resume player, resume box advance, resume NPCs, resume obstruction
end

script,hatistory4,begin
 	suspend player, suspend box advance, suspend NPCs
 	walk hero to X (me,49) , wait for hero (me)
 	walk hero to y (me,28), wait for hero (me)
 	walk hero (me,down,1), wait for hero (me), suspend obstruction, wait (2)
 	set NPC frame (1,1), wait (1), set NPC frame (1,0), wait (1)
 	set NPC frame (1,1), wait (1), set NPC frame (1,0), wait (1)
 	show text box (2316), wait (7), wait for key (usekey), advance text box
 	show text box (2317), wait (7), wait for key (usekey), advance text box
 	show text box (2318), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (2337), wait (7), wait for key (usekey), advance text box
 	set NPC direction (1,left)
 	set NPC frame (1,1), wait (1), set NPC frame (1,0), wait (1)
 	set NPC frame (1,1), wait (1), set NPC frame (1,0), wait (1)
 	show text box (2338), wait (7), wait for key (usekey), advance text box
 	set NPC direction (1,down)
 	set NPC frame (1,1), wait (1), set NPC frame (1,0), wait (1)
 	set NPC frame (1,1), wait (1), set NPC frame (1,0), wait (1)
 	show text box (2327), wait (7), wait for key (usekey), advance text box
 	show text box (2328), wait (7), wait for key (usekey), advance text box
 	show text box (2329), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (2330), wait (7), wait for key (usekey), advance text box
 	walk NPC (1,down,8), wait (10)
 	show text box (2331), wait (7), wait for key (usekey), advance text box
 	wait for NPC (1), resume player, set NPC position (1,44,45)
 	set NPC direction (1,down), resume box advance
 	resume NPCs, resume obstruction
end

script,hatistory5,begin
 	suspend player, suspend box advance, suspend NPCs, walk hero (me,down,1), wait for hero (me)
 	walk hero to x (me,45), wait for hero (me), walk hero to y (me,45)
 	set NPC frame (1,1), wait (1), set NPC frame (1,0), wait (1)
 	set NPC frame (1,1), wait (1), set NPC frame (1,0), wait (1)
 	show text box (2319), wait (7), wait for key (usekey), advance text box
 	show text box (2320), wait (7), wait for key (usekey), advance text box
 	focus camera (50,50,2)
 	show text box (2321), wait (7), wait for key (usekey), advance text box
 	wait for camera 
 	show text box (2322), wait (7), wait for key (usekey), advance text box
 	show text box (2323), wait (7), wait for key (usekey), advance text box
 	focus camera (45,45,2), wait for camera, set hero direction (me,left)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (2324), wait (7), wait for key (usekey), advance text box
 	set NPC direction (1,right)
 	set NPC frame (1,1), wait (1), set NPC frame (1,0), wait (1)
 	set NPC frame (1,1), wait (1), set NPC frame (1,0), wait (1)
 	show text box (2325), wait (7), wait for key (usekey), advance text box
 	set npc direction (1,down)
 	show text box (2326), wait (7), wait for key (usekey), advance text box 
 	walk NPC (1,left,8), wait (5)
 	show text box (2349), wait (7), wait for key (usekey), advance text box
 	wait for NPC (1), set NPC position (1,12,41), set NPC direction (1,down), camera follows hero (me)
 	resume player, resume box advance, resume NPCs, resume obstruction
end

script,hatistory6,begin
 	suspend player, suspend box advance, suspend NPCs
 	walk hero to y (me,43), wait for hero (me)
 	walk hero to x (me,12), wait for hero (me)
 	set hero direction (me,up), set NPC direction (1,down)
 	set NPC frame (1,1), wait (1), set NPC frame (1,0), wait (1)
 	set NPC frame (1,1), wait (1), set NPC frame (1,0), wait (1)
 	show text box (2350), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (2339), wait (7), wait for key (usekey), advance text box 
 	set NPC frame (1,1), wait (1), set NPC frame (1,0), wait (1)
 	set NPC frame (1,1), wait (1), set NPC frame (1,0), wait (1)
 	show text box (2340), wait (7), wait for key (usekey), advance text box
 	show text box (2341), wait (7), wait for key (usekey), advance text box
 	walk hero (me,up,1), wait for hero (me)
 	show text box (2342), wait (7), wait for key (usekey), advance text box
 	wait (5), set NPC direction (1,right), wait (5)
 	show text box (2343), wait (7), wait for key (usekey), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (2344), wait (7), wait for key (usekey), advance text box 
 	walk hero (me,down,1), set hero direction (me,up), walk NPC (1,down,1)
 	set NPC frame (1,1), wait (1), set NPC frame (1,0), wait (1)
 	set NPC frame (1,1), wait (1), set NPC frame (1,0), wait (1)
 	show text box (2345), wait (7), wait for key (usekey), advance text box
 	show text box (2346), wait (7), wait for key (usekey), advance text box
 	wait (5), set NPC frame (1,1), wait (1), set NPC frame (1,0), wait (1)
 	set NPC frame (1,1), wait (1), set NPC frame (1,0), wait (1)
 	show text box (2347), wait (7), wait for key (usekey), advance text box
 	wait (1), tweak palette (10,0,0), update palette
 	play sound (sfx:StormMagic,false,true)
 	teach spell ((find hero(hero:Night)),atk:Hater)
 	wait (10), reset palette, fade screen in
 	show text box (2348), wait (7), wait for key (use key), advance text box
 	wait (5), fade screen out (63,63,63), wait (4)
 	use door (2), play song (song:Vile), resume player
 	resume box advance, resume NPCs, resume obstruction
end

script,arenamu,begin
 	suspend player, suspend box advance
 	fade screen out, wait (2), stop song, set hero position (me,37,10)
# Dr Mu, the villain of Walthros, finally comes to challenge the party.
	set hero direction (me,left), set NPC position (35,31,10), set NPC direction (35,right)
 	wait (3), fade screen in, wait (2),  play song (song:Vile)
 	wait (10), focus camera (34,10,2), wait for camera
 	show text box (3336), wait (7), wait for key (usekey), advance text box
 	show text box (3337), wait (7), wait for key (usekey), advance text box
 	show text box (3338), wait (7), wait for key (usekey), advance text box
 	show text box (3339), wait (7), wait for key (usekey), advance text box
 	show text box (3340), wait (7), wait for key (usekey), advance text box
 	show text box (3341), wait (7), wait for key (usekey), advance text box
 	show text box (3342), wait (7), wait for key (usekey), advance text box
 	show text box (3343), wait (7), wait for key (usekey), advance text box
 	bossintroduction
 	fight formation (287) 
 	show text box (3344), wait (7), wait for key (usekey), advance text box
 	show text box (3345), wait (7), wait for key (usekey), advance text box
 	show text box (3346), wait (7), wait for key (usekey)
 	play sound (sfx:earthquake,false,true) 
 	pancamera(up,1,20),waitforcamera, pancamera(down,2,20),waitforcamera
 	pancamera(up,2,20),waitforcamera, pancamera(down,1,20),waitforcamera 
 	pancamera(left,1,20),waitforcamera, pancamera(right,2,20),waitforcamera
 	pancamera(left,2,20),waitforcamera, pancamera(right,1,20),waitforcamera 
 	pan camera (up,1,20), pan camera (right,1,20), wait for camera, pan camera (down,2,20), pan camera (left,2,20), wait for camera
 	pan camera (up,2,20), pan camera (right,2,20), wait for camera
 	pan camera (down,1,20), pan camera (left,1,20), wait for camera
 	fade screen out (63,63,63), wait (1),set tag (tag:DR MU,on), advance text box
 	wait (1), camera follows hero (me), use door (9)
 	advance text box , resume box advance, resume player, fade screen in
end

script,hatifight1,begin
	remember party, suspend player, suspend box advance
 	suspend NPCs, fade screen out, stop song, focus camera (27,13,20)
 	set hero position (me,2,2), wait for camera , wait (2), update void parallax
 	walk hero (me,up,1), set tag (tag:wargsfight,on), wait (2), fade screen in, wait (5)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	show text box (2363), wait (7), wait for key (usekey), advance text box
 	set NPC frame (10,1), wait (1), set NPC frame (10,0), wait (1)
 	set NPC frame (10,1), wait (1), set NPC frame (10,0), wait (1)
 	show text box (2364), wait (7), wait for key (usekey), advance text box
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	show text box (2365), wait (7), wait for key (usekey), advance text box
 	set NPC frame (14,1), wait (1), set NPC frame (14,0), wait (1)
 	set NPC frame (14,1), wait (1), set NPC frame (14,0), wait (1)
 	show text box (2366), wait (7), wait for key (usekey), advance text box
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	show text box (2367), wait (7), wait for key (usekey), advance text box
 	show text box (2368), wait (7), wait for key (usekey), advance text box
 	show text box (2369), wait (7), wait for key (usekey), advance text box
 	set NPC frame (16,1), wait (1), set NPC frame (16,0), wait (1)
 	set NPC frame (16,1), wait (1), set NPC frame (16,0), wait (1)
 	show text box (2370), wait (7), wait for key (usekey), advance text box
 	set NPC frame (13,1), wait (1), set NPC frame (13,0), wait (1)
 	set NPC frame (13,1), wait (1), set NPC frame (13,0), wait (1)
 	show text box (2371), wait (7), wait for key (usekey), advance text box
 	set NPC frame (16,1), wait (1), set NPC frame (16,0), wait (1)
 	set NPC frame (16,1), wait (1), set NPC frame (16,0), wait (1)
 	show text box (2372), wait (7), wait for key (usekey), advance text box
 	resume box advance
 end

script,hatifight2,begin
	remember party, suspend player, suspend box advance, suspend NPCs
 	set NPC frame (16,1), wait (1), set NPC frame (16,0), wait (1)
 	set NPC frame (16,1), wait (1), set NPC frame (16,0), wait (1)
 	show text box (2380), wait (7), wait for key (usekey), advance text box, walk NPC (10,right,1)
 	show text box (2381), wait (7), wait for key (usekey), advance text box, walk NPC (15,left,1)
 	show text box (2382), wait (7), wait for key (usekey), advance text box
 	wait (10), set NPC direction (15,down), wait (3), set NPC direction (15,right), wait (10)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	show text box (2383), wait (7), wait for key (usekey), advance text box
 	set NPC direction (15,down), wait (2), set NPC direction (15,left)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	show text box (2384), wait (7), wait for key (usekey), advance text box
 	walk NPC (11,right,1)
 	show text box (2385), wait (7), wait for key (usekey), advance text box
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	show text box (2386), wait (7), wait for key (usekey), advance text box
 	walk NPC (16,left,1)
 	show text box (2387), wait (7), wait for key (usekey), advance text box
 	bossintroduction, fight formation (6)
 	show text box (2388), wait (7), wait for key (usekey), advance text box
 	hatifinal, encounters
end

script,god,begin
 	suspend player, suspend box advance, suspend NPCs
 	show text box (2390), wait (7), wait for key (usekey), advance text box
 	show text box (2391), wait (7), wait for key (usekey), advance text box
 	show text box (2392), wait (7), wait for key (usekey), advance text box
 	show text box (2393), wait (7), wait for key (usekey), advance text box
 	show text box (2394), wait (7), wait for key (usekey), advance text box
 	show text box (2395), wait (7), wait for key (usekey), advance text box
 	show text box (2396), wait (7), wait for key (usekey), advance text box
 	wait (2), tweak palette (0,0,10), update palette, play sound (sfx:Beam Attack,false,true)
 	teach spell ((find hero(hero:Frumpy)),atk:Believe), wait (3), reset palette, update palette
 	show text box (2397), wait (7), wait for key (usekey), advance text box
 	show text box (2398), wait (7), wait for key (usekey), advance text box
 	resume player, resume box advance, resume NPCs
end

script,Rachel2,begin
	remember party, suspend player, suspend box advance
 	suspend NPCs, swap by position (0,find hero (hero:Frumpy))
 	show text box (2403), wait (7), wait for key (usekey), advance text box
 	show text box (2404), wait (7), wait for key (usekey), advance text box
 	show text box (2405), wait (7), wait for key (usekey), advance text box
 	show text box (2406), wait (7), wait for key (usekey), advance text box
 	show text box (2407), wait (7), wait for key (usekey), advance text box
 	show text box (2408), wait (7), wait for key (usekey), advance text box
 	wait (2), tweak palette (0,0,10), update palette
 	play sound (sfx:Heal8Bit,false,true)
 	teach spell ((find hero(hero:Frumpy)),atk:Care4)
 	wait (3), reset palette, update palette
 	show text box (2409), wait (7), wait for key (usekey), advance text box
 	show text box (2410), wait (7), wait for key (usekey), advance text box
 	resume player, resume box advance, resume NPCs,reinstate party
end

script,skadi3,begin
	remember party, suspend player, suspend box advance
 	suspend NPCs, swap by position (0,find hero (hero:Frumpy))
 	show text box (2418), wait (7), wait for key (usekey), advance text box
 	show text box (2419), wait (7), wait for key (usekey), advance text box
 	show text box (2420), wait (7), wait for key (usekey), advance text box
 	show text box (2421), wait (7), wait for key (usekey), advance text box
 	wait (2), tweak palette (0,0,10), update palette
 	play sound (sfx:Heal8Bit,false,true)
 	teach spell ((find hero(hero:Frumpy)),atk:Nurse3)
 	wait (3), reset palette, update palette
 	show text box (2422), wait (7), wait for key (usekey), advance text box
 	show text box (2423), wait (7), wait for key (usekey), advance text box
 	show text box (2424), wait (7), wait for key (usekey), advance text box
 	resume player, resume box advance, resume NPCs,reinstate party
end

script,narvi2,begin
	remember party, suspend player, suspend box advance, suspend NPCs
 	swap by position (0,find hero (hero:Frumpy))
 	show text box (2427), wait (7), wait for key (usekey), advance text box
 	show text box (2428), wait (7), wait for key (usekey), advance text box
 	show text box (2429), wait (7), wait for key (usekey), advance text box
 	show text box (2430), wait (7), wait for key (usekey), advance text box
 	show text box (2431), wait (7), wait for key (usekey), advance text box
 	show text box (2432), wait (7), wait for key (usekey), advance text box
 	show text box (2433), wait (7), wait for key (usekey), advance text box
 	show text box (2434), wait (7), wait for key (usekey), advance text box
 	show text box (2435), wait (7), wait for key (usekey), advance text box
 	show text box (2436), wait (7), wait for key (usekey), advance text box
 	show text box (2437), wait (7), wait for key (usekey), advance text box
 	show text box (2438), wait (7), wait for key (usekey), advance text box
 	wait (2), tweak palette (0,0,10), update palette, play sound (sfx:Heal8Bit,false,true)
 	teach spell ((find hero(hero:Frumpy)),atk:Raise), wait (3), reset palette, update palette
 	show text box (2439), wait (7), wait for key (usekey), advance text box
 	show text box (2440), wait (7), wait for key (usekey), advance text box
 	show text box (2441), wait (7), wait for key (usekey), advance text box
 	resume player, resume box advance, resume NPCs,reinstate party
end

script,cow,begin
	remember party, suspend player, suspend box advance, suspend NPCs
 	swap by position (0,find hero (hero:Hilda)), swap by position (1,find hero (hero:Olaf))
 	show text box (2443), wait (7), wait for key (usekey), advance text box
 	walk hero to x (me,54), wait for hero (me)
 	walk hero to y (me,51), wait for hero (me)
 	set caterpillar mode (on), set hero position (1, 54, 51)
 	set hero position (2, 54, 51), set hero position (3, 54, 51)
 	wait (1), suspend caterpillar , wait (1)
 	walk hero (me,left,1), walk hero (1,up,1)
 	walk hero (2,down,1), wait for hero (me)
 	set hero direction (me,left), set hero direction (1,left)
 	set hero direction (2,left), set hero direction (3,left) 
 	show text box (2444), wait (7), wait for key (usekey), advance text box
 	show text box (2445), wait (7), wait for key (usekey), advance text box
 	show text box (2446), wait (7), wait for key (usekey), advance text box
 	show text box (2447), wait (7), wait for key (usekey), advance text box
 	show text box (2448), wait (7), wait for key (usekey), advance text box
 	BossIntroduction, fight formation (288), swap by position (0,find hero (hero:Hilda)) 
	swap by position (1,find hero (hero:Olaf)), set tag (tag:cowfight,on)
 	show text box (2449), wait (7), wait for key (usekey), advance text box, set hero direction (me,right) 
	show text box (2450), wait (7), wait for key (usekey), advance text box
 	show text box (2451), wait (7), wait for key (usekey), advance text box
 	walk hero (me,left), set hero direction (me,right), walk hero (1,left,1), wait for hero (1)
 	show text box (2452), wait (7), wait for key (usekey), advance text box
 	show text box (2453),wait (7), wait for key (usekey), advance text box
 	show text box (2454), wait (7), wait for key (usekey), advance text box, wait (10)
 	show text box (2455), wait (7), wait for key (usekey), advance text box, wait(20)
 	show text box (2456), wait (7), wait for key (usekey), advance text box
 	show text box (2457), wait (7), wait for key (usekey), advance text box
 	walk hero (2,left,1), wait for hero (2)
 	walk hero (me,right,1), walk hero (1,down,1), walk hero (2,up,1), walk hero (3,left,1)
 	wait for hero (me), camera follows hero (me), wait (1), tweak palette (10,0,0), update palette
 	play sound (sfx:StormMagic,false,true), wait (5), reset palette, update palette
 	show text box (2458), wait (7), wait for key (use key), advance text box
 	wait (5), resume NPCs, resume player, resume box advance
 	resume caterpillar, set caterpillar mode (off),reinstate party, encounters
end

script,hissu,begin
 	suspend player, suspend box advance, suspend NPCs, fade screen out, remember party
 	wait (5), put hero (me,0,0), focus camera (12,10,0)
  	set NPC position (10,11,11), set NPC direction (10,right)
  	set NPC position (11,10,9), set NPC direction (11,right)
  	set NPC position (12,12,9), set NPC direction (12,down)
  	set NPC position (13,8,9), set NPC direction (13,up)
  	set NPC position (14,13,10), set NPC direction (14,left)
  	set NPC position (15,14,7), set NPC direction (15,down), wait (5), fade screen in
 	show text box (2459), wait (7), wait for key (use key), advance text box
 	show text box (2460), wait (7), wait for key (use key), advance text box
 	show text box (2461), wait (7), wait for key (use key), advance text box
 	play sound (sfx:earthquake,false,true) , pancamera(up,1,20),waitforcamera
 	pancamera(down,2,20),waitforcamera, pancamera(up,2,20),waitforcamera
 	pancamera(down,1,20),waitforcamera , pancamera(left,1,20),waitforcamera
 	pancamera(right,2,20),waitforcamera, pancamera(left,2,20),waitforcamera
 	pancamera(right,1,20),waitforcamera , pan camera (up,1,20), pan camera (right,1,20) 
	wait for camera, pan camera (down,2,20), pan camera (left,2,20), wait for camera 
	pan camera (up,2,20), pan camera (right,2,20), wait for camera
 	pan camera (down,1,20), pan camera (left,1,20), wait for camera, wait (5)
 	set NPC direction (10,down), set NPC direction (11,down), set NPC direction (12,down)
 	set NPC direction (13,down), set NPC direction (14,down), wait (5)
 	show text box (2462), wait (7), wait for key (use key), advance text box
 	play sound (sfx:earthquake,false,true) , pancamera(up,1,20),waitforcamera
 	pancamera(down,2,20),waitforcamera, pancamera(up,2,20),waitforcamera
 	pancamera(down,1,20),waitforcamera , pancamera(left,1,20),waitforcamera
 	pancamera(right,2,20),waitforcamera, pancamera(left,2,20),waitforcamera
 	pancamera(right,1,20),waitforcamera , pan camera (up,1,20), pan camera (right,1,20) 
	wait for camera, pan camera (down,2,20), pan camera (left,2,20), wait for camera
 	pan camera (up,2,20), pan camera (right,2,20), wait for camera
 	pan camera (down,1,20), pan camera (left,1,20), wait for camera
 	wait (5), fade screen out (63,63,63), wait (2)
 	show text box (2463), set tag (tag:Annoy Midgardsorm,on), wait (2)
 	fade screen in, wait (30), fade screen out (63,63,63)
 	set NPC direction (10,right), set NPC direction (11,right)
 	set NPC direction (12,right), set NPC direction (13,right)
 	set NPC direction (14,right), wait (2), advance text box, wait (2), fade screen in
 	show text box (2464), walk NPC (14,left,2), set NPC direction (14,right), wait (7)
 	wait for key (use key), advance text box, walk NPC (10,right,1), wait for NPC (10)
 	show text box (2465), wait (7), wait for key (use key), advance text box
 	show text box (401), wait (7), wait for key (use key), advance text box, wait (3)
 	show text box (402), wait (7), wait for key (use key), advance text box
 	show text box (403), wait (7), wait for key (use key), advance text box, walk NPC (13,right,1)
 	show text box (404), wait (7), wait for key (use key), advance text box
 	play sound (sfx:earthquake,false,true) , pancamera(up,1,20),waitforcamera
 	pancamera(down,2,20),waitforcamera, pancamera(up,2,20),waitforcamera
 	pancamera(down,1,20),waitforcamera , pancamera(left,1,20),waitforcamera
 	pancamera(right,2,20),waitforcamera, pancamera(left,2,20),waitforcamera
 	pancamera(right,1,20),waitforcamera , pan camera (up,1,20), pan camera (right,1,20) 
	wait for camera, pan camera (down,2,20), pan camera (left,2,20), wait for camera
 	pan camera (up,2,20), pan camera (right,2,20), wait for camera
 	pan camera (down,1,20), pan camera (left,1,20), wait for camera, wait (5)
 	show text box (405), wait (7), wait for key (use key), advance text box
 	bossintroduction, fight formation (5),walk NPC (14,right,1)
 	show text box (407), wait (7), wait for key (use key), advance text box
 	show text box (408), wait (7), wait for key (use key), advance text box
	walk NPC (11,right,1)
 	show text box (409), wait (7), wait for key (use key), advance text box
 	show text box (410), wait (7), wait for key (use key), advance text box
 	show text box (411), wait (7), wait for key (use key), advance text box
 	show text box (3347), wait (7), wait for key (use key), advance text box
	set NPC direction (14,up)
 	show text box (3348), wait (7), wait for key (use key), advance text box
	set NPC direction (10,up)
 	show text box (3349), wait (2),set NPC direction (14,right), wait (3)
	set NPC direction (14,down), wait (2), wait for key (use key), advance text box
 	show text box (3350), wait (7), wait for key (use key), advance text box
	set NPC direction (10,right), set NPC direction (14,right)
 	show text box (3351), wait (7), wait for key (use key), advance text box
	set NPC direction (12,down)
 	show text box (3352), wait (7), wait for key (use key), advance text box
	wait (15)
 	show text box (3360), wait (7), wait for key (use key), advance text box
 	show text box (3353), wait (7), wait for key (use key), advance text box
	set NPC direction (12,right)
 	show text box (3354), wait (7), wait for key (use key), advance text box
 	show text box (3355), wait (7), wait for key (use key), advance text box
 	show text box (3356), wait (7), wait for key (use key), advance text box
 	show text box (3357), wait (7), wait for key (use key), advance text box
 	show text box (3358), wait (7), wait for key (use key), advance text box
	set NPC direction (10,up)
 	show text box (3359), wait (7), wait for key (use key), advance text box
	fade screen out (63,63,63), wait (2), set tag (tag:beatsnake,on)
 	set hero position (me,12,10),  camera follows hero (me), wait (2), fade screen in
 	resume NPCs, resume player, resume box advance,reinstate party
 	resume caterpillar, set caterpillar mode (off)
end

script,slayjotun,begin
	remember party, suspend player, suspend box advance
 	swap by position (0, find hero (hero:Styrge))
 	show text box (2469), wait (7), wait for key (use key), advance text box
 	show text box (2470), wait (7), wait for key (use key), advance text box
 	show text box (2471), wait (7), wait for key (use key), advance text box
 	walk hero (me,down,1), wait for hero (me), walk NPC (6,left,1)
 	wait for NPC (6), set NPC direction (6,right)
 	walk hero to x (me,26), wait for hero (me), walk hero to y (me,1), wait for hero (me)
 	wait (2), walk hero (me,up,2), wait for hero (me), wait (5)
 	walk NPC (7,down,1), wait for NPC (7), wait (2)
 	boss introduction, fight formation (292)
 	swap by position (0, find hero (hero:Styrge)), set tag (tag:jotunslain,on)
 	tweak palette (10,0,0), update palette, play sound (sfx:Crush8Bit,false,true)
 	wait (3), reset palette, fade screen in
 	show text box (2472), wait (7), wait for key (usekey), advance text box
 	teach spell ((find hero(hero:Styrge)),atk:GiantDoom), wait (5)
 	resume box advance, resume player,reinstate party
end

# Tim-Tim the mighty Gnome can teach Night a spell that reduces enemy magic power

script,timtim,begin
 	suspend player, suspend box advance,remember party
 	swap by position (0, find hero (hero:Night))
 	show text box (2474), wait (7), wait for key (usekey), advance text box
 	show text box (2475), wait (7), wait for key (usekey), advance text box
 	show text box (2476), wait (7), wait for key (usekey), advance text box
 	tweak palette (0,10,0), update palette, play sound (sfx:Crush8Bit,false,true), wait (3), reset palette, fade screen in
 	show text box (2477), wait (7), wait for key (usekey), set tag (tag:timtim1,on), advance text box
 	teach spell ((find hero(hero:Night)),atk:Hinder), wait (5)
 	show text box (2478), wait (7), wait for key (usekey), advance text box
 	show text box (2479), wait (7), wait for key (usekey), advance text box
 	resume player, resume box advance, reinstate party
end


script,delvirefinal,begin
 	suspend player, suspend box advance, fade screen out, wait (2)
 	set hero position (me,34,5), swap by position (0,find hero (hero:Bram))
 	swap out hero (hero:Freki), swap out hero (hero:Kitt), swap out hero (hero:Styrge)
 	swap out hero (hero:Hilda), swap out hero (hero:Olaf), swap out hero (hero:Eric)
 	swap out hero (hero:Frumpy), swap out hero (hero:Night), swap out hero (hero:Renard)
 	wait (2),remember party
# Delvire
 	set NPC position (23,31,10), set NPC direction (23,right), focus camera (34,10,2), wait for camera
#Bram
 	set NPC position (17,37,10), set NPC direction (17,left), wait (3)
 	fade screen in, wait (10)
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	show text box (2484), wait (7), wait for key (use key), advance text box
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	show text box (2485), wait (7), wait for key (use key), advance text box
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	show text box (2486), wait (7), wait for key (use key), advance text box
 	set NPC direction (23,down), wait (3), set NPC direction (23,left)  
	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	show text box (2487), wait (7), wait for key (use key), advance text box
 	show text box (2488), wait (7), wait for key (use key), advance text box
 	walk NPC (17,left,1), wait for NPC (17)
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	show text box (2489), wait (7), wait for key (use key), advance text box
 	set NPC direction (23,down), wait (3), set NPC direction (23,right)
 	show text box (2490), wait (7), wait for key (use key), advance text box, walk NPC (23,right,1)
 	show text box (2491), wait (7), wait for key (use key), advance text box
 	show text box (2492), wait (7), wait for key (use key), advance text box
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	show text box (2493), wait (7), wait for key (use key), advance text box
 	set NPC direction (23,down), wait (3), set NPC direction (23,left)
  	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	show text box (2494), wait (7), wait for key (use key), advance text box
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	show text box (2495), wait (7), wait for key (use key), advance text box
 	set NPC direction (23,down), wait (3), set NPC direction (23,right)
 	show text box (2496), wait (7), wait for key (use key), advance text box
	remember party, BossIntroduction , fight formation (261)
 	swap by position (0,find hero (hero:Bram))  
	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	show text box (2497), wait (7), wait for key (use key), advance text box, wait (7)
  	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
  	show text box (2498), wait (7), wait for key (use key), advance text box
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	show text box (2499), wait (7), wait for key (use key), advance text box
 	set NPC direction (23,down), wait (2), set NPC direction (23,left)
  	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
  	show text box (2500), wait (7), wait for key (use key), advance text box
 	fade screen out, wait (2)
 	show text box (2501), wait (2), fade screen in
 	wait (7), wait for key (use key), advance text box
  	show text box (2502), wait (7), wait for key (use key), advance text box
  	show text box (2503), wait (7), wait for key (use key), fade screen out
 	wait (2), advance text box, wait (2), set NPC direction (23,right), fade screen in
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	show text box (2504), wait (7), wait for key (use key), advance text box, walk NPC (23,right,1)
  	show text box (2505), wait (7), wait for key (use key), advance text box
  	show text box (2506), wait (7), wait for key (use key), advance text box
 	set NPC direction (17,down), wait (3), set NPC direction (17,right), wait (10), stop song
 	show text box (2507), wait (7), wait for key (use key), advance text box
 	wait (10), set NPC direction (17,down), walk NPC (17,down,2)
 	wait for NPC (17), set NPC direction (23,down)
  	show text box (2508), wait (7), wait for key (use key), advance text box, wait (10)
  	show text box (2509), wait (7), wait for key (use key), advance text box
 	set NPC direction (17,left), wait (3), set NPC direction (17,up), wait (3)
  	show text box (2510), wait (7), wait for key (use key), advance text box
  	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
 	set NPC frame (23,1), wait (1), set NPC frame (23,0), wait (1)
  	show text box (2511), wait (7), wait for key (use key), advance text box
 	wait (1), tweak palette (0,10,0), update palette
 	play sound (sfx:Heal8bit,false,true), teach spell ((find hero(hero:Bram)),atk:Flux Time)
 	wait (10), reset palette, fade screen in
 	show text box (2512), wait (7), wait for key (use key), advance text box
 	fade screen out, wait (2), resume box advance, resume NPCs
 	resume obstruction,set tag (tag:LastDelvire,on), camera follows hero (me)
 	wait (2), use door (9), wait (2), fade screen in, resume player
end

# Kitt gains WeakStrike - which gets stronger the fewer HP he has.
# You'll need an Adamant Hammer, which can be bought in Alfheim.

script,weakstrike,begin
	remember party, suspend player, suspend box advance
 	swap by position (0,find hero (hero:Kitt))
 	show text box (2535), wait (7), wait for key (use key), advance text box
 	show text box (2536), wait (7), wait for key (use key), advance text box
 	wait (1), tweak palette (10,0,0), update palette
 	play sound (sfx:StormMagic,false,true), teach spell ((find hero(hero:Kitt)),atk:Weaksmash)
 	wait (10), reset palette, fade screen in
 	show text box (2537), wait (7), wait for key (use key), advance text box
 	show text box (2538), wait (7), wait for key (use key), advance text box
 	show text box (2539), wait (7), wait for key (use key), advance text box
 	show text box (2540), wait (7), wait for key (use key), advance text box
 	show text box (2541), wait (7), wait for key (use key), advance text box
 	wait (5), resume player, resume box advance, reinstate party
end

# Styrge can gain Manslayer - which deals extra damage to human characters.
# You'll need a Manslayer sword, which can be bought in Alfheim.

script,manslay,begin
	remember party, suspend player, suspend box advance, swap by position (0,find hero (hero:Styrge))
 	show text box (2542), wait (7), wait for key (use key), advance text box
 	wait (1), tweak palette (10,0,0), update palette, play sound (sfx:StormMagic,false,true)
 	teach spell ((find hero(hero:Styrge)),atk:ManSlayer), wait (10)
 	reset palette, fade screen in
 	show text box (2543), wait (7), wait for key (use key), advance text box
 	show text box (2544), wait (7), wait for key (use key), advance text box
 	show text box (2545), wait (7), wait for key (use key), advance text box
 	show text box (2546), wait (7), wait for key (use key), advance text box
 	show text box (2547), wait (7), wait for key (use key), advance text box
 	show text box (2548), wait (7), wait for key (use key), advance text box
 	show text box (2549), wait (7), wait for key (use key), advance text box
 	resume player, resume box advance, reinstate party
end

# Olaf can gain Dark Rage, an attack that deals dark damage in exchange for some HP loss.
# You'll need an Antler, of all things - which can be bought in (you guessed it) Alfheim.

script,darkrage,begin
	remember party, suspend player, suspend box advance, swap by position (0,find hero (hero:Olaf))
 	show text box (2550), wait (7), wait for key (use key), advance text box
 	show text box (2551), wait (7), wait for key (use key), advance text box
 	wait (1), tweak palette (10,0,0), update palette, play sound (sfx:Roar,false,true)
 	teach spell ((find hero(hero:Olaf)),atk:Dark Rage), wait (10), reset palette, fade screen in
 	show text box (2552), wait (7), wait for key (use key), advance text box
 	show text box (2553), wait (7), wait for key (use key), advance text box
 	show text box (2554), wait (7), wait for key (use key), advance text box
 	show text box (2555), wait (7), wait for key (use key), advance text box
 	resume box advance, resume player, reinstate party
 end

script,itsatrap,begin
	remember party, suspend player, suspend box advance
 	stop song, play sound (sfx:Fart,false,true), set tag (tag:FART,on), wait (20)
 	tweak palette (-5,5,-5), fade screen in, wait (2)
 	tweak palette (-5,5,-5), fade screen in, wait (2)
 	tweak palette (-5,5,-5), fade screen in, wait (2)
 	tweak palette (-5,5,-5), fade screen in, wait (2)
 	tweak palette (-5,5,-5), fade screen in, wait (2)
 	tweak palette (-5,5,-5), fade screen in, wait (2)
 	tweak palette (-5,5,-5), fade screen in, wait (2)
 	fade screen out, wait (2), reset palette, wait (2), set tag (tag:FART,off)
 	suspend npcs, swap by position (0, find hero (hero:Kitt))
 	swap out hero (hero:Bram), swap out hero (hero:Frumpy), swap out hero (hero:Styrge)
 	swap out hero (hero:Hilda), swap out hero (hero:Olaf), swap out hero (hero:Night)
 	swap out hero (hero:Eric), set hero position (me,80,17)
 	wait (2), fade screen in, wait (2), focus camera (80,24,2), wait for camera
 	walk NPC (47,down,1), wait for NPC (47)
 	tweak palette (63,63,63), update palette, play sound (sfx:Metal_Hit,false,true)
 	wait (1), reset palette, update palette, wait (2)
 	walk NPC (47,up,1), set NPC direction (47,down), wait for NPC (47)
 	wait (2), walk NPC (47,down,1), wait for NPC (47)
 	tweak palette (63,63,63), update palette, play sound (sfx:Metal_Hit,false,true), wait (1)
 	reset palette, update palette, wait (2)
 	walk NPC (47,up,1), set NPC direction (47,down), wait for NPC (47), wait (2)
 	walk NPC (47,down,1), wait for NPC (47), tweak palette (63,63,63)
 	update palette, play sound (sfx:Metal_Hit,false,true), wait (1)
 	reset palette, update palette, wait (2)
 	show text box (2564), wait (7), wait for key (use key), advance text box
 	show text box (2565), wait (7), wait for key (use key), advance text box
 	show text box (2566), wait (7), wait for key (use key), advance text box
 	show text box (2567), wait (7), wait for key (use key), advance text box
 	set NPC direction (50,down)
 	walk NPC (52,down,2), walk NPC (48,right,1), walk NPC (43,up,6)
 	walk NPC (44,up,6), walk NPC (45,up,6), walk NPC (46,up,6)
 	wait for NPC (43), walk NPC (43,left,2), walk NPC (44,up,1),
 	walk NPC (45,right,1), walk NPC (46,left,1), wait for NPC (46)
 	set NPC direction (43,down), set NPC direction (45,up), set NPC direction (46,up)
 	wait (2), set NPC direction (43,right), wait (2)
 	show text box (2568), wait (7), wait for key (use key), advance text box
 	set NPC frame (48,1), wait (1), set NPC frame (48,0), wait (1)
 	set NPC frame (48,1), wait (1), set NPC frame (48,0), wait (1)
 	show text box (2569), wait (7), wait for key (use key), advance text box
 	set NPC direction (44,left)
 	set NPC frame (44,1), wait (1), set NPC frame (44,0), wait (1)
 	set NPC frame (44,1), wait (1), set NPC frame (44,0), wait (1)
 	show text box (2570), wait (7), wait for key (use key), advance text box
 	set NPC frame (47,1), wait (1), set NPC frame (47,0), wait (1)
 	set NPC frame (47,1), wait (1), set NPC frame (47,0), wait (1)
 	show text box (2571), wait (7), wait for key (use key), advance text box
 	wait (5), set NPC direction (44,up), wait (3)
 	show text box (2572), wait (7), wait for key (use key), advance text box
 	set NPC frame (47,1), wait (1), set NPC frame (47,0), wait (1)
 	set NPC frame (47,1), wait (1), set NPC frame (47,0), wait (1)
 	show text box (2573), wait (7), wait for key (use key), advance text box
 	wait (5), walk NPC (46,up,1), wait for NPC (46), wait (5)
 	show text box (2574), wait (7), wait for key (use key), advance text box
 	set NPC frame (49,1), wait (1), set NPC frame (49,0), wait (1)
 	set NPC frame (49,1), wait (1), set NPC frame (49,0), wait (1)
 	show text box (2575), wait (7), wait for key (use key), advance text box
 	set NPC frame (44,1), wait (1), set NPC frame (44,0), wait (1)
 	set NPC frame (44,1), wait (1), set NPC frame (44,0), wait (1)
 	show text box (2576), wait (7), wait for key (use key), advance text box
 	set NPC direction (44,right), wait (2), set NPC direction (44,down), wait (2)
 	set NPC frame (44,1), wait (1), set NPC frame (44,0), wait (1)
 	set NPC frame (44,1), wait (1), set NPC frame (44,0), wait (1)
 	show text box (2577), wait (7), wait for key (use key), advance text box
 	show text box (2578), wait (7), wait for key (use key), advance text box	
 	set NPC frame (54,1), wait (1), set NPC frame (54,0), wait (1)
 	set NPC frame (54,1), wait (1), set NPC frame (54,0), wait (1)
 	show text box (2579), wait (7), wait for key (use key), advance text box
 	wait (2), set NPC direction (44,right), wait (2)
 	show text box (2580), wait (7), wait for key (use key), advance text box
 	wait (2), set NPC direction (44,left), wait (2), set NPC direction (44,up), wait (2)
 	set NPC frame (44,1), wait (1), set NPC frame (44,0), wait (1)
 	set NPC frame (44,1), wait (1), set NPC frame (44,0), wait (1)
 	show text box (2581), wait (7), wait for key (use key), advance text box
 	show text box (2582), wait (7), wait for key (use key), advance text box
 	set NPC frame (44,1), wait (1), set NPC frame (44,0), wait (1)
 	set NPC frame (44,1), wait (1), set NPC frame (44,0), wait (1)
 	show text box (2583), wait (7), wait for key (use key), advance text box
 	show text box (2584), wait (7), wait for key (use key), advance text box, wait (5)
 	show text box (2585), wait (7), wait for key (use key), advance text box, wait (5)
 	show text box (2586), wait (7), wait for key (use key), advance text box
 	wait (2), set nPC direction (44,left), wait (2), set NPC direction (44,down), wait (2)
 	show text box (2587), wait (7), wait for key (use key), advance text box
 	walk NPC (44,down,11), wait (10), walk NPC (43,right,2), walk NPC (46, right,1), wait for NPC (46)
 	walk NPC (46,down,11), wait for NPC (43), walk NPC (43,down,11), wait for NPC (43)
 	stop song, wait (10)
 	show text box (2588), wait (7), wait for key (use key), advance text box
 	wait (5), set NPC direction (45,left), wait (5)
 	show text box (2589), wait (7), wait for key (use key), advance text box
 	set NPC frame (47,1), wait (1), set NPC frame (47,0), wait (1) 
 	set NPC frame (47,1), wait (1), set NPC frame (47,0), wait (1)
 	show text box (2590), wait (7), wait for key (use key), advance text box
 	wait (5), set NPC direction (45,up), wait (2), walk NPC (45,up,2), wait for NPC (45), wait (5)
 	set NPC frame (44,1), wait (1), set NPC frame (44,0), wait (1)
 	set NPC frame (44,1), wait (1), set NPC frame (44,0), wait (1)
 	show text box (2591), wait (7), wait for key (use key), advance text box
 	set NPC frame (47,1), wait (1), set NPC frame (47,0), wait (1)
 	set NPC frame (47,1), wait (1), set NPC frame (47,0), wait (1)
 	show text box (2592), wait (7), wait for key (use key), advance text box
 	fade screen out,  wait (1), show text box (2593), wait (1), fade screen in
 	wait (7), wait for key (use key), advance text box
 	show text box (2594), wait (7), wait for key (use key), advance text box
 	show text box (2595), wait (7), wait for key (use key), advance text box
 	show text box (2596), wait (7), wait for key (use key), fade screen out 
 	wait (1), advance text box, wait (2), fade screen in, wait (2)
 	set NPC frame (47,1), wait (1), set NPC frame (47,0), wait (1)
 	set NPC frame (47,1), wait (1), set NPC frame (47,0), wait (1)
 	show text box (2597), wait (7), wait for key (use key), advance text box
 	walk NPC (45,up,3), wait for NPC (45), set NPC direction (45,right), wait (2)
 	set NPC frame (45,1), wait (1), set NPC frame (45,0), wait (1)
 	set NPC frame (45,1), wait (1), set NPC frame (45,0), wait (1)
 	set NPC direction (42,left), set NPC direction (45,left)
 	wait (1), set NPC direction (45,up), wait (1), set NPC direction (45,right)
 	wait (1), set tag (tag:gatedown,on), wait (5) , set NPC direction (45,up)
 	show text box (2598), wait (7), wait for key (use key), advance text box
 	show text box (2599), wait (7), wait for key (use key), advance text box
 	wait (2), walk NPC (45,left,1), wait for NPC (45), set NPC direction (45,down), wait (2)
 	show text box (2600), wait (7), wait for key (use key), advance text box
 	set NPC direction (45,left), wait (2), set NPC direction (45,up), wait (2)
 	show text box (2601), wait (7), wait for key (use key), advance text box
 	show text box (2602), wait (7), wait for key (use key), advance text box
 	tweak palette (10,0,0), update palette, play sound (sfx:EnemyDeath,false,true) 
 	teach spell ((find hero(hero:Kitt)),atk:HPstrike), wait (10), reset palette, fade screen in
 	show text box (2605), wait (7), wait for key (use key), advance text box
 	wait (5), walk NPC (45,down,1), set NPC direction (45), wait for NPC (45)
 	set NPC direction (45), wait (2), walk NPC (45,down,11), wait for NPC (45)
 	show text box (2603), wait (7), wait for key (use key), advance text box
 	show text box (2604), wait (7), wait for key (use key), advance text box
 	fade screen out, wait (2), set tag (tag:trapped,on), set hero position (me,80,24)
 	camera follows hero (me), wait (2), fade screen in
 	resume box advance, resume player, resume NPCs
end

# This is the script for the first time you see the gate to Helheim

script,seethegate,begin
 	suspend player, suspend box advance
 	focus camera (14,9,4), wait for camera, wait (25)
 	focus camera (14,25,4), wait for camera
 	show text box (2625), wait (7), wait for key (use key), advance text box
 	camera follows hero (me), resume player, resume box advance
end

# This script runs each time you open Helheim's door. It lights up, and then moves to open.

script,intohelheim,begin
 	suspend player, suspend obstruction, wait (2)
 	set NPC direction (2,right), set NPC direction (3,right), set NPC direction (4,right)
 	set NPC direction (5,right), set NPC direction (6,right), set NPC direction (7,right)
 	set NPC direction (8,right), set NPC direction (9,right), set NPC direction (10,right)
 	set NPC direction (11,right), set NPC direction (12,right), set NPC direction (13,right)
 	wait (2)
 	set NPC direction (2,up), set NPC direction (3,up), set NPC direction (4,up)
 	set NPC direction (5,up), set NPC direction (6,up), set NPC direction (7,up)
 	set NPC direction (8,up), set NPC direction (9,up), set NPC direction (10,up)
 	set NPC direction (11,up), set NPC direction (12,up), set NPC direction (13,up)
 	wait (2)
 	set NPC direction (2,left), set NPC direction (3,left), set NPC direction (4,left)
 	set NPC direction (5,left), set NPC direction (6,left), set NPC direction (7,left)
 	set NPC direction (8,left), set NPC direction (9,left), set NPC direction (10,left)
 	set NPC direction (11,left), set NPC direction (12,left), set NPC direction (13,left)
 	wait (15), play sound (sfx:earthquake,false,true)
 	walk NPC (2,left,2), walk NPC (3,left,2), walk NPC (4,left,2)
 	walk NPC (5,left,2), walk NPC (6,left,2), walk NPC (7,left,2)
 	walk NPC (8,right,2), set NPC direction (8,left), walk NPC (9,right,2), set NPC direction (9,left)
 	walk NPC (10,right,2), set NPC direction (10,left), walk NPC (11,right,2), set NPC direction (11,left)
 	walk NPC (12,right,2), set NPC direction (12,left), walk NPC (13,right,2), set NPC direction (13,left)
 	wait for NPC (13), wait (20), fade screen out, wait (2)
 	use door (2), resume obstruction, resume player
end

# We're in for a FUN script now. Welcome to Vikings of Midgard's biggest Minigame.
# In actuality, it's Spoonweaver's Spaceship Funkatron, reskinned.

plotscript, vikitron, begin
	suspend player, suspend box advance,resume NPCs
	suspend obstruction,import globals (33), fade screen out, wait (1)
	showtextbox (2635), fade screen in, wait (20), fade screen out, advance textbox
 	wait (1),teleport to map (37,11,0), wait (1)

	timer:=0
	score:=0
	keytimer:=0
 	fade screen in,wait (16)
	write map block (11,2,14),play sound (sfx:Soft_Airy_Swish,false,true) 
	wait(10),create npc (3,11,2),wait(5),walk npc (3,south,3),wait(15)
	create npc (1,11,2),wait(5),walk npc (1,south,3),walk npc (3,west,2)
	wait(20),create npc (2,11,2),set NPC direction (3, south),wait(5)
	write map block (11,2,7), play sound (sfx:Soft_Airy_Swish,false,true) 
	walk npc (2,south,1), wait(15), walk npc (2,east,2)
	wait(15),set NPC direction (2, north), play sound (sfx:Pingdadingdingding,false,true) 
	wait(15),play sound (0,false,false),wait(10),walk npc (2,south,2)
	wait (5), set NPC direction (13, left), set NPC direction (12, right), wait (15)
	wait (5), set NPC direction (13, down), set NPC direction (12, down), wait (15)

	variable(tilex,tiley)
	for (tilex,0,22,1) do,begin
		for (tiley,0,2,1) do, begin
			write map block (tilex,tiley,8)
			end
		end
	write map block (10,0,9,2),write map block (10,1,25,2),write map block (10,2,41,2)
	write map block (11,0,10,2),write map block (11,2,42,2)
	write map block (12,0,11,2),write map block (12,1,27,2),write map block (12,2,43,2)
	write map block (10,0,0,0),write map block (10,1,0,0),write map block (10,2,0,0)
	write map block (11,0,0,0),write map block (11,1,0,0),write map block (11,2,0,0)
	write map block (12,0,0,0),write map block (12,1,0,0),write map block (12,2,0,0)
	write map block (4,1,13,0),write map block (5,1,13,0),write map block (6,1,13,0)
	write map block (7,1,13,0),write map block (8,1,13,0),write map block (9,1,13,0)
	write map block (13,1,13,0),write map block (14,1,13,0),write map block (15,1,13,0)
	write map block (16,1,13,0),write map block (17,1,13,0),write map block (18,1,13,0)
	write map block (19,1,13,0),write map block (4,1,29,2),write map block (5,1,30,2)
	write map block (6,1,12,2),write map block (7,1,12,2),write map block (8,1,12,2)
	write map block (9,1,12,2),write map block (13,1,12,2),write map block (14,1,12,2)
	write map block (15,1,12,2),write map block (16,1,12,2),write map block (17,1,12,2)
	write map block (18,1,12,2),write map block (19,1,12,2),play song (56)

	tyron:=NPC reference (1,0)
	boosh:=NPC reference (2,0)
	steve:=NPC reference (3,0)
	funkout
	suspend timers
	show no value
	exit script
end

#-------------------------------------------------------------------------

#game loop
#-------------------------------------------------------------------------

plotscript, funkout, begin
	variable(keyz,rand,kill)
	while (1==1) do,begin
		show value (score)
		if (timer<<2550) then (keytimer:=1+keytimer)
		if (timer<<2550>>1300) then (keytimer:=1+keytimer)
		rand:=random(6,9)
		if (keytimer>>20) then (create npc (rand,22,1,west),keytimer:=0)
		kill:=npc at spot (4,1)
		if (get NPC ID (kill)>>0) then (score:=score--3,create npc (10,4,1,west), play sound (sfx:Cancel8Bit,false,true),wait (1) )
		destroy npc (kill)
		DESTROY NPC (11)
		DESTROY NPC (10)
		keyz:=npc at pixel (220,30)
		if (key is pressed (key:up),and,not (key is pressed (key:right)),and,not (key is pressed (key:down)),and,not (key is pressed (key:left))) then , begin
			if (get NPC ID (keyz)==6) then (score:=score+10,change npc id(keyz,11), play sound (sfx:Bloop,false,true) )
			end
		if (key is pressed (key:right),and,not (key is pressed (key:up)),and,not (key is pressed (key:down)),and,not (key is pressed (key:left))) then , begin
			if (get NPC ID (keyz)==7) then (score:=score+10,change npc id(keyz,11), play sound (sfx:Bloop,false,true) )
			end
		if (key is pressed (key:down),and,not (key is pressed (key:up)),and,not (key is pressed (key:right)),and,not (key is pressed (key:left))) then , begin
			if (get NPC ID (keyz)==8) then (score:=score+10,change npc id(keyz,11), play sound (sfx:Bloop,false,true) )
			end
		if (key is pressed (key:left),and,not (key is pressed (key:up)),and,not (key is pressed (key:right)),and,not (key is pressed (key:down))) then , begin
			if (get NPC ID (keyz)==9) then (score:=score+10,change npc id(keyz,11), play sound (sfx:Bloop,false,true) )
			end
		if (timer==0,or,timer==130,or,timer==390,or,timer==640,or,timer==785,or,timer==1725,or,timer==925,or,timer==1140,or,timer==2385,or,timer==1460,or,timer==2005,or,timer==2274) then , begin
			put npc (3,180,100),put npc (1,220,100),put npc (2,260,100)
			set NPC direction (1, south),set NPC direction (2, south),set NPC direction (3, south)
			end
		if (timer==5,or,timer==15,or,timer==25,or,timer==35,or,timer==45,or,timer==55,or,timer==65,or,timer==75,or,timer==85,or,timer==95,or,timer==105,or,timer==115,or,timer==125) then , begin
			put npc (3,180,95),put npc (1,220,100),put npc (2,260,95)
			end
		if (timer==10,or,timer==20,or,timer==30,or,timer==40,or,timer==50,or,timer==60,or,timer==70,or,timer==80,or,timer==90,or,timer==100,or,timer==110,or,timer==120) then , begin
			put npc (3,180,100),put npc (1,220,95),put npc (2,260,100)
			end
		if (timer==140,or,timer==160,or,timer==180,or,timer==200,or,timer==220,or,timer==240,or,timer==260,or,timer==280,or,timer==300,or,timer==320,or,timer==340,or,timer==360,or,timer==380) then , begin
			set NPC direction (1, west),set NPC direction (2, west),set NPC direction (3, west)
			end
		if (timer==150,or,timer==170,or,timer==190,or,timer==210,or,timer==230,or,timer==250,or,timer==270,or,timer==290,or,timer==310,or,timer==330,or,timer==350,or,timer==370) then , begin
			set NPC direction (1, east),set NPC direction (2, east),set NPC direction (3, east)
			end
		if (timer==400,or,timer==420,or,timer==440,or,timer==460,or,timer==480,or,timer==500,or,timer==520,or,timer==540,or,timer==560,or,timer==580,or,timer==600,or,timer==620) then , begin
			set NPC direction (1, north),set NPC direction (2, north),set NPC direction (3, north)
			end
		if (timer==410,or,timer==430,or,timer==450,or,timer==470,or,timer==490,or,timer==510,or,timer==530,or,timer==550,or,timer==570,or,timer==590,or,timer==610,or,timer==630) then , begin
			set NPC direction (1, south),set NPC direction (2, south),set NPC direction (3, south)
			end
		
		if (timer==655,or,timer==665,or,timer==675,or,timer==685,or,timer==695,or,timer==705,or,timer==715,or,timer==725,or,timer==735,or,timer==745,or,timer==755,or,timer==765,or,timer==775,or
			,timer==2275,or,timer==2285,or,timer==2295,or,timer==2305,or,timer==2315,or,timer==2325,or,timer==2335,or,timer==2345,or,timer==2355,or,timer==2365,or,timer==2375) then,begin
			set NPC direction (1, west),set NPC direction (3, west), put npc (1,220,95)
			end

		if (timer==660,or,timer==670,or,timer==680,or,timer==690,or,timer==700,or,timer==710,or,timer==720,or,timer==730,or,timer==740,or,timer==750,or,timer==760,or,timer==770,or,timer==780,or,timer==2280,or,timer==2290,or,timer==2300,or,timer==2310,or,timer==2320,or,timer==2330,or,timer==2340,or,timer==2350,or,timer==2360,or,timer==2370,or,timer==2380) then,begin
			set NPC direction (1, west),set NPC direction (3, west), put npc (1,220,100)
			end

if (timer==795,or,timer==805,or,timer==815,or,timer==825,or,timer==835,or,timer==845,or,timer==855,or,timer==865,or,timer==876,or,timer==885,or,timer==895,or,timer==905,or,timer==915) then,begin
			set NPC direction (1,east),set NPC direction (2,east),put npc (1,220,95)
			end

if (timer==800,or,timer==810,or,timer==820,or,timer==830,or,timer==840,or,timer==850,or,timer==860,or,timer==870,or,timer==880,or,timer==890,or,timer==900,or,timer==910,or,timer==920) then,begin
			set NPC direction (1,east),set NPC direction (2,east), put npc (1,220,100)
			end
		if (timer==930,or,timer==990,or,timer==1050,or,timer==1110,or,timer==1430) then,begin
			set NPC direction (3,east)
			end
		if (timer==940,or,timer==1000,or,timer==1060,or,timer==1120,or,timer==1440) then,begin
			set NPC direction (1,east)
			end
		if (timer==950,or,timer==1010,or,timer==1070,or,timer==1130,or,timer==1450) then,begin
			set NPC direction (2,east)
			end
		if (timer==960,or,timer==1020,or,timer==1080,or,timer==1400) then,begin
			set NPC direction (3,west)
			end
		if (timer==970,or,timer==1030,or,timer==1090,or,timer==1410) then,begin
			set NPC direction (1,west)
			end
		if (timer==980,or,timer==1040,or,timer==1100,or,timer==1420) then,begin
			set NPC direction (2,west)
			end

		if (timer==1160,or,timer==1220,or,timer==1280,or,timer==1340) then,begin
			set NPC direction (3,north)
			end

		if (timer==1170,or,timer==1230,or,timer==1290,or,timer==1350) then,begin
			set NPC direction (1,north)
			end

		if (timer==1180,or,timer==1240,or,timer==1300,or,timer==1360) then,begin
			set NPC direction (2,north)
			end

		if (timer==1190,or,timer==1250,or,timer==1310,or,timer==1370) then,begin
			set NPC direction (3,south)
			end

		if (timer==1200,or,timer==1260,or,timer==1320,or,timer==1380) then,begin
			set NPC direction (1,south)
			end

		if (timer==1210,or,timer==1270,or,timer==1330,or,timer==1390) then,begin
			set NPC direction (2,south)
			end
		if (timer==1460,or,timer==1470,or,timer==1480,or,timer==1490,or,timer==1500,or,timer==1510,or,timer==1520,or,timer==1530,or,timer==1540,or,timer==1550,or,timer==1560,or,timer==1570,or,timer==1580,or,timer==1590,or,timer==1600,or,timer==1610,or,timer==1620) then,begin
			set NPC direction (2,south),set NPC direction (3,south),set NPC direction (1,north)
			end
		if (timer==1465,or,timer==1475,or,timer==1485,or,timer==1495,or,timer==1505,or,timer==1515,or,timer==1525,or,timer==1535,or,timer==1545,or,timer==1555,or,timer==1565,or,timer==1575,or,timer==1585,or,timer==1595,or,timer==1605,or,timer==1615,or,timer==1625) then,begin
			set NPC direction (2,north),set NPC direction (3,north),set NPC direction (1,south)
		end
		if (timer==1630,or,timer==1640,or,timer==1650,or,timer==1660,or,timer==1670,or,timer==1680,or,timer==1690,or,timer==1700,or,timer==1710,or,timer==1720) then,begin
			set NPC direction (2,west),set NPC direction (3,west),set NPC direction (1,east)
		end
		if (timer==1635,or,timer==1645,or,timer==1655,or,timer==1665,or,timer==1675,or,timer==1685,or,timer==1695,or,timer==1705,or,timer==1715) then,begin
			set NPC direction (2,east),set NPC direction (3,east),set NPC direction (1,west)
		end
		if (timer==1730,or,timer==1740,or,timer==1760,or,timer==1770,or,timer==1790
		,or,timer==1800,or,timer==1810,or,timer==1830,or,timer==1840) then,begin
			set NPC direction (3,east),set NPC direction (1,east),put npc (3,180,100)
		end
		if (timer==1735,or,timer==1765,or,timer==1795,or,timer==1805,or,timer==1835) then,begin
			set NPC direction (3,east),set NPC direction (1,east), put npc (3,180,95)
		end
		if (timer==1745,or,timer==1755,or,timer==1775,or,timer==1785,or,timer==1815,or,timer==1825,or,timer==1845,or,timer==1855) then,begin
			set NPC direction (2,west),set NPC direction (1,west),put npc (2,260,100)
		end


		if (timer==1750,or,timer==1780,or,timer==1820,or,timer==1850) then,begin
			set NPC direction (2,west),set NPC direction (1,west), put npc (2,260,95)
		end
		if (timer==1860,or,timer==1875,or,timer==1885,or,timer==1895,or,timer==1905,or,timer==1915,or,timer==1925,or,timer==1935,or,timer==1945,or,timer==1955,or,timer==1965,or,timer==1975,or,timer==1985,or,timer==1995) then,begin
			set NPC direction (2,west),set NPC direction (1,north),set NPC direction (3,east)
			put npc (2,260,95),put npc (3,180,95)
		end

		if (timer==1870,or,timer==1880,or,timer==1890,or,timer==1900,or,timer==1910,or,timer==1920,or,timer==1930,or,timer==1940,or,timer==1950,or,timer==1960,or,timer==1970,or,timer==1980,or,timer==1990,or,timer==2000) then,begin
			set NPC direction (2,west),set NPC direction (1,north),set NPC direction (3,east)
			put npc (2,260,100),put npc (3,180,100)
		end
if (timer==2020,or,timer==2030,or,timer==2040,or,timer==2050,or,timer==2060,or,timer==2070,or,timer==2080,or,timer==2090,or,timer==2100,or,timer==2110,or,timer==2120,or,timer==2130,or,timer==2140,or,timer==2150,or,timer==2160,or,timer==2170,or,timer==2180,or,timer==2190,or,timer==2200,or,timer==2210,or,timer==2220,or,timer==2230,or,timer==2240,or,timer==2250,or,timer==2260,or,timer==2270) then , begin
			put npc (3,180,95),put npc (1,220,100),put npc (2,260,95)
		end

if (timer==2015,or,timer==2025,or,timer==2035,or,timer==2045,or,timer==2055,or,timer==2065,or,timer==2075,or,timer==2085,or,timer==2095,or,timer==2105,or,timer==2115,or,timer==2125,or,timer==2135,or,timer==2145,or,timer==2155,or,timer==2165,or,timer==2175,or,timer==2185,or,timer==2195,or,timer==2205,or,timer==2215,or,timer==2225,or,timer==2235,or,timer==2245,or,timer==2255,or,timer==2265) then , begin
			put npc (3,180,100),put npc (1,220,95),put npc (2,260,100)
		end

			if (timer==2390) then (change NPC ID (tyron,4))
if (timer==2390,or,timer==2394,or,timer==2398,or,timer==2402,or,timer==2406,or,timer==2410,or,timer==2414,or,timer==2418,or,timer==2422,or,timer==2426,or,timer==2430,or,timer==2434,or,timer==2438,or,timer==2442,or,timer==2446,or,timer==2450,or,timer==2454,or,timer==2458,or,timer==2462,or,timer==2466,or,timer==2470,or,timer==2474,or,timer==2478,or,timer==2482,or,timer==2486,or,timer==2490,or,timer==2494,or,timer==2498,or,timer==2502,or,timer==2506,or,timer==2510,or,timer==2514,or,timer==2518,or,timer==2522,or,timer==2526,or,timer==2530,or,timer==2534,or,timer==2538,or,timer==2542,or,timer==2546,or,timer==2550,or,timer==2554,or,timer==2558,or,timer==2562,or,timer==2566,or,timer==2570,or,timer==2574,or,timer==2578,or,timer==2582,or,timer==2586,or,timer==2590,or,timer==2594,or,timer==2598,or,timer==2602,or,timer==2606,or,timer==2610,or,timer==2614,or,timer==2618,or,timer==2622,or,timer==2626) then,begin
			set NPC direction (2,east),set NPC direction (4,down)
			put npc (4,253,100)
		end



		if (timer==2392,or,timer==2396,or,timer==2400,or,timer==2404,or,timer==2408,or,timer==2412,or,timer==2416,or,timer==2420,or,timer==2424,or,timer==2428,or,timer==2432,or,timer==2436,or,timer==2440,or,timer==2444,or,timer==2448,or,timer==2452,or,timer==2456,or,timer==2460,or,timer==2464,or,timer==2468,or,timer==2472,or,timer==24760,or,timer==2480,or,timer==2484,or,timer==2488,or,timer==2492,or,timer==2496,or,timer==2500,or,timer==2504,or,timer==2508,or,timer==2512,or,timer==2516,or,timer==2520,or,timer==2524,or,timer==2528,or,timer==2532,or,timer==2536,or,timer==2540,or,timer==2544,or,timer==2548,or,timer==2552,or,timer==2556,or,timer==2560,or,timer==2564,or,timer==2568,or,timer==2572,or,timer==2576,or,timer==2580,or,timer==2584,or,timer==2588,or,timer==2592,or,timer==2596,or,timer==2600,or,timer==2604,or,timer==2608,or,timer==2612,or,timer==2616,or,timer==2620,or,timer==2624,or,timer==2628) then,begin
			set NPC direction (2,east),set NPC direction (4,up)
			put npc (4,238,100)
		end





		if (timer==2450) then (change NPC ID (boosh,5), play sound (sfx:Wilhelm,false,true) )
		if (timer==2520) then (set NPC direction (3,east), set NPC direction (5,down), stop song, play sound (sfx:Breakdown,false,true) 
			set NPC direction (13, left), set NPC direction (12, right))
		if (timer==2550) then (walk npc (3,west,10)
			 walk NPC (13,down,1),set NPC direction (13, up), walk NPC (12,down,1) set NPC direction (12, up))

		timer:=1+timer
# 2620.8 song ends
		if (timer>>2621) then (scoreboard)
		wait(1)
		show no value
#-V cleanup

#-^ cleanup
		suspend timers

	end
end
#-------------------------------------------------------------------------


#end of game
#-------------------------------------------------------------------------
plotscript, scoreboard, begin
	stop song
	show no value
	if (score>>highscore) then (highscore:=score)
	export globals (5,1,1)
	save in slot (5)
	 fade screen out
	 show no value
	 wait (2)
	Show text box (2634)
	 wait (1)
	 fade screen in
	 wait (10)
	 fade screen out
	 advance text box
	timer:= 0
 	show no value
	teleport to map (33,41,15)
	 wait (1)
	 fade screen in
	 wait (2)
	 if (score>=1000) then (funkatronbest)
	 if (score<=999, and , score >=800) then (funkatrongreat)
	 if (score<=799, and , score >=600) then (funkatrongood)
	 if (score<=599, and , score >=400) then (funkatronokay)
	 if (score<=399, and , score >=200) then (funkatronpoor)
	 if (score<=199, and , score >=1) then (funkatronbad)
	 if (score <= -300) then (funkatronawful)
	show no value
	resume player
	resume box advance
	resume obstruction
	show no value
	export globals (33,1,1)
	save in slot (33)
	wait (5)
	load from slot (33)
	exit script
end
#-------------------------------------------------------------------------

script,funkatronbest,begin
 	if (checktag (tag:RagnaROCK)) then ( 
 		show text box (2638)
 		wait (7)
 		wait for key (use key)
 		advance text box) else 
			(tweak palette (10,0,0), update palette, play sound (sfx:EnemyDeath,false,true) 
			teach spell ((find hero(hero:Eric)),atk:RagnaROCK), wait (10), reset palette 
			fade screen in, show text box (2636), wait (7), wait for key (use key), advance text box 
			show text box (2637), wait (7), wait for key (use key), advance text box)
	show no value
end

script,funkatrongreat,begin
 	show text box (2639), wait (7), wait for key (use key), advance text box
	show no value
end

script,funkatrongood,begin
 	show text box (2640), wait (7), wait for key (use key), advance text box
	show no value
end

script,funkatronokay,begin
 	show text box (2641), wait (7), wait for key (use key), advance text box
	show no value
end

script,funkatronpoor,begin
 	show text box (2642), wait (7), wait for key (use key), advance text box
	show no value
end

script,funkatronbad,begin
 	show text box (2644), wait (7), wait for key (use key), advance text box
	show no value
end

script,funkatronawful,begin
 	show text box (2643), wait (7), wait for key (use key), advance text box
	show no value
end

script,OmegaWEAPON,begin
	remember party, suspend player, suspend box advance
 	swap by position (0,find hero (hero:Night)), swap by position (1,find hero (hero:Renard))
 	swap by position (2,find hero (hero:Freki)), swap by position (3,find hero (hero:Frumpy)) 
 	set caterpillar mode (on), set hero position (1,14,12)
 	set hero position (2,14,12), set hero position (3,14,12), suspend caterpillar, wait (3)
 	walk hero (1,down,1), walk hero (2,down,1), walk hero (3,down,1)
 	wait for hero (1), walk hero (1,left,1), walk hero (2,right,1), wait for hero (1)
 	set hero direction (1,up), set hero direction (2,up), set hero direction (3,up), wait (3)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (2645), wait (7), wait for key (use key), advance text box
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (2646), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (2647), wait (7), wait for key (use key), advance text box
 	fade screen out, greyscale palette, teleport to map (62,14,18), focus camera (14,12,4)
 	wait for camera, wait (5), fade screen in
 	show text box (2648), wait (7), wait for key (use key), advance text box
 	show text box (2649), wait (7), wait for key (use key), advance text box
 	show text box (2650), wait (7), wait for key (use key), advance text box
 	tweak palette (63,63,63), update palette, wait (1), reset palette
 	wait (1), greyscale palette, update palette
 	show text box (2666), wait (7), wait for key (use key), advance text box
 	walk NPC (14,right,2), wait for NPC (14), set NPC direction (14,down)
 	show text box (2651), wait (7), wait for key (use key), advance text box
 	walk NPC (16,down,1), set NPC direction (16,up), walk NPC (17,down,1)
 	set NPC direction (17,up), walk NPC (15,down,1), set NPC direction (15,up), wait for NPC (15)
 	show text box (2667), wait (7), wait for key (use key), advance text box, walk NPC (14,down,2)
 	show text box (2668), wait (7), wait for key (use key), advance text box
 	show text box (2669), wait (7), wait for key (use key), advance text box
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	show text box (2652), wait (7), wait for key (use key), advance text box
 	set NPC frame (14,1), wait (1), set NPC frame (14,0), wait (1)
 	set NPC frame (14,1), wait (1), set NPC frame (14,0), wait (1)
 	show text box (2653), wait (7), wait for key (use key), advance text box
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	show text box (2654), wait (7), wait for key (use key), advance text box
 	show text box (2655), wait (7), wait for key (use key), advance text box
 	fade screen out (63,63,63), wait (40), greyscale palette, fade screen in
 	create npc (18,14,13,down), set NPC direction (15,down), set NPC direction (16,right), set NPC direction (17,left)
 	show text box (2656), wait (7), wait for key (use key), advance text box
 	set NPC frame (14,1), wait (1), set NPC frame (14,0), wait (1)
 	set NPC frame (14,1), wait (1), set NPC frame (14,0), wait (1)
 	show text box (2657), wait (7), wait for key (use key), advance text box
 	set NPC direction (15,right), wait (2), set NPC direction (15,up), wait (2)
 	show text box (2658), wait (7), wait for key (use key), advance text box, set NPC direction (14,left)
 	show text box (2670), wait (7), wait for key (use key), advance text box
 	show text box (2671), wait (7), wait for key (use key), advance text box, set NPC direction (14,up)
 	show text box (2672), wait (7), wait for key (use key), advance text box
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	set NPC frame (15,1), wait (1), set NPC frame (15,0), wait (1)
 	show text box (2659), wait (7), wait for key (use key), advance text box
 	show text box (2660), wait (7), wait for key (use key), advance text box
 	show text box (2661), wait (7), wait for key (use key), advance text box
	set NPC direction (14,left), wait (2), set NPC direction (14,down)
 	show text box (2673), wait (7), wait for key (use key), advance text box
 	show text box (2674), wait (7), wait for key (use key), advance text box, walk NPC (15,up,1)
 	show text box (2675), wait (7), wait for key (use key), advance text box, wait (2)
 	set NPC direction (2,right), set NPC direction (3,right), set NPC direction (4,right)
 	set NPC direction (5,right), set NPC direction (6,right), set NPC direction (7,right)
 	set NPC direction (8,right), set NPC direction (9,right), set NPC direction (10,right)
 	set NPC direction (11,right), set NPC direction (12,right), set NPC direction (13,right), wait (2)
 	set NPC direction (2,up), set NPC direction (3,up), set NPC direction (4,up)
 	set NPC direction (5,up), set NPC direction (6,up), set NPC direction (7,up)
 	set NPC direction (8,up), set NPC direction (9,up), set NPC direction (10,up)
 	set NPC direction (11,up), set NPC direction (12,up), set NPC direction (13,up),wait (2)
 	set NPC direction (2,left), set NPC direction (3,left), set NPC direction (4,left)
 	set NPC direction (5,left), set NPC direction (6,left), set NPC direction (7,left)
 	set NPC direction (8,left), set NPC direction (9,left), set NPC direction (10,left)
 	set NPC direction (11,left), set NPC direction (12,left), set NPC direction (13,left)
 	wait (15), fade screen out, reset palette, wait (1)
 	teleport to map (9,14,18), camera follows hero
 	set hero position (me,14,12), set hero position (1,13,13)
 	set hero position (2,14,13), set hero position (3,15,13)
 	set hero direction (1,up), set hero direction (2,up)
 	set hero direction (3,up), fade screen in, wait (3)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (2662), wait (7), wait for key (use key), advance text box
 	set hero direction (me,left), wait (2), set Hero direction (me,down), wait (2)
 	show text box (2663), wait (7), wait for key (use key), advance text box
 	set hero direction (me,left), wait (2), set hero direction (me,up)
 	show text box (2664), wait (7), wait for key (use key), advance text box
 	show text box (2665), wait (7), wait for key (use key), advance text box
 	tweak palette (63,63,63), update palette, wait (1), reset palette, wait (1), update palette
 	show text box (2676), wait (7), wait for key (use key), advance text box
 	set hero direction (2,left), wait (2), set hero direction (1,left)
 	set hero direction (2,right), set hero direction (3,down), wait (5)
 	tweak palette (63,63,63), update palette, wait (1)
 	reset palette, wait (1), update palette, wait (2)
 	set hero direction (me,up), set hero direction (1,up)
 	set hero direction (2,up), set hero direction (3,up)
 	wait (1), tweak palette (63,63,63), update palette
 	create npc (14,14,11,down), wait (1), reset palette
 	wait (1), update palette, walk hero (me,down,1), walk hero (1,down,1)
 	walk hero (2,down,1), walk hero (3,down,1)
 	set hero direction (me,up), set hero direction (1,up)
 	set hero direction (2,up), set hero direction (3,up)
 	show text box (2678), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (2679), wait (7), wait for key (use key), advance text box
 	wait (5), focus camera (14,13,4), wait for camera
 	show text box (2680), wait (7), wait for key (use key), advance text box
 	wait (2), walk hero (me,left,1), walk hero (1,down,1)
 	walk hero (2,up,1), wait for hero (2), set hero direction (1,up), set hero direction (me,up)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	set hero frame (2,1), wait (1), set hero frame (2,0), wait (1)
 	show text box (2681), wait (7), wait for key (use key), advance text box
 	wait (2), set NPC direction (14,left), wait (2), set NPC direction (14,up), wait (3)
 	show text box (2682), wait (7), wait for key (use key), advance text box
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (2683), wait (7), wait for key (use key), advance text box
 	wait (10)
 	show text box (2684), wait (7), wait for key (use key), advance text box
 	walk NPC (14,left,10), wait (10), set hero direction (me,left)
 	set hero direction (1,left), set hero direction (2,left), set hero direction (3,left)
 	wait for NPC (14), set NPC position (14,14,20), wait (2), walk NPC (14,up,6), wait (10)
  	set hero direction (me,down), set hero direction (1,down)
 	set hero direction (2,down), set hero direction (3,down)
 	wait for NPC (14), walk hero (2,right,1),walk hero (3,down,1), set hero direction (me,down)
 	set hero direction (1,down), set hero direction (2,down), set hero direction (3,down)
 	walk NPC (14,up,3), set hero direction (me,right), set hero direction (1,right)
 	set hero direction (2,left), set hero direction (3,left), wait for NPC (14)
 	set hero direction (me,up), set hero direction (1,up), set hero direction (2,up), set hero direction (3,up)
 	show text box (2685), wait (7), wait for key (use key), advance text box
 	set NPC direction (14,left), wait (2), set NPC direction (14,down), wait (2)
 	show text box (2686), wait (7), wait for key (use key), advance text box
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	set hero frame (me,1), wait (1), set hero frame (me,0), wait (1)
 	show text box (2687), wait (7), wait for key (use key), advance text box
 	set NPC frame (14,1), wait (1), set NPC frame (14,0), wait (1)
 	set NPC frame (14,1), wait (1), set NPC frame (14,0), wait (1)
 	show text box (2688), wait (7), wait for key (use key), advance text box
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show text box (2689), wait (7), wait for key (use key), advance text box
 	wait (5), set NPC frame (14,1), wait (1), set NPC frame (14,0), wait (1)
 	set NPC frame (14,1), wait (1), set NPC frame (14,0), wait (1)
 	show text box (2694), wait (7), wait for key (use key), advance text box
 	show text box (2695), wait (7), wait for key (use key), advance text box
 	boss introduction, fight formation (311),remember party 
 	swap by position (0,find hero (hero:Night)), swap by position (1,find hero (hero:Renard))
 	swap by position (2,find hero (hero:Freki)), swap by position (3,find hero (hero:Frumpy)) 
 	tweak palette (0,0,10), update palette, play sound (sfx:laser gun,false,true)
 	teach spell ((find hero(hero:Frumpy)),atk:Miracle), wait (3), reset palette, update palette
 	show text box (2692), wait (7), wait for key (usekey), advance text box
 	tweak palette (0,10,0), update palette, play sound (sfx:Death,false,true)
 	teach spell ((find hero(hero:Bram)),atk:TimeStop), wait (10), reset palette, fade screen in
 	show text box (2768), wait (7), wait for key (use key), advance text box
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	set hero frame (3,1), wait (1), set hero frame (3,0), wait (1)
 	show text box (2693), wait (7), wait for key (use key), advance text box
 	set NPC direction (14,left), wait (2), set NPC direction (14,up), wait (2)
 	set NPC frame (14,1), wait (1), set NPC frame (14,0), wait (1)
 	set NPC frame (14,1), wait (1), set NPC frame (14,0), wait (1)
 	show text box (2696), wait (7), wait for key (use key), advance text box
 	show text box (2697), wait (7), wait for key (use key), advance text box
 	set NPC frame (14,1), wait (1), set NPC frame (14,0), wait (1)
 	set NPC frame (14,1), wait (1), set NPC frame (14,0), wait (1)
 	show text box (2698), wait (7), wait for key (use key), advance text box
 	set NPC direction (14,left), wait (2), set NPC direction (14,down), wait (2)
 	show text box (2699), wait (7), wait for key (use key), advance text box
 	walk NPC (14,down,1), wait for NPC (14)
 	show text box (2700), wait (7), wait for key (use key), advance text box
 	fade screen out (63,63,63), wait (5), set tag (tag:defeatsery,on)
 	wait (5), fade screen in
 	show text box (2701), wait (7), wait for key (use key), advance text box
 	fade screen out, wait (5), set hero position (me,14,13), camera follows hero (me)
 	resume NPCs, resume player, resume box advance, resume caterpillar
 	set caterpillar mode (off), wait (2), fade screen in, reinstate party, encounters
end

script,OmegaWEAPONfinal,begin
	remember party, suspend player, suspend box advance
 	walk NPC (18,up,1), wait for NPC (18), wait (3)
 	set NPC direction (18,left), wait (3), set NPC direction (18,down), wait (3)
 	tweak palette (63,63,63), play sound (sfx:SmallExplosion8bit,false,true) 
 	update palette, wait (1), reset palette, update palette, wait (10)
 	tweak palette (63,63,63), play sound (sfx:SmallExplosion8bit,false,true) 
 	update palette, wait (1), reset palette, update palette, wait (10)
 	tweak palette (63,63,63), play sound (sfx:MediumExplosion8bit,false,true) 
 	update palette, set tag (tag:OMEGA,on), wait (1), reset palette
 	update palette, wait (10), boss introduction, fight formation (69)
 	wait (5), set damage cap (9999)
 	show text box (2730), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2707), wait (7), wait for key (use key), advance text box
  	show text box (2708), wait (7), wait for key (use key), advance text box
 	show text box (2709), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2710), wait (7), wait for key (use key), advance text box
  	show text box (2711), wait (7), wait for key (use key), advance text box
 	show text box (2712), wait (7), wait for key (use key), advance text box
 	wait (5), stop song
 	show text box (2713), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2714), wait (7), wait for key (use key), advance text box
 	show text box (2715), wait (7), wait for key (use key), advance text box
 	fade screen out, wait (2),show text box (2716), wait (7)
 	fade screen in, wait (7), wait for key (use key), advance text box
 	show text box (2717), wait (7), wait for key (use key), advance text box
 	show text box (2718), wait (7), wait for key (use key), advance text box
 	show text box (2719), wait (7), wait for key (use key), advance text box
 	show text box (2720), wait (7), wait for key (use key), fade screen out
 	advance text box, wait (3), fade screen in, wait (3)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2721), wait (7), wait for key (use key), advance text box
	show text box (2722), wait (7), wait for key (use key), advance text box
	show text box (2723), wait (7), wait for key (use key), advance text box
 	set hero direction (me,left), wait (5), set hero direction (me,down), wait (5)
	show text box (2724), wait (7), wait for key (use key), advance text box
	show text box (2725), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2726), wait (7), wait for key (use key), advance text box
 	show text box (2727), wait (7), wait for key (use key), advance text box
 	show text box (2728), wait (7), wait for key (use key), advance text box
 	show text box (2729), wait (7), wait for key (use key), advance text box
 	wait (3), resume box advance, resume player, reinstate party, encounters
end


Script, Enherdesert,begin
 	suspend player, suspend box advance, fade screen out
 	stop song, wait (5), set hero position (me,9,7), wait (5)
 	fade screen in, focus camera (9,12,2)
 	walk NPC (18,down,1), wait for NPC (18)
 	show text box (2799), wait (7), wait for key (usekey), advance text box
 	show text box (2800), wait (7), wait for key (usekey), advance text box
 	set NPC direction (18,right)
 	show text box (2801), wait (7), wait for key (usekey), advance text box
 	set NPC frame (19,1), wait (1), set NPC frame (19,0), wait (1)
 	set NPC frame (19,1), wait (1), set NPC frame (19,0), wait (1)
 	show text box (2802), wait (7), wait for key (usekey), advance text box
 	play sound (sfx:Fart,false,true) 
# 16 Tri 17 Kyle 18 Dog 19 HM
 	set NPC frame (18,1), wait (1), set NPC frame (18,0), wait (1)
 	set NPC frame (18,1), wait (1), set NPC frame (18,0), wait (1)
 	show text box (2803), wait (7), wait for key (usekey), advance text box
 	set NPC frame (16,1), wait (1), set NPC frame (16,0), wait (1)
 	set NPC frame (16,1), wait (1), set NPC frame (16,0), wait (1)
 	show text box (2804), wait (7), wait for key (usekey), advance text box
	walk NPC (18,right,1), wait for NPC (18)
 	show text box (2805), wait (7), wait for key (usekey), advance text box,wait (10)
 	show text box (2806), wait (7), wait for key (usekey), advance text box
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	show text box (2807), wait (7), wait for key (usekey), advance text box
 	set NPC direction (16,down)
 	set NPC frame (16,1), wait (1), set NPC frame (16,0), wait (1)
 	set NPC frame (16,1), wait (1), set NPC frame (16,0), wait (1)
 	show text box (2808), wait (7), wait for key (usekey), advance text box
 	set NPC direction (17,right)
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	show text box (2809), wait (7), wait for key (usekey), advance text box
 	set NPC frame (16,1), wait (1), set NPC frame (16,0), wait (1)
 	set NPC frame (16,1), wait (1), set NPC frame (16,0), wait (1)
 	show text box (2810), wait (7), wait for key (usekey), advance text box
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	show text box (2811), wait (7), wait for key (usekey), advance text box
 	set NPC direction (17,down)
 	show text box (2812), wait (7), wait for key (usekey), advance text box
 	show text box (2813), wait (7), wait for key (usekey), advance text box
 	set NPC frame (16,1), wait (1), set NPC frame (16,0), wait (1)
 	set NPC frame (16,1), wait (1), set NPC frame (16,0), wait (1)
 	show text box (2814), wait (7), wait for key (usekey), advance text box
	set NPC direction (17,right)
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	show text box (2815), wait (7), wait for key (usekey), advance text box
 	set NPC frame (18,1), wait (1), set NPC frame (18,0), wait (1)
 	set NPC frame (18,1), wait (1), set NPC frame (18,0), wait (1)
 	show text box (2816), wait (7), wait for key (usekey), advance text box
 	set NPC direction (17,down), wait (5), set NPC direction (17,left)
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	show text box (2817), wait (7), wait for key (usekey), advance text box
 	set NPC direction (19,right)
 	set NPC frame (19,1), wait (1), set NPC frame (19,0), wait (1)
 	set NPC frame (19,1), wait (1), set NPC frame (19,0), wait (1)
 	show text box (2818), wait (7), wait for key (usekey), advance text box
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	show text box (2819), wait (7), wait for key (usekey), advance text box
 	set NPC frame (18,1), wait (1), set NPC frame (18,0), wait (1)
 	set NPC frame (18,1), wait (1), set NPC frame (18,0), wait (1)
 	show text box (2820), wait (7), wait for key (usekey), advance text box
 	set NPC direction (17,down), wait (5), set NPC direction (17,right)
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	show text box (2821), wait (7), wait for key (usekey), advance text box
 	set NPC frame (16,1), wait (1), set NPC frame (16,0), wait (1)
 	set NPC frame (16,1), wait (1), set NPC frame (16,0), wait (1)
 	show text box (2822), wait (7), wait for key (usekey), advance text box
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	show text box (2823), wait (7), wait for key (usekey), advance text box
 	set NPC frame (16,1), wait (1), set NPC frame (16,0), wait (1)
 	set NPC frame (16,1), wait (1), set NPC frame (16,0), wait (1)
 	show text box (2824), wait (7), wait for key (usekey), advance text box
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	show text box (2825), wait (7), wait for key (usekey), advance text box
 	wait (5), set NPC direction (17,down), wait (5), set NPC frame (17,1)
 	wait (1), set NPC frame (17,0), wait (1)
 	set NPC frame (17,1), wait (1), set NPC frame (17,0), wait (1)
 	show text box (2826), wait (7), wait for key (usekey), advance text box
 	set tag (tag:EINSAND,on), fade screen out, wait (5)
 	play song (get ambient music), set hero position (me,10,52)
 	camera follows hero (me), resume NPCs, resume player, resume box advance
 	resume caterpillar, set caterpillar mode (off), wait (2), fade screen in, encounters
end

script,HildaValia,begin
	remember party, suspend player, suspend box advance
 	swap by position (0,find hero (hero:Hilda)), swap by position (1,find hero (hero:Olaf))
 	set caterpillar mode (on), set hero position (1, 94, 5), set hero position (2, 6, 9)
 	set hero position (3, 6, 9), wait (1), suspend caterpillar, walk hero (1,left,1)
 	wait for hero (1), set hero direction (1,down),focus camera (91,8,4), wait for camera
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2827), wait (7), wait for key (use key), advance text box
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (2828), wait (7), wait for key (use key), advance text box
 	set hero direction (me,left)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2829), wait (7), wait for key (use key), advance text box
 	show text box (2830), wait (7), wait for key (use key), advance text box
 	set hero direction (1,right)
 	show text box (2831), wait (7), wait for key (use key), advance text box
 	show text box (2832), wait (7), wait for key (use key), advance text box
 	show text box (2833), wait (7), wait for key (use key), advance text box
 	set hero direction (1,down), set hero direction (0,down)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (2834), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2835), wait (7), wait for key (use key), advance text box
 	show text box (2836), wait (7), wait for key (use key), advance text box
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	set hero frame (1,1), wait (1), set hero frame (1,0), wait (1)
 	show text box (2837), wait (7), wait for key (use key), advance text box
 	show text box (2838), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2839), wait (7), wait for key (use key), advance text box, wait (4)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2840), wait (7), wait for key (use key), advance text box, wait (10)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2841), wait (7), wait for key (use key), advance text box, wait (10)
 	show text box (2842), wait (7), wait for key (use key), advance text box
 	wait (5), set hero direction (1,right), set hero direction (0,left), wait (15)
 	set hero direction (1,down), set hero direction (0,down)
 	bossintroduction, fight formation (313)
 	swap by position (0,find hero (hero:Hilda)), swap by position (1,find hero (hero:Olaf))
 	tweak palette (0,10,0), update palette, play sound (sfx:Death,false,true)
 	teach spell ((find hero(hero:Hilda)),atk:Valiant), wait (10), reset palette, fade screen in
 	show text box (2843), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2844), wait (7), wait for key (use key), advance text box
	walk hero (1,right,1), wait for hero (1),focus camera (94,5,4)
 	wait for camera, camera follows hero (me), wait (1)
	resume caterpillar, set caterpillar mode (off), wait (1)
 	resume box advance, resume player, reinstate party, encounters
end 

script,Linnorm,begin
	remember party, suspend player, suspend box advance
 	play sound (sfx:Roar,false,true), wait (4)
 	bossintroduction, fight formation (314)
 	set tag (tag:LINNORM,on), swap by position (0,find hero (hero:Styrge))
 	tweak palette (0,10,0), update palette, play sound (sfx:TornadoMagic,false,true)
 	teach spell ((find hero(hero:Styrge)),atk:Drakedoom), wait (10)
 	reset palette, fade screen in
 	show text box (2845), wait (7), wait for key (use key), advance text box
 	show text box (2846), wait (7), wait for key (use key), advance text box
 	resume player, resume box advance, reinstate party, encounters
end

script,TripCut,begin
	remember party, suspend player, suspend box advance
 	swap by position (0,find hero (hero:Kitt))
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2851), wait (7), wait for key (use key), advance text box
 	set NPC frame (24,1), wait (1), set NPC frame (24,0), wait (1)
 	set NPC frame (24,1), wait (1), set NPC frame (24,0), wait (1)
 	show text box (2852), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2853), wait (7), wait for key (use key), advance text box
 	set NPC frame (24,1), wait (1), set NPC frame (24,0), wait (1)
 	set NPC frame (24,1), wait (1), set NPC frame (24,0), wait (1)
 	show text box (2854), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2855), wait (7), wait for key (use key), advance text box
 	set NPC frame (24,1), wait (1), set NPC frame (24,0), wait (1)
 	set NPC frame (24,1), wait (1), set NPC frame (24,0), wait (1)
 	show text box (2856), wait (7), wait for key (use key), advance text box
 	show text box (2857), wait (7), wait for key (use key), advance text box
	BOSS INTRODUCTION,fight formation (315), swap by position (0,find hero (hero:Kitt))
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2858), wait (7), wait for key (use key), advance text box
 	set NPC frame (24,1), wait (1), set NPC frame (24,0), wait (1)
 	set NPC frame (24,1), wait (1), set NPC frame (24,0), wait (1)
 	show text box (2859), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2860), wait (7), wait for key (use key), advance text box
 	set NPC frame (24,1), wait (1), set NPC frame (24,0), wait (1)
 	set NPC frame (24,1), wait (1), set NPC frame (24,0), wait (1)
 	show text box (2861), wait (7), wait for key (use key), advance text box
 	walk NPC (24,left,1), walk hero (me,left,1), wait for hero (me)
 	walk NPC (24,right,2), walk hero (me,right,2), wait for hero (me)
 	walk NPC (24,left,1), set NPC direction (24,right)
 	walk hero (me,left,1), wait for hero (me)
 	tweak palette (10,0,0), update palette, play sound (sfx:Slash8Bit,false,true)
 	teach spell ((find hero(hero:Kitt)),atk:TripleCut), wait (10), reset palette, fade screen in
 	show text box (2862), wait (7), wait for key (use key), advance text box
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	set hero frame (0,1), wait (1), set hero frame (0,0), wait (1)
 	show text box (2863), wait (7), wait for key (use key), advance text box
 	set NPC frame (24,1), wait (1), set NPC frame (24,0), wait (1)
 	set NPC frame (24,1), wait (1), set NPC frame (24,0), wait (1)
 	show text box (2864), wait (7), wait for key (use key), advance text box
 	show text box (2865), wait (7), wait for key (use key), advance text box
 	show text box (2866), wait (7), wait for key (use key), advance text box
 	fade screen out (63,63,63), wait (5), set tag (tag:Threecut,on)
 	wait (5), fade screen in, resume player, resume box advance,reinstate party, encounters
end


# This script gives Kitt the sword Gram, and teaches him OctaSlash.
# Way back when, Gram was called Excalibur, but THAT sword is NOT norse,
# And only Renard deals with Celtic weapons.

script,excalibur,begin
	remember party
	suspend player, suspend box advance
	greyscale palette, fade screen in, wait (3)
	show text box (2878), wait (7), wait for key (use key), advance text box
	wait (3), bossintroduction, fight formation (103), set tag (tag:Excal,on)
	show text box (3762), wait (7), wait for key (use key), advance text box
	show text box (3763), wait (7), wait for key (use key), advance text box
	teach spell ((find hero(hero:Kitt)),atk:OctaSlash)
	show text box (2879), wait (7), wait for key (use key), advance text box
	resume box advance, resume player
reinstate party, encounters
end

# Uh oh! A constant! Some weirdness is coming up shortly!

define constant(4, void parallax timer)

script, void autorun, begin
  	update void parallax
end

script, update void parallax, begin
  	variable(sl, mapw, maph, screenw, screenh, layerw, layerh)
  	if(current map <> map:Mt Jtun) then(
    		stop timer(void parallax timer)
# (The following is only needed if 'recreate map slices when leaving map' is off)
    		sl := lookup slice(sl:map layer 0)
    		set slice x(sl, 0)
    		set slice y(sl, 0)
    		exit script
  	)
  	next camera pixel x := camera pixel x
  	next camera pixel y := camera pixel y
  	mapw := map width * 20
  	maph := map height * 20
  	screenw := slice width(sprite layer)
  	screenh := slice height(sprite layer)
  	layerw := mapw / 5  # e.g. 50 * 20 pixels
  	layerh := maph / 5  # e.g. 20 * 20 pixels
  	sl := lookup slice(sl:map layer 0)
  	calculate next camera pixel xy
  	set slice x(sl, (next camera pixel x * (mapw -- layerw) / (mapw -- screenw)))
  	set slice y(sl, (next camera pixel y * (maph -- layerh) / (maph -- screenh)))
# Set the script to run again next tick
  	set timer(void parallax timer, 0, 1, @update void parallax)
end

script, dir X, dir, begin
  	switch (dir) do (
    		case (up, down) do (return (0))
    		case (right) do (return (1))
    		case (left) do (return (-1))
  	)
end

script, dir Y, dir, begin
  	switch (dir) do (
    		case (left, right) do (return (0))
    		case (down) do (return (1))
    		case (up) do (return (-1))
  )
end

script, trying to move direction, begin
  	return (-1)
# If a textbox is up or player is suspended, the hero can't move
  	if (current textbox > -1 || player is suspendeda) then (exit returning (false))
# Nor if a menu is up which suspends gameplay.
# A more complicated menu check could be required if you are using fancy scripted menus that are always visible.
  	if(top menu) then(exit script)
  	if (key is pressed(key:right)) then (return (right))
  	if (key is pressed(key:left)) then (return (left))
  	if (key is pressed(key:down)) then (return (down))
  	if (key is pressed(key:up)) then (return (up))
end

# Return true if "suspend player" is active

script, player is suspendeda, begin
  	return ((read general(44), and, 2) <> 0)
end

# This will return true if hero 0 will move this tick, either because
# they're already moving or because of player input to start a new
# step.
# There are no commands that can tell you that directly: you have to
# figure it out by checking keypresses and for obstructions.
# Note: this doesn't handle all edge cases, like multiple NPCs
# on one tile, or NPCs over the edge of the map
script, hero will move, begin
	variable (dir, npc)
  	if (hero is walking(0)) then (exit returning (true))
# Check for player input
  	dir := trying to move direction
  	if (dir == -1) then (exit returning (false)) 
# If there's a wall in the way, nothing will happen (unless walls are suspended...)
  	if (check hero wall(0, dir)) then (exit returning (false))
# Check for an NPC in the way which you can't step on
# (this isn't correct either if obstruction is suspended, or other edge cases)
  	npc := npc at spot (hero x(0) + dir x(dir), hero y(0) + dir y(dir))
  	if (npc && readNPC(npc, NPCstat:activation) <> NPCactivation:stepon) then (exit returning (false))
# OK, you will start walking in this direction
  	return (true)
end

# Guess the direction that the leader will move this tick, or -1 if they won't move.
script, next leader move direction, begin
  	if (hero is walking(0)) then (
    		return (hero direction(0))
  	) else if (hero will move) then (
    		return (trying to move direction)
  	) else (
    		return (-1)
  	)
end

# Guess the position the leader will move to this tick
script, next leader pixel x, begin
  	variable(ret, dir)
  	ret := hero pixel x
  	dir := next leader move direction
  	if (dir <> -1) then (
    		ret += get hero speed(0) * dirX(dir)
  	)
  	return (ret)
end

# Guess the position the leader will move to this tick
script, next leader pixel y, begin
  	variable(ret, dir)
  	ret := hero pixel y
  	dir := next leader move direction
  	if (dir <> -1) then (
    		ret += get hero speed(0) * dirY(dir)
  	)
  	return (ret)
end

# Updates the values of the "next camera pixel x/y" global variables.
# Camera following NPCs or slices are not supported!

script, calculate next camera pixel xy, begin
  	variable(destx, desty, diff, cam dir, cam speed)
  	variable(mapw, maph, screenw, screenh)
  	screenw := slice width(sprite layer)
  	screenh := slice height(sprite layer)
  	mapw := map width * 20
  	maph := map height * 20
  	next camera pixel x := camera pixel x
  	next camera pixel y := camera pixel y
# Check value of gen(genCameraMode)
  	if (read general(45) == 0) then (   # herocam (camera following hero)
# Offset from the top-left of the hero sprite to the topleft of the screen
    		next camera pixel x := next leader pixel x -- (screenw -- 20) / 2
    		next camera pixel y := next leader pixel y -- (screenh -- 20) / 2
  	) else if (read general(45) == 2) then (  #pancam
    		cam dir := read general(46)
    		cam speed := read general(48)
    		next camera pixel x += dirX(cam dir) * cam speed
    		next camera pixel y += dirY(cam dir) * cam speed
  	) else if (read general(45) == 3) then (  #focuscam
    		destx := read general(46)
    		desty := read general(47)
    		cam speed := read general(48)
    		diff := destx -- camera pixel x
    		if (abs(diff) <= cam speed) then (
      		next camera pixel x := dest x
    		) else (
      			next camera pixel x += sign(diff) * cam speed
    		)
    	diff := desty -- camera pixel y
    	if (abs(diff) <= cam speed) then (
      		next camera pixel y := dest y
    		) else (
      			next camera pixel y += sign(diff) * cam speed
    		)
  	)
  # Crop to map edge
  	if (next camera pixel x < 0) then (next camera pixel x := 0)
  	if (next camera pixel x > mapw -- screenw) then (next camera pixel x := mapw -- screenw)
  	if (next camera pixel y < 0) then (next camera pixel y := 0)
  	if (next camera pixel y > maph -- screenh) then (next camera pixel y := maph -- screenh)
end

script, water autorun, begin
	update water parallax
end

script, update water parallax, begin
  	variable(sl, mapw, maph, screenw, screenh, layerw, layerh)
  	if(current map <> map:Shore of the Midgarsorm) then(
    		stop timer(void parallax timer)
# (The following is only needed if 'recreate map slices when leaving map' is off)
    		sl := lookup slice(sl:map layer 0)
    		set slice x(sl, 0)
    		set slice y(sl, 0)
    		exit script
  		)
  	mapw := map width * 20
  	maph := map height * 20
  	screenw := slice width(sprite layer)
  	screenh := slice height(sprite layer)
  	layerw := mapw / 5  # e.g. 50 * 20 pixels
  	layerh := maph / 5  # e.g. 20 * 20 pixels
  	sl := lookup slice(sl:map layer 0)
  	calculate next camera pixel xy
  	set slice x(sl, (next camera pixel x * (mapw -- layerw) / (mapw -- screenw)))
  	set slice y(sl, (next camera pixel y * (maph -- layerh) / (maph -- screenh)))
# Set the script to run again next tick
  	set timer(void parallax timer, 0, 1, @update water parallax)
end


# Tetracut is an attack for Kitt that does Fire, Ice, and Lightning damage
# Plus a physical attack. Enemies that are weak against magic can get wrecked!

script,tetracut,begin
 	suspend player, suspend box advance
 	show text box (2874), wait (7), wait for key (use key), advance text box
 	wait (1), tweak palette (10,0,0), update palette
 	play sound (sfx:StormMagic,false,true), teach spell ((find hero(hero:Kitt)),atk:Tetracut)
 	wait (10), reset palette, fade screen in
 	show text box (2935), wait (7), wait for key (use key), advance text box
 	resume box advance, resume player
end

script,reaper,begin
 	suspend player, suspend box advance
 	show text box (4031), wait (7), wait for key (use key), advance text box
 	show text box (4032), wait (7), wait for key (use key), advance text box
 	show text box (4033), wait (7), wait for key (use key), advance text box
 	show text box (4034), wait (7), wait for key (use key), advance text box
 	show text box (4035), wait (7), wait for key (use key), advance text box
 	show text box (4036), wait (7), wait for key (use key), advance text box
 	show text box (4037), wait (7), wait for key (use key), advance text box
 	wait (1), tweak palette (10,0,0), update palette
 	play sound (sfx:Death,false,true), teach spell ((find hero(hero:Night)),atk:Reaper)
 	wait (10), reset palette, fade screen in
 	show text box (2877), wait (7), wait for key (use key), advance text box
 	show text box (4038), wait (7), wait for key (use key), advance text box
	set tag (tag:DEATHREAPER,on), resume box advance, resume player
end

script,silencer,begin
 	suspend player, suspend box advance
 	wait (1), tweak palette (10,0,0), update palette
 	play sound (sfx:Death,false,true), teach spell ((find hero(hero:Night)),atk:Silencer)
 	wait (10), reset palette, fade screen in
 	show text box (2936), wait (7), wait for key (use key), advance text box
 	resume box advance, resume player
end

script,panopt1,begin
 	suspend player, suspend box advance, wait (10)
 	show text box (2995), wait (7), wait for key (use key), advance text box
	walk hero to x (me, 6), wait for hero (me), walk hero to y (me,5), wait for hero (me), set hero direction (me,up)
 	show text box (2996), wait (7), wait for key (use key), advance text box
 	show text box (2997), wait (7), wait for key (use key), advance text box
 	show text box (2998), wait (7), wait for key (use key), advance text box	
 	show text box (2999), wait (7), wait for key (use key), advance text box	
	wait (5), set NPC direction (1,right), wait (5)
 	show text box (3000), wait (7), wait for key (use key), advance text box
 	show text box (3001), wait (7), wait for key (use key), advance text box	
	wait (5), set NPC direction (1,up), wait (5)
	show text box (3002), wait (7), wait for key (use key), advance text box
	show text box (3003), wait (7), wait for key (use key), advance text box
	wait (3), set NPC direction (1,right), wait (3), set NPC direction (1,down), wait (3)
	show text box (3004), wait (7), wait for key (use key), advance text box
	show text box (3005), wait (7), wait for key (use key), advance text box
	wait (3), set NPC direction (1,right), wait (3), set NPC direction (1,up), wait (3)
	show text box (3006), wait (7), wait for key (use key), advance text box
	set tag (tag:PANOPT1,on), resume box advance, resume player
end

script,panopt2,begin
	remember party, suspend player, suspend box advance, wait (10)
 	show text box (3007), wait (7), wait for key (use key), advance text box
	walk hero to x (me, 30), wait for hero (me), swap by position (0,find hero (hero:Frumpy))
	show text box (3008), wait (7), wait for key (use key), advance text box
	show text box (3009), wait (7), wait for key (use key), advance text box
	wait (3), set NPC direction (2,down), wait (3), set NPC direction (2,right), wait (3)
	show text box (3010), wait (7), wait for key (use key), advance text box
	show text box (3011), wait (7), wait for key (use key), advance text box
	wait (3), set NPC direction (2,down), wait (3), set NPC direction (2,left), wait (3)
	show text box (3012), wait (7), wait for key (use key), advance text box
	show text box (3013), wait (7), wait for key (use key), advance text box
	show text box (3014), wait (7), wait for key (use key), advance text box
	wait (3), set NPC direction (2,down), wait (3), set NPC direction (2,right), wait (3)
	show text box (3015), wait (7), wait for key (use key), advance text box
	show text box (3016), wait (7), wait for key (use key), advance text box
	show text box (3017), wait (7), wait for key (use key), advance text box
	set tag (tag:PANOPT2,on),resume box advance, resume player,reinstate party
end

script,panopt3,begin
	remember party, suspend player, suspend box advance, wait (10)
 	show text box (3018), wait (7), wait for key (use key), advance text box
	walk hero to y (me, 6), wait for hero (me), swap by position (0,find hero (hero:Freki))
	walk hero to x (me, 52), set hero direction (me,left)
	show text box (3019), wait (7), wait for key (use key), advance text box
	show text box (3020), wait (7), wait for key (use key), advance text box
	wait (3), set NPC direction (3,down), wait (3), set NPC direction (3,left), wait (3)
	show text box (3021), wait (7), wait for key (use key), advance text box
	show text box (3022), wait (7), wait for key (use key), advance text box
	wait (3), set NPC direction (3,down), wait (3), set NPC direction (3,right), wait (3)
	show text box (3023), wait (7), wait for key (use key), advance text box
	show text box (3024), wait (7), wait for key (use key), advance text box
	show text box (3025), wait (7), wait for key (use key), advance text box
	wait (3), set NPC direction (3,down), wait (3), set NPC direction (3,left), wait (3)
	show text box (3026), wait (7), wait for key (use key), advance text box
	show text box (3027), wait (7), wait for key (use key), advance text box
	show text box (3028), wait (7), wait for key (use key), advance text box
	set tag (tag:PANOPT3,on), resume box advance, resume player, reinstate party
end

script,panopt4,begin
	remember party, suspend player, suspend box advance, wait (10)
 	show text box (3029), wait (7), wait for key (use key), advance text box
	walk hero (me,up,1), wait for hero (me), swap by position (0,find hero (hero:Renard))
	set hero direction (me,right)
	show text box (3030), wait (7), wait for key (use key), advance text box
	show text box (3031), wait (7), wait for key (use key), advance text box
	wait (3), set NPC direction (4,down), wait (3), set NPC direction (4,right), wait (3)
	show text box (3032), wait (7), wait for key (use key), advance text box
	show text box (3033), wait (7), wait for key (use key), advance text box
	wait (3), set NPC direction (4,down), wait (3), set NPC direction (4,left), wait (3)
	show text box (3034), wait (7), wait for key (use key), advance text box
	show text box (3035), wait (7), wait for key (use key), advance text box
	wait (3), set NPC direction (4,down), wait (3), set NPC direction (4,right), wait (3)
	show text box (3036), wait (7), wait for key (use key), advance text box
	show text box (3037), wait (7), wait for key (use key), advance text box
	show text box (3038), wait (7), wait for key (use key), advance text box
	wait (3), set NPC direction (4,down), wait (3), set NPC direction (4,left), wait (3)
	show text box (3039), wait (7), wait for key (use key), advance text box
	set tag (tag:PANOPT4,on), resume box advance, resume player, reinstate party
end

script,panopt5,begin
	remember party, suspend player, suspend box advance, wait (10)
 	show text box (3040), wait (7), wait for key (use key), advance text box
	show text box (3041), wait (7), wait for key (use key), advance text box
	show text box (3042), wait (7), wait for key (use key), advance text box
	show text box (3043), wait (7), wait for key (use key), advance text box
	wait (10), set tag (tag:PANOPT5,on), wait (10)
	show text box (3044), wait (7), wait for key (use key), advance text box
 	resume box advance,resume player
end

script,panopt6,begin
	remember party, suspend player, suspend box advance
 	wait (10),swap by position (0,find hero (hero:Olaf))
	set hero direction (me,right)
 	show text box (3045), wait (7), wait for key (use key), advance text box
	show text box (3046), wait (7), wait for key (use key), advance text box
	show text box (3047), wait (7), wait for key (use key), advance text box
	show text box (3048), wait (7), wait for key (use key), advance text box
	show text box (3047), wait (7), wait for key (use key), advance text box
	show text box (3049), wait (7), wait for key (use key), advance text box
	show text box (3047), wait (7), wait for key (use key), advance text box
	show text box (3050), wait (7), wait for key (use key), advance text box
	show text box (3047), wait (7), wait for key (use key), advance text box
	show text box (3051), wait (7), wait for key (use key), advance text box
	show text box (3047), wait (7), wait for key (use key), advance text box
	show text box (3052), wait (7), wait for key (use key), advance text box
	show text box (3053), wait (7), wait for key (use key), advance text box
	show text box (3054), wait (7), wait for key (use key), advance text box
	wait (20), set tag (tag:PANOPT6,on), wait (20)
	show text box (3055), wait (7), wait for key (use key), advance text box
 	resume box advance, resume player, reinstate party
end

script,panopt7,begin
	remember party, suspend player, suspend box advance
 	wait (10),swap by position (0,find hero (hero:Hilda)),	set hero direction (me,up)
 	show text box (3056), wait (7), wait for key (use key), advance text box
 	show text box (3057), wait (7), wait for key (use key), advance text box
 	show text box (3058), wait (7), wait for key (use key), advance text box
 	show text box (3059), wait (7), wait for key (use key), advance text box
 	show text box (3060), wait (7), wait for key (use key), advance text box
 	show text box (3061), wait (7), wait for key (use key), advance text box
 	show text box (3062), wait (7), wait for key (use key), advance text box
	wait (20), set tag (tag:PANOPT7,on), wait (20)
	show text box (3063), wait (7), wait for key (use key), advance text box
 	resume box advance, resume player, reinstate party
end

script,panopt8,begin
	remember party, suspend player, suspend box advance
 	wait (10),swap by position (0,find hero (hero:Bram))
	set hero direction (me,up)
 	show text box (3064), wait (7), wait for key (use key), advance text box
 	show text box (3065), wait (7), wait for key (use key), advance text box
 	show text box (3066), wait (7), wait for key (use key), advance text box
 	show text box (3067), wait (7), wait for key (use key), advance text box
 	show text box (3068), wait (7), wait for key (use key), advance text box
 	show text box (3069), wait (7), wait for key (use key), advance text box
 	show text box (3070), wait (7), wait for key (use key), advance text box
 	show text box (3071), wait (7), wait for key (use key), advance text box
 	show text box (3072), wait (7), wait for key (use key), advance text box
 	show text box (3073), wait (7), wait for key (use key), advance text box
 	show text box (3074), wait (7), wait for key (use key), advance text box
 	show text box (3075), wait (7), wait for key (use key), advance text box
 	show text box (3076), wait (7), wait for key (use key), advance text box
	wait (20), set tag (tag:PANOPT8,on), wait (20)
	show text box (3077), wait (7), wait for key (use key), advance text box
 	resume box advance, resume player, reinstate party
end

script,panopt9,begin
	remember party, suspend player, suspend box advance, wait (10)
 	show text box (3078), wait (7), wait for key (use key), advance text box
	wait (10), swap by position (0,find hero (hero:Freki)), wait (10)
	set hero direction (me,right)
	show text box (3079), wait (7), wait for key (use key), advance text box
	show text box (3080), wait (7), wait for key (use key), advance text box
	wait (3), set NPC direction (40,down), wait (3), set NPC direction (40,right), wait (3)
	show text box (3081), wait (7), wait for key (use key), advance text box
	show text box (3082), wait (7), wait for key (use key), advance text box
	wait (3), set NPC direction (40,down), wait (3), set NPC direction (40,left), wait (3)
	show text box (3083), wait (7), wait for key (use key), advance text box
	show text box (3084), wait (7), wait for key (use key), advance text box
	show text box (3085), wait (7), wait for key (use key), advance text box
	wait (3), set NPC direction (40,down), wait (3), set NPC direction (40,right), wait (3)
	show text box (3086), wait (7), wait for key (use key), advance text box
	show text box (3087), stop song, wait (7), wait for key (use key), advance text box
	wait (20), set tag (tag:PANOPT9,on), wait (20)
	show text box (3088), wait (7), wait for key (use key), advance text box
 	resume box advance, resume player,reinstate party
end

# A final story script, but this one's optional. Kyle apologizes for his actions,
# Then begs the party to defeat whatever monster lurks in the abyss of the void.
# With his last breath, he accepts his end and fades away.

script,kylevoid,begin
 	suspend player, suspend box advance
	walk hero to x (me, 67), wait for hero (me), walk hero to y (me,50), wait for hero (me)
 	swap by position (0,find hero (hero:Freki)), set hero direction (me,left)
	set caterpillar mode (on)
	set hero position (1, 67, 50), set hero position (2, 67, 50), set hero position (3, 67, 50), wait (5)
	suspend caterpillar
	walk hero (1,up,1),walk hero (2,down,1), walk hero (3,right,1), wait for hero (3)
	set hero direction (1,left), set hero direction (2,left), set hero direction (3,left)
	wait (10)
	show text box (2880), wait (7), wait for key (use key), advance text box
	show text box (2881), wait (7), wait for key (use key), advance text box
	show text box (2882), wait (7), wait for key (use key), advance text box
	show text box (2883), wait (7), wait for key (use key), advance text box
	show text box (2884), wait (7), wait for key (use key), advance text box
	show text box (2885), wait (7), wait for key (use key), advance text box
	set npc direction (24,up)
	show text box (3110), wait (7), wait for key (use key), advance text box
	show text box (3111), wait (7), wait for key (use key), advance text box
	show text box (3112), wait (7), wait for key (use key), advance text box
	show text box (3113), wait (7), wait for key (use key), advance text box
	show text box (3114), wait (7), wait for key (use key), advance text box
	wait (10), set npc direction (24,down), wait (10)
	show text box (3115), wait (7), wait for key (use key), advance text box
	wait (10), set npc direction (24,up), wait (10)
	show text box (3116), wait (7), wait for key (use key), advance text box
	show text box (3117), wait (7), wait for key (use key), advance text box
	show text box (3118), wait (7), wait for key (use key), advance text box
	show text box (3119), wait (7), wait for key (use key), advance text box
	show text box (3120), wait (7), wait for key (use key), advance text box
	wait (10), set npc direction (24,down), wait (10)
	show text box (3121), wait (7), wait for key (use key), advance text box
 	wait (20)
	show text box (3122), wait (7), wait for key (use key), advance text box
	wait (20)
	show text box (3123), wait (7), wait for key (use key), advance text box
	wait (20)
	show text box (3124), wait (7), wait for key (use key), advance text box
 	wait (20)
 	set tag (tag:KYLEDIES,on)
	walk hero (1,down,1),walk hero (2,up,1), walk hero (3,left,1), wait for hero (3)
	set caterpillar mode (off), wait (3), resume caterpillar
 	resume box advance, resume player
end

script,defender,begin
remember party
 	suspend player, suspend box advance
 	swap by position (0,find hero (hero:Freki))
	show text box (3125), wait (7), wait for key (use key), advance text box
	if ((checktag(tag:Guiltdefeated)==on) and (checktag(tag:Billybeat)==on)) then
		(if ((checktag(tag:Managarm defeated)==on) and (checktag(tag:ERUSAIZU)==on)) then (
			(if ((checktag(tag:LIGHTCRYSTAL)==on) and (checktag(tag:DARKMATTER)==on)) then (						
				show text box (3126), wait (7), wait for key (use key), advance text box	
				)
		)
	) else (	
		show text box (3127), wait (7), wait for key (use key), advance text box)
	)
 	resume box advance,resume player
end


# Here it is. The final boss.

script,trueboss,begin
 	suspend player, suspend box advance, fade screen out (63,63,63)
 	wait (20),set caterpillar mode (off), resume caterpillar,camera follows hero (me)
 	wait (5), use door (0)
	show text box (3128), wait (7), wait for key (use key), advance text box
	show text box (3129), wait (7), wait for key (use key), advance text box
	show text box (3130), wait (7), wait for key (use key), advance text box
	show text box (3131), wait (7), wait for key (use key), advance text box
	show text box (3132), wait (7), wait for key (use key), advance text box
	tweak palette (63,63,63), play sound (sfx:ThunderMagic,false,true) ,update palette, set npc position (10,8,3)
	wait (7),reset palette,update palette, set npc direction (0,up), set npc direction (1,up), set npc direction (4,up)
	show text box (3133), wait (7), wait for key (use key), advance text box
	show text box (3134), wait (7), wait for key (use key), advance text box
	show text box (3135), wait (7), wait for key (use key), advance text box
	show text box (3136), wait (7), wait for key (use key), advance text box
	show text box (3137), wait (7), wait for key (use key), advance text box
	show text box (3138), wait (7), wait for key (use key), advance text box
	show text box (3139), wait (7), wait for key (use key), advance text box
	show text box (3140), wait (7), wait for key (use key), advance text box
	show text box (3141), wait (7), wait for key (use key), advance text box
	show text box (3142), wait (7), wait for key (use key), advance text box

#Begin the badass boasting
	play song (song:Vikings of Midgard)
	walk npc (1,up,1)
	show text box (3143), wait (7), wait for key (use key), advance text box
	walk npc (9,left,1)
	show text box (3144), wait (7), wait for key (use key), advance text box
	walk npc (2,right,1), wait for npc (2), set npc direction (2,up)
	show text box (3145), wait (7), wait for key (use key), advance text box
	walk npc (4,up,1)
	show text box (3146), wait (7), wait for key (use key), advance text box
	walk npc (8,right,1)
	show text box (3147), wait (7), wait for key (use key), advance text box
	walk npc (7,right,1)
	show text box (3148), wait (7), wait for key (use key), advance text box
	walk npc (3,left,1), wait for npc (3), set npc direction (3,up)
	show text box (3149), wait (7), wait for key (use key), advance text box
	walk npc (5,left,1)
	show text box (3150), wait (7), wait for key (use key), advance text box
	walk npc (6,right,1)
	show text box (3151), wait (7), wait for key (use key), advance text box
	walk npc (0,up,1)
	show text box (3152), wait (7), wait for key (use key), advance text box
	stop song, wait (20)
#end badass boasting. The villain starts calling out the party.
	play song (song:Vile)
	show text box (3153), wait (7), wait for key (use key), advance text box
	show text box (3154), wait (7), wait for key (use key), advance text box
	show text box (3155), walk npc (6,down,1), walk npc (6,right,3), wait for npc (6)
	set npc direction (6,up), wait for key (use key), advance text box
	show text box (3156), wait (7), wait for key (use key), advance text box
	show text box (3157), walk npc (8,right,3), wait for npc (3), set npc direction (8,up)
	wait for key (use key), advance text box
	show text box (3158), wait (7), wait for key (use key), advance text box
	show text box (3159), walk npc (7,down,1), walk npc (9,left,1), wait for npc (7)
	set npc direction (9,up), walk npc (7,right,4), wait for npc (7), set npc direction (7,up)
	wait for key (use key), advance text box
	show text box (3160), wait (7), wait for key (use key), advance text box
	show text box (3161), walk npc (5,down,1), walk npc (5,left,3), wait for npc (5), set npc direction (5,up)
	wait (7), wait for key (use key), advance text box
# You thought it was that other guy, but it was me! Cthulhu!
	stop song, wait (20)
	tweak palette (63,63,63), play sound (sfx:ThunderMagic,false,true) ,update palette, set npc position (11,8,3)
	set npc position (10,8,9), wait (7),reset palette,update palette, set npc direction (0,up)
	show text box (3162), wait (7), wait for key (use key), advance text box
	show text box (3163), wait (7), wait for key (use key), advance text box, wait (20)
	show text box (3164), wait (7), wait for key (use key), advance text box
	show text box (3165), wait (7), wait for key (use key), advance text box
	show text box (3166), wait (7), wait for key (use key), advance text box
	show text box (3167), wait (7), wait for key (use key), advance text box
	show text box (3168), wait (7), wait for key (use key), advance text box
	show text box (3169), wait (7), wait for key (use key), advance text box
	show text box (3170), wait (7), wait for key (use key), advance text box
	show text box (3171), wait (7), wait for key (use key), advance text box
	show text box (3172), wait (7), wait for key (use key), advance text box
	show text box (3173), wait (7), wait for key (use key), advance text box
	show text box (3174), wait (7), wait for key (use key), advance text box
	show text box (3175), wait (7), wait for key (use key), advance text box
	show text box (3176), wait (7), wait for key (use key), advance text box
	show text box (3177), wait (7), wait for key (use key), advance text box
	show text box (3178), wait (7), wait for key (use key), advance text box
	show text box (3179), wait (7), wait for key (use key), advance text box
	show text box (3180), wait (7), wait for key (use key), advance text box, wait (20)
	show text box (3181), wait (7), wait for key (use key), advance text box
	show text box (3182), wait (7), wait for key (use key), advance text box
	show text box (3183), wait (7), wait for key (use key), advance text box
	show text box (3184), wait (7), wait for key (use key), advance text box
 	use shop (shop:Before Combat), wait (5),remember party, wait (1)
	BossIntroduction
	set victory music (song:Hail The Conquering Heroes)
# Don't ask, but the very first formation in the game's data is specifically reserved FOR the final boss.
 	fight formation (0),set tag (tag:CTHULHUFINAL,on)
# And because it's a long ass script, we're going to shove the Epilogue into
# It's own script and call it here.
	FINALE

 	resume box advance, resume player
end


script, ginga autorun, begin
  	update ginga parallax
end

script, update ginga parallax, begin
  	variable(sl, mapw, maph, screenw, screenh, layerw, layerh)
  	if(current map <> map:Ginnungagap) then(
    		stop timer(void parallax timer)
# (The following is only needed if 'recreate map slices when leaving map' is off)
    		sl := lookup slice(sl:map layer 0)
    		set slice x(sl, 0)
    		set slice y(sl, 0)
    		exit script
  		)
  	mapw := map width * 20
  	maph := map height * 20
  	screenw := slice width(sprite layer)
  	screenh := slice height(sprite layer)
  	layerw := mapw / 10  # e.g. 50 * 20 pixels
  	layerh := maph / 10  # e.g. 20 * 20 pixels
  	sl := lookup slice(sl:map layer 0)
  	calculate next camera pixel xy
  	set slice x(sl, (next camera pixel x * (mapw -- layerw) / (mapw -- screenw)))
  	set slice y(sl, (next camera pixel y * (maph -- layerh) / (maph -- screenh)))
# Set the script to run again next tick
  	set timer(void parallax timer, 0, 1, @update ginga parallax)
end

script,gahn1,begin
 	suspend player, suspend box advance, suspend obstruction
	show text box (3466), wait (7), wait for key (use key), advance text box
	show text box (3467), wait (7), wait for key (use key), advance text box
	show text box (3468), wait (7), wait for key (use key), advance text box
	focus camera (24,25,2), set hero direction (me,left), set NPC direction (6,left)
	show text box (3469), wait (7), wait for key (use key), advance text box
	show text box (3470), wait (7), wait for key (use key), advance text box
	show text box (3471), wait (7), wait for key (use key), advance text box
	wait for camera
	show text box (3472), wait (7), wait for key (use key), advance text box
	show text box (3473), wait (7), wait for key (use key), advance text box
	set hero direction (me,down), set NPC direction (6,up)
	focus camera (38,25,4), wait for camera, camera follows hero (me)
	show text box (3474), wait (7), wait for key (use key), advance text box
	show text box (3475), wait (7), wait for key (use key), advance text box
	show text box (3476), wait (7), wait for key (use key), advance text box
	show text box (3477), wait (7), wait for key (use key), advance text box
	walk NPC (6,up,1), wait for NPC (6)
	wait (5)
	resume player, resume box advance, resume obstruction
	set tag (tag:GAHN1, on)
end

script,gahn2,begin
 	suspend player, suspend box advance, suspend obstruction
	show text box (3478), wait (7), wait for key (use key), advance text box
	focus camera (24,25,2), set hero direction (me,up), set NPC direction (7,up)
	show text box (3479), wait (7), wait for key (use key), advance text box
	show text box (3480), wait (7), wait for key (use key), advance text box
	wait for camera, set NPC position (7,23,39)
	show text box (3481), wait (7), wait for key (use key), advance text box
	show text box (3482), wait (7), wait for key (use key), advance text box
	set hero direction (me,left), set NPC direction (7,right)
	focus camera (24,39,4), wait for camera, camera follows hero (me)
	walk NPC (7,right,1), wait for NPC (7)
	wait (5)
	set NPC position (7,0,0), wait (5)
	resume player, resume box advance, resume obstruction
end

script,gahn3,begin
 	suspend player, suspend box advance, suspend obstruction
	show text box (3483), wait (7), wait for key (use key), advance text box
	show text box (3484), wait (7), wait for key (use key), advance text box
	focus camera (24,25,2), set hero direction (me,right), set NPC direction (7,right)
	show text box (3485), wait (7), wait for key (use key), advance text box
	show text box (3486), wait (7), wait for key (use key), advance text box
	wait for camera, set NPC position (7,15,24)
	show text box (3487), wait (7), wait for key (use key), advance text box
	show text box (3488), wait (7), wait for key (use key), advance text box
	show text box (3489), wait (7), wait for key (use key), advance text box
	set hero direction (me,right), set NPC direction (7,right)
	focus camera (15,25,4), wait for camera, camera follows hero (me)
	show text box (3490), wait (7), wait for key (use key), advance text box
	show text box (3491), wait (7), wait for key (use key), advance text box
	show text box (3492), wait (7), wait for key (use key), advance text box
	walk NPC (7,down,1), wait for NPC (7)
	wait (5)
	set NPC position (7,0,0), wait (5)
	resume player, resume box advance, resume obstruction
end

script,jade,begin
 	suspend player, suspend box advance, suspend obstruction
	show text box (3493), wait (7), wait for key (use key), advance text box
	walk hero (me,up,2), wait for hero (me), set NPC direction (7,up)
	set NPC position (7,24,26), walk NPC (7,left,1), wait for NPC

 	set caterpillar mode (on), set hero position (1,24,26), set hero position (2,24,26)
 	set hero position (3,24,26), suspend caterpillar, wait (3)
	walk NPC (7,up,1)
 	walk hero (1,left,1), walk hero (2,right,1), walk hero (3,down,1)
 	wait for hero (1), set NPC direction (7,right), wait for hero (1)
 	set hero direction (1,up), set hero direction (2,up), set hero direction (3,up)
 	wait (3),	set NPC position (1,24,32), set NPC direction (1,up)
	show text box (3494), wait (7), wait for key (use key), advance text box
	set hero direction (me,down), set hero direction (1,down)
	set hero direction (2,down), set hero direction (3,down)	
	focus camera (24,32,4), wait for camera, walk NPC (1,up,1)
	show text box (3495), wait (7), wait for key (use key), advance text box
	show text box (3496), wait (7), wait for key (use key), advance text box
	play song (song:Vile)
	focus camera (24,25,4), walk NPC (7,up,1), wait for NPC (7)
	walk NPC (7,right,1), wait for NPC (7),wait for camera
	set NPC direction (7,down)
	show text box (3497), wait (7), wait for key (use key), advance text box
	set hero direction (me,up), set hero direction (1,up)
	set hero direction (2,up), set hero direction (3,up)	
	wait (5), BossIntroduction
 	fight formation (259)
	play song (song:An Unfortunate End)
	show text box (3498), wait (7), wait for key (use key), advance text box
	show text box (3499), wait (7), wait for key (use key), advance text box
	show text box (3500), wait (7), wait for key (use key), advance text box
	fade screen out (63,63,63), stop song, wait (5)
remember party
 	swap by position (0,find hero (hero:Freki))
 	swap by position (2,find hero (hero:Hilda))
 	swap by position (1,find hero (hero:Olaf))
	swap by position (3,find hero (hero:Frumpy))
	set NPC position (7,0,0)
	set NPC position (5,24,23), set NPC direction (5,down), wait (5), fade screen in
	play song (song:In Soft Reflection)
	show text box (3501), wait (7), wait for key (use key), advance text box
	show text box (3502), wait (7), wait for key (use key), advance text box
	walk hero (2,up,1), walk hero (me,right,1), walk hero (1,right,1), wait for hero (me)
	walk hero (2,up,1), walk hero (me,up,1), walk hero (1,right,1), wait for hero (me)
	walk hero (2,right,1), walk hero (1,right,1), walk hero (3,up,1), wait for hero (1)
	walk hero (1,up,1), walk hero (3,right,1), wait for hero (1)
	set hero direction (2,down), set hero direction (me,down), set hero direction (1,down), set hero direction (3,down)
	walk NPC (1,up,5)
	set hero direction (3,left), walk NPC (5,left,1), wait for NPC (5)	
	walk NPC (5,down,1), wait for NPC (1), set NPC direction (5,right), set NPC direction (1,left)
	show text box (3503), wait (7), wait for key (use key), advance text box
	show text box (3504), wait (7), wait for key (use key), advance text box
	wait (5), set NPC direction (5,down), wait (5), set NPC direction (5,left), wait (5)
	show text box (3505), wait (7), wait for key (use key), advance text box
	show text box (3506), wait (7), wait for key (use key), advance text box
	wait (5), set NPC direction (5,down), wait (5), set NPC direction (5,right), wait (5)
	show text box (3507), wait (7), wait for key (use key), advance text box
	show text box (3508), wait (7), wait for key (use key), advance text box
	show text box (3509), wait (7), wait for key (use key), advance text box
	show text box (3510), wait (7), wait for key (use key), advance text box
	wait (5), set NPC direction (5,up), wait (5)
	show text box (3511), wait (7), wait for key (use key), advance text box
	show text box (3512), wait (7), wait for key (use key), advance text box
	show text box (3513), wait (7), wait for key (use key), advance text box
	wait (5), set hero direction (2,down), wait (5)
	show text box (3514), wait (7), wait for key (use key), advance text box
	wait (5), set hero direction (3,up), set NPC direction (1,up), wait (5)
	show text box (3515), wait (7), wait for key (use key), advance text box
	show text box (3516), wait (7), wait for key (use key), advance text box
	show text box (3517), wait (7), wait for key (use key), advance text box
	set hero direction (1,down), set hero direction (2,down), set hero direction (3,left)
	wait (5), set NPC direction (5,right), wait (5)
	show text box (3518), wait (7), wait for key (use key), advance text box
	wait (5), set NPC direction (1,left), wait (5)
	walk NPC (1,left,1), wait for NPC (1), walk NPC (1,up,1)
	show text box (3519), wait (7), wait for key (use key), advance text box
	wait (10)
	show text box (3520), wait (7), wait for key (use key), advance text box
	fade screen out (63,63,63), wait (5)
	set NPC position (5,0,0), set NPC position (1,0,0), wait (5), set tag (tag:JADE,on)
 	set caterpillar mode (off), resume caterpillar, camera follows hero (me), wait for camera, wait (5)
	fade screen in
	show text box (3521), wait (7), wait for key (use key), advance text box
	resume player, resume box advance, resume obstruction, encounters
end

# The actual finale of the game.

script,FINALE,begin
	play song (song:Sleeping Buddha)
	show text box (3700), wait (7), wait for key (use key), advance text box
	walk NPC (5,up,2), walk NPC (6,left,2), walk NPC (3,right,2), walk NPC (2,up,1)
	walk NPC (0,up,1), walk NPC (7,left,1), walk NPC (9,right,1), wait for NPC (3)
	set NPC direction (0,down), set NPC direction (1,right), set NPC direction (2,right)
	set NPC direction (3,left), set NPC direction (4,left), set NPC direction (5,down)
	set NPC direction (6,right), set NPC direction (7,right), set NPC direction (9,left)
	wait (10)
		
	show text box (3701), wait (7), wait for key (use key), advance text box	
	show text box (3702), wait (7), wait for key (use key), advance text box	
	wait (5), set NPC direction (4,down), wait (5)
	show text box (3703), wait (7), wait for key (use key), advance text box
	show text box (3704), wait (7), wait for key (use key), advance text box
	show text box (3705), wait (7), wait for key (use key), advance text box
	show text box (3706), wait (7), wait for key (use key), advance text box
	show text box (3707), wait (7), wait for key (use key), advance text box
	wait (5), set NPC direction (5,left), wait (5)
	show text box (3708), wait (7), wait for key (use key), advance text box
	wait (5), set NPC direction (3,down), wait (5)
	show text box (3709), wait (7), wait for key (use key), advance text box
	show text box (3710), wait (7), wait for key (use key), advance text box
	show text box (3711), wait (7), wait for key (use key), advance text box
	wait (5), set NPC direction (9,up), wait (5)
	show text box (3712), wait (7), wait for key (use key), advance text box
	wait (5), set NPC direction (1,down), wait (5)
	show text box (3713), wait (7), wait for key (use key), advance text box
	wait (5), set NPC direction (5,down), wait (5)
	show text box (3714), wait (7), wait for key (use key), advance text box
	wait (5), set NPC direction (2,up), wait (5)
	show text box (3715), wait (7), wait for key (use key), advance text box
	wait (5), set NPC direction (7,left), wait (5)
	show text box (3716), wait (7), wait for key (use key), advance text box
	walk NPC (0,left,1), set NPC direction (1,left), set NPC direction (2,left)
	set NPC direction (3,left), set NPC direction (4,left), set NPC direction (5,left)
	set NPC direction (6,right), set NPC direction (7,left), set NPC direction (9,left)
	wait (10)
	show text box (3717), wait (7), wait for key (use key), advance text box
	show text box (3718), wait (7), wait for key (use key), advance text box
	wait (5), set NPC direction (7,down), wait (5)
	show text box (3719), wait (7), wait for key (use key), advance text box
	show text box (3720), wait (7), wait for key (use key), advance text box
	wait (5), set NPC direction (7,right), wait (5)
	show text box (3721), wait (7), wait for key (use key), advance text box
	wait (5), set NPC direction (0,down), wait (5)
	show text box (3722), wait (7), wait for key (use key), advance text box
	wait (5), set NPC direction (8,up), wait (5)
	show text box (3723), wait (7), wait for key (use key), advance text box
	set NPC direction (0,down), set NPC direction (1,down), set NPC direction (2,down)
	set NPC direction (3,left), set NPC direction (4,down), set NPC direction (5,left)
	set NPC direction (6,right), set NPC direction (7,right), set NPC direction (9,left)
	wait (10)
	show text box (3724), wait (7), wait for key (use key), advance text box
	show text box (3725), wait (7), wait for key (use key), advance text box
	wait (5), set NPC direction (4,down), wait (5)
	show text box (3726), wait (7), wait for key (use key), advance text box
	wait (5), set NPC direction (8,right), wait (5)
	show text box (3727), wait (7), wait for key (use key), advance text box
	show text box (3728), wait (7), wait for key (use key), advance text box
	show text box (3729), wait (7), wait for key (use key), advance text box
	wait (5), set NPC direction (8,down), wait (5)
	show text box (3730), wait (7), wait for key (use key), advance text box
	show text box (3731), wait (7), wait for key (use key), advance text box
	wait (5), set NPC direction (8,right), wait (5)
	show text box (3732), wait (7), wait for key (use key), advance text box
	wait (5), set NPC direction (5,down), wait (5)
	show text box (3733), wait (7), wait for key (use key), advance text box
	show text box (3734), wait (7), wait for key (use key), advance text box
	wait (5), set NPC direction (7,down), wait (5)
	show text box (3735), wait (7), wait for key (use key), advance text box
	wait (5), set NPC direction (5,left), wait (5)
	show text box (3736), wait (7), wait for key (use key), advance text box
	wait (5), set NPC direction (4,down), wait (5), set NPC direction (4,right)
	wait (5), set NPC direction (4,up), wait (5), set NPC direction (4,left)
	wait (5), set NPC direction (4,down), wait (5)
	show text box (3737), wait (7), wait for key (use key), advance text box

	stop song, fade screen out
	play song (song:Second Star To The Right)
	walk hero (me,down,1)
#

#Renard's Epilogue
	show text box (3871), wait (10), fade screen in, wait (108), fade screen out
	wait (10)
	show text box (3858), wait (10), fade screen in, wait (108)
	show text box (3859), wait (108)
	show text box (3860), wait (108)
	show text box (3861), wait (108)
	show text box (3862), wait (108)
	show text box (3863), wait (108)
	show text box (3864), wait (108)	
	show text box (3865), wait (108)
	show text box (3866), wait (108)
	show text box (3867), wait (108)
	show text box (3868), wait (108)
	show text box (3869), wait (108)
	show text box (3870), wait (108), fade screen out

#Kitt's Epilogue
	show text box (3872), wait (10), fade screen in, wait (108), fade screen out
	wait (10)

	if (checktag (tag:utgard)==on) then (
		show text box (3873), wait (10), fade screen in, wait (108)
		show text box (3874), wait (108)
		show text box (3875), wait (108)
		show text box (3876), wait (108)
		show text box (3877), wait (108)
		show text box (3878), wait (108)
		show text box (3879), wait (108)	
		show text box (3880), wait (108)
		show text box (3881), wait (108)
		show text box (3882), wait (108)
		show text box (3883), wait (108), fade screen out
		) else (
		show text box (4206), wait (10), fade screen in, wait (108)
		show text box (4207), wait (108)
		show text box (4208), wait (108)
		show text box (4209), wait (108)
		show text box (4210), wait (108)
		show text box (4211), wait (108)
		show text box (4212), wait (108)	
		show text box (4213), wait (108)
		show text box (4214), wait (108)
		show text box (4215), wait (108)
		show text box (4216), wait (108), fade screen out
		)

#Hilda's Epilogue
	show text box (3884), wait (10), fade screen in, wait (108), fade screen out
	wait (10)
	show text box (3885), wait (10), fade screen in, wait (108)
	show text box (3886), wait (108)
	show text box (3887), wait (108)
	show text box (3888), wait (108)
	show text box (3889), wait (108)
	show text box (3890), wait (108)
	show text box (3891), wait (108)	
	show text box (3892), wait (108)
	show text box (3893), wait (108)
	show text box (3894), wait (108)
	show text box (3895), wait (108), fade screen out

#Olaf's Epilogue
	show text box (3896), wait (10), fade screen in, wait (108), fade screen out
	wait (10)
	show text box (3897), wait (10), fade screen in, wait (108)
	show text box (3898), wait (108)
	show text box (3899), wait (108)
	show text box (3900), wait (108)
	show text box (3901), wait (108)
	show text box (3902), wait (108)
	show text box (3903), wait (108)	
	show text box (3904), wait (108)
	show text box (3905), wait (108), fade screen out

#Styrge's Epilogue
	show text box (3906), wait (10), fade screen in, wait (108), fade screen out
	wait (10)
	if (checktag (tag:styrge rejoins)==on) then (
		show text box (3907), wait (10), fade screen in, wait (108)
		show text box (3908), wait (108)
		show text box (3909), wait (108)
		show text box (3910), wait (108)
		show text box (3911), wait (108)
		show text box (3912), wait (108)
		show text box (3913), wait (108)	
		show text box (3914), wait (108)
		show text box (3915), wait (108), fade screen out
	) else (
		show text box (4217), wait (10), fade screen in, wait (108)
		show text box (4218), wait (108)
		show text box (4219), wait (108)
		show text box (4220), wait (108)
		show text box (4221), wait (108)
		show text box (4222), wait (108)
		show text box (4223), wait (108)	
		show text box (4224), wait (108)
		show text box (4225), wait (108)
		show text box (4226), wait (108)
		show text box (4227), wait (108)
		show text box (4228), wait (108), fade screen out
	)

#Bram's Epilogue
	show text box (3916), wait (10), fade screen in, wait (108), fade screen out
	wait (10)
	show text box (3917), wait (10), fade screen in, wait (108)
	show text box (3918), wait (108)
	show text box (3919), wait (108)
	show text box (3920), wait (108)
	show text box (3921), wait (108)
	show text box (3922), wait (108)
	show text box (3923), wait (108)	
	show text box (3924), wait (108)
	show text box (3925), wait (108)
	show text box (3926), wait (108), fade screen out

#Night's Epilogue
	show text box (3927), wait (10), fade screen in, wait (108), fade screen out
	wait (10)
	if (checktag (tag:nightback)==on) then (

		show text box (3928), wait (10), fade screen in, wait (108)
		show text box (3929), wait (108)
		show text box (3930), wait (108)
		show text box (3931), wait (108)
		show text box (3932), wait (108)
		show text box (3933), wait (108)	
		show text box (3934), wait (108)
		show text box (3935), wait (108)
		show text box (3936), wait (108)
		show text box (3937), wait (108)
		show text box (3938), wait (108), fade screen out
	) else (
		show text box (4229), wait (10), fade screen in, wait (108)
		show text box (4230), wait (108)
		show text box (4231), wait (108)
		show text box (4232), wait (108), fade screen out
	)


#Frumpy's Epilogue
	show text box (3939), wait (10), fade screen in, wait (108), fade screen out
	wait (10)
	show text box (3940), wait (10), fade screen in, wait (108)
	show text box (3941), wait (108)
	show text box (3942), wait (108)
	show text box (3943), wait (108)	
	show text box (3944), wait (108)
	show text box (3945), wait (108)
	show text box (3946), wait (108)
	show text box (3947), wait (108)
	show text box (3948), wait (108)
	show text box (3949), wait (108)
	show text box (3950), wait (108)
	show text box (3951), wait (108)
	show text box (3952), wait (108), fade screen out

#Eric's Epilogue
	show text box (3953), wait (10), fade screen in, wait (108), fade screen out
	wait (10)
	show text box (3954), wait (10), fade screen in, wait (108)
	show text box (3955), wait (108)
	show text box (3956), wait (108)
	show text box (3957), wait (108)	
	show text box (3958), wait (108)
	show text box (3959), wait (108)
	show text box (3960), wait (108)
	show text box (3961), wait (108)
	show text box (3962), wait (108)
	show text box (3963), wait (108)
	show text box (3964), wait (108), fade screen out
	
 	suspend player, wait (1), advance text box
 	use door (0), wait (2), fade screen in
	set hero speed (me,1) 
  play song(song:Mannheim) 
  song start ms := milliseconds 


 	walk hero (me,down,220)
 	wait for hero
	check for song end

end






plotscript,remember party, begin
	spot0:= hero by slot (0)
	spot1:= hero by slot (1)
	spot2:= hero by slot (2)
	spot3:= hero by slot (3)
end

plotscript,reinstate party, begin
	swap by name (hero by slot(0),spot0)
	swap by name (hero by slot(1),spot1)
	swap by name (hero by slot(2),spot2)
	swap by name (hero by slot(3),spot3)
end


plotscript, lavatile, begin
# Right here we're checking for if the player is standing on a harm tile.
	if (read pass block (hero x, hero y), and, harm tile) then (
# If they are, then it'll play an sfx to help inform the player that they just took damage
		if (sound is playing (sfx:SmallExplosion8Bit) == false) then (
		 play sound (sfx:SmallExplosion8Bit,false,true), wait for sound(sfx:SmallExplosion8Bit))
	)
end

plotscript,bard1,begin
	suspend player, suspend box advance, remember party, suspend random enemys
  	set hero speed (me,4), focus camera ((hero x (me)),(hero y (me)),4)
 	swap by position (0,find hero (hero:Eric))
 	swap by position (1,find hero (hero:Bram))
 	swap by position (2,find hero (hero:Kitt))
 	swap by position (3,find hero (hero:Frumpy))
 	wait for hero (me), suspend caterpillar, set caterpillar mode (on)
	set hero position (1, (hero x (me)), (hero y (me)))
	set hero position (2, (hero x (me)), (hero y (me)))
	set hero position (3, (hero x (me)), (hero y (me)))
	wait (1), walk hero (me,down,1), walk hero (1,left,1), walk hero (2,up,1), walk hero (3,right,1)
	wait for hero (me), wait (5)
	set hero direction (me,left), set hero direction (1,down), set hero direction (2,left), set hero direction (3,down)
	wait (5),set hero direction (me,up), set hero direction (1,right) 
	set hero direction (2,down), set hero direction (3,left), wait (5)

	show text box (4044), wait (7), wait for key (use key), advance text box
	show text box (4045), wait (7), wait for key (use key), advance text box
	show text box (4046), wait (7), wait for key (use key), advance text box
	show text box (4047), wait (7), wait for key (use key), advance text box
	show text box (4048), wait (7), wait for key (use key), advance text box
	show text box (4049), wait (7), wait for key (use key), advance text box
	show text box (4050), wait (7), wait for key (use key), advance text box
	show text box (4051), wait (7), wait for key (use key), advance text box
	show text box (4052), wait (7), wait for key (use key), advance text box

	walk hero (me,up,1), walk hero (1,right,1), walk hero (2,down,1), walk hero (3,left,1), wait for hero (me)
	camera follows hero (me), set caterpillar mode (off)
	resume random enemys, reinstate party, resume player, resume box advance, encounters
end

plotscript,bard2,begin
	suspend player, suspend box advance, remember party, suspend random enemys
  	set hero speed (me,4), focus camera ((hero x (me)),(hero y (me)),4)
 	swap by position (0,find hero (hero:Eric))
 	swap by position (1,find hero (hero:Styrge))
 	swap by position (2,find hero (hero:Hilda))
 	swap by position (3,find hero (hero:Freki))
 	wait for hero (me), suspend caterpillar, set caterpillar mode (on)
	set hero position (1, (hero x (me)), (hero y (me)))
	set hero position (2, (hero x (me)), (hero y (me)))
	set hero position (3, (hero x (me)), (hero y (me)))
	wait (1), walk hero (me,down,1), walk hero (1,left,1), walk hero (2,up,1), walk hero (3,right,1)
	wait for hero (me), wait (5)
	set hero direction (me,left), set hero direction (1,down), set hero direction (2,left), set hero direction (3,down)
	wait (5),set hero direction (me,up), set hero direction (1,right) 
	set hero direction (2,down), set hero direction (3,left), wait (5)

	show text box (4053), wait (7), wait for key (use key), advance text box
	show text box (4054), wait (7), wait for key (use key), advance text box
	show text box (4055), wait (7), wait for key (use key), advance text box
	show text box (4056), wait (7), wait for key (use key), advance text box
	show text box (4057), wait (7), wait for key (use key), advance text box
	show text box (4058), wait (7), wait for key (use key), advance text box
	show text box (4059), wait (7), wait for key (use key), advance text box
	show text box (4060), wait (7), wait for key (use key), advance text box
	show text box (4061), wait (7), wait for key (use key), advance text box
	show text box (4062), wait (7), wait for key (use key), advance text box
	show text box (4063), wait (7), wait for key (use key), advance text box

	walk hero (me,up,1), walk hero (1,right,1), walk hero (2,down,1), walk hero (3,left,1), wait for hero (me)
	camera follows hero (me), set caterpillar mode (off)
	resume random enemys, reinstate party, resume player, resume box advance, encounters
end

plotscript,bard3,begin
	suspend player, suspend box advance, remember party, suspend random enemys
  	set hero speed (me,4), focus camera ((hero x (me)),(hero y (me)),4)
 	swap by position (0,find hero (hero:Eric))
 	swap by position (1,find hero (hero:Olaf))
 	swap by position (2,find hero (hero:Freki))
 	swap by position (3,find hero (hero:Night))
 	wait for hero (me), suspend caterpillar, set caterpillar mode (on)
	set hero position (1, (hero x (me)), (hero y (me)))
	set hero position (2, (hero x (me)), (hero y (me)))
	set hero position (3, (hero x (me)), (hero y (me)))
	wait (1), walk hero (me,down,1), walk hero (1,left,1), walk hero (2,up,1), walk hero (3,right,1)
	wait for hero (me), wait (5)
	set hero direction (me,left), set hero direction (1,down), set hero direction (2,left), set hero direction (3,down)
	wait (5),set hero direction (me,up), set hero direction (1,right) 
	set hero direction (2,down), set hero direction (3,left), wait (5)

	show text box (4065), wait (7), wait for key (use key), advance text box
	show text box (4066), wait (7), wait for key (use key), advance text box
	show text box (4067), wait (7), wait for key (use key), advance text box
	show text box (4068), wait (7), wait for key (use key), advance text box
	show text box (4069), wait (7), wait for key (use key), advance text box
	show text box (4070), wait (7), wait for key (use key), advance text box
	show text box (4071), wait (7), wait for key (use key), advance text box
	show text box (4072), wait (7), wait for key (use key), advance text box
	show text box (4073), wait (7), wait for key (use key), advance text box
	show text box (4074), wait (7), wait for key (use key), advance text box
	show text box (4075), wait (7), wait for key (use key), advance text box

	walk hero (me,up,1), walk hero (1,right,1), walk hero (2,down,1), walk hero (3,left,1), wait for hero (me)
	camera follows hero (me), set caterpillar mode (off)
	resume random enemys, reinstate party, resume player, resume box advance, encounters
end

plotscript,surtr,begin
	suspend player, suspend box advance, remember party, suspend random enemys
	walk hero to x (me,5), wait for hero (me), walk hero to y (me,5), wait for hero (me)
  	set hero speed (me,4), focus camera ((hero x (me)),(hero y (me)),4)
 	wait for hero (me), suspend caterpillar, set caterpillar mode (on)
	set hero position (1, (hero x (me)), (hero y (me)))
	set hero position (2, (hero x (me)), (hero y (me)))
	set hero position (3, (hero x (me)), (hero y (me)))
	walk hero (1,left,1), walk hero (2,right,1), walk hero (3,down,1), wait for hero (1)
	set hero direction (me,up), set hero direction (1,up), set hero direction (2,up), set hero direction (3,up)
	show text box (4177), wait (7), wait for key (use key), advance text box
	show text box (4178), wait (7), wait for key (use key), advance text box
	show text box (4179), wait (7), wait for key (use key), advance text box
	show text box (4180), wait (7), wait for key (use key), advance text box
	show text box (4181), wait (7), wait for key (use key), advance text box
	show text box (4182), wait (7), wait for key (use key), advance text box
	show text box (4183), wait (7), wait for key (use key), advance text box
	show text box (4184), wait (7), wait for key (use key), advance text box
	walk NPC (16,down,1), wait for NPC (16)
	Boss Introduction, fight formation (316)

	show text box (3769), wait (7), wait for key (use key), advance text box
 	
 	wait (1), play sound (sfx:Nuclear,false,true)
 	tweak palette (20,-20,20), fade screen in, wait (4), set tag (tag:defeat Cthulhu, on)
 	set NPC position (17,5,4)	set tag (tag:Brisinghint,on)
	set NPC direction (17,up), set NPC frame (17,0), pan camera (up,1,20), wait (2)
	set NPC direction (17,up), set NPC frame (17,1), pan camera (down,1,20), wait (2)
	set NPC direction (17,right), set NPC frame (17,0), pan camera (up,1,20), wait (2)
	set NPC direction (17,right), set NPC frame (17,1), pan camera (down,1,20), wait (2)
	set NPC direction (17,down), set NPC frame (17,0), pan camera (up,1,20), wait (2)
	set NPC direction (17,down), set NPC frame (17,1), pan camera (down,1,20), wait (2)
	set NPC direction (17,left), set NPC frame (17,0), pan camera (up,1,20), wait (2)
	set NPC direction (17,left), set NPC frame (17,1), pan camera (down,1,20), wait (2)
	set NPC position (17,50,50), wait for camera
 	wait (3), reset palette, fade screen in, wait (3)

	walk hero (1,right,1), walk hero (2,left,1), walk hero (3,up,1), wait for hero (1)
	camera follows hero (me), set caterpillar mode (off)
	resume random enemys, reinstate party, resume player, resume box advance, encounters
end

plotscript, check for song end, begin
  	variable(elapsed) 
  	elapsed := milliseconds -- song start ms 
# In this example the song is 4 minutes, 22 seconds 
  	if(elapsed < (1000 * 262)) then( 
# Song has not ended yet, check again next tick 
    		set timer(timer:song, 0, 1, @check for song end) 
  	)
	stop song
	fade screen out, wait (10)

#Freki's Epilogue

	show text box (3984), wait (10), fade screen in, wait (108)
	show text box (3985), wait (108)
	show text box (3986), wait (108)
	show text box (3987), wait (108)	
	show text box (3988), wait (108)
	show text box (3989), wait (108)
	show text box (3990), wait (108)
	show text box (3991), wait (108)
	show text box (3992), wait (108)
	show text box (3993), wait (108), wait for key (use key), fade screen out (63,63,63)

	resume player,	resume box advance
	gameover

END

plotscript,forestreturns,begin
	suspend player, suspend box advance, remember party, suspend random enemys
	fade screen out (40,63,40), wait (10)
	show text box (4233), wait (7), fade screen in
	wait for key (use key), advance text box
	show text box (4234), wait (7), wait for key (use key), advance text box
	show text box (4235), wait (7), wait for key (use key), advance text box
	show text box (4236), wait (7), wait for key (use key), advance text box
	show text box (4237), wait (7), wait for key (use key), advance text box
	show text box (4238), wait (7), wait for key (use key), advance text box
	show text box (4239), wait (7), wait for key (use key), advance text box
	show text box (4240), wait (7), wait for key (use key), advance text box
	show text box (4241), wait (7), wait for key (use key), fade screen out (63,63,63)
	wait (7), advance text box, wait (7)
	set tag (tag:Forest Revives,on), wait (2), use door (2), wait (2), fade screen in
	show text box (3681), wait (7), wait for key (use key), advance text box
	resume random enemys, reinstate party, resume player, resume box advance, encounters
end

plotscript,forestinn,begin
	suspend player, suspend box advance, remember party, suspend random enemys
	show text box (4242), wait (7), wait for key (use key), advance text box
	fade screen out, wait (10), use door (22)
	fade screen in

	set NPC frame (1,0), wait (1), set NPC frame (1,1), wait (1)
	set NPC frame (1,0), wait (1), set NPC frame (1,1), wait (1)
	show text box (4243), wait (7), wait for key (use key), advance text box
	set NPC frame (2,0), wait (1), set NPC frame (2,1), wait (1)
	set NPC frame (2,0), wait (1), set NPC frame (2,1), wait (1)
	show text box (4244), wait (7), wait for key (use key), advance text box
	set NPC frame (8,0), wait (1), set NPC frame (8,1), wait (1)
	set NPC frame (8,0), wait (1), set NPC frame (8,1), wait (1)
	show text box (4245), wait (7), wait for key (use key), advance text box
	set NPC direction (2,right),	set NPC frame (2,0), wait (1), set NPC frame (2,1), wait (1)
	set NPC frame (2,0), wait (1), set NPC frame (2,1), wait (1)
	show text box (4246), wait (7), wait for key (use key), advance text box
	set NPC frame (7,0), wait (1), set NPC frame (7,1), wait (1)
	set NPC frame (7,0), wait (1), set NPC frame (7,1), wait (1)
	show text box (4247), wait (7), wait for key (use key), advance text box
	set NPC direction (2,up),set NPC frame (2,0), wait (1), set NPC frame (2,1), wait (1)
	set NPC frame (2,0), wait (1), set NPC frame (2,1), wait (1)
	show text box (4248), wait (7), wait for key (use key), advance text box
	set NPC direction (1,down), set NPC frame (1,0), wait (1), set NPC frame (1,1), wait (1)
	set NPC frame (1,0), wait (1), set NPC frame (1,1), wait (1)
	show text box (4249), wait (7), wait for key (use key), advance text box
	show text box (4250), wait (7), wait for key (use key), advance text box
	set NPC direction (1,right), set NPC direction (7,left)
	set NPC frame (7,0), wait (1), set NPC frame (7,1), wait (1)
	set NPC frame (7,0), wait (1), set NPC frame (7,1), wait (1)
	show text box (4251), wait (7), wait for key (use key), advance text box
	show text box (4252), wait (7), wait for key (use key), advance text box
	show text box (4253), wait (7), wait for key (use key), advance text box
	show text box (4254), wait (7), wait for key (use key), advance text box
	set NPC frame (2,0), wait (1), set NPC frame (2,1), wait (1)
	set NPC frame (2,0), wait (1), set NPC frame (2,1), wait (1)
	show text box (4255), wait (7), wait for key (use key), advance text box
	set NPC frame (8,0), wait (1), set NPC frame (8,1), wait (1)
	set NPC frame (8,0), wait (1), set NPC frame (8,1), wait (1)
	show text box (4256), wait (7), wait for key (use key), advance text box
	set NPC frame (7,0), wait (1), set NPC frame (7,1), wait (1)
	set NPC frame (7,0), wait (1), set NPC frame (7,1), wait (1)
	show text box (4257), wait (7), wait for key (use key), advance text box
	set NPC frame (1,0), wait (1), set NPC frame (1,1), wait (1)
	set NPC frame (1,0), wait (1), set NPC frame (1,1), wait (1)
	show text box (4258), wait (7), wait for key (use key), advance text box
	set NPC frame (5,0), wait (1), set NPC frame (5,1), wait (1)
	set NPC frame (5,0), wait (1), set NPC frame (5,1), wait (1)
	show text box (4259), wait (7), wait for key (use key), advance text box

	walk NPC (0,right,6), wait (5)
	show text box (4260), wait (7), wait for key (use key), advance text box
	wait for NPC (0),	set NPC frame (8,0), wait (1), set NPC frame (8,1), wait (1)
	set NPC frame (8,0), wait (1), set NPC frame (8,1), wait (1)
	show text box (4261), wait (7), wait for key (use key), advance text box
	set NPC frame (0,0), wait (1), set NPC frame (0,1), wait (1)
	set NPC frame (0,0), wait (1), set NPC frame (0,1), wait (1)
	show text box (4262), wait (7), wait for key (use key), advance text box
	set NPC frame (5,0), wait (1), set NPC frame (5,1), wait (1)
	set NPC frame (5,0), wait (1), set NPC frame (5,1), wait (1)
	show text box (4263), wait (7), wait for key (use key), advance text box
	wait (5), set NPC direction (0,up), wait (5)
	show text box (4264), wait (7), wait for key (use key), advance text box
	set NPC frame (2,0), wait (1), set NPC frame (2,1), wait (1)
	set NPC frame (2,0), wait (1), set NPC frame (2,1), wait (1)
	show text box (4265), wait (7), wait for key (use key), advance text box
	set NPC direction (1,up),	set NPC frame (1,0), wait (1), set NPC frame (1,1), wait (1)
	set NPC frame (1,0), wait (1), set NPC frame (1,1), wait (1)
	show text box (4266), wait (7), wait for key (use key), advance text box
	set NPC frame (5,0), wait (1), set NPC frame (5,1), wait (1)
	set NPC frame (5,0), wait (1), set NPC frame (5,1), wait (1)
	show text box (4267), wait (7), wait for key (use key), advance text box
	set NPC frame (0,0), wait (1), set NPC frame (0,1), wait (1)
	set NPC frame (0,0), wait (1), set NPC frame (0,1), wait (1)
	show text box (4268), wait (7), wait for key (use key), advance text box
	wait (5), walk NPC (0,left,10), wait (5), set NPC direction (5,left), wait (5)
	set NPC frame (5,0), wait (1), set NPC frame (5,1), wait (1)
	set NPC frame (5,0), wait (1), set NPC frame (5,1), wait (1)
	show text box (4269), wait (7), wait for key (use key), advance text box
	set NPC frame (8,0), wait (1), set NPC frame (8,1), wait (1)
	set NPC frame (8,0), wait (1), set NPC frame (8,1), wait (1)
	show text box (4270), wait (7), wait for key (use key), advance text box

 	wait (5), fade screen out, stop song,wait (5) 
	play sound (sfx:sleep,false,true),walk hero (me,up,1), set hero direction (me,down), wait (120)

# When the screen comes back, we want the game to play the music for the area. 
# Because each area is different, we want the "default" ambient music.

	use door (2) ,wait (5)

	resume random enemys, reinstate party, resume player, resume box advance, encounters
end



#linked from textbox 414
plotscript,snaketeleport,begin
	suspend player, suspend box advance, remember party, suspend random enemys
	show text box (4271), wait (7), wait for key (use key), advance text box
 	suspend player,	bifrostbeam(0)
 	fade screen out (63,63,63), wait (1), use door (10), reset palette, wait (1)
 	show map, camera follows hero (me), wait (1), fade screen in, bifrostbeam (1)
	encounters
	show text box (4272), wait (7), wait for key (use key), advance text box
	wait (5), set hero direction (me,left), wait (5), walk hero to y (me,30), wait for hero (me)
	show text box (4273), wait (7), wait for key (use key), advance text box
	set NPC direction (21,right),	set NPC frame (21,0), wait (1), set NPC frame (21,1), wait (1)
	set NPC frame (21,0), wait (1), set NPC frame (21,1), wait (1)
	show text box (4274), wait (7), wait for key (use key), advance text box
	set hero direction (me,left)
	set hero frame (me,0), wait (1), set hero frame (me,1), wait (1)
	set hero frame (me,0), wait (1), set hero frame (me,1), wait (1)
	show text box (4275), wait (7), wait for key (use key), advance text box, set hero direction (me,up)
	show text box (4276), wait (7), wait for key (use key), advance text box
	set NPC direction (21,up), set NPC frame (21,0), wait (1), set NPC frame (21,1), wait (1)
	set NPC frame (21,0), wait (1), set NPC frame (21,1), wait (1)
	show text box (4277), wait (7), wait for key (use key), advance text box
	show text box (4278), wait (7), wait for key (use key), advance text box
	show text box (4279), wait (7), wait for key (use key), advance text box
	set hero frame (me,0), wait (1), set hero frame (me,1), wait (1)
	set hero frame (me,0), wait (1), set hero frame (me,1), wait (1)
	show text box (4280), wait (7), wait for key (use key), advance text box
	show text box (4281), wait (7), wait for key (use key), advance text box
	show text box (4282), wait (7), wait for key (use key), advance text box
	set hero frame (me,0), wait (1), set hero frame (me,1), wait (1)
	set hero frame (me,0), wait (1), set hero frame (me,1), wait (1)
	show text box (4283), wait (7), wait for key (use key), advance text box
	show text box (4284), wait (7), wait for key (use key), advance text box
	set hero frame (me,0), wait (1), set hero frame (me,1), wait (1)
	set hero frame (me,0), wait (1), set hero frame (me,1), wait (1)
	show text box (4285), wait (7), wait for key (use key), advance text box
	show text box (4286), wait (7), wait for key (use key), advance text box
	set NPC frame (21,0), wait (1), set NPC frame (21,1), wait (1)
	set NPC frame (21,0), wait (1), set NPC frame (21,1), wait (1)
	show text box (4287), wait (7), wait for key (use key), advance text box
	set hero frame (me,0), wait (1), set hero frame (me,1), wait (1)
	set hero frame (me,0), wait (1), set hero frame (me,1), wait (1)
	show text box (4288), wait (7), wait for key (use key), advance text box
	set tag (tag:SNAKETIME,on)
	resume random enemys, reinstate party, resume player, resume box advance, encounters
end

plotscript,snaketeleport2,begin
	suspend player, suspend box advance, remember party, suspend random enemys
	show text box (4290), wait (7), wait for key (use key), advance text box
	suspend player,	bifrostbeam(0)
 	fade screen out (63,63,63), wait (1), camera follows hero (me)
 	fade screen out (63,63,63), wait (1),	use door (9), reset palette, 	wait (1)
 	wait (1), fade screen in,	bifrostbeam (1)
	resume random enemys, reinstate party, resume player, resume box advance, encounters
end

plotscript,desertinn,begin
	suspend player, suspend box advance, remember party, suspend random enemys
	show text box (4301), wait (7), wait for key (use key), advance text box
	fade screen out, wait (10), use door (22), fade screen in
	set NPC frame (1,0), wait (1), set NPC frame (1,1), wait (1)
	set NPC frame (1,0), wait (1), set NPC frame (1,1), wait (1)
	show text box (4302), wait (7), wait for key (use key), advance text box
	set NPC frame (8,0), wait (1), set NPC frame (8,1), wait (1)
	set NPC frame (8,0), wait (1), set NPC frame (8,1), wait (1)
	show text box (4303), wait (7), wait for key (use key), advance text box
	set NPC frame (1,0), wait (1), set NPC frame (1,1), wait (1)
	set NPC frame (1,0), wait (1), set NPC frame (1,1), wait (1)
	show text box (4304), wait (7), wait for key (use key), advance text box
	set NPC direction (3,right), wait (5), set NPC direction (3,down), wait (5)
	set NPC frame (3,0), wait (1), set NPC frame (3,1), wait (1)
	set NPC frame (3,0), wait (1), set NPC frame (3,1), wait (1)
	show text box (4305), wait (7), wait for key (use key), advance text box
	set NPC frame (5,0), wait (1), set NPC frame (5,1), wait (1)
	set NPC frame (5,0), wait (1), set NPC frame (5,1), wait (1)
	show text box (4306), wait (7), wait for key (use key), advance text box
	set NPC direction (1,up),set NPC frame (1,0), wait (1), set NPC frame (1,1), wait (1)
	set NPC frame (1,0), wait (1), set NPC frame (1,1), wait (1)
	show text box (4307), wait (7), wait for key (use key), advance text box
	set NPC direction (1,right), set NPC frame (1,0), wait (1), set NPC frame (1,1), wait (1)
	set NPC frame (1,0), wait (1), set NPC frame (1,1), wait (1)
	show text box (4308), wait (7), wait for key (use key), advance text box
	set NPC frame (4,0), wait (1), set NPC frame (4,1), wait (1)
	set NPC frame (4,0), wait (1), set NPC frame (4,1), wait (1)
	show text box (4309), wait (7), wait for key (use key), advance text box
	show text box (4310), wait (7), wait for key (use key), advance text box
	set NPC direction (7,left), set NPC direction (5,right)
	set NPC frame (7,0), wait (1), set NPC frame (7,1), wait (1)
	set NPC frame (7,0), wait (1), set NPC frame (7,1), wait (1)
	show text box (4311), wait (7), wait for key (use key), advance text box
	show text box (4312), wait (7), wait for key (use key), advance text box
	set NPC frame (5,0), wait (1), set NPC frame (5,1), wait (1)
	set NPC frame (5,0), wait (1), set NPC frame (5,1), wait (1)
	show text box (4313), wait (7), wait for key (use key), advance text box
	show text box (4314), wait (7), wait for key (use key), advance text box
	walk NPC (0,right,6), wait (5)
	show text box (4315), wait (7), wait for key (use key), advance text box
	set NPC frame (8,0), wait (1), set NPC frame (8,1), wait (1)
	set NPC frame (8,0), wait (1), set NPC frame (8,1), wait (1)
	show text box (4316), wait (7), wait for key (use key), advance text box
	wait (5), walk NPC (3,down,1), wait for NPC (3)
	set NPC frame (3,0), wait (1), set NPC frame (3,1), wait (1)
	set NPC frame (3,0), wait (1), set NPC frame (3,1), wait (1)
	show text box (4317), wait (7), wait for key (use key), advance text box
	set NPC frame (2,0), wait (1), set NPC frame (2,1), wait (1)
	set NPC frame (2,0), wait (1), set NPC frame (2,1), wait (1)
	show text box (4318), wait (7), wait for key (use key), advance text box
	set NPC frame (7,0), wait (1), set NPC frame (7,1), wait (1)
	set NPC frame (7,0), wait (1), set NPC frame (7,1), wait (1)
	show text box (4319), wait (7), wait for key (use key), advance text box
	wait (10), stop song,	 play sound (sfx:Breakdown,false,true)
	wait (15), set NPC direction (1,up), set NPC direction (2,left)
	set NPC direction (3,right), set NPC direction (4,left)
	set NPC direction (5,down), set NPC direction (6,left), wait (60)
	show text box (4320), wait (7), wait for key (use key), advance text box
	show text box (4321), wait (7), wait for key (use key), advance text box
	set NPC frame (3,0), wait (1), set NPC frame (3,1), wait (1)
	set NPC frame (3,0), wait (1), set NPC frame (3,1), wait (1)
	show text box (4322), wait (7), wait for key (use key), advance text box
	set NPC frame (4,0), wait (1), set NPC frame (4,1), wait (1)
	set NPC frame (4,0), wait (1), set NPC frame (4,1), wait (1)
	show text box (4323), wait (7), wait for key (use key), advance text box
	set NPC frame (5,0), wait (1), set NPC frame (5,1), wait (1)
	set NPC frame (5,0), wait (1), set NPC frame (5,1), wait (1)
	show text box (4324), wait (7), wait for key (use key), advance text box
	wait (5), walk NPC (0,left,10), wait (5), set NPC direction (5,left), wait (5)
	set NPC frame (8,0), wait (1), set NPC frame (8,1), wait (1)
	set NPC frame (8,0), wait (1), set NPC frame (8,1), wait (1)
	show text box (4270), wait (7), wait for key (use key), advance text box
 	wait (5), fade screen out, stop song,wait (5) 
	play sound (sfx:sleep,false,true),walk hero (me,up,1), set hero direction (me,down), wait (120)
# When the screen comes back, we want the game to play the music for the area. 
# Because each area is different, we want the "default" ambient music.
	use door (2) ,wait (5)
	resume random enemys, reinstate party, resume player, resume box advance, encounters
end

plotscript,norns,begin
	suspend player, suspend box advance, remember party, suspend random enemys
	walk hero to y (me, 49), wait for hero (me)
	walk hero to x (me, 44), wait for hero (me)
  	set hero speed (me,4), focus camera ((hero x (me)),(hero y (me)),4)
 	swap by position (0,find hero (hero:Freki))
 	swap by position (1,find hero (hero:Bram))
 	swap by position (2,find hero (hero:Hilda))
 	swap by position (3,find hero (hero:Olaf))
 	wait for hero (me), suspend caterpillar, set caterpillar mode (on)
	set hero position (1, (hero x (me)), (hero y (me)))
	set hero position (2, (hero x (me)), (hero y (me)))
	set hero position (3, (hero x (me)), (hero y (me)))
	wait (1), walk hero (1,left,1), walk hero (2,down,1), walk hero (3,right,1)
	wait for hero (1), wait (5)
	set hero direction (me,up), set hero direction (1,up), set hero direction (2,left), set hero direction (3,up)
	wait (5), set hero direction (2,up), wait (5)
	set NPC frame (1,0), wait (1), set NPC frame (1,1), wait (1)
	set NPC frame (1,0), wait (1), set NPC frame (1,1), wait (1)
	show text box (4327), wait (7), wait for key (use key), advance text box
	set NPC frame (2,0), wait (1), set NPC frame (2,1), wait (1)
	set NPC frame (2,0), wait (1), set NPC frame (2,1), wait (1)
	show text box (4328), wait (7), wait for key (use key), advance text box
	show text box (4329), wait (7), wait for key (use key), advance text box
	set hero frame (1,0), wait (1), set hero frame (1,1), wait (1)
	set hero frame (1,0), wait (1), set hero frame (1,1), wait (1)
	show text box (4330), wait (7), wait for key (use key), advance text box
	set NPC frame (3,0), wait (1), set NPC frame (3,1), wait (1)
	set NPC frame (3,0), wait (1), set NPC frame (3,1), wait (1)
	show text box (4331), wait (7), wait for key (use key), advance text box
	set NPC frame (2,0), wait (1), set NPC frame (2,1), wait (1)
	set NPC frame (2,0), wait (1), set NPC frame (2,1), wait (1)
	show text box (4332), wait (7), wait for key (use key), advance text box
	show text box (4333), wait (7), wait for key (use key), advance text box
	set NPC frame (1,0), wait (1), set NPC frame (1,1), wait (1)
	set NPC frame (1,0), wait (1), set NPC frame (1,1), wait (1)
	show text box (4334), wait (7), wait for key (use key), advance text box
	set hero frame (0,0), wait (1), set hero frame (0,1), wait (1)
	set hero frame (0,0), wait (1), set hero frame (0,1), wait (1)
	show text box (4335), wait (7), wait for key (use key), advance text box
	show text box (4336), wait (7), wait for key (use key), advance text box
	set hero frame (1,0), wait (1), set hero frame (1,1), wait (1)
	set hero frame (1,0), wait (1), set hero frame (1,1), wait (1)
	show text box (4337), wait (7), wait for key (use key), advance text box
	show text box (4338), wait (7), wait for key (use key), advance text box
	set NPC frame (1,0), wait (1), set NPC frame (1,1), wait (1)
	set NPC frame (1,0), wait (1), set NPC frame (1,1), wait (1)
	show text box (4339), wait (7), wait for key (use key), advance text box
	set hero frame (3,0), wait (1), set hero frame (3,1), wait (1)
	set hero frame (3,0), wait (1), set hero frame (3,1), wait (1)
	show text box (4340), wait (7), wait for key (use key), advance text box
	set NPC frame (2,0), wait (1), set NPC frame (2,1), wait (1)
	set NPC frame (2,0), wait (1), set NPC frame (2,1), wait (1)
	show text box (4341), wait (7), wait for key (use key), advance text box
	set hero frame (2,0), wait (1), set hero frame (2,1), wait (1)
	set hero frame (2,0), wait (1), set hero frame (2,1), wait (1)
	show text box (4342), wait (7), wait for key (use key), advance text box
	set hero frame (1,0), wait (1), set hero frame (1,1), wait (1)
	set hero frame (1,0), wait (1), set hero frame (1,1), wait (1)
	show text box (4343), wait (7), wait for key (use key), advance text box
	set NPC frame (1,0), wait (1), set NPC frame (1,1), wait (1)
	set NPC frame (1,0), wait (1), set NPC frame (1,1), wait (1)
	show text box (4344), wait (7), wait for key (use key), advance text box
	set NPC frame (3,0), wait (1), set NPC frame (3,1), wait (1)
	set NPC frame (3,0), wait (1), set NPC frame (3,1), wait (1)
	show text box (4345), wait (7), wait for key (use key), advance text box
	walk NPC (4,down,1), wait for NPC (4)
	set NPC frame (4,0), wait (1), set NPC frame (4,1), wait (1)
	set NPC frame (4,0), wait (1), set NPC frame (4,1), wait (1)
	show text box (4346), wait (7), wait for key (use key), advance text box, set hero direction (me,left)
	show text box (4347), wait (7), wait for key (use key), advance text box
	set hero frame (0,0), wait (1), set hero frame (0,1), wait (1)
	set hero frame (0,0), wait (1), set hero frame (0,1), wait (1)
	show text box (4348), wait (7), wait for key (use key), advance text box
	set NPC frame (1,0), wait (1), set NPC frame (1,1), wait (1)
	set NPC frame (1,0), wait (1), set NPC frame (1,1), wait (1)
	show text box (4349), wait (7), wait for key (use key), advance text box, set hero direction (me,up)
	set hero frame (2,0), wait (1), set hero frame (2,1), wait (1)
	set hero frame (2,0), wait (1), set hero frame (2,1), wait (1)
	show text box (4350), wait (7), wait for key (use key), advance text box
	set NPC frame (2,0), wait (1), set NPC frame (2,1), wait (1)
	set NPC frame (2,0), wait (1), set NPC frame (2,1), wait (1)
	show text box (4351), wait (7), wait for key (use key), advance text box
	set NPC frame (3,0), wait (1), set NPC frame (3,1), wait (1)
	set NPC frame (3,0), wait (1), set NPC frame (3,1), wait (1)
	show text box (4352), wait (7), wait for key (use key), advance text box, wait (5)
	set hero direction (me,left), set hero direction (1,down), set hero direction (3,left), wait (5)
	set hero direction (me,down), set hero direction (1,right), wait (5)
	set hero frame (0,0), wait (1), set hero frame (0,1), wait (1)
	set hero frame (0,0), wait (1), set hero frame (0,1), wait (1)
	show text box (4353), wait (7), wait for key (use key), advance text box
	walk hero (1,right,1), walk hero (2,up,1), walk hero (3,left,1), wait for hero (1)
	camera follows hero (me), set caterpillar mode (off)
	resume random enemys, reinstate party, resume player, resume box advance, encounters
end

plotscript,mother,begin
	suspend player, suspend box advance, remember party, suspend random enemys
	walk hero to y (me, 36), wait for hero (me), stop song
	walk hero to x (me, 37), wait for hero (me)
  	set hero speed (me,4), focus camera ((hero x (me)),(hero y (me)),4)
 	swap by position (0,find hero (hero:Freki))
 	swap by position (1,find hero (hero:Night))
 	wait for hero (me), suspend caterpillar, set caterpillar mode (on)
	set hero position (1, (hero x (me)), (hero y (me)))
	set hero position (2,0,0)
	set hero position (3,0,0)
	wait (1), walk hero (1,right,1), wait for hero (1), wait (5)
	set hero direction (me,up), set hero direction (1,up), wait (5)
	set hero frame (0,0), wait (1), set hero frame (0,1), wait (1)
	set hero frame (0,0), wait (1), set hero frame (0,1), wait (1)
	show text box (4356), wait (7), wait for key (use key), advance text box
	set hero frame (1,0), wait (1), set hero frame (1,1), wait (1)
	set hero frame (1,0), wait (1), set hero frame (1,1), wait (1)
	show text box (4357), wait (7), wait for key (use key), advance text box
	set NPC frame (5,0), wait (1), set NPC frame (5,1), wait (1)
	set NPC frame (5,0), wait (1), set NPC frame (5,1), wait (1)
	show text box (4358), wait (7), wait for key (use key), advance text box
	wait (5), set hero direction (me,left), set hero direction (1,left), wait (5)
	set hero frame (0,0), wait (1), set hero frame (0,1), wait (1)
	set hero frame (0,0), wait (1), set hero frame (0,1), wait (1)
	show text box (4359), wait (7), wait for key (use key), advance text box
	wait (5), set hero direction (me,up), set hero direction (1,up), wait (5)
	set hero frame (1,0), wait (1), set hero frame (1,1), wait (1)
	set hero frame (1,0), wait (1), set hero frame (1,1), wait (1)
	show text box (4360), wait (7), wait for key (use key), advance text box
	wait (30), walk NPC (6,left,1), wait for NPC (6)
	set NPC frame (6,0), wait (1), set NPC frame (6,1), wait (1)
	set NPC frame (6,0), wait (1), set NPC frame (6,1), wait (1)
	show text box (4361), wait (7), wait for key (use key), advance text box
	show text box (4362), wait (7), wait for key (use key), advance text box
	set NPC frame (5,0), wait (1), set NPC frame (5,1), wait (1)
	set NPC frame (5,0), wait (1), set NPC frame (5,1), wait (1)
	show text box (4363), wait (7), wait for key (use key), advance text box
	wait (10), walk NPC (5,right,1), wait for NPC (5)
	show text box (4364), wait (7), wait for key (use key), advance text box
	wait (5), set hero direction (me,left), set hero direction (1,left), wait (5)
	set hero frame (0,0), wait (1), set hero frame (0,1), wait (1)
	set hero frame (0,0), wait (1), set hero frame (0,1), wait (1)
	show text box (4365), wait (7), wait for key (use key), advance text box
	wait (5), set hero direction (me,up), set hero direction (1,up), wait (5)
	set hero frame (0,0), wait (1), set hero frame (0,1), wait (1)
	set hero frame (0,0), wait (1), set hero frame (0,1), wait (1)
	show text box (4366), wait (7), wait for key (use key), advance text box
	wait (5), walk NPC (5,down,1), wait for NPC (5), wait (5)
	set NPC direction (5,right), wait (5), set NPC direction (5,up), wait (5)
	set NPC frame (5,0), wait (1), set NPC frame (5,1), wait (1)
	set NPC frame (5,0), wait (1), set NPC frame (5,1), wait (1)
	show text box (4367), wait (7), wait for key (use key), advance text box
	set hero frame (0,0), wait (1), set hero frame (0,1), wait (1)
	set hero frame (0,0), wait (1), set hero frame (0,1), wait (1)
	show text box (4368), wait (7), wait for key (use key), advance text box
	set hero frame (1,0), wait (1), set hero frame (1,1), wait (1)
	set hero frame (1,0), wait (1), set hero frame (1,1), wait (1)
	show text box (4369), wait (7), wait for key (use key), advance text box
	wait (6), walk NPC (6,down,1), wait for NPC (6), wait (5)
	set NPC direction (6,left), wait (5), set NPC direction (6,up), wait (5)
	set hero frame (1,0), wait (1), set hero frame (1,1), wait (1)
	set hero frame (1,0), wait (1), set hero frame (1,1), wait (1)
	show text box (4370), wait (7), wait for key (use key), advance text box
	show text box (4371), wait (7), wait for key (use key), advance text box
	show text box (4372), wait (7), wait for key (use key), advance text box
	set hero frame (0,0), wait (1), set hero frame (0,1), wait (1)
	set hero frame (0,0), wait (1), set hero frame (0,1), wait (1)
	show text box (4373), wait (7), wait for key (use key), advance text box
	set hero frame (1,0), wait (1), set hero frame (1,1), wait (1)
	set hero frame (1,0), wait (1), set hero frame (1,1), wait (1)
	show text box (4374), wait (7), wait for key (use key), advance text box
	wait (5), set hero direction (me,right), wait (5)
	set hero frame (0,0), wait (1), set hero frame (0,1), wait (1)
	set hero frame (0,0), wait (1), set hero frame (0,1), wait (1)
	show text box (4375), wait (7), wait for key (use key), advance text box
	set hero frame (1,0), wait (1), set hero frame (1,1), wait (1)
	set hero frame (1,0), wait (1), set hero frame (1,1), wait (1)
	show text box (4376), wait (7), wait for key (use key), advance text box
	wait (5), fade screen out, wait (5), show text box (4377), wait (5), fade screen in
	wait (7), wait for key (usekey), advance text box, set hero direction (me,up)
	show text box (4378), wait (7), wait for key (use key), advance text box
	show text box (4379), wait (7), wait for key (use key), fade screen out
	wait (5), advance text box, wait (5), fade screen in, wait (5)
	set hero frame (1,0), wait (1), set hero frame (1,1), wait (1)
	set hero frame (1,0), wait (1), set hero frame (1,1), wait (1)
	show text box (4380), wait (7), wait for key (use key), advance text box
 	tweak palette (10,0,0), update palette, play sound (sfx:earthquake,false,true)
 	teach spell ((find hero(hero:Night)),atk:Meteor), wait (3), reset palette, update palette
 	show text box (2691), wait (7), wait for key (use key), advance text box
	set hero frame (1,0), wait (1), set hero frame (1,1), wait (1)
	set hero frame (1,0), wait (1), set hero frame (1,1), wait (1)
	show text box (4381), wait (7), wait for key (use key), advance text box
	walk hero (1,left,1), wait for hero (1), wait (1)
	set tag (tag:MOTHER,on)
	camera follows hero (me), set caterpillar mode (off)
	resume random enemys, reinstate party, resume player, resume box advance, encounters
end

plotscript,encounters,begin
# We're checking a tag here. If it's on, we turn off encounters completely. Otherwise, they're allowed.
	if (checktag(tag:NOENCOUNTERS)==on) then (suspend random enemys)
	if (checktag(tag:NOENCOUNTERS)==off) then (resume random enemys)
end

# This script is to get around the funkiness with Inns only restoring the HP/MP of
# Party members who are only in the active party. Special credit to Foxley for
# The workaround!

plotscript, heal full party, begin
    variable (i)
    for (i, 0, 40) do (
        if (hero by slot (i) >= 0) then (
            set hero stat(i, 0, get hero stat(i, 0, maximum stat), current stat) 
            set hero stat(i, 1, get hero stat(i, 1, maximum stat), current stat) 
        )
    )
end