
// ***************************** SCP_DEFN INFORMATION HEADER FOR V220-35 ******************************

// Last updated January 2021	Formatted for use with notepad

// For more info see R3D_ModelScript.txt in the R3D_Docs folder.

// Notes;

// Using -debug_scp on the command line when running a scripted map lists all used spots
// to Risen3D.out making it easier to see which are still available.

// SCRIPT SPOT	a THING in the range 7900 to 7999 or 6900 to 6999 or 5900 to 5999
// ACTION SPOT	a THING in the range 7800 to 7899 or 6800 to 6899 or 5800 to 5899	only used with SPAWN
// LINEDEF SPOT	a THING in the range 7700 to 7799 or 6700 to 6799 or 5700 to 5799
// LINKED TRIGGER SPOTS 7400 to 7499 link 7500 to 7599

// SET_THING_LL has been removed. This can now be set in the ded in the Thing definition
//              Use "Light" = x where x is a short in the range 1 to 255

// TYPE 7300 to 7309
//	When a THING referenced by a 73xx spot is killed the map is scanned for all remaining things
//	of the same type.  If none are left then the line special identified by the SPOT is activated.
//	Note that this is limited to types with the doomednumbers 7, 16, 67, 68 and 3003.
//
//	The 73nn type num is set for the type wanting to be scanned, viz;
//
//	7300 - doomednum    7  Spider Mastermind
//	7301 - doomednum   16  Cyberdemon
//	7302 - doomednum   67  Mancubus
//	7303 - doomednum   68  Arachnotron
//	7304 - doomednum 3003  Baron of Hell

//	7305 - doomednum 6085  Custom Monster
//	7306 - doomednum 6086  Custom Monster
//	7307 - doomednum 6087  Custom Monster
//	7308 - doomednum 6088  Custom Monster
//	7309 - doomednum 6089  Custom Monster


//	Note:	a) only one instance of each type is allowed in a map
//		b) the line special must be a player use type

// TYPE 7310
//	A 7310 type placed in a sector will stop any moving, start or stop sounds being played
//	for that sector. Any number of 7310 types can be put in a map.




// 1)	A 79nn/69nn THING can only be set once in a map.

// 2)	78nn/68nn THINGs are used to spawn other THINGs.
//	They are purely scripted and have no nn correspondence.
//	They must also be linked to a 79nn THING even if that is not used
//	for any other purpose.  Where this is necessary then no SPAWNSPOT
//	def should be used.

// 3)	Line actions are set using a 77nn/67nn THING or THINGs placed on lines.
//	A 77nn THING must be on a line.
//	77nn THINGs are linked to a 79nn THING by nn.
//	No 77nn things means nothing will happen.
//	More than one instance of a 77nn THING can be used.
//	Options are used with 77nn THINGs to define their action.
//	No options set (i.e. easy, medium, hard, deaf, multiplayer etc.)
//	means it purely links a trigger line with it's 79nn owner.
//	EASY      - will set line to blocking.
//	MEDIUM    - will link that line directly to it's owner to allow the
//		        owner to be reset.
//	HARD      - will cause that line to activate a crossing line action.
//	DEAF      - used to set a script line special from the script.
//	NOT DM    - used to trigger a line but only when a 79nn's amodel is logically dead
//	NOT CO-OP - used to trigger a line but only when a 79nn's amodel is logically alive
//	This allows mixing actions whilst using the same 77nn number.


// 4)	ONDEATH refers to the state of a THING spawned at SCRIPT SPOT

// 5)	35 tics = 1 second

// ------------------------------------------ GLOBAL COMMANDS ----------------------------------------

//       These apply to all maps in a script and should be placed at the start
//		         of the script before any mapid's

// HUDSCALE	<SCALE>
//		Scales pwad textures used for the hud. (range 10 to 40)
//		Can only be set once for a map.

// HUDSCALEKEY	<KEYID> <SCALE>		v220-13
//		This allows keys to be individually scaled. SCALE is in the range 0 to 60.
//		A scale of 0 forces the graphic to be scaled the same as the original IWAD graphic.
//		The replacement graphic must be a png.
//		The keyID's are; RKEY, YKEY, BKEY RSKU, YSKU and BSKU
//		Note that each key that needs to be independently scaled will need it's own
//		entry.

// PUSH_SOUND <doomednum> <lumpname>	v220-10
// 		Allows a specific push sound to be played if a THING with the mf2_pushable flag is
//		also set. The doomednum of a THING is used and the lump added must be a playable
//		sound file.




// ------------------------------------------ LOCAL COMMANDS -----------------------------------------

// All local commands must be preceded by a mapid for the map they are intended to be used with.

// MAPXX	where XX is in the range 01 to 99
//		Must be specified at the start of the script. A script terminates at the
//		file's end or when another MAPXX or the END keyword is encountered.
//		As such the XX number can only be used once as using, say, MAP01 will
//		cause the script to be read if loading map 1 which means if a later
//		MAP01 keyword is encountered the script will end despite it having the
//		same number.
//
//		If scripts for more than one map are in the same SCP_DEFN file then
//		the keywords for each will be read following a MAPXX identification.
//		E.g.;
//		 MAP01
//		 script for map 1
//		 MAP02
//		 script for map 2
//
//		They don't have to be in this order e.g.;
//		 MAP02
//		 script for map 2
//		 MAP01
//		 script for map 1
//		will work equally well but would be less clear than keeping them in order.
//
//		The END keyword is not mandatory but may want to be used for clarity.
//		E.g.;
//		 MAP01
//		 script for map 1
//		 END
//		 MAP02
//		 script for map 2
//		 END
//		Any keywords between an END and MAPXX keyword will be ignored.


// ================================= PRIMARY SCRIPT KEYWORDS =========================================

// Primary keywords. These are base keywords that, unlike secondary keywords (see further down) are
//		     not dependant on any other command.


// MAP SPECIFIC COMMANDS These should be entered following the mapid

// 2 GAME OPTIONS commands have been provided	v220-4

// BERSERKBUG	 <0 or 1>	1 - on 0 - off
// FALLINGDAMAGE <0 or 1>	1 - on 0 - off

