Swamp campaigns allow players to script custom adventures that use the standard maps or custom maps they have created.  This guide will give you a basic list of the script commands available to these campaigns.  Using these commands to create a fun and interesting adventure will rely on the creativity and ingenuity of the author.  Script files are standard text files that must be placed in the "Campaigns" sub folder within the main Swamp directory.

The campaign script file is pretty lenient when it comes to extra lines and comments.  If a line is blank or begins with "\\", 
//", or "'" then it will be treated as a comment, and your script file should still work just fine.  Adding in comments can help you remember exactly what a line or section is meant to do, so don't be afraid to include some.

The single most important line in the file is the one that tells which map we will use.  It is a good idea to start out with this line, and the format is simply the word map, an equal sign, and the file name.

map=multi1

If your campaign ends up using multiple custom maps, you can group them together into a folder within the maps folder.  Accessing them would only require adding the sub folder name to the usual map command.

map=firepit\introduction

If you want players to begin in a location different than the map's default, these 2 commands can be used to spawn players on an exact spot.  Don't use decimal numbers, and also be aware that several of the commands will not work if you put extra spaces before or after the equals sign.  To be safe, try to never add in extra unnecessary spaces.  Setting up your own X and Y coordinate is completely optional.  If you choose not to add these lines then the map will just use the default starting location.

x=30
y=14

If you want to set the player's direction, that can be done with the degrees 0 through 359.  Start by typing "d=", followed by the degrees of the direction.  0 is East, 90 is South, 180 is West, and 270 is North.  Other values represent any other angle you wish to have inbetween the 4 standard directions.

d=90

Teleporting players to a new spot on the map is slightly different than setting their starting X and Y coordinates with the lines we just covered.  To move a player to a specific location on the map, start by typing "jump to ", followed by the X and Y coordinates where you want him to go (separated by a comma).  Do not use decimals in the coordinates.

jump to 50,50

As a more advanced command specifically meant for simulating 3D structures, you can manually set a new fake X and Y coordinate for the player.  The new coordinates are fake because the player will not move when this command is executed.  When the player checks their current location, it will forever tell them the relative coordinates based on the fake ones you provided.

As an example imagine you are at coordinates 75,75 in an elevator.  To simulate that the elevator has taken them up, you use the "Jump to" command to move them to another part of the map decorated to seem like the next floor.  The problem is that the player could check their coordinates and realize that they have actually just moved somewhere else on the map.  After moving them, you can set the fake coordinates to 75,75 and it would then seem as though they were in the same location but raised up higher than before.

Start with "xy shift", the fake X coordinate, a comma, and the fake Y coordinate.  There are no spaces before or after the comma.  Do not use decimals for the coordinates.

xy shift 75,75

If you wish to remove an xy shift, type the following command.

xy normal

Normally Zombies respawn once they are killed, but you have the option to disable that.  This is only recommended for campaigns that have been carefully scripted to keep players busy and challenged during the entire battle.  As you can imagine, if the zombies don't respawn automatically, players could quickly run out of things to fight.  If you choose to disable zombie respawn, here is the line to add to the file.

no respawn

In custom maps, normally items will vanish forever once they are picked up.  You have the option of enabling item respawn, which will create a new item and randomly place it on the map after someone has picked it up.  The new item will exactly match the old one so this is a way for you to populate your map with exactly the ratio of items you want, and it will stay that way.  If a player finds a gun that they already have, then they will be given ammunition for it instead.  Here is the code.

Item respawn

As a more advanced command, you can adjust the performance level for the client.  By default this value is set to 60, and it represents the maximum distance away that zombies, guards, and allies will be processed by the game.  In a perfect world, this value would be increased to 710 so all game entities will always be processed.  The problem is that as the settings go higher, the processor load increases.  Lowering the value improves performance but can affect the AI of the zombies in unusual ways.  It is not really recommended that this value even be changed, but it is here just in case someone wants to.  Start with "performance=", and the new value.  Do not use a decimal for the value.

performance=75

If you are reading this file before Swamp has been officially updated to version 2.9, then you might not be used to the idea of zombies becoming stronger as the player levels up.  If you choose to start the player at a specific level, here is the code.

level=10

As an important tip, changing the level of the player will only affect the strength of new zombies you create.  This means you can place a zombie, change the player's level, place a new zombie, and those 2 zombies will have different strengths even if they are the same type of zombie.

Besides setting a specific level for the player, you can also level the player up by a single level.  At this point it probably doesn't make much since to have a single "level up" feature, but it makes more sense once we get into scripted events.  Here is the code.

level up

During the game players can press Q to hear their current quest message.  You can set the player's quest message with this code.

quest=This is a sample quest.  You can replace this message with whatever message you want.

You can have the game read off a spoken message with this code.

say=Zombies are coming to eat your brain.  This is generally something you do not want to have happen.

Radio messages are similar to using the "say" command, but the player will hear the radio message sound, and the message will be listed among the radio chat history.  There are no spaces before, or after, the equals sign.  To make the message sound more authentic, you can begin the message so that it seems to have been sent by someone specific.

radio=Aprone says, we need more firepower on the west wall!

Player experience points and reputation points can both be set to a specific value easily.  For experience points, start with "set player xp=", followed by the amount you want it to be.  Do not use a decimal for the value.

set player xp=50

For reputation points, start with "set player reputation=", followed by the amount you want it to be.  Do not use a decimal for the value.

set player reputation=1000

Instead of setting experience to a certain number, you can choose to add a value to it.  Start with "add player xp=", followed by the amount you want to have added to it.  Do not use a decimal for the value.  You are allowed to use a negative number to reduce the player's experience points.

add player xp=25

Instead of setting reputation to a certain number, you can choose to add a value to it.  Start with "add player reputation=", followed by the amount you want to have added to it.  Do not use a decimal for the value.  You are allowed to use a negative number to reduce the player's reputation points.

add player reputation=900

Maps that have a Safe zone or Outpost can benefit from changing the storyline players can access from those locations.  The Safe zone has 3 story sections, each with a menu title and a story.  To set the title, start with "set safe", the section number 1-3, "title=", and the new message.  There is no space between the word "safe" and the section number.  There are no spaces before or after the equals sign.  As a tip, menu titles should probably not be very long since they are just part of the menu.

set safe2 title=The day was not going well.

To set the story, start with "set safe", the section number 1-3, "story=", and the new story.  There is no space between the word "safe" and the section number.  There are no spaces before or after the equals sign.

set safe2 story=I awoke to the sound of gunshots in the distance.  My neighborhood was filled with panicked screaming people, running back and forth everywhere.  No one knew what was happening!

Outposts have only 2 story sections, unlike Safe zones which have 3.  To set the title of an outpost, start with "set outpost", the section number 1-2, "title=", and the new message.  There is no space between the word "outpost" and the section number.  There are no spaces before or after the equals sign.  As a tip, menu titles should probably not be very long since they are just part of the menu.

set outpost1 title=Holding the road.

To set the story, start with "set outpost", the section number 1-2, "story=", and the new story.  There is no space between the word "outpost" and the section number.  There are no spaces before or after the equals sign.

set outpost1 story=Most of the alleyways and side streets have been blocked off, so this road represents only one of 2 ways to get inside.  A few of us guys are stationed here to defend this spot.

You can choose exactly what gear the player will begin your campaign with.  If you don't specify any gear then the player will start out with only an axe.  To quickly equip the player with the basic items (field kit, med kit, Glock 19, and some ammo), just include this line of code.

starting gear

You can give items directly to the player by following this format of code.  Start with "give item", the amount of the item, and then the exact item name.  The commands themselves are not case sensitive, but item and zone names are!  Be sure to get the exact spelling and capitals to be sure the items will work as desired.

give item 1 Glock 17