// COTRIGGER	<SCRIPT SPOT> <SCRIPT SPOT2>
//		SPOT2 will be triggered when SPOT is triggered.
//		SPOT2 must not own any 77nn things.

// CUSTOMPUNCHVARS <num hits> <damage>	v220-4
//		Sets the number of hits possible with custom punch until depleted. In
//		addition the amount of damage each hit confers can also be changed.
//		The default values are 100 and 9999 respectively so this command need
//		only be used if values other than these are required.
//		The minimum number of hits allowed is 12 and the minimum damage 250.

// DAMAGEFACTOR_TO_PLAYER <ID> <float modifier>		v220-33
//		The damage applied when a Thing with the (string) ID fires on the player can
//		be increased or decreased by multiplying it with the modifier. This allows
//		for different damage levels to be set on a Thing basis rather than it being
//		fixed for all Things calling the A_FireXX state.

// DLMAXRAD	<value>
//		Max dynamic light radius (range 64 to 256)
//		Can only be set once for a map

// DROPITEM	<THING TYPE> <a b c d>
//		Associates 4 items that can be dropped by a Thing.  The Thing must be a 60XX
//		type.  Item a to d will be selected randomly.  This allows a certain amount
//		of flexibility.  E.g. If the same item must always be dropped then a to d
//		would all be set to the item type.  If an item should be dropped with one
//		chance in four then a would be set to the item type with b, c and d set to 0.
//		If one of four different items should be dropped with equal probability then
//		a to d would each be set to each item type.  And so on...

// DUMMYHIGHFLOORSEC <tag> <sound>		v220-4a
//		Set a tagged sector's floorheight to the highest surrounding floorheight.
//		If the sector with the highest surrounding floor owns a fake sector then the fake
//		sector's floorpic will be used. The floor lightlevel used, however, will always be
//		that of the adopted sector's floorheight.
//		This only affects the rendered floor not the logical floor.
//		If a moving sector then the sound can be suppressed using 0
//		The sound will always need to be sent whether needed or not and must be either 1 or 0

// DYN7000	<DOOMEDNUM range 7000 to 7699> <VAL 0.05f to 0.99f>
//		Used to set the intensity of dynlight cast on a specific architectural model.

// DYNGLOBAL	<PLANES> <DYNLIGHT MULTIPLIER>
//		where PLANES is an integer but is currently unused (must be set - just use 0)
//		DYNLIGHT MULTIPLIER is a floating point value can be used to reduce the
//		strength of dynlight cast on a model globally in the range 0.05 to 1.0
//		1 will mean no change; 0.05 will reduce it to the minimum allowed.

// DYNLIGHTNUM	<NUM>	where num is in the range 4 to 10
//		The number of dynlights allowed can be set with this command.

// END		Will terminate any further script reading until encountering another MAPxx keyword

// ENDLEVEL	<DELAY to show text> <DELAY from start of showing text to ending level>
//				<MASSACRE 1 or 0> "text" {list of 79nn amodels}
//		Endlevel will only be activated if all the listed 79nn amodels are dead
//		and if a positive number has been used for
//		<DELAY from start of showing text to ending level>.
//		Using a negative number still gives the same delay as with a
//		positive value but prevents the level from ending.
//		Line feeds are represented by two chars \n (see SETLINE above)

// FCOLIMIT	<ACTION SPOT>			v220-4
//		Means: Friends Carried Over Limit
//		If carrying over from one map to the next then the number of friends being
//		spawned from a 78xx spot in the next map can be limited to the number re-
//		maining in the previous map.  This can only be used once in a script.
//		The 78xx type must still have a SPAWN list.  That is that it reflects
//		the friends to be spawned that could be carried over.  It can have fewer
//		spawn items in the list than could be carried over (i.e. to limit the
//		maximum). Matching friends will be spawned. For example if spawning two
//		types in map 1 (say two of each) then the list in map 2 must reflect this.
//		If one of each survives in map 1 then one of each will be spawned in map 2
//		with the remaining entries (should they exist) being ignored.

// FLATSOFFSET	{entry1 entry2 .. entryn}
//		Where each entry comprises five integers;
//
//		sectornum ceiloffx ceiloffy flooroffx flooroffy
//
//		Where a floor offset is required but no ceiling offset then just use 0 0
//		for the ceiling
//		e.g. for sector 3 where an x offset for the floor is wanted of 16; 3 0 0 16 0
//
//		To aid with error checking then the offsets must be in the range -63 to 63
//
//		TIP:	To avoid errors or time wasting do not prepare FLATSOFFSET
//			entries until the map is complete.  An editor could change
//			the sector numbers whilst the map is being developed.

// INTERREACT	<AMODEL doomednum>
//		This can be used with rectangular amodels to make them interreact with
//		a Thing (i.e. the model will behave in the same way as a sector with walls
//		constructed to look like the amodel).  The model must be a parallelepiped
//		(although it can deviate slightly) and it's height must be correctly set in
//		the ded.  It cannot be rotated in the map as it's bounding box is used to
//		determine the limits unless it is rotated through 90degrees and in the
//		intervening period the error does not affect gameplay.  It must be spawned
//		N, S, E or W.
//		NOTE: this only works for models spawned on running the script.  It will
//		      not work with models spawned when the map is loaded.

// JUMPKILL <ID>	v220-33
//		Any Thing with the (string) ID that is jumped or landed on will be killed.
//		Up to 16 different Things can be entered.

// JUMPPOWER <float value>	v220-13
//		Set the jump power for the map
//		9.0 is the Risen3D default (can jump up 69 and no higher)
//		8.0 is the   ZDoom default (can jump up 60 and no higher)
//		The value on entry is restored on exiting the map

// LINEMUSIC	<special in the range 8120 to 8139> <filename.ext>
//		Music can be triggered to play following the player crossing a line in the map
//		by setting the line special in the range 8120 to 8139 and defining the file to
//		be played.  Files to be played must be in the \Risen3D\Data\custom.music\ folder.
//		E.g. Suppose the file mymusic.mp3 is in the directory as stated and the script
//		entry is;
//			LINEMUSIC 8120 mymusic.mp3
//		then, in game, when the line is crossed by the player the file will be played.
//		The range of 20 available specials allows up to 20 different music selections
//		to be triggered in any one map.  A line special can be used more than once
//		allowing the same music selection to be triggered more than once.
//
//		There are three points to bear in mind;
//
//		1) Once a line has been triggered its line special is cleared preventing it
//		   from being triggered again.
//		2) If file is already being played it will not be restarted. The line special
//		   will still be cleared, however.
//		3) Music will only be played once.  There is no option to loop the music.

// LINKKEY	<SCRIPT SPOT> <KEYID> <DELAY>		v220-4
//		Allows script actions to be run if picking up a key.
//		The key is identified with one of the following;
//		CB	Blue   keycard
//		CY	Yellow keycard
//		CR	Red    keycard
//		SB	Blue   skull key
//		SY	Yellow skull key
//		SR	Red    skull key

// LINKPICKUP	<SCRIPT SPOT> <DELAY>		v220-4
//		NOTE:	For all pickup THINGS other than KEYS.
//			KEYS must use the LINKKEY keyword.
//
//		This can be used with standard pickups. It does not handle keys for which
//		LINKKEY must be used. The difference is that LINKPICKUP will only work if
//		the pickup has been spawned at the outset unlike keys which can be spawned
//		at any time.  To link the 79xx Thing with the pickup Thing then they have
//		to be superimposed in the map.  I.e. they must have the same x,y co-ords.
//		It can be used with a 16000 type where the type is used to spawn a pickup
//		using the SCP_ZOFF script.  In this case the 79xx Thing should be aligned
//		with the 16xxx Thing. Note that the z height is not taken into account
//		which means that if pickups are stacked then only one will be linked with
//		the 79xx Thing.  There is no way of explicitly selecting a stacked map
//		thing as this is determined on a first come first served basis. It is
//		likely to be the one with the lowest map number.

// MAKE_AGGRESSIVE <type>	v220-13
//		Makes a Thing spawned using a 6xxx spot more aggressive.
//		type must be in the range 6000 to 6099. This is limited to these types.

// MAPFOG	<flag> <start> <end> <density> <R> <G> <B>
//
//		Flag is used to define the type of fog wanted.
//		mif_fogexp        - fog over the entire map (requires a density value)
//		 e.g. mif_fogexp 0 0 0.0005 191 191 191
//		 The colour values are equivalent to a mapinfo def of grey75 (255 * 75/100)
//		mif_fogoutside    - outside fog only        (requires start and end values)
//		 e.g. mif_fogoutside 100 2100 0 191 191 191
//		mif_fogunderwater - underwater fog only     (requires a density value)
//		 e.g. mif_fogunderwater 0 0 0.003 0 0 1
//		NOTE: fog types cannot be mixed, only one flag can be set.  The flag string
//		is not checked - any errors will just mean no fog will be set.
//
//		Colours are entered as integers in the range 0 to 255.  This differs from a
//		ded value where the colour is a floating point value entered in the range
//		0.0 to 1.0.  The ded method has not been changed for reasons of backward
//		compatibility.
//
//		Density - note that a small change has a large affect.
//		It is only the RGB values that may need to be changed (these should be in the
//		range 0 to 255).
//
//		Alternatively values can be set directly in a custom ded.

// MAPNAME	<"mapname"> <"authorname">    // both fields must be set
//		If the mapname exceeds 20 chars then only the first 20 will be drawn
//		If the authorname exceeds 32 chars then only the first 32 will be drawn
//		For both fields leading and trailing spaces are removed. Quotes are
//		needed if any spaces separating words are used.
//		This is map specific - not global

// MAXLIGHTDISTANCE <value>
//		With dynlit maps then it is often the case that the default distance to
//		darken walls/floors with distance is not viable (given original Doom
//		did not support dynlights).  This command can be used to set a more
//		acceptable value.  If this command is not included in a script then
//		a default of 4096 will be applied.  When included then the range accepted
//		is from 1024 to 8192.
//
//		Note that the value can also be adjusted in Control Panel under Lighting
//		unless a scripted map is loaded in which case adjustment is inhibited
//		(although it can still be set using the vid-darken command for develop-
//		ment purposes).
//
//		The value that gives the same result as original Doom is 1024 although
//		in practice, with normal maps, 2048 often looks better.

// MUSICONCE	Do not loop music (i.e. play once)

// NOINFIGHT {id1 id2 .. idn } where id is the ded Thing's id	v220-13
//		Stop same type Thing from infighting
//		Only works with Things that fire bullets or Things with flag mf_skullfly

// ONDEATH	<SCRIPT SPOT> { second level SCRIPT }
//		This is the main script keyword - it is the only one that calls
//		a secondary script (see Second level SCRIPT keywords further down).

// ONRESET	<AMODEL> <SOUND lumpname>
//		Play sound when reset

// OCCLUDEWITHSECTORS { list of sector numbers }	v220-33
//		With a model map buildings can have a roof thus the wall heights would be
//		lower than the ceiling (which would normally be sky) so cannot normally be
//		set to occlude. By defining a sector here then all lines in the sector will
//		be set to occlude (and these also, importantly, will not have sky walls
//		drawn which would otherwise obscure the roof model). Note that the roof
//		model's dimensions must exceed the occluded sector else it will not be
//		drawn. In addition if the viewpoint is high enough to look beyond the roof
//		then everything beyond the sector will remain occluded so map design is
//		important. The viewpoint can be higher than the walls, however, as the
//		roof model will prevent anything beyond the wall from being seen (and not
//		rendering objects that cannot be seen, in order to speed things up, is the
//		whole point of using this function).