Items can be added to the map so that the player has to actually go and find them.  Instead of a specific spot, you choose an area where the item will be randoly spawned within.  Start with "add item", the amount of the item, the X and Y coordinates for the top-left corner of the spawn area (separated by a comma), the X and Y coordinates for the bottom-right corner of the spawn area (separated by a comma), and the exact item name.  You can turn the spawning area into an exact spot if you just set both sets of coordinates to the same spot.  Don't use decimals with the coordinates.  If you want the item to be a unique item that sounds like a crate, add a minus sign at the beginning of the item name.  Keep in mind that unique items will not work as normal weapons even if the name is the same.  Here are example lines for a normal item, and for a unique item.

add item 1 35,16,37,16 AA12
add item 1 10,10,50,20 -Can of dog food

As a tip, If you want to create a random item, name the item "*" (the star created by shift + 8).  The game will randomly turn this item into anything from the standard item list.  Using random items can also be useful when you have enabled item respawning because it gives the same effect as playing online, where the items are always new and random, instead of being the same few items repeated everywhere.  When the player picks up a random item, the amount is determined by the client to match the default for that item type, regardless of the amount you had entered.  A list of all current game items can be found at the end of this file.  This gives you the items but also helps you be sure you have the spelling and capitals correct.

Especially for ammunition, med kits, and random items, there are times when you want to place many items but don't want to use a separate command to add each one.  To spawn multiple items with a single command, start with "add items", the number of individual loot piles you want, the amount of the item, the X and Y coordinates for the top-left corner of the spawn area (separated by a comma), the X and Y coordinates for the bottom-right corner of the spawn area (separated by a comma), and the exact item name.  You can turn the spawning area into an exact spot if you just set both sets of coordinates to the same spot.  Don't use decimals with the coordinates.  The normal item naming rules apply exactly as they do with the normal "add item" command.

add items 15 1 10,30,80,80 *

You can make the game play a sound file for the player by following this code.  Start with "play sound" followed by the file path.  The file path already starts in the "/sounds/" folder of Swamp, so you will need to specify which sub folder your sound can be found in.

play sound items\ammo.wav

To be a bit more advanced you can play a sound so that it seems to have been put into the map with the player.  Start with "put sound", the X and Y coordinates where the sound will be (separated by a comma), and the sound path.  Do not use decimals with the location coordinates.  If the player is close enough to the location, they will hear it.

put sound 10,10 guard/Behemoth1.wav

Adding zombies can be done in 5 ways.  The most basic way is to simply have zombies added to the map randomly.  Keep in mind that the maximum number of zombies is 400 so if you try to go over that limit, no new zombies will actually be created.  Start with "add random", the name of the zombie type, and equals sign, and the number of zombies you want added.  Do not put in any spaces before or after the equals sign.

add random dire=2

A more advanced way to add zombies is similar to adding items onto the map.  Start with "add spot", the X and Y coordinates for the top-left corner of the spawn area (separated by a comma), the X and Y coordinates for the bottom-right corner of the spawn area (separated by a comma), the type of zombies to be created, an equals sign, and the number of zombies you want added.  This will not only spawn the zombies, but they will all spawn within the area you have specified.  This gives you more control over where and when players will encounter zombies during their campaign.  Do not use decimals for the coordinates and do not put in any spaces before or after the equals sign.

add spot 35,16,37,16 canine=15

At times you may want to add zombies randomly around the border of your map.  To do this, start with "add border", the type of zombies to be created, an equals sign, and the number of zombies to add.  There are no spaces before or after the equals sign.

add border normal=5

Rather than specifying coordinates, you can use the map's zones to spawn zombies.  You will need to know the exact spelling of the zone, with the capitals matching what is in the map file.  You'll also need to know if it is a primary or secondary zone.  For a primary zone, start out with "add zone1", the type of zombie, "=", the number you wish to add, a space, and the name of the zone the zombies will spawn on.  There are no spaces before or after the equals sign.

add zone1 normal=5 Gas pumps

For placing zombies in secondary zones, the code is the same except "zone1" is replaced with "zone2".

add zone2 tyrant=1 Gas Station

Removing zombies works similar to adding them with the "add spot" command.  Start with "remove zombie", the X and Y coordinates for the top-left corner of the area (separated by a comma), the X and Y coordinates for the bottom-right corner of the area (separated by a comma), and the type of zombies to be removed.  All zombies of the specified type will be removed from within the area you've specified.  Do not use decimals for the coordinates and do not put in any spaces before or after the equals sign.

remove zombie 35,16,37,16 normal

To help you with the ways to create and remove zombies, here are the names of the zombies you are able to spawn.
Normal
Canine
Giant
Tyrant
Stalker
Matriarch
Reaper
Lamprey
Dire
Amorphous
Raider
You can also use this code to add/remove an NPC guard like the ones you see outside of the safe zones.  Just use the name Guard instead of a zombie name.

There are 2 ways that you can add sound decorations to the map.  The first places a looping sound at the coordinates of your choice.  Start with "add amb ", then the X and Y coordinates where you want the sound (separated by a comma), and then the file name.  Do not include the ".wav" file extension on the name.  The game assumes these looping sounds will be found in the "sounds/Ambience" folder of Swamp, though CAE Jones found a quick way around that in the past, LOL!

add amb 4,4 alarm1

In addition to the normal looping sounds, sporadic sounds will contain random delays of time before they loop again.  These are the kinds of sounds that are used for the zombies banging on windows and doors in the warehouse missions.  Start with "add random amb ", then the X and Y coordinates where you want the sound (separated by a comma), and then the file name.  Do not include the ".wav" file extension on the name.  The game assumes these looping sounds will be found in the "sounds/Ambience" folder of Swamp.

add random amb 4,4 WindowHit

Removing ambient sounds from a map can be useful in many situations.  Instead of removing sounds by their file name, you specify a coordinate range and any sounds within it will be removed from the map.  This also makes it easy to clear an entire area just as easily as you can clear individual sounds.  Start with "remove amb", the X and Y coordinates for the top-left corner of the area (separated by a comma), and the X and Y coordinates for the bottom-right corner of the area (separated by a comma).  Do not use decimals for the coordinates.

remove amb 10,10,12,12

If you wish, you can specifically pick the background music for your campaign.  Start with "set music=", followed by the file path to the music file.  The file must be in an mp3 format, and the file path assumes you are starting in the "Swamp/sounds/" sub folder.  There are no spaces before or after the equals sign.

set music=Music\Lastman.mp3

Swamp maps use zones to describe things about the world.  With a specific script you can change the description of a zone as the player is playing.  The hardest part is knowing what zone ID number you need, so I've added a way to output a zone to help you as you design.  Reading off the zone is really only good for the person creating the campaign, and I recommend removing the command before handing it out to other players to play.  To have a zone read off, start with "say zone id=", followed by the zone number.  There are no spaces before or after the equals sign.  To find the exact zone you're looking for, you could use this command to guess and check numbers, or you could open the map file and count how many down the list your zone is.

say zone id=45

To change the description of a zone, start with "rename zone id=", the zone number, and then the new description.  There are no spaces before or after the equals sign.

rename zone id=45 An empty cabinet drawer.

To speed up the ability to find the zone you're looking for, and to know its zone id number, a command has been added that will read each zone from the map and output it into a separate file for you.  This is a command that should be removed after it is used so that players of your campaign aren't bothered by the debug message.

output zones

Swamp maps are composed of tiles.  For debugging purposes you can have the game read off information about a tile type based on its ID number.  Start with "say tile id=", followed by the tile number.  There are no spaces before or after the equals sign.  I recommend removing this command before giving your campaign out to other players, because it has no use except for helping you figure out which tile number is the one you want.

say tile id=3