// PICKUPDEFAULTS <v1 v2 v3 v4 v5 v6 v7 v8 v9 v10>		v220-20
//                where v1 corresponds to 7690 through to v10 for 7699
// 
// Four additional armour pickups can be set using Things 7690, 7691, 7692 and 7693
// Six additional health  pickups can be set using Things 7694, 7695, 7696, 7697, 7698 and 7699
//
// These will only act as pickups if the mf_special flag is set else they will behave as per
// normal. This makes it backward compatible should any previous map have used these Thing numbers.
// In addition they can be spawned in the map. They do not have to exist at the outset.
//
// Ten new txt entries have been added to the Defs\Base\txt.ded namely;
//
//  GOTSCPARM1    // used with 7690
//  GOTSCPARM2    // used with 7691
//  GOTSCPARM3    // used with 7692
//  GOTSCPARM4    // used with 7693
//  GOTSCPHLT1    // used with 7694
//  GOTSCPHLT2    // used with 7695
//  GOTSCPHLT3    // used with 7696
//  GOTSCPHLT4    // used with 7697
//  GOTSCPHLT5    // used with 7698
//  GOTSCPHLT6    // used with 7699
//
// This allows default strings to be changed, as required, with the ded as per usual.
//
// Note that as long as the map is a scripted type that no entry has to be made in SCP_DEFN
// In this case hardcoded default values of 10 for each entry will be used to increment the
// armour/health values. Currently a Thing will be picked up even if the player already has
// max armour (in the case of armour) or max health (in the case of health).
//
// If used all eight values must be provided irrespective of whether or not all 779x Things
// exist or have the mf_special flag set.
//
// NOTE: values can be negative making items dangerous to pick up. Negative health is applied
// even if the player is in god mode or has invulnerability.
//
// The defaults are reset to 10 at the start of each map so an SCP_DEFN entry is map specific
// (not global)
// An example entry would be;
//
// MAP01
// PICKUPDEFAULTS 100 30 40 50 10 2 3 4 // All eight values must be defined
//
// Another example is;
//
// MAP01
// PICKUPDEFAULTS 100 30 40 50 -201 2 3 4 // All eight values must be defined
//
// With this then picking up 7696 will kill (but not gib) the player irrespective of
// armour/health points.

// PISTOLHEADDAMAGE <ID> <min height> <max height>	v220-33
//		Kill outright a Thing with the (string) ID if hit between the min and max
//		heights above its base by a player with a pistol shot. Up to 16 different
//		Things can be entered. Note that if any are defined then the pistol shot
//		will always be accurate and the chain gun will always be inaccurate. Thus
//		using this elevates the pistol to being an important weapon.

// PLAYLISTSOUND <SCRIPT SPOT> <N name1 name2 ..> <delay min addon> <state>
//						<VOLUME 0 to 1.0> <ATTENUATION 0 to 5.0>
//		Randomly selects and then plays a sound from the list until the SCRIPT SPOT
//		is terminated with an ONDEATH command.
//		N is the number of sounds that follow and can range from 1 to 4
//		namex is in the form "SOUNDLUMPNAME"
//		state is the defn state name for the spawned model required to sync the
//		start of the sound
//		Delay min addon is the range randomly selected before the next sound is
//		played. The delay will always be at least min. When running, the value in
//		addon is randomly selected between 0 and the addon value and then added to
//		min. The range is from [min] 35tics(1 second) to [addon] 0 - 1050tics
//		(0 to 30 seconds).
//
//		E.g. To play one of 3 sounds with a delay between 1 and 3 seconds at
//		half volume with script spot 7900 and normal attenuation;
//		PLAYLISTSOUND 7900 3 name1 name2 name3 statename 35 105 0.5 1
//			where name1 name2 name3 are the lump names containing the sounds

// PLAYERVIEWHEIGHT <val>		v220-22
//              Set the player's view height. val must be in the range 40 to 56
//              NOTE: This does not affect the blocking height.

// PRECACHE { list.. }
//		With a scripted map a model can be newly spawned after all the precacheing
//		has been done.  Such models can be independently precached by using this
//		command.  The list should comprise of the doomednum.  Hence to precache a
//		fatso and babyspid the command would be PRECACHE { 67 68 }

// RADTIME <integer in range 10 to 90>
//		Percentage reduction to be applied to radiation suit timeout

// RADX_GREN <integer in range 2 to 10>
//		Radius damage multiplier to be applied to health with a grenade or pipebomb
//		Note: this does not change the radius or thrust and will not affect the player

// RADX_RCKT <integer in range 2 to 10>
//		Radius damage multiplier to be applied to health with a rocket
//		Note: this does not change the radius or thrust and will not affect the player

// RESETMANUAL	<SCRIPT SPOT>
//		Allows amodel to be resurrected if line is retriggered

// SETLZ	<SCRIPT SPOT> <LIGHTLEVEL> <Z HEIGHT above floor> <FALL = 1 STAY PUT = 0>
//		Same as SETZ except a specific lightlevel can be set that will override the
//		sector lightlevel the Thing is in.  This is similar to the SETDEF command
//		available with a SCP_ZOFF script

// SEETHRULINE	<SCRIPT SPOT>
//		Flags all lines owned by the spot to not occlude

// Note: support for SETFAKEHEIGHT was removed in b220-3

// SETLINE	<LINEDEF SPOT> <1 = ALWAYS 0 = ONMOVE> <SOUND lumpname> "text"
//		Associates a sound with a line and/or print the text in quotes
//		If no sound is wanted use NONE for the lumpname
//		If no text is required to be printed use ""
//		Maximum text length = 255 chars (including \n)
//		Line feeds are represented by two chars \n
//		If a line feed is required then forms part of string
//		e.g. "textline1\ntextline2"
//		The string must not be broken i.e. all on one line contained inside ""
//		Breaking a line into more than one is the author's responsibility.
//		No checks are made by the Risen3D code as to whether text between /n
//		can be represented on screen.  It is recommended that text between /n
//		markers does not exceed 62 chars.

// SETWATERVARS	<THINGNUM> <OPACITY> <FOG DENSITY>
//			 [<FOG R> <FOG G> <FOG B>] [MOD <MODULATE> <PERIOD> <PHASE>]
//		To set water as translucent then put a THING type in the range 6100 to 6199
//		in the fake sector referenced by the sector(s) whose fake floor/ceiling is
//		required to be set. This means only having to add one thing type to set all
//		the sectors referencing the fake sector. Note that only one THING 61xx where
//		xx is a unique number should be placed in the map and that any fake sector
//		should only be referenced by one THING of this type.
//		If the above placement conditions are not met or if a marked fake sector is
//		not referenced then an error will be generated and loading will terminate.
//
//		To just set opacity then, for example, use the command;
//		 SETWATERVARS 6100 186 0
//		This will cause all sectors referencing the fake sector in which THING 6100
//		has been placed to have an opacity of 186 (the alpha value that will
//		be applied).
//		Note also, from the example, that if fog density is set to 0 that the R,G,B
//		values should not be sent (as they are redundant).
//
//		Opacity can only be applied with blue animated water textures.
//		The range for opacity is 0 to 255.
//		An opacity value of 255 will mean the water is totally opaque.
//		Density is a floating point value but is not range checked.  Only small
//		values (less than 0.01f) are workable and it should be a positive number.
//		The THING range allows for up to 100 61xx types to be placed in a map.
//
//
//		If also wanting to set underwater fog for these sectors then send a density
//		value of > 0 and also set the RGB value. E.g.;
//		 SETWATERVARS 6100 186 0.003 0 0 16
//		In this case the RGB values must be appended.
//		The range for each of R, G and B is 0 to 255
//
//		NOTE: if setting water opacity to less than 255 then it will only work if;
//			a) used with models and
//			b) if any model below the fake water level does not bisect the fake
//			   water level.
//			   I.e. it must be totally 'submerged'.
//			c) Translucency cannot be used with teleportation between water
//			   sectors without causing significant problems.  Using it with
//			   silent teleportation or sectors with under/over Things should
//			   be avoided.
//
//		MODULATE and PERIOD	v220-4a
//		Finally values can be applied (MODULATE, PERIOD and PHASE) to make the water
//		oscillate up and down for a particular fake sector.
//		MODULATE is a floating point value where 1.0f = 1 mapunit.
//		PERIOD   is an integer number of tics and is used to set one complete cycle
//			 where 35 tics = 1 second.
//		PHASE    is an integer number of degrees from 0 to 359. This is useful where
//			 two unjoined sectors have the same PERIOD but visually are wanted
//			 to not appear to be in sync.
//
//		If setting these values then precede them with the sub-keyword MOD. This has
//		been added to make any definition, once written, clearer.
//
//		NOTE: where sectors are joined but have different ceilings which require
//		different fake sectors then the MODULATE, PERIOD and PHASE values should be
//		set identically for each else the water levels will vary between sectors and
//		will become disjointed. 
//
//		Examples;
//		No fog, no modulation;
//		SETWATERVARS 6100 170 0
//		No fog, mod  of +- 0.5 mapunit/140 tics, 0 = in phase;
//		SETWATERVARS 6100 150 0 MOD 0.5 140 0		   
//		No fog, mod  of +- 0.5 mapunit/140 tics, 45 degrees out of phase;
//		SETWATERVARS 6102 150 0 MOD 0.5 140 45
//		Fog, no modulation;
//		SETWATERVARS 6100 120 0.003 0 0 16
//		Fog, mod of +- 0.75 mapunit/105 tics, in phase;  
//		SETWATERVARS 6100 120 0.003 0 0 16 MOD 0.75 105 0
//
//		Note also that if you want a decoration model to move with the water then it
//		will need to have the flag mf3_modulate set in its ded. Any such models in
//		fake sectors, whether modulated or not, should have their height adjusted by
//		spawning them with a 16000 type using the SETDEF keyword in an accompanying
//		SCP_ZOFF script.

// SETZ		<SCRIPT SPOT> <Z HEIGHT above floor> <FALL = 1 STAY PUT = 0>

// SETTHINGFLAGS <DOOMEDNUM> <FLAGS>
//		Used to set bounce, friend or touchy flags with a particular mobj
//		Values are 1-Touchy  2-Bounces  4-Friend
//		Note that these are binary flags so that sending 3 would result in an error
//		being reported as a bouncy Thing cannot be set as friendly.
//		These cannot be used with types 6700 to 7999

// SOUNDGLOBAL { SCRIPTSPOT1 SCRIPTSPOT2 etc. }
//		Normally if an Amodel has its see sound set then this is only played when
//		there's line of sight (LOS) possible between it and the player.  To bypass
//		the LOS test then use this command.  Note: the SPAWNSTART command for the
//		Thing must have been defined prior to using SOUNDGLOBAL.  By using the
//		SCRIPT SPOTS then the same Thing type can be selectively selected.
//
//		NOTE:	Instead of using SOUNDGLOBAL, and giving better results in most cases,
//		a THING 15600 can be put in a map which will cause Risen3D to group all ad-
//		joining sectors with height (i.e. where a sector's floor is less than its
//		ceiling height) into one specific group.  This means a door sector, for example,
//		will block any further sectors from being added to the list. When the map is run
//		then, if the player is in the same group as any cyclic sound producing amodels,
//		they will be heard and, if not, then only if they can be seen.
//		When creating a group R3D will not expect to find any further 15600 THINGs.
//		Note that where using more than one 15600 THING in a map that each group of
//		sectors created by Risen3D must be mutually exclusive.  If any sectors are
//		shared between groups then Risen3D will exit with an error.  A sector list is
//		terminated by closed sectors and it is entirely the map designer's
//		responsibility to ensure that a THING 15600 is placed so that all adjacent
//		sectors will be defined by closure.

// SOUNDTHING	<DOOMEDNUM> <"SOUNDLUMPNAME"> <VOLUME 0 TO 1.0f> <ATTENUATION 0 TO 5.0>
//		Set THINGs to play a repeating sound.

// SPAWNDUMMY	<SCRIPT SPOT> <AMODEL>
//		Allows a dummy model to be spawned where spot actions are required without
//		the dummy, itself, being rendered.

// SPAWNSTART	<SCRIPT SPOT> <AMODEL> <SPAWN: ALIVE 1, DEAD 0>
//		This is the general spawning command