Changing map tiles is a very powerful way to customize your advanture.  You can simulate doors locking behind players, windows breaking, and many other things.  Each line only changes a single tile, so complex map changes will result in many lines of code in the scripting file.  To change the tile, start with "change tile", the X and Y coordinates where you want to change (separated by a comma), a space, and the new tile type you want this spot to become.  Do not use decimals for the coordinates.

change tile 4,4 3

During some more advanced campaigns, changing individual tiles will simply not be enough.  To save an incredible amount of time, Swamp allows you to quickly copy and paste parts of the map into a new area!  Start out with "copy map", the X and Y coordinates for the top-left corner of the area you want to copy (separated by a comma), a space, the X and Y coordinates for the bottom-right corner of the area you want to copy (separated by a comma), "to", and the X and Y coordinates for the top-left corner of the new area you want the map data to be copied to (separated by a comma).  The copied map data will include all map terrain and zones, but it will not include copies of ambient sounds, items, or zombies that were in the copied area. 

copy map 75,90 100,130 to 20,20

If an advanced campaign is copying map data from outside of the normal playing area, problems can arise when zombies try to spawn in those areas.  Using the "resize map" command you are able to tell the client to only use a portion of the map as the playable area.  When the map resizes, the North and West borders will remain the same, and the South and East borders will be moved to match your new values.  Here is an example of the command.

resize map 75,50

After using this command, the actual map is exactly the same size so no data is lost.  This command now forces randomly spawned items and zombies to only spawn within these new map limits.  As an example, imagine we started with a warehouse map that was 75 by 50 tiles in size.  Because we wanted to animate walls and windows breaking, we made the map wider in a map editor so that we could put the different map pieces along the Eastern edge.  Of course we kept the original border wall around the map so players can't actually walk over there, but randomly spawning loot and zombies could normally spawn in that area we added.  So even though we're loading in a map that is 100 by 50, we use the resize map command to reduce it back to the original 75 by 50.  This keeps zombies and loot in the correct area but still allows us to copy map sections that we are storing along the side.  If this section seems confusing, don't worry!  This represents a rather advanced technique that beginning campaign developers probably won't be using.

Beacons are used to help players navigate between major locations on a map.  Traditionally beacon number 1 leads to the local safe zone, on maps that have a safe zone.  To change a beacon start with "change beacon id=", the beacon number (1 through 13), the X and Y coordinates where you want it to lead (separated by a comma), and the new description for the beacon.  Do not use decimals for the coordinates.

change beacon id=1 10,20 This is a test beacon.