// SPAWNVDOOR	<SCRIPT SPOT> <AMODEL>
//                <REQUIRED RENDERING HEIGHT OF BLOCKING SECTOR'S CEILING ABOVE FLOOR HEIGHT>
//		  	<HEIGHT TO RISE ON DEATH> <TIME TO RISE IN TICS>
//
//		A 79nn, 69nn or 59nn thing spawned using SPAWNVDOOR will cause its sector to be
//		treated as a special rising sector by R3D.  The sector itself is not rendered using
//		the normal sector values but with those specified by the command.  The model's base
//		is tied to the sector's ceiling height.  When the sector's ceiling is made to rise
//		then the model will rise with the sector. The sector must not have a special or a
//		line tag as it is not treated as a normal doom sector.  The sector's ceilingheight
//		(set in the map editor) must be greater than its floorheight to prevent occlusion.
//

// THINGOFFSET <doomednum> <offset>			v220-21
//		All Things spawned in the map at load time matching doomednum will have the
//      offset value added to its current z height. If a Thing does not have the
//		mf_nogravity flag set then an error will be generated. The offset must be in
//		the range 0 to 32767 else an error will be generated. Things will automatically
//		be adjusted downward if the offset pushes the Thing through the ceiling of its
//		owner sector. If no Things are found matching doomednum then an error will be
//		generated.

// SKYBOXTEXTURE <identifying name>	v220-6
//		TGA texture sets should be in \Risen3D\skyboxbyname\
//		A set will comprise of 6 tga or jpg tex's with identifying  extensions;
//		_ft, _bk, _up, _dn, _lf, _rt
//		Thus a set will appear as;
//		identifyingname_ft.jpg, identifyingname_bk.jpg etc.
//              or
//		identifyingname_ft.tga, identifyingname_bk.tga etc.
//		Just send the identifyingname with the command.
//              Note that if both exist jpg takes precedence.

// TEXOFFSET	<sector number> <type> <xoff> <yoff>	v220-13
//		Used to position floor and/or ceiling flats.
//		If type = 0, floor flat repositioned
//		If type = 1, ceil flat repositioned
//		If type = 2, floor and ceil flat repositioned
//		Note: xoff and yoff are integers in map units

// USED79LIST <LISTNUM> { 79nn 69nn 59nn. }	v220-23 
//
//	Used to set a list of 79nn, 69nn, 59nn spots as required which can be attached to another
//	79nn, 69nn or 59nn spot (see CHECKU79LIST) such that it cannot be activated until all the
//	list entries have either been activated (indicated by their tics != -1) or removed.
//
//	LISTNUM must be in the range 1 to 299
//
//	The list entries must be enclosed inside curly braces.

// VDOOR_SCATTER	<PERCENTAGE of BULLETS to allow through>
//
//		A value of 0 will block all bullets and 100 will allow all bullets to pass.
//
//		Vdoors are normally non-occluding models.  Since they are raised using a special
//		sector which is used by the logical code to block Things but whose ceiling height
//		is lower than the rendered height then anything above the model's base will
//		normally be blocked.  It has, however, been made possible to allow bullets to pass.
//		To give the effect that some bullets have actually hit the model then a percentage
//		can be defined that will not pass.
//		Note that;	a) only bullets can pass
//				b) the range is 0 to 100

// VDOOR_PARMS	<SCRIPT SPOT> <TIME TO WAIT UNTIL CLOSE in TICS>
//			<TIME TO FALL in TICS> <CRUSH -1 or 0 or 1> [ <xpos> <ypos> ]
//
//		If VDOOR_PARMS is not specified then the door will just open and stay open.
//		If specified then it must follow a SPAWNVDOOR definition.
//
//		After the wait time has expired the door will close at the defined rate.
//
//		If crush < 0 then vdoor will rise if hitting anything underneath
//		If crush = 0 then the door will stay at the current height until able to lower
//		If crush > 0 then anything under the door will be crushed
//		xpos and ypos are not mandatory but if xpos is set then so must ypos.
//		Their range is in  mapunits.
//		If set then the model's x,y position owned by the script spot will be reset
//		to the values sent in xpos and ypos.  This is useful if a small sector that
//		the thing is in is needed but is not at the model centre.  When first spawned
//		then the sector it is in is identified.  From this point on it's subsector is
//		never rechecked meaning its x and y values can be changed, without affecting
//		the sector it belongs to, allowing its position to be altered for rendering
//		purposes.


// ------------------------------------------- REVERB OPTIONS ----------------------------------------

// The following applies from v220-18a on.

// SETDEFAULTSKYREVERB <"EAX string type"> <VOLUME> [<DECAY> <DAMPING>]
//		Sets a default for all sky sectors in the map.
//		To set a sky sector differently then a SETREVERB command can be used.
//		If using SETREVERB or SETFLATSREVERB then SETDEFAULTSKYREVERB must precede
//		both else a script error will be generated.
//		Only one instance of SETDEFAULTSKYREVERB is allowed.

// SETREVERB	<THINGNUM> <"EAX string type"> <VOLUME> [<DECAY> <DAMPING>]
//		THINGNUM is in the range 20000 to 20127  This allows for up to 128 unique
//		reverb settings.
//		If a THINGNUM has not been put in the map but is called using SETREVERB
//		then the script will abort with an error message.
//		A sector can only have one THING type 20XXX.  If more than one exists in the
//		same sector then the script will abort with an error message.
//		The same THINGNUM can be put in multiple sectors since they are used to
//		ensure that a group of sectors have the same reverb characteristics.
//		If a 20XXX Thing has its centre placed precisely on a line then the sector on each
//		side of the line will be selected. This means only one need be used instead of two.
//
//              NOTE: A sector with a reverb Thing will override any settings made with
//                    SETFLATSREVERB or SETFLATSREVERB_FAKE 

// SETFLATSREVERB <"CEILFLATNAME" or ""> <"FLOORFLATNAME" or "">
//			<"EAX string type"> <VOLUME> [<DECAY> <DAMPING>]
//			
//		Scans all sectors not set with SETREVERB for a matching floor flat or a matching
//		ceiling flat or both if both set.  Those that match will have the reverb values
//		transferred.
//		Note either CEILFLATNAME or FLOORFLATNAME or both must have a name, i.e. "" ""
//		is invalid.
//		If a sky sector is needed then use "SKY" not "F_SKY1".
//
//		NOTE: If a sector has a sky sector then "SKY" must be set for the ceiling.
//		      This is the only case where the CEILFLATNAME must be set.

// SETFLATSREVERB_FAKE <"FLOORFLATNAME"> <"EAX string type"> <VOLUME> [<DECAY> <DAMPING>] v220-4
//			
//		Scans all fake sectors for a matching floor flat.  All sectors that reference
//              any one of the matching fake sector(s) will have the reverb values transferred.
//		Note FLOORFLATNAME must be a valid FLAT name.  By matching fake floor flats
//		it is possible to span a range of normal sectors with this single command.
//

// SETGENERALREVERB <"EAX string type"> <VOLUME> [<DECAY> <DAMPING>]
//		This will be applied to all sectors not set with SETREVERB or SETFLATSREVERB
//		and not having a sky ceiling.


// general reverb data			

//	Limits for all reverb keywords;
//
//		NOTE:	EAX TYPE and VOLUME must be set
//			If DECAY is set then DAMPING must also be set.
//			If DECAY and DAMPING are not specified then values of 1.49f and 1.0f
//			are applied respectively.
//
//		VOLUME	  0  to  1.0f
//		DECAY	0.1f to 20.0f
//		DAMPING	  0  to 10.0f
//
//		Setting a value outside the allowed range will result in a script error


//	EAX string types;
//		GENERIC
//		ALLEY
//		ARENA
//		AUDITORIUM
//		BATHROOM
//		CAVE
//		CARPETEDHALLWAY
//		CITY
//		CONCERTHALL
//		DIZZY
//		DRUGGED
//		FOREST
//		HANGAR
//		HALLWAY
//		LIVINGROOM
//		PADDEDCELL
//		PARKINGLOT
//		PLAIN
//		PSYCHOTIC
//		QUARRY
//		ROOM
//		SEWERPIPE
//		STONECORRIDOR
//		STONEROOM
//		UNDERWATER	NOTE:	this type is automatically set when the player is
//					underwater. Any other type set will be applied
//					when above the fake floor.
//
// NOTE v220-18: MOUNTAINS has been removed as it has no effect


// ---------------------------- End of primary keyword definitions -----------------------------------



// ================================ SECONDARY SCRIPT KEYWORDS ========================================

// Secondary SCRIPT keywords can only be used with used with the ONDEATH command 

// Note: A secondary script must be inside { } curly braces e.g.; ONDEATH {...}

// If ACTVATE or ACTIVATEDELAY are used with a 3D lift then only specials 230 and 234 will work.

// ACTIVATE <74xx>	 v220-4
//
//		On a 79xx THING's death the line special and tag accessed by the 74xx THING
//		is activated.  This only works with a USE type special.
//
//		NOTE: xx has a range of 0 to 99.
//		      Only one 74xx THING is allowed in the map for each instance of xx.
//		      Type 74xx is is also used with TRANSFERTRIGGER (see below) so this
//		      must be taken into account when assigning this type.
//		      Where a 79xx THING is resurrected and then killed again the line will
//		      also be triggered again unless the Doom code has cleared the special.
//		      As such trigger once types would normally be used with this keyword.

// ACTIVATEDELAY <74xx> <delay>  v220-31
//              As ACTIVATE but line will not be triggered until delay has expired.
//              The delay must be a positive number <= 16000
//              In terms of being allowed then it counts the same as for ACTIVATE
//              with the additional exception that the 74xx Thing's line must have
//              its frontsector as the moving sector.


// CHANGETYPE	<current doomednum> <new doomednum> <set friendliness (0 or 1)>
//		This can be used to change an active mobj from its current type to a new type.
//              The new type must be a shootable Thing but the current type can be almost
//		any Thing type. Since the mobj will adopt the new type's characteristics it is
//		encumbent upon the map author to ensure that a direct substitution can be made.
//		If friendliness is set to 1 then it will help the player.
//		Up to 10 CHANGETYPE commands can be used with any one 79xx thing.

// CHECKU79LIST <LISTNUM> <SOUNDLUMPNAME> <MESSAGE>	v220-23 (see addendum below)
//
//	Used to attach a listnum set using USED79LIST to a 79nn, 69nn or 59nn script spot.
//	The listnum must be set prior to entering this keyword. When run if any list Thing is
//	present and has tics == -1 then the message will be printed and sound played plus all
//	other commands in its group will be aborted (irrespective of its position in a curly
//	braced group).
//
//	If no sound is wanted then use "NONE"
//	If no message is wanted then use ""

// DISABLE	<ACTION SPOT>
// ENABLE	<ACTION SPOT>
//		Note: If disabled then an action spot will be re-enabled. 
//		The same SCRIPT SPOT cannot both enable and disable the same ACTION SPOT.
//		Also, in each case, it is a one time operation.

// KILL		<SCRIPT SPOT> <DELAY> <WAIT if occupied = 1 else 0>

// KILLAMBIENT	<AMBIENT THING NUM - range 14001 to 14064> 
//		Stops all ambients owned by a mobj referencing THING NUM
//		irrespective of the owner.

// KILLMOBJ	{ list.. }	v220-4
//
//		Specific mobj's identified by their mapid can be killed when a 79xx is killed.
//		Two types of entry can be put in the list (entries can also be mixed);
//
//		1) Where the number in the list is a specific mobj in the map
//
//		   The mapid corresponds to the number set in a map editor.  For example if you
//		   wanted to kill T136 and T230 you would provide the command;
//
//		   KILLMOBJ { 136 230 }
//
//		   NOTE: this command should be used with THINGS spawned when the map is loaded 
//		         notTHINGS spawned by the script. These have the disadvantage that they
//			 will have to be ammended when developing a map if the THING numbers are
//			 altered by the map editor.
//
//		2) Where the number in the list is a 78xx number
//
//		   If a 78xx number is put in the list then any mobjs that have been spawned using the
//		   78xx number will be killed.  Any subsequently spawned will be unaffected when the
//		   KILLMOBJ listnum has been activated once all existing mobjs have been killed.  IOW
//		   a thinker is spawned which will kill any mobjs spawned from the 78xx spot until no
//		   further mobjs can be found.  At this point the thinker is removed.  If during this
//		   process other things are spawned using the same 78xx spot then these will also be
//		   killed if the thinker is still active.
//
//		In general a thing is not killed outright.  It has a random amount of health deducted
//		per tick until its health is exhausted.  This prevents a number of things all dying
//		in sychronisation which would look somewhat artificial.