After changing beacons, map tile data, and zones, some campaign developers might want to save their modified map as its own map file.  Separate map editors (CAE Jones' map editor to be more specific) already allows you to create and customize your own maps, but for a quick change to a map this might be convenient.  The saved map will be named "savedmap" and will be found in the Swamp maps folder.  The command outputs only to this file name so that people can't create campaigns that accidentally overwrite official Swamp maps.  Any new ambient sounds that you've added should be saved in the new map file, along with all terrain, zone, and beacon changes.  Items and zombies will not be saved.

Save map

During the game you can use a command to load in a brand new campaign file.  Perhaps you have made a few campaigns that all tie together with a progressing story line, or you have an introduction campaign file that lets users choose the adventure they want to load up.  Loading a new campaign will forget all of your current custom variables and events.

campaign=pyramid.txt

Some people will like the idea of loading data form other files, but they will not actually want to load up a totally separate campaign.  Using the include command, campaign designers can split their work up into a few separate files that get linked together with commands.  New code that is loaded will be added to the current code instead of starting over as a new campaign.  This will be especially useful for developers who wish to share useful pieces of code that can be easily added to other projects, such as stores, custom AI behavior, or other tools.  In some situations, the include command can be used to give SCS the use of sub procedures/functions.

include=storesystem.txt

Dire howls and Matriarch cries draw zombies into an area based on sound.  You can quietly produce the same effect to draw zombies to a particular tile.  Start with "lure", the X and Y coordinates for the location (separated by a comma), a space, and the intensity of the lure.  The intensity is the number of tiles, in a radius, that the call will travel.  Do not use decimals for the coordinates or the intensity.

lure 10,10 30

A variation on the lure command is called Area lure.  Area lure takes all zombies within a square of coordinates, and lures them to a specific location that you choose.  Start with "area lure", the X and Y coordinates for the top-left corner of the area to affect (separated by a comma), a space, the X and Y coordinates for the bottom-right corner of the area to affect (separated by a comma), a space, and the X and Y coordinates for the location you wish to lure the zombies to (separated by a comma).

area lure 12,50 30,65 100,120

If you absolutely positively want some zombies to know where the player is, reguardless of how quiet the player is being, then the "hunt" command is the key.  All zombies affected by this command will instantly know where the player is, and they'll rush off to attack it.  The effect will eventually wear off, but it takes long enough that the zombies should reach the player first.  Start with "hunt", the X and Y coordinates for the location (separated by a comma), a space, and the radius of the effect.  The radius determins how large of an area will be affected by the "hunt" command.  Do not use decimals for the coordinates or the radius.

hunt 50,30 25

At some point you will want to end your campaign and reward the player with a victory message.  The command works almost exactly how the "say" command works, except the player will be taken to the main menu without the option to continue playing the campaign.  There is no sound played when this command is read, so if you want a sound to be played you will need to use a separate command.  Start with "victory=", followed by the message that will be read.  There are no spaces before or after the equals sign.

Victory=You have won!  Excellent work soldier.

As you might imagine, the "victory" command could just as easily be used as a defeat message since there is no actual sound played to go with it.  As an alternative you may use the "defeat" or the "draw" commands, which do exactly the same thing as the "victory" command.  There is literally no difference except your own personal preference.  Each of these 3 commands reads the message and prevents the player from continuing in the campaign.

Defeat=You lose!
Draw=Thank you helping to test this campaign, the rest will be worked on later.  To be continued.

Ending the campaign with the "defeat" command might not be the effect you are aiming for.  With a single command you can choose to kill the player instantly.  Here is the command.

kill player

To hurt the player, start with "hurt player=", and then the amount of health you wish to take away.  Hurting the player in this way will not make any sound to alert the player that they have been injured.  If the player's health lowers to zero with this command, then the player will be killed.  There are no spaces before or after the equals sign.  Do not use a decimal for the value.

hurt player=10

To heal the player, start with "heal player=", and then the amount of health you wish to add.  Healing the player in this way will not make any sound to alert the player that they have been restored.  This command will not raise the player's health above their maximum health.  There are no spaces before or after the equals sign.  Do not use a decimal for the value.

heal player=20

To set the player's health to a certain amount, start with "set player hp=", and then the amount of health you want them to have.  If this command attempts to raise the player's health above their maximum health, the player will end up with their maximum health.  There are no spaces before or after the equals sign.  Do not use a decimal for the value.  

set player hp=95

During the course of designing or debugging your campaign, it can be useful for the author to become both invisible and invincible.  This allows you to move around to observe the zombies' behavior without them being drawn to you.  The commands to turn on and off this ability are the following.

god mode
mortal mode

With a single command you are able to instantly kill zombies within a coordinate range.  Start with "kill zombie", the X and Y coordinates for the top-left corner of the area (separated by a comma), and the X and Y coordinates for the bottom-right corner of the area (separated by a comma), a space, and the type of zombies you wish to kill.  In the following example, every stalker within the coordinates will be killed.  Do not use decimals for the coordinates.

kill zombie 10,10,40,40 stalker

If you want to inflict damage on the zombies instead of instantly killing them, this can also be accomplished.  Start with "hurt zombie", the minimum damage you want to cause, a space, the maximum damage you want to cause, a space, the X and Y coordinates for the top-left corner of the area (separated by a comma), and the X and Y coordinates for the bottom-right corner of the area (separated by a comma), a space, and the type of zombies you wish to kill.  Do not use decimals for the damage amounts or the coordinates.  The actual damage caused to the zombie will be randomly chosen between the minimum and maximum damage, so if you want an exact damage just set the minimum and maximum to the same number.  If the command injures multiple zombies, each zombie will be affected by random damage, so it will not be exactly the same for each one.  The following example will deal between 5 and 15 damage to any canine zombies within the coordinates.

hurt zombie 5 15 0,0,100,100 canine

These are the choices you can use for the zombie kill or hurt commands:
Any - This will not hurt/kill allies or guards, only zombies.
Normal
Canine
Giant
Tyrant
Stalker
Matriarch
Reaper
Lamprey
Dire
Amorphous
Raider
Guard
Ally

Computer controlled players, referred to as Allies, can be added to your campaign to help tell a story, to reinforce the player, or even to serve as a person to be rescued or escorted somewhere.  Allies can be killed by zombies, but in most cases the zombies will prefer to go after the actual player if they can.  To add an ally, begin with "add ally spot", the amount of the item, the X and Y coordinates for the top-left corner of the spawn area (separated by a comma), the X and Y coordinates for the bottom-right corner of the spawn area (separated by a comma), "name=", the name you wish to give to the ally, "gun=", and the exact name for one of the Swamp weapons.  You can turn the spawning area into an exact spot if you just set both sets of coordinates to the same spot.  Don't use decimals with the coordinates.  There are no spaces before or after either equals sign.  There is a single space before the word "name", and also a single space before the word "gun".  When naming your ally, remember to keep it short enough that it won't annoy the player to hear it read throughout the campaign.

add Ally spot 14,10,14,10 name=Jeremy gun=MP5

When an ally is created it is assigned a voice randomly.  To manually choose a voice for your ally, start with "set ally voice", the ally's name, "=", and the number for the voice.  There are no spaces before or after the equals sign.  The voice numbers are the same as the folder names for the different voices.

set ally voice Fred=7

By default, all allies have a movement speed of 30.  This causes them to run approximately the same speed as a human player that is not using any points toward running speed.  To manually choose a different speed, start with "set ally speed", the ally's name, "=", and the new speed.  There are no spaces before or after the equals sign.  Do not use decimals for the speed value.  Increasing or decreasing the ally's speed by too much could cause strange behavior or even errors.  It is highly recommended that you do not use any speed value below 10 or above 50, unless you have done so in the past and did not experience any problems.

set ally speed John=35

By default, all allies start out with instructions to stand still in the spot they spawned.  You have a few options to choose how the ally will behave.  Start out with "set ally mission", the ally's name, "=", and then the new behavior word.  There are no spaces before or after the equals sign.  The available behavior words are "Stop", "Follow", "Go", and "Wander".  "Stop" is the default behavior which tells the ally to stand still even if it has a destination it wants to travel to.  "Follow" instructs the ally to follow the player to the best of its ability.  "Go" tells the ally it is allowed to move, but only to move to its destination coordinates.  Once it arrives at those coordinates it will wait there until it is given a new destination.  "Wander" tells the ally to wander freely just like zombies tend to do.

set ally mission fred=wander

By default, all allies start off being obedient to the player.  If an obedient ally is close by, the player can use voice commands to alter the behavior of that ally.  Using the voice command for "follow me" will set that ally with the "Follow" behavior.  Using the voice command for "stay here" will set the ally's behavior to "Stop".  These 2 commands give the player a chance to stop an ally, clear or scout the area ahead, and then call for the ally to continue following.  This is especially useful in rescue style campaigns where you must keep the ally alive.

Allies that are not set to be obedient will simply ignore voice messages sent by the player.  This gives the campaign script full control over the ally.  To set the obedient setting of an ally, start out with "set ally obey", the ally's name, "=", and either "yes" or "no".  There are no spaces before or after the equals sign.  Selecting "yes" means that the ally will obey the player, and "no" means they will only follow commands given in the campaign script.

set ally obey Jeremy=no

By default, all allies start out with aggression level set to "none".  You have a few options to choose how the ally will behave.  Start out with "set ally aggression", the ally's name, "=", and then the new aggression word.  There are no spaces before or after the equals sign.  The available aggression words are "None", "Some", and "Full".  "None" prevents the ally from ever attacking zombies, "Some" will make the ally attack any zombies that attack it first, and "Full" will cause them to behave like most players and fight any zombies that come within range.

set ally aggression fred=full

A freshly created ally will begin with their weapon loaded with 1 full clip of ammunition.  Once that ammo runs out, they have nothing.  To give your ally reserve ammo, start out with "set ally ammo", the ally's name, "=", and the amount of ammo you want to give them.  There are no spaces before or after the equals sign.  Do not use decimals for the ammo amount.  You do not have to specify the type of ammo because it will automatically become the correct type for the weapon the ally was assigned.

set ally ammo Jeremy=60

At times you will want your newly created ally to have an empty weapon.  You can manually set how many bullets are loaded in their weapon.  Start out with "set ally clip", the ally's name, "=", and the amount of ammo you want to give them.  There are no spaces before or after the equals sign.  Do not use decimals for the ammo amount.  You are allowed to enter a larger value than a weapon normally holds, if that's what you want to do.

set ally clip Jeremy=0

Ally awareness is a rating for how quickly an ally will identify a new target as zombies are approaching.  If set to the best level, the ally will almost instantly begin aiming and firing at the next zombie.  This makes the ally more useful in combat but it does lower game performance as more computer resources are used by the AI.  Besides helping game performance, making the ally less aware helps simulate real players who would need a few moments to notice and aim at the next incoming zombie.  Start out with "set ally awareness", the ally's name, "=", and the awareness value you want to give them.  There are no spaces before or after the equals sign.  Do not use decimals for the ammo amount.  The default value is 12.  Lowering the value makes the ally faster and choosing a new target to attack, with zero being the fastest.  Raising the value make the ally slower at deciding what to shoot, but this also improves game performance.

set ally awareness Jeremy=12

Aim is the accuracy of the allies whenever they fire a shot.  Excellent snipers would only be a fraction of a degree off, when firing at a distant target.  Firing a weapon at a close range target could be 2 or 3 degrees off and still hit the zombie with each shot.  The aim value for your ally is the maximum number of degrees their shot will sway to the right or left.  Start out with "set ally aim", the ally's name, "=", and the aim value.  There are no spaces before or after the equals sign.  Do not use decimals for the aim amount.  The default value is 6 for allies you create.  Lowing the value improves the accuracy of the ally and raising the value lowers it.  If your ally is supposed to be a soldier, the default 6 might fit quite well.  If the ally is a trained sniper you might want to lower the value below 6, and a civilian might be higher than 6.

set ally aim Bill=6

Shot delay is a random pause between shots as an ally fires at a target.  Some people fire off shots from their weapons as quickly as the gun allows, but most people pause for a moment to adjust their aim or to listen for signs that the zombie has been killed.  Start out with "set ally shot delay", the ally's name, "=", and the delay value.  There are no spaces before or after the equals sign.  Do not use decimals for the delay amount.  The default value is 15 for allies you create.  Lowering the value will cause your ally to rattle off his shots closer together, while raising the value puts a potentially larger pause between them.  The lowest this value can go is zero, which makes the ally fire each shot as quickly as the weapon will allow.

set ally shot delay Aprone=15

At times you will want your ally characters to play sound effects or speak phrases.  The "ally sound" command works just like the "play sound" command except it will cause the sound to come from the ally's current location.  Start with "ally sound", the ally's name, "=", and the file path.  The file path already starts in the "/sounds/" folder of Swamp, so you will need to specify which sub folder your sound can be found in.  There are no spaces before or after the equals sign.

ally sound fred=voices\1\medic.wav

Allies can be instantly jumped to any point on the map.  Start with "set ally jump", the X and Y coordinates for the location (separated by a comma), a space, and the ally's name.  Do not use decimals in the coordinates.

set ally jump 18,24 Aprone

Movement commands can be given to allies.  Start with "set ally go", the X and Y coordinates for the location (separated by a comma), a space, and the ally's name.  Do not use decimals in the coordinates.  If the ally's behavior has been set to follow the player, then the movement command will quickly be forgotten and the ally will continue to follow the player.  If the ally's behavior is set to stand still, the ally will ignore the movement command until you set its behavior to either "go" or "wander".

set ally go 18,24 Jeremy

Half of the scripts we've covered don't seem to be very useful at the very beginning of the campaign, so this is where events come in handy.  Normally you can have blank lines or comments in your campaign file, but events require 2 lines that have no such extra stuff between them.  The basic idea is that the first line determins what kind of event you are creating, and the following line is the campaign code you want to have happen once that event comes true in the game.  For example you could have a player level up once they reach some location on the map, a certain sound play once they pick up some special item, or a swarm of zombies to spawn once a player walks out the front door of a building.  By repeating event codes you can have multiple lines of code all execute at the same time.

The first event type happens once a player walks into a coordinate range you set.  Start with "location event", the X and Y coordinates for the top-left corner of the area (separated by a comma), and the X and Y coordinates for the bottom-right corner of the area (separated by a comma).  Do not use decimals for the coordinates.  Remember that the very next line should be a normal script command that will happen once the player has walked to that portion of the map.

location event 3,3,10,10
say=You have walked to the top-left corner of the map.

As an important tip, avoid creating location events that do not have at least 1 tile range in both the X and the Y coordinates.  If you specify only a single X value, for example, then the event is unlikely to ever trigger since the player is unlikely to ever land on that exact X value.  Even if the game says the player is at that X coordinate, remember that the game rounds the decimal and you are probably not exactly on that number.  If you keep your location event with at least 1 square tile of an area, then players will be able to walk into it without any problems.

The second event type is a Zone 1 event.  This also works by location but it uses the zones of the map instead of the coordinates.  An example of a zone 1 location could be the "snack aisle" in a store.  Start with "zone1 event" followed by the exact name of the zone.  Make sure you match the zone name exactly how it is in the map file!  If the capitals are different then it will not work.  While it seems like capitals should be ignored to make this easier, there are situations when changing capitals is done intentionally so that you can do more with events.  For example consider needing an event to happen once a player reaches the "checkout counter" of a store, but 5 other stores exist on your map that also have "checkout counter" zones.  You don't want the event to happen in the wrong store so you could simply choose to capitalize the "C" for one of the stores but not for the others.  This lets the game read them the same while allowing you to customize them enough that events will treat them differently.

zone1 event Jackson street

The third event type is almost identical to the second.  Zone 2 events use the alternative zone information from the map.  An example of a zone 2 location would be the "Kai mart" which is a large overview of an area, and not a specific spot inside of the Kai mart.  Start with "zone2 event" followed by the exact name of the zone.  Make sure you match the zone name exactly how it is in the map file!

zone2 event Kai Mart

The fourth type of event is the item pickup event.  This event occurs when a player picks up an item with the same name.  Start with "pickup event" followed by the exact item name.  You can use standard item names, such as the weapons we're all used to, or you can use the names for custom items you've placed yourself.

pickup event AA12

The fifth type of event is a zombie counter event.  This triggers once the total number of zombies has dropped to (or below) a certain number.  This event will not work if you have zombie respawn enabled because the total number of zombies will not actually go down as they get killed.  Start with "zombie event=" followed by the number of zombies.  There are no spaces before or after the equals sign.

zombie event=14

As an important tip to remember, guards will count toward the zombie count of the map.  If you have added 2 guards and wanted to have some event occur once there were only 10 zombies left, you would use zombie event=12.

I'll take a quick break in events to explain the campaign timer.  The campaign timer allows you to set an event to happen after a certain amount of minutes or seconds.  Rather than beginning the timer automatically, you have to enable it yourself.  This actually gives you the freedom to only activate it after some other event, or to simply not use it at all.  To enable the timer, here is the code.

start timer

The amount of process power it requires is not even worth mentioning, but I did add in a command to disable the timer as well so that it won't be running after you're finished using it in your campaign.  Here is the code to stop the timer.  Stopping the timer sets it back to zero minutes and zero seconds.

stop timer

You can pause the timer so that it will stop, but will not lose track of the time that already went by.  This is the command.  Use the "start timer" command to unpause the timer when you are ready.

pause timer

You can manually set a time into the timer if you wish.  Setting a time into the timer will not enable the timer for you, you will still have to use the "start timer" command for that.  Start out with "Set timer M=", the number of minutes, a space, "S=", and the number of seconds.  There are no spaces before or after the equals signs.  Do not use decimals for the values.

set timer m=2 s=56

The sixth type of event is the timer event.  Start with "time event m=", the number of minutes, " s=", and finally the number of seconds.  There is no space before or after either equals sign.  There is a space before "S=".  Do not use decimals for either value, and be sure to put at least something for each spot, even if it is just a zero.

time event m=4 s=30

If you find yourself in need of more than 1 timer, you are allowed to use up to 10.  The 3 timer commands and the timer event we just covered are all meant for timer 1 by default.  You can simply include the timer number (1 through 10) after the word "timer" to access the rest of the timers.  Even though you can leave off any extra numbers to default back to timer number 1, you can also choose to include the "1" if you like.  Here are examples of all 4 timer commands set to use timer number 7.

start timer7
stop timer7
pause timer7
set timer7 m=4 s=0

If you have done any work with events, you may have noticed that they only trigger once.  For example, if you have a message speak once the player walks to a certain place, that message will only be read once.  This is because events have a certain life span, and by default that life span is a single use.  You can alter your events to have a specific number, or even an infinite number of uses.  You begin your event line by putting a "+", the number of uses, and another "+".  Then type your event line as normal, without putting in any extra spaces.  Here is an example of a location event that will happen 3 times.  Each time it will teleport the player to a spot on the map.

+3+location event 0,0,8,8
jump to 15,15

If you want the event to happen an infinite number of times, enter the number -1, like this.

+-1+location event 0,0,8,8
jump to 15,15

As an important tip, be careful when using infinite event lifespans.  Imagine an infinite location event that doesn't move the player out of the actual location!  The player would still be standing in the same spot so the event would keep triggering over and over forever, which would likely cause the game to freeze.

As a more advanced way to handle your events, block events can be used.  Block events are a way of having a single event line run multiple script lines.  If you wish to use them, add the word "block " in front of your event line.  You absolutely must add the line "end event" at the end of your block though, or it will error and have odd results.  You must also avoid using any comments or blank lines within your block.  Here is an example of a location event that will do 4 different things when the player walks into the correct area.

block location event 0,0,8,8
say=The portal opens and you have been sent to the space station.
level up
quest=Explore the space station.
jump to 15,15
end event

When using block events, be mindful of the order you put the commands in.  In the example that was just given, I made sure to do everything else before I used the "jump to" command to move the player.  If the player had been moved right away, it might not have finished executing the commands because the player would no longer be in the correct location for the event.

Block events can still have their lifespans increased like normal.  Just add the lifespan command to the beginning of the event, while being sure you do not put any unnecessary spaces between the "+" and the word "block".  Here is an example of a block pickup event that will happen a maximum of 2 times.

+2+block Pickup event Vulcan Minigun
say=You've found a rare and powerful weapon!
level up
end event

Swamp campaign scripts allow you to create, and use, up to 100 custom variables.  These variables can be set and modified by events, and then later you can use them to form multi conditional events.  To create a new variable start with "new var", followed by the name you wish to use, "=", and then the number value this variable will start out holding.  The name can be anything you wish as long as it does not contain spaces.  Do not put any spaces before or after the equals sign.  Do not use a decimal as the starting value.

new var escapedfactory=0

Once a variable exists, you can set it to a new value if you wish.  Start with "set var", the variable name, "=", and the new value.  Do not put any spaces before or after the equals sign.  Do not use a decimal for the new value.  Don't worry about matching capitals with your variable name.  Swamp will know that it is the same variable even if the capitals are different.

set var escapedfactory=5

You can add or subtract from your custom variables when needed.  This could be used to add up points as the player collects special items, count down each time a player travels through some special portal, or any other way that I'm just not thinking of at the moment.  Start with "add", the variable name, "by", and the number to add to the variable.  You can use a negative number if you want to subtract instead, but the command will still begin with the word "add".  There is a space between the word "add" and the variable name, and there is a space before and after the word "by".  Do not use a decimal for the value to be added.

add taco by 12

In addition to adding numbers to your custom variables, you can also add 2 custom variables together.  Just use the variable name where you would have put the number.  In this example, taco becomes equal to itself plus the value of the variable potato.  If taco started out with 10, and potato started out with 5, then after this command taco will have a value of 15 and potato will be unchanged.

add taco by potato

You can use the "add" command to subtract if you are adding a negative number to it, but this trick will not work if you intend to subtract one variable from another.  For that situation, there is also a "subtract" command.  Start with "subtract", the variable name, "by", and the number to subtract from the variable.  There is a space between the word "subtract" and the variable name, and there is a space before and after the word "by".  Do not use a decimal for the value to be subtracted.

subtract lumber by cost

The seventh type of event deals with custom variables being compaired to values or to other variables.  Start out with "var event", then the variable name, then the comparison sign, then the value you want to compare it to.  The comparison signs are "<" for less than, "=" for equals, ">" for greater than, "<=" for less than or equal to, "<>" for not equal to, and ">=" for greater than or equal to.  Var events will only trigger when a variable is set or changed by using the "set var" or "add var" commands.  Here are 6 examples.  The first event occurs once the variable taco is less then 4, the next occurs once taco is equal to 4, the third occurs once taco is greater than 4, the fourth either less than or equal to 4, fifth is not equal to 4, and the last is greater than or equal to 4.  There are no spaces before or after the comparison sign.

var event taco<4
var event taco=4
var event taco>4
var event taco<=4
var event taco<>4
var event taco>=4

Instead of using a specific number, you can use the name of another variable.  Here is an example of an event that occurs when the variables taco and bacon both match each other's value.

var event taco=bacon

The eighth event type triggers when zombies are killed.  You can specify which type of zombie death will cause the event to trigger, or you can set it to happen regardless of the type of zombie that was killed.  Begin by typing "kill event=", followed by the word "any", or the name of the type of zombie.  There are no spaces before or after the equals sign.  Capitals do not matter for the zombie type.

kill event=dire

The ninth event type deals with user typed messages.  During the campaign a player can press / and type, similar to typing messages in multiplayer.  A chat event allows you to run scripts as the player types messages.  Start out with "chat event=" followed by the message they must type.  There are no spaces before or after the equals sign.  Capitals do not matter with the message and the event will still trigger even if the player's message has capitals differently than yours.

chat event=testing

A similar but different chat event is called the chat contains event.  This event will only trigger if the message the player types contains a certain word or words.  In this example, the event will trigger if the typed message contains the word "home", even if their typed message was something such as "There is no place like home".

chat contains event=home

The tenth event deals with custom variables, but allows for 2 separate comparisons.  In double var events, each variable can only be compaired to an actual value (not another variable), and greater-than and less-than comparisons are not allowed.  Start with "double var event", the first variable name, "=", the value, a space, the second variable name, "=", and the second value.  There are no spaces before or after either equals sign.  Do not use decimals for the values.  The event will trigger once both variables match the values you entered.  Double Var events will only trigger when a variable is set or changed by using the "set var" or "add var" commands.

double var event taco=2 and bacon=4

The eleventh event type occurs when the player uses the Shift+Q key combination within the game.  In multiplayer that normally reads off the amount of diesel fuel or crates the player has.  The "ShiftQ event" includes within it the power of the "var event" as well.  The player must press Shift and Q, but a variable must also meet the greater than, less than, or equals to condition in order for the event to trigger.  Start out with "shiftQ event", then the variable name, the comparison sign, and the second value.  The comparison signs are "<" for less than, "=" for equals, ">" for greater than, "<=" for less than or equal to, "<>" for not equal to, and ">=" for greater than or equal to.  You may not use the built-in variables, but standard numbers and your custom variables will work just fine.  There are no spaces before or after the comparison sign.

shiftq event taco>1

The twelfth event type is nearly identical to the "shiftq event" but occurs when the player presses enter within the game.  The "enter event" includes within it the power of the "var event" as well.  The player must press enter, but a variable must also meet the greater than, less than, or equals to condition in order for the event to trigger.  Start out with "enter event", then the variable name, the comparison sign, and the second value.  The comparison signs are "<" for less than, "=" for equals, ">" for greater than, "<=" for less than or equal to, "<>" for not equal to, and ">=" for greater than or equal to.  You may not use the built-in variables, but standard numbers and your custom variables will work just fine.  There are no spaces before or after the comparison sign.

enter event power=45

The thirteenth type of event is the item donate event.  This event occurs when a player donates an item, with the same name, to a safe zone.  Start with "donate event" followed by the exact item name.  You can use standard item names, such as the weapons we're all used to, or you can use the names for custom items you've placed yourself.

donate event Chainsaw

The fourteenth type of event (I number them because it helps me remember) triggers when the player fires a certain weapon.  This might be useful if you want a gun to break after they've fired 10 shots, or to let them shatter a window by swinging their axe.  Start with "fire event" followed by the weapon name.  Normally you have to be extra careful with item names to be sure the spelling and case are exact, but in this event the game will understand even if you leave all of the letters lowercase.

fire event axe

The fifteenth type of event triggers when the player is killed.  Most players realize they have lost when some zombies chew them to pieces, but you may wish to run commands anyway.

death event

Allies tend to be stuffed with delicious brains, just like the player, so from time to time they will be killed by zombies.  The "ally death" event triggers when this happens.  Start with "ally death event", a space, and the name of the ally.

ally death event Ryan

The location event is very useful in running commands as the player moves around the map.  The movements of allies can be tracked as well.  Start with "ally location event", the X and Y coordinates for the top-left corner of the area (separated by a comma), the X and Y coordinates for the bottom-right corner of the area (separated by a comma), a space, and the name of the ally this event applies to.  Do not use decimals for the coordinates.

ally location event 3,3,10,10 fred

The nineteenth event type is a merger between the location event and the enter event.  Location enter events trigger only when the player presses enter within the appropriate range of coordinates.  Start with "location enter event", the X and Y coordinates for the top-left corner of the area (separated by a comma), and the X and Y coordinates for the bottom-right corner of the area (separated by a comma).  Do not use decimals for the coordinates.

location enter event 0,0,6,6

The twentieth event type is a merger between the location event and the shift+Q event.  Location enter events trigger only when the player presses shift+Q within the appropriate range of coordinates.  Start with "location shiftq event", the X and Y coordinates for the top-left corner of the area (separated by a comma), and the X and Y coordinates for the bottom-right corner of the area (separated by a comma).  Do not use decimals for the coordinates.

location shiftq event 20,30,26,36

As a rather advanced event type, you are able to trigger an event when a player's fired bullet impacts a wall at a certain location.  This can be used to simulate breaking windows, a door lock being shot off, or puncturing the wall of a ginger bread space ship thus sucking the player out into the vacuum of space.  Start with "location impact event", the X and Y coordinates for the top-left corner of the area (separated by a comma), and the X and Y coordinates for the bottom-right corner of the area (separated by a comma).  This will trigger if a wall within those coordinates is shot with a bullet, arrow, or struck with a melee weapon.

location impact event 14,14,45,45

You are also able to trigger an event when a player's fired bullet impacts a wall at a certain zone.  This is a lot less stable than using coordinates, but it has been included into the SCS language for those willing to use it.  Depending on the way zones have been placed on the map, this can work perfectly or simply not work at all.  You would have to test it first to find out which it will be.  Start with "zone1 impact event", and then the exact zone name you wish to use.  Make sure the spelling and capitals exactly match the zone in the map file.

zone1 impact event Behind the Gas Station

For impacts on the secondary zone, just change "zone1" to "zone2" like this.

zone2 impact event Gas Station

During the course of a campaign it can be necessary to actually move the coordinates of your location events.  This is considered an advanced technique, but "location", "ally location", "location enter", "location shiftq", and "location impact" events can have their coordinate boundaries changed.  Each of these follows the same pattern, so the original "location event" will be used in this example.  Start with "move location event", the original X and Y coordinates for the top-left corner of the area (separated by a comma), the original X and Y coordinates for the bottom-right corner of the area (separated by a comma), a space, the new X and Y coordinates for the top-left corner of the area (separated by a comma), and the new X and Y coordinates for the bottom-right corner of the area (separated by a comma).  Do not use decimals for the coordinates.  Make sure you use the correct original coordinates because the command looks for an exact match to know which location event it is supposed to be changing.

move location event 20,0,25,6 0,0,4,4

Here are examples of the other move commands.

move ally location event 20,0,25,6 0,0,4,4
move location enter event 20,0,25,6 0,0,4,4
move location shiftq event 20,0,25,6 0,0,4,4
move location impact event 20,0,25,6 0,0,4,4

The use of custom variables can increase the power of nearly every command that has been mentioned so far.  Variables can be used to customize messages or to let your campaign script adjust itself to fit the situations.  Here are a few examples.

With the exception of the "var event", "double var event", "shiftq event", and "Enter event", you can substitute numbers with the custom variables you have created.

set var difficulty=15
add random dire=difficulty

When being used in a situation that involves a typed message (such as "say", "quest", "beacon", and "zones"), you will need to surround your custom variable with brackets.  This is how Swamp will know that it is a variable and not just another normal word in your sentence.

set var rockets=3
quest=Collect [rockets] more rockets and bring them to the base.

In addition to the custom variables you create for yourself, Swamp campaign script (SCS) allows you to use built-in variables.  The built-in variables will always be inside of brackets, even if you are using them in places that are not typed messages.  The following example would display a personalized message containing the player's name, and then it would use a custom variable to inform them of their current progress on some type of mission.  The custom variable must be within brackets because it is being used in a typed message.

say=Excellent work [player.name].  You have collected [score] diamonds.

In commands and events that are not typed messages, custom variables no longer need brackets but the built-in variables always do.  This command lures zombies to the player's exact coordinates, using a radius that is a custom variable.  (A list of the built-in variables can be found at the end of this guide.)

lure [player.x],[player.y] lurepower

When debugging your campaign script, it can sometimes be useful to have the script completely stop, and give you information about the current state of your variables.  The debug command will use a windows message box to display a message.  The script, and the Swamp client, both pause until you press enter to continue.  Your variables can be included in the messages, by surrounding them in brackets, just like the other commands that use typed messages.

debug=Taco is [taco].

Reading from the player's inventory can be an easy way to track their progress as they gather items from the map.  If you supply the item name the "item count" command will count how many the player has, and will store it in the custom variable of your choosing.  Start with "item count", the name of your custom variable, "=", and the exact item name.  There are no spaces before or after the equals sign.

item count temp=vulcan minigun

Counting zombies works very similar to counting items in the player's inventory.  You are able to specify coordinates to check within, and also specify which type of zombies you want to count.  The results are stored in the custom variable of your choice.  Start with "zombie count", the X and Y coordinates for the top-left corner of the area (separated by a comma), and the X and Y coordinates for the bottom-right corner of the area (separated by a comma), the name of your custom variable, "=", and the type of zombie you wish to count.  Do not use decimals for the coordinates.

zombie count 0,0,30,30 taco=ANY

These are the choices you can use for the zombie count command:
Any - This will also count guards and allies.
Normal
Canine
Giant
Tyrant
Stalker
Matriarch
Reaper
Lamprey
Dire
Amorphous
Raider
Guard
Ally

Random number can add variety to your campaign, and prevent players from simply memorizing everything that will happen.  Creating random numbers works similar to including custom variables in your commands and events.  The random command has parts to it that must be filled in, but remember that it is not actually a command or an event of its own.  It is used in place of a number or a variable.  Start with "[random/", the minimum value of your random number, "/", the maximum value of your random number, and "]".  There are no spaces anywhere in the command.  Do not use decimals for any of the values.  In the following examples, the random number will be used in a few commands you are already familiar with.  The first takes a custom variable, that I named dice, and stores a random number in it between 1 and 6.

set var dice=[random/1/6]

This next example takes my custom variable taco, and adds a random number that could be as low as -5, or as high as 5.

add taco by [random/-5/5]

The minimum and maximum values for your random command can even be variables themselves!  They can not, however, be other random commands.  Each of these 3 examples shows a different way that variables can be included directly into the random number generator.

set var taco=[random/potato/25]
set var hurt=[random/1/[player.hp]]
set var car=[random/[player.level]/[total.zombies]]

When an event triggers, normally each line of code within it will be executed.  A single line if it is a normal event, or all of the lines inside, if it is a block event.  You won't always want each line of code to execute, so you can use the optional "IF THEN" condition on your statements.  Start with "If", the variable name, comparison symbol, "Then", a space, and then your normal script command.  There is no space before or after the comparison symbol.  Using "IF THEN" conditions is only meant for commands, and not for events.  The comparison signs are "<" for less than, "=" for equals, ">" for greater than, "<=" for less than or equal to, "<>" for not equal to, and ">=" for greater than or equal to.  In this situation, the message "Hello!" will only be displayed if the variable taco is equal to 1.  If taco does not equal 1 then the line will simply be skipped, but the event itself will still lose 1 life span.  "IF THEN" conditions work with standard values, custom variables, and the built in variables.

if taco=1 then say=HELLO!

You can group multiple sets of "IF THEN" on the same line to require multiple conditions to be met.  Many languages use the term "AND" or "&&", but in SCS you use the same "IF THEN" directly following the last "IF THEN".  The following example will only say the message if Taco equals 1 and Fred is less than 4.

if taco=1 then if fred<4 then say=This works!

We've covered how to use "IF THEN" conditions to stop certain lines from executing.  Events can also be limited by using a "WHILE AND" condition.  Begin your event with "While", then your variable name, the comparison sign, the value to compare to, the word "And", and the normal event command as usual.  You can not use the built-in variables at this time, but custom variables do work.  There are no spaces before or after the comparison sign.  The comparison signs are "<" for less than, "=" for equals, ">" for greater than, "<=" for less than or equal to, "<>" for not equal to, and ">=" for greater than or equal to.

while taco>3 and chat event=Fire

When stringing together life cycle settings, block conditions, and "While And" conditions to your events, it is important to put them in the proper order.  The following example demonstrates a block event, with unlimited lifespan, and a "While And" condition so that it only triggers if the variable potato equals 1.  Always start out with the lifespan code (if desired), follow with block (if desired), then any "while and" condition before finishing up with the event itself.

+-1+block while potato=1 and location event 0,0,6,6
say=Hello.
end event

Storing strings (or text) into custom variables can be useful, but it should be considered a more advanced way to use the variables.  If numbers can be used to get the job done, then I recommend using normal numbers rather than text.  As time goes on I'll try to improve support for string variables, but for now, use them at your own risk.  LOL!  When using strings (text), you absolutely must surround your words with quotation marks so that the client knows you are typing words and not the names for custom variable.  Here is an example showing various ways that text can be stored and used within custom variables.  Two variables are created and set to hold text, notice that there are quotes around the words.  The enter event compares a variable to a string of text before it will trigger, and once it does trigger it sets taco to become the message "I am Aprone".  Finally a var event triggers once the variables taco and potato are equal to each other, showing that the equals sign is able to compare messages the same as it would normally compare numbers.

new var taco="Jeremy Kaldobsky"
new var potato="I am Aprone"

enter event taco="Jeremy Kaldobsky"
set var taco="I am Aprone"

var event taco=potato
debug=Yay it works!

During multiplayer, Swamp players are used to being able to purchase items from the Safe zone stores.  Purchase might not be the correct word since the story explains they are lending out weapons based on how much they trust you with them, but in essence it is a store.  You can create your own stores for your campaigns!

By default your custom store starts out empty, but if you ever wish to change your store you will need to clear it out and stock it again.  Here is the command for clearing out the current store.

clear store

By default the store will be referred to as the Safe Zone, because in multiplayer the Safe zones are where players encounter stores.  You can change the name of the store, which will change how it is referred to in the menu options.  Start with "Store name=" and the new name for the store.  Changing the name has very little effect, but players who review back through their messages might normally see "Safe zone menu" when it is not appropriate, if you do not set your own custom name.

store name=Fish market

To stock your store with items, start out with "store item", the exact name of your item, a comma, the number of this item you get whey you buy it, a comma, the store price, a comma, the sell price that the store will pay you for donating, a comma, and finally the accepted value.  The accepted value is 0 or 1, where zero means the store will not buy this item from you and 1 means it will.  There are no spaces before or after the commas.  Do not use decimals for any of the values.

store item MP5,1,50,25,1

Here are examples for all of the normal ammunition types, with the correct amounts and prices filled in:

store item 9mm ammo,20,24,12,1
store item Shotgun shells,12,24,12,1
store item .30 calibur,20,24,12,1
store item 5.56mm ammo,20,30,15,1
store item 7.62mm ammo,20,80,40,1
store item Gas,60,60,30,1
store item .45 ACP ammo,20,24,12,1
store item Arrows,2,2,1,1

Your current store will always be accessible by pressing enter in a Safe zone, but at times you will want to put stores in other locations.  When this command is executed, the player will find themselves in your custom store.  This command can be put into a location enter event if you want to mimic the way players access the Safe Zone store.

open store

Storytelling can be a very important part of a campaign, or sometimes a campaign just needs to present the player with a list of choices to choose from.  In a similar way to creating a custom store, you can create a custom menu.

By default your menu is empty, but if you wish to clear it at any time this is the command.

clear menu

Adding items to a menu requires 2 pieces of information.  Start with "Menu item, a space, the listing number, "=", and the message you want added.  The listing number should be 0 for normal messages that are only meant to relay information.  If you want the player to be able to press enter on something from the menu, you must supply a listing number.  Listing numbers can be anything from 1 to 99999.  There are no spaces before or after the equals sign.  Do not use a decimal for the listing number.

menu item 0=Welcome to my humble home.  My name is Potato, and as you might have guessed, my parents hated me very much.
menu item 4=You can press enter on me if you wish.

You can use a command to close down the custom menu if you wish.  This is particularlly useful if you want one of the menu choices to close down the menu automatically.

close menu

To make your menu more interactive, each menu item that has a listing number will trigger a special menu event if the player presses enter on it.  Start out with "menu event=", and the listing number.

menu event=4
say=It works!

To have the safe zone menu open for the player, this is the command. (This command essentially does the same thing as the open store command)

safezone menu

To have the skills menu open for the player, this is the command.

skills menu

To have the armor menu open for the player, this is the command.

armor menu

List of built-in variables that SCS currently supports:
[player.X] The X coordinate of the player.
[player.Y] The Y coordinate of the player.
[player.D] The direction that the player is facing.
[player.HP] The health of the player.
[player.maxhp] The maximum health of the player, based on their current level.
[player.name] The name of the player.  Be careful never to use non-numeric variables in places where a number is required.
[player.level] The level of the player.
[player.zone1] A string variable returning the name of the primary zone that the player is standing in.
[player.zone2] A string variable returning the name of the secondary zone that the player is standing in.
[player.zoneID1] Returns the ID number for the primary zone the player is standing in.  This is useful for developers who must find zone ID numbers to use in other commands.
[player.zoneID2] Returns the ID number for the secondary zone the player is standing in.
[player.shots] The total number of shots the player has fired since beginning the campaign.
[player.hits] The total number of times the player has shot a zombie since beginning the campaign.
[player.kills] The total number of kills the player has achieved since beginning the campaign.
[player.lastshot] A string variable returning the name of the last weapon the player attacked with.
[player.lastchat] A string containing the last message the user typed.
[player.xp] Returns the amount of experience points the player currently has.
[player.reputation] Returns the current amount of reputation the player has.
[total.zombies] The total number of zombies on the map.
[map.sounds] The number of ambient sounds on the map.
[map.loot] The number of loot items on the map.
[map.width] The width of the map.
[map.height] The height of the map.
[map.name] A string variable returning the file name of the map that is loaded.
[random/#/#] Becomes a random number based on the range you enter.
[timer.seconds] The total amount of time on timer number 1, displayed as seconds.
[timer.minutes] The number of minutes on timer number 1, rounded down to the last full minute.
[timer#.seconds] The total amount of time on the timer number you supply, displayed as seconds.
[timer#.minutes] The number of minutes on the timer number you supply, rounded down to the last full minute.
[deadzombie.x] This provides the X coordinate for the last zombie that was killed.  This is especially useful within the kill event.
[deadzombie.y] This provides the Y coordinate for the last zombie that was killed.  This is especially useful within the kill event.
[ally.*.x] Put the ally's name in place of the *.  This returns the X coordinate for the ally.
[ally.*.y] Put the ally's name in place of the *.  This returns the Y coordinate for the ally.
[ally.*.hp] Put the ally's name in place of the *.  This returns the current health for the ally.
[ally.*.mission] Put the ally's name in place of the *.  This returns the mission/behavior number for the ally.  0=Stop, 1=Follow, 2=Go, 3=Wander.
[ally.*.clip] Put the ally's name in place of the *.  This returns the current number of rounds the ally has loaded in his weapon.
[ally.*.ammo] Put the ally's name in place of the *.  This returns the current number of rounds the ally has in reserve.


List of current game items:
5.56mm ammo
9mm ammo
Shotgun shells
.30 calibur
Gas
7.62mm ammo
.45 ACP ammo
Riot Shield
Glock 19
Glock 17
Browning Citori
Winchester
Field kit
Med kit
MP5
Uzi
UMP45
Vector
M-1928
AR15
Benelli
Shortbow
Longbow
AA12
M240
Arrows
Leather Bracer
Small Silencer
Yukon Scope
Small Suppressor
Large Suppressor
Chainsaw
M40
M60
Vulcan Minigun
Sledgehammer
Machete
Flamethrower
Winter coat
Tattered vest
Football pads
Leather jacket
Kevlar vest
Composite armor
SWAT vest
Plate armor
Ceramic armor
Apronic vest
Ball cap
Hard hat
Bike helmet
Paintball mask
Motorcycle helmet
Football helmet
Military helmet
Riot face guard
Apronic helmet
Work jeans
Plastic shin pads
Armored leggings
Metal shin pads
Ceramic leggings
Apronic leggings
Boots
Combat boots
Motorcycle shoulder pads
Football pads
Epaulettes
Quiver
Tuxedo T-shirt
Reflective vest
Camo pants
Camo jacket
Overalls
Inflatable sheep
Adult diaper
Diesel fuel
Bunny Slippers
Running shorts
Running shoes
Sprained ankle
Broken leg
Bloody clothes