// PLAYSOUND	<SOUND lump name> <LOOP 0 or 1> <VOLUME 0.0 to 1.0> <ATTENUATE 0 or 1>
//		If attenuate is set to 0 then the sound will played as a global map sound.
//		This might also be useful where doppler shift is not wanted whilst the
//		sound is being played.

// REMOVE	No parameters, just indicates to remove self
//		(i.e. the T79xx SCRIPT SPOT caller)

// REPLACE	<SCRIPT SPOT> <THING>

// RESETMODEL	<SCRIPT SPOT> <DELAY>

// RESURRECT	<DELAY in tics>

// SETTRIGGER	<SCRIPT SPOT> <special>
//
//		Note that the line special to be changed must be set in the map to 0 or 8106
//		The line with the special or tag info to be actioned is referenced by a 77xx
//		HARD THING.  On death the stored reference trigger line is actioned.

// SETWAIT	<LINEDEF SPOT> <SECTOR CEILING HEIGHT in mapunits> <"MESSAGE" or "" if none required>
//		Used with SPAWNVDOOR.  A line special referenced by the LINEDEF SPOT, when triggered,
//		will be aborted if the VDOOR ceiling height is greater than the value set.  If aborted
//		then MESSAGE, if set, will be printed to screen.

// SETTAGGED	<special>	Note: line's special must be 8107 and line must be tagged

// SPAWN <ACTION SPOT> { item }
//	item = <doom edit num> <z off> <delay in tics> <spawn fog 0 or 1>

// SPAWNONCE <ACTION SPOT> { item }
//	item = <doom edit num> <z off> <delay in tics> <spawn fog 0 or 1>
//
//	Used where multiple trigger lines access the same t79nn and where after being
//	triggered by the first instance all other triggers should be ignored.

// STOPSOUND	<SCRIPT SPOT>

// TEXT		<SHOW: ONCE = 0, REPEAT = 1> <"text string">

// TOGGLEREPLACE 
		<SCRIPT SPOT> <THING> <THING2>	Note: forces RESETMANUAL if not defined

// TRANSFERTRIGGER <74xx> <FLAGS>	 v220-4
//
//		This command is used to set line specials and tag on a 79xx THING's death. The way
//		this works is to set up a referencing sector which has a two sided line, with the
//		same front and backsector, with the special and tag required.  On this line is placed
//		a THING 74xx.
//
//		The lines that require the special and tag on the reference line to be adopted have
//		a THING or THINGS 75xx placed on them where xx must match that for the 74xx THING.
//
//		NOTE: xx has a range of 0 to 99.
//		      Only one 74xx THING is allowed in the map for each instance of xx.
//		      Up to 10 75xx THINGS are allowed for each instance of xx.
//		      Type 74xx is also used with ACTIVATE (see above) so this
//		      must be taken into account when assigning this type.
//
//		In addition flags can be set to carry out further changes.
//
//		FOG         	 1		Spawn a Teleport fog
//		FOGSOUND	 2		Play DS_TELEPT
//		CSECLIGHT	 4		Adopt the reference sectors lightlevel on the
//							75xx line's backsector ceiling.
//		FSECLIGHT	 8		Adopt the reference sectors lightlevel on the
//							75xx line's backsector floor.
//		CEILINGPIC	16		Adopt the reference sectors ceilingpic for the
//							75xx line's backsector.
//		FLOORPIC	32		Adopt the reference sectors floorpic for the
//							75xx line's backsector.
//
//		Just sum the flags needed, e.g. fog + floorpic = 33, and use this for the FLAGS value.
//		If none are wanted then just use 0 for FLAGS

// UNBLOCK	<DELAY in tics>


// --------------------------------- Gamekey specific commands ---------------------------------------

// IFKEYS { list of key identifiers }
//
//		If included then none of the other ONDEATH commands will be run when a
//		line is triggered unless the keys in the list are held by the player
//		with the exception of ONLOCKED.
//
//		The identifiers are;
//		card  keys - blue red yellow; CBx CRx CYx
//		skull keys - blue red yellow; SBx SRx SYx
//
//		where x is 0 or 1.  If x is 1, assuming a monster line trigger is used, then
//		the door cannot be opened by a monster unless the player has the key card.
//		Multiple identifiers should be separated by spaces e.g. { CB0 CR0 CY0 }
//		In the absence of an ONLOCKED definition then the standard message noting
//		key requirement where not possessed is displayed and the usual 'oof' sound
//		is played.

// ONLOCKED	<SCRIPT SPOT> <SOUND lumpname> <"text string">
//		Used, if required, with IFKEYS.

// REMOVEHUDKEY
//		Used where a key triggers a replacement model following which it is not
//		wanted to be seen in the (minimised) HUD.
//
//		NOTE: this will only work if the Thing being replaced uses a single key


// ---------------------------- End of secondary keyword definitions ---------------------------------


// v220-22 Death list commands addendum ============================

// In general:
//	Up to 255 different lists can be created.
//
//	Only one list per spot is supported.
//
//	A list can be attached to more than one 79nn (or 69nn)
//	spot. That is it can be shared if required.
//
// Example - 7904 cannot be activated/killed until 7900 through 7903 have been activated/killed
//
// USED79LIST 1 {7900 7901 7902 7903 }	// Must be defined first
//
// ONDEATH 7904 {
//    CHECKU79LIST 1 DSTINK "Cannot activate - There are Things left to kill!"
// }

// end death list addendum =========================================


// DEBUG SWITCH	 -debug_scp

// Using -debug_scp on the command line lists all used spots making it easier to see which are still
// available.

// Comments are defined using // or # This header has had all comment identifiers added so that
// you can copy this file at the start of your script if required.

// For clarity it is recommended that you put the following comment line at the start of a script;
// SCRIPT START for <enter wad name>

// Don't forget a mapid must precede local keywords (e.g. MAP01)!


//----------------------------------------------------------------------------------
