### Character Script Commands

When the player enters the room, NPCs start performing the custom behavior you designate. The scripting system is quite flexible and allows you to implement a wide variety of behaviors. There are five general classes of script commands, as follows:

1. Placement
2. Condition
3. Interaction
4. Queries
5. Decision making

Notes about using NPC scripts
Imperatives
Behaviors
Predefined vars
Examples of branching code structures
Example of a multiple choice question
How to make a new monster type
Character on tarstuff
How to make custom equipment

1. Placement - Change the NPC's location.

1. Appear - If not visible, the NPC will appear at the current square (i.e. it enters the room). This command does nothing if the NPC is already visible. If a monster or the player occupies the square it is appearing in, then the NPC will wait until the square is vacant to appear.
2. Appear at - Use this to have an invisible NPC enter the room at a designated square different from the one where the NPC is current located. After selecting this command, the room will temporarily appear. Click on a square to select where the NPC will enter the room. This command does nothing if the NPC is already visible. If a monster or the player occupies the square the NPC is to appear in, it will wait until the square becomes vacant to appear.
3. Disappear - Removes the NPC from the room, making him invisible. Use this to show an NPC leaving the room. Script commands continue to play while the character is invisible but the NPC will not physically interact with any room elements unless it Appears again.
4. Move to - The NPC will move to the indicated square (selected by clicking on a room square, as above). Optionally, one of the entity types listed in the adjacent list box may be selected as who the NPC should follow. Hold <Ctrl> while clicking to select and unselect multiple selections. Each turn, the NPC will attempt to move one square closer to its destination. It moves roughly in a straight line and won't move on a given turn if something is in its way. Enable "Forbid turning" if you don't want the monster turning to face the direction it is moving each step. Hint: If you want the NPC to move in a more complex fashion, such as following a twisting corridor, this can be accomplished with a sequence of Move to commands, one to navigate each twist in the corridor. This command finishes when the NPC arrives at the destination square. If the NPC is not visible (i.e. not in the room), movement to the destination tile is immediate. Enable "Single step" to have the NPC only attempt to make a single step toward the indicated destination before continuing to the next script command. If no move can be made, the next script command is executed immediately.
5. Move - Similar to Move to, except a relative number of tiles to move from the NPC's current location is specified. Positive numbers indicate movement south and east, and negative numbers are for moving north and west. When a cut scene is executing and the player's role is set to None, an NPC executing a Move command that would cause the NPC to exit the room causes the game to exit the room in that direction as if the player had exited it. If the NPC is not visible (i.e. not in the room), movement to the destination tile is immediate.
6. Face direction - Initially, the NPC faces the direction it is oriented when placed in the room. Use this command to turn the NPC in a different direction without moving (takes 1 turn).

2. Condition - How the NPC functions.

1. Set appearance - Changes the NPC's "Graphic" and default properties to the specified entity type.
2. Turn into monster - Turns the NPC into a regular monster of the type indicated by its graphic. This ends script execution immediately and the NPC is permanently replaced by a regular monster.
3. Imperative - Sets a special status condition on the NPC (see Imperatives). Compatible imperatives may be combined.
4. Behavior - Enables a behavior pattern for the NPC that is executed following script commands each turn. Also used to define certain attributes of the NPC's abilities (see Behaviors). Compatible behaviors may be combined.

3. Interaction - How the NPC interacts with its environment.

1. Activate item at - Activates the item at the room square you select. Items that can be activated are: orbs, pressure plates, lights and wall lights. Nothing will happen this turn if no relevant item is at the indicated square. Hint: Move the character next to orbs before striking them for more intuitive behavior. If no one is next to the orb when struck, it will appear that Beethro is using his portable orb.
2. Speech - Causes someone in the room to say something.
   Dialog text: Type the words that are said. This may be left blank in order to only play a sound effect.
   Speaker: who says the words. The text appears next to the person's figure in the room and their face appears on screen while they are speaking. Use "Custom" to have the NPC "throw its voice" to a different square in the room. If a monster or character is located at the indicated square when this command is executed, it will appear as if this monster or character is speaking. If speaker is set to "None", or the person indicated is not present in the room, then the words will appear next to the NPC.
   Mood: the face displays the indicated mood. Only supports Beethro's facial expressions.
   Speech delay: How long, in milliseconds, the speech lasts for. If placing multiple lines of speech in sequence, this determines how much time passes until the next line of speech (and corresponding speaker) is displayed. Set this value to zero to have the game engine calculate how long to wait based on the length of the speech text.
   Add sound: A sound file (Wave or Ogg Vorbis format) on disk can be optionally attached to the speech. If a sound is specified, it will play along with the text and the next speech command will be played when the sound completes. Use a non-zero speech delay to force when the next line of speech will play regardless of how long the attached sound file plays.
   Exporting speech text: A hold's entire speech script can be exported to an HTML file on disk when exporting the hold by adding the line "ExportSpeech=1" to the "[Startup]" section of Data/drod.ini.
3. Flush Speech (on/off) - Tells the game to immediately process any previously queued speech that hasn't had time to play yet. If "On" is selected, these texts will appear immediately onscreen. If "Off" is selected, then text that hasn't played yet won't show at all. Hint: This command is used for dramatic effect, to ensure speech queued after this command will be immediately spoken, as intended. This command is not needed if it doesn't matter at what point in play speech texts are delivered.
4. Ambient sound - Plays a custom sound effect, imported from a sound file on disk. Select "Loop Off" to play the sound once, and "Loop On" to play the sound repeatedly. Selecting no sound file in conjunction with this command will silence any ambient sounds playing when the command is executed.
5. Ambient sound at - Plays a custom sound effect, imported from a sound file on disk, from the room location you specify. The sound will play from the direction the sound is coming to the player in the room and will be quieter the further the player is away from that room tile. Selecting no sound file in conjunction with this command will silence any ambient sounds currently playing at the room location you specify.
6. Build - Build the specified item in the marked room region.
7. Go to level entrance - Sends the player immediately to any level entrance defined in the hold, or ends the hold. "Return to Prior Location" will return the player to the last level exit point taken, either via stairs or script. Using it again consecutively will return to the location of original use.
8. Play video - Plays a video file, imported from a video file on disk, at the specified screen coordinates. Sound tracks in video files are not supported, but sounds and music may be played concurrently with the proper script commands. Currently, only Ogg Theora video format is supported.
9. Set music - Set any of the available music themes to play. Additionally, custom music, imported from a music file on disk, may be played. Only Ogg Vorbis and Wave formats are supported. Custom music can be set to continue playing across rooms by executing this command on room entrance.
10. Player role - Indefinitely sets the player to play the role you indicate. In these roles, properties that apply to that entity type generally hold.
11. Generate entity - Creates a new entity of the specified type at room location (x,y) and the indicated orientation once that room tile is vacant. Custom NPCs with a default script defined may be created where an entity already occupies the room tile, but begins as not visible. NPCs will begin executing their default script when created.
12. Cut scene - When set, room turns will proceed automatically at the rate you specify without player intervention. Invoke this command with a rate of "0" to end the cut scene and return movement control to the player. Hint: This command is used for dramatic effect, to have NPCs do things, such as move around the room, without requiring the player to take turns to allow the NPCs to likewise move. If on a given turn no NPCs are executing, the cut scene playing will automatically terminate, restoring control to the player.
13. Answer option - Provides a multiple choice option for a Question command (see below). A label from the list of defined Label commands in the script must be selected as the point from where the script will continue execution if the user selects this choice. Up to nine answer options are supported for a given Question. Any additional options are ignored.
14. Set var - In addition to predefined variables, each hold you create contains a set of zero or more variables, named by you. Use these variables to track persistent game state information across rooms during play. To add a variable to a hold, type its name into the uppermost text box and click "Add". Variable names must begin with a letter and not contain any punctuation except underscore ('_'). To permanently remove a hold variable, select it from the list box on the left and click "Remove". Note that this removes the variable completely from the hold and all NPC scripts that use it, not just from this particular script.
    Select a hold variable from the list, choose an operation and a value. Variables may either store an integer or text. If the operation you specify is "Assign text" or "Add text", the variable you select will be set to store the text you provide. You may also reference other variables to insert into the given text. For operations dealing with numbers, if you provide the name of another variable, its value will be used (invalid names will be considered a value of 0). Otherwise, the number you provide is used. Use the text box on top to specify the text being assigned or added to the variable. For other operations, use the text box on the right to input a number or variable name. The variable will store a number.
    Using vars in text: In variable text assignments, Speech, Questions (see below), level entrance texts, and scroll text, type "$<var name>$" to insert the current value of the variable you name at this point in the text. Type "$\n$" to skip to the next line of text.
    Comprehensive variable reference list: In the Room Editor Screen, press F2 to output a comprehensive list of hold variables to the clipboard (use the paste option of your favorite text editor to view this text). This list shows all rooms and NPC (x,y) locations where the variable is referenced in a script throughout the hold. A number after the (x,y) location of the script indicates how many times the variable is referenced in that script.
    Monitoring variables during play: Press Ctrl-F7 while playing to turn on and off the variable monitor. Whenever a script changes a hold variable, you will be notified onscreen. This only works while playtesting, playing a hold you authored, or playing a CaravelNet hold in beta.
15. Each attack - Each time the NPC attacks, jump the script to the indicated Label.
16. Each defend - Each time the NPC is hit, jump the script to the indicated Label.
17. Each use - (Custom equipment scripts only) Each time this equipment is activated by the player, jump the script to the indicated Label.
18. Equipment - Modifies the player's indicated equipment slot. Trade: set the specified custom NPC as a custom item. Any equipment the player is carrying in that slot is dropped in the room, if this action will not destroy an incompatible item at the player's current location. The custom equipment begins functioning as a global script until the player acquires a different item. Destroy: Removes any item from the indicated equipment slot. Sell: Gives the player the monetary value of the indicated equipment and destroys it. Non-custom equipment has no sell value. Disable: Indefinitely remove the use of the indicated equipment type. Enable: Reenable a disabled equipment type. Activating a custom inventory item will execute its scripted "EachUse" code segment, if defined. When the "Command" type is selected, it initiates a unique global default script that runs during play. The player may invoke this command script using the "Special" command, which executes this scripts "EachUse" block, if defined. Hint: use this to enable special any-time events like warping to an inventory room. Like with other items, it cannot be invoked when the player is not in the room, questions are needing to be answered, or combat or a cut scene is playing out. Selecting this type again will replace any previous command script.
19. Score checkpoint - Marks a score point where the player's score will be displayed onscreen. The name you provide for this checkpoint is used on the CaravelNet score boards if you publish your hold. CaravelNet players will have their game stats and score submitted to the CaravelNet high score list for this checkpoint when this command executes.
20. Add room to map - Marks a room in the current level on the player's map. If "Full room reveal" is set, then it will show the room on the minimap as if the player has already explored it. If the indicated room has already been explored by the player, this command does nothing.
21. Autosave - Automatically saves the player's game in an "Autosave" slot under the name you provide. Whenever this command is executed, any previous autosave slot with the same name will be overwritten. Hint: You might consider including this command at importing game points, such as whenever a new level is entered.
22. Game effect - Display a visual effect at a specified room location. Particle effects may have a direction given them. Some effects may play an optional accompanying sound effect.

4. Queries - Use queries to examine the state of the room and wait indefinitely until certain events occur.

1. Question - If one or more Answer option commands have been provided previously in script execution, this will ask the user a multiple choice question with the dialogue you specify and answer options previously provided. Script execution will continue from the label of the Answer option selected by the player. Once a Question has been asked, the list of Answer options is reset for the next Question.
   If no Answer option commands have been provided before this command is executed, the user will be asked a "Yes" or "No" question with the dialogue you specify. If a yes/no Question is executed as the condition for an If ... command, the corresponding script block will execute if the user answers "Yes".
2. Wait - This tells the NPC to do nothing until the number of game turns you specify has passed. Wait 0 will stop the script at the current point until the next turn.
3. Wait for event - The NPC waits until the specified game event has taken place.
4. Wait for entity - The NPC waits for any of the selected entity type (or entities) to enter the room region you specify. Hold <Ctrl> while clicking to select and unselect multiple selections. After selecting this command, the room will temporarily appear. Hold down the mouse button and drag the mouse cursor to select the area any of the entity or entities must enter before the NPC does anything else.
5. Wait while entity - Wait while any of the selected entity type remains in the room region that you select.
6. Wait for door to (open/close) - Waits for the door at the selected room square to either open or close.
7. Wait for turn - The NPC does nothing until at least the specified number of game turns has passed since the player entered the room.
8. Wait for turn - Waits until the player has made the specified number of moves in the room.
9. Wait for player to face - Waits until the player turns in the specified direction.
10. Wait for player to move - Waits until the player moves in the specified direction.
11. Wait for player to touch me - Waits until the player bumps into the NPC.
12. Wait until var - Waits until a hold variable meets the condition you specify.
13. Wait for defeat - Waits until the NPC has been defeated (i.e. its HP has been reduced to zero). This must be used in conjunction with Imperative: Unkillable in order to create an NPC that may be defeated in battle but continue to execute commands afterward. After the NPC has been defeated, its defeated status may be undone by resetting its HP to a nonzero value. Other sources of damage, such as briars or bomb-blasts, will also flag the NPC as defeated.
14. Wait for open move - Wait until the NPC is able to make a move in the specified direction. When rotations are considered, they will check for a "safe" turn, i.e. that a sword- wielding NPC would not harm itself by striking a bomb. Hint: Use this query to test whether a move may be made before executing a Move command in that direction.
15. Wait for item - Wait until the specified element is located in the marked room region.

5. Decision making - Use the following commands to execute only a marked portion of script commands or to continue executing script commands from a different location in the script.

1. If ... - Use this command to optionally run a block of one or more script commands, based on a condition you specify in the next script command, which must be a query. If the query is immediately satisfied, then the script commands that follow after will be executed. An If End or Else command indicates the end of the optional code block. If the following query is not true, the script will continue after the following the next Else or If End command that marks the end of the optional code block.
2. If .... The end of the Else block is indicated with an If End command.
3. Else - Marks the beginning of a script section that is executed if the query condition following the If ... command is not satisfied. Else commands in conditional blocks are optional, but they must always follow somewhere after an If ... to be meaningful.
4. If End - Marks the end of If ... and Else blocks.
   Notes:
   1. A "?" symbol displayed in front of a command in the script list means the command is not a recognized as a valid condition for an If ... command.
   2. If ... commands may be nested, i.e., an inner code block may be completely contained within an outer code block.
   3. A "!" symbol displayed in front of a command in the script list means that an If ... or Else block is not properly closed with an If End command at the end, or that an Else command is placed without an If ... coming first.
   4. See "Examples of branching code structures" below.
5. Label - marks a location in the script to continue executing commands from (used in conjunction with Go to, Answer option, Each Attack, Each Defend and Each Use commands). Also, labels may be used to simply comment in normal language on what the following script commands do.
6. Go to - Select a label to continue executing commands from. Hint: Use Goto to make a loop in the script that repeats a sequence of commands over and over. Use a Wait 0 command as the last statement of a loop that is to be executed once each turn.
7. End on room exit - Removes the NPC for the rest of the current game when the room is exited. Hint: use this command at the start of a script to have the NPC execute commands until the player exits the room, and then never appear again.
8. End - Ends the character script executing immediately, and the NPC will be removed from the room for the rest of the current game when the room is exited. Hint: use this command to permanently stop the NPC from executing any more commands, and then disappear when the room is exited.

Notes about using NPC scripts

1. Each character script begins execution when the room is first entered. Upon room reentry, the script will continue where it left off by default.
2. A script can be made to restart from the beginning when the player reenters the room by executing an Imperative: Restart script on entrance command at the anywhere within the script.
3. NPCs with Ended scripts will not appear in the room when the player enters it in the future.
4. An NPC can be turned into a regular monster of its specified entity type with the Turn into monster command, but it might be preferable to set stat vars for the NPC so the player may fight it in its current form.

Imperatives - NPC/script properties that may be set with the Imperative command.

1. Killable: Makes the NPC vulnerable to killing (default).
2. Unkillable: Makes the NPC invincible so it cannot be killed by combat or other methods of inflicting damage. When an unkillable NPC has its HP dropped to zero, its "defeated" flag is set (see Wait For Defeat). Non-flying NPCs may still be killed by dropping them off a platform.
3. Critical hero: When set, the room will automatically restart if the NPC is ever killed.
4. Safe: Forbids the NPC to harm the player, by engaging in combat when bumping into the player, and vice-versa.
5. Sword safe to player: Sword stabs from this NPC won't harm the player.
6. Deadly: Allows the NPC to bump into the player to engage in combat. Also makes sword hits harm to the player according to the ATK rating of the NPC (default).
7. Die: Makes the NPC die with a blood splatter.
8. Hide stat changes: Makes Set Var commands that alter the player's stats not display as game effects.
9. Showstat changes: Makes Set Var commands that alter the player's stats display as game effects (default).
10. Ghost display: When the NPC is not in the room, the NPC's image will appear at its current coordinates anyway.
11. No ghost display: When the NPC is not in the room, it is not displayed (default).
12. Restart script on entrance: When the player reenters the room, the NPC's script and internal state vars will restart from the beginning.
13. No restart on entrance: When the player reenters the room, the NPC's script and internal state vars will continue as they left off when the room was last exited (default).
14. Make script global: When executed, the NPC and its script are removed from the room into a list of global scripts. Global scripts continue to execute for the duration of the current game, within all rooms. Once a script is in the global list, it may no longer re-enter the player's current room as an NPC with the Appear command variants. If an End command variant is executed, the script terminates as usual. Hint: use this to create a script that can make things happen in any room or check for things happening at any time during play, not only in a particular room. LIMITATION: only available within default scripts of custom NPCs.

Behaviors - NPC behaviors and attributes that may be set with the Behavior command.

1. Standard: Reverts the NPC to no special behavior pattern or attributes (default).
2. Face target: Face toward the player.
3. Face away from target: Face away from the player.
4. Attack in front with back turned: Attack(*) whenever the player is in front of the NPC and has his back turned.
5. Attack in front: Attack(*) whenever the player is in front of the NPC.
6. Attack adjacent: Attack(*) whenever the player is adjacent the NPC.
7. Beam attack: NPC emits a beam that halves the player's health on contact.
8. Surprised from behind: If the player attacks a monster with this attribute from behind, the NPC loses its first attack turn. For equipment, it gives the player's first hit x2 ATK when hitting the monster first from behind.
9. Goblin Weakness: NPC is weak to goblin blades (i.e. player gets x2 ATK). Embues custom weapons with goblin blade attribute.
10. Wyrm Weakness: NPC is weak to wyrm blades (i.e. player gets x2 ATK). Embues custom weapons with wyrm blade attribute.
11. Metal: Metal monsters will be damaged on oremites the same as if on a hot tile. Embues custom equipment with metal attribute (disabled on oremites).
12. Lucky: Embues custom equipment with lucky attribute (x2 GR from combat for each lucky item held).
13. REP Doubler: Embues custom equipment with REP doubler attribute (x2 REP from combat for each REP doubler item held).
14. Briar cutter: NPC can cut briars with its sword. Embues custom equipment with briar-cutting attribute (the player's sword can cut briars).
15. No enemy defense: Attacks nullify the enemy's DEF rating. Embues custom armor with protection against monsters with this attack ability.
16. Attack first: Get first attack against the enemy. Embues custom armor and accessory with protection against monsters with this attack ability.
17. Attack last: Always attack last against the enemy.
18. Drop Trapdoors: When moving off trapdoors, setting this causes them to drop. Otherwise, nothing happens (default).
19. Move Into Swords: Allows the NPC to move onto swords. Otherwise, it is not allowed (default).
20. Push Objects: Allows the NPC to push mirrors and move platforms. Otherwise, it is not allowed (default).
21. Direct-only movement: If the target is in a diagonal direction from the NPC, but diagonal movement is blocked, then don't move at all. If the target is in an orthogonal direction, attempt to move along a straight path to the target.
22. Normal movement: When a desired diagonal movement is blocked, then choose vertical movement, if possible, otherwise choose a horizontal movement to approach the destination (default).
23. Smarter movement: When a desired diagonal movement is blocked, then choose the better of horizontal or vertical movement to approach the destination.
24. Omni movement: When a desired diagonal or orthogonal movement is blocked, then attempt to make a movement to the side that might help to approach the destination.

*Attack - Monsters may not attack the player when the player is above the monster, e.g. standing on a raised door when the monster is not.

Predefined vars - There are several predefined variables that may be set and queried with the Set var and Wait until var commands. Some of these variables are tied to game state and are updated automatically as play progresses. Others are altered solely through script commands.

Name | Description | Default value | Valid range
NPC stats |  |  |
_MyHP | NPC's HP | 0 (*) | 0,MAX
_MyATK | NPC's ATK | 0 | 0,MAX
_MyDEF | NPC's DEF | 0 | 0,MAX
_MyGold | NPC's GR (battle loot) | 0 | -MAX,MAX
_MyREP | NPC's REP (battle loot) | 0 | -MAX,MAX
_MyColor | NPC's RGB modifier (*) | 505050 | 000000,999999
_MySword | NPC's sword type (*) | -1 (use base type) | -1,9
_MyX | NPC's X coordinate (room column) |  | 0,15
_MyY | NPC's Y coordinate (room row) |  | 0,15
_MyO | NPC's orientation (direction faced) |  | 0,8
_MyScriptX | NPC's command X param override(*) | -9999 (no override) | by command
_MyScriptY | NPC's command Y param override | -9999 (no override) | by command
_MyScriptW | NPC's command W param override | -9999 (no override) | by command
_MyScriptH | NPC's command H param override | -9999 (no override) | by command
_MyScriptF | NPC's command Flags param override | -9999 (no override) | by command
Game state modifiers |  |  |
_MonsterHPMult | global monster HP multiplier(*) | 100 (percent) | 0,MAX
_MonsterATKMult | global monster ATK multiplier | 100 (percent) | 0,MAX
_MonsterDEFMult | global monster DEF multiplier | 100 (percent) | 0,MAX
_MonsterGRMult | global monster GR multiplier | 100 (percent) | -MAX,MAX
_MonsterREFMult | global monster REP multiplier | 100 (percent) | -MAX,MAX
_ItemMult | global item stat multiplier | 100 (percent) | -MAX,MAX
_ItemHPMult | global health item multiplier | 100 (percent) | -MAX,MAX
_ItemATKMult | global ATK power-up multiplier | 100 (percent) | -MAX,MAX
_ItemDEFMult | global DEF power-up multiplier | 100 (percent) | -MAX,MAX
_ItemGRMult | global money door multiplier | 100 (percent) | -MAX,MAX
_HotTile | hot tile damage(*) | 5 (percent) | -MAX,100
_Explosion | explosion damage(*) | 100 (percent) | -MAX,100
Player stats |  |  |
_HP | player's HP |  | 0,MAX
_Attack | player's ATK |  | -MAX,MAX
_Defense | player's DEF |  | -MAX,MAX
_Gold | player's GR |  | -MAX,MAX
_REP | player's REP |  | -MAX,MAX
_YellowKeys | player's yellow keys |  | 0,MAX
_GreenKeys | player's green keys |  | 0,MAX
_BlueKeys | player's blue keys |  | 0,MAX
_SkeletonKeys | player's skeleton keys |  | 0,MAX
_Sword | player's sword type |  | 0,9
_Shield | player's shield type |  | 0,5
_Accessory | player's accessory type |  | 0,11
_X | player's X coordinate (room column) |  | 0,15
_Y | player's Y coordinate (room row) |  | 0,15
_O | player's orientation (direction faced) |  | 0,8
Play info |  |  |
_TotalMoves | total moves made by the player this game |  |
_TotalTime | total time spent by the player this game (in ms) |  |
Combat stats |  |  |
_EnemyHP | Enemy's HP(*) |  | 0,MAX
_EnemyATK | Enemy's ATK |  | 0,MAX
_EnemyDEF | Enemy's DEF |  | 0,MAX
_EnemyGR | Enemy's GR (battle loot) |  | -MAX,MAX
_EnemyREP | Enemy's REP (battle loot) |  | -MAX,MAX
Equipment values |  |  |
_WeaponATK | player weapon ATK(*) |  | -MAX,MAX
_WeaponDEF | player weapon DEF |  | -MAX,MAX
_WeaponGR | player weapon GR |  | -MAX,MAX
_ArmorATK | player armor ATK |  | -MAX,MAX
_ArmorDEF | player armor DEF |  | -MAX,MAX
_ArmorGR | player armor GR |  | -MAX,MAX
_AccessoryATK | player accessory ATK |  | -MAX,MAX
_AccessoryDEF | player accessory DEF |  | -MAX,MAX
_AccessoryGR | player accessory GR |  | -MAX,MAX

*_MyHP - In order for an NPC to engage the player in combat, its HP stat must be set to a value greater than zero (the default). You probably want to set the ATK, DEF, GR, and REP values as well.

*_MyColor - a six-digit number, where each two-digit pair defines the amount of R/G/B color offset to the NPC's image. A value of 50 is normal. Lower values (0-49) remove a proportionate amount of that color. Greater values (51-99) enhance that color.

*_MySword - set this to change what kind of sword the NPC wields. This affects the NPC's appearance only, and does not alter the NPC's ATK rating. See Equipment for available choices, numbered in order of appearance. A value of 0 indicates no sword.

*_MyScriptX - This and the other script command parameter overrides are used if variable parameters are required for certain script commands instead of hard-coded values. This applies to commands: AppearAt (x,y), MoveTo (x,y), Move (x,y), FaceDirection (x), ActivateItemAt (x), Wait (x turns), WaitForRect (x,y,w,h,flags), WaitWhileRect (x,y,w,h,flags), WaitForDoorTo (x,y), WaitForTurn (x), WaitForPlayerToFace (x), WaitForPlayerToMove (x), WaitForOpenMove (x), LevelEntrance (y=display text or not), CutScene (x=speed), AmbientSoundAt (x,y), PlayVideo (x,y), BuildTiles (x,y,w,h,flags), WaitForItem (x,y,w,h,flags). Note: You must remember to reset parameter override vars to -9999 (their default value) after executing a command with variable parameters in order to ensure later commands are not affected unintentionally by your parameter overrides.

*_MonsterHPmult - This value is a percent multiplier. It is applied to a predefined monster's base HP when the player first enters the room. The other stat multipliers are applied to the monster's base stats during combat.

*_HotTile, _Explosion - When damage is set to a positive value, it indicates the percentage of HP the target will lose. A negative value indicates a flat damage to inflict. When the player is hasted by a Speed Potion, expected damage is halved.

*_EnemyHP, _EnemyATK, _EnemyDEF, _EnemyGR, _EnemyREP - These vars are only applicable when in combat. Custom equipment may query or set these values to affect the enemy being fought. When used by the script of the monster being fought itself, its own stats are affected.

*_WeaponATK, _WeaponDEF, _WeaponGR, _ArmorATK, _ArmorDEF, _ArmorGR, _AccessoryATK, _AccessoryDEF, _AccessoryGR - These vars reference the stat values of the player's current equipment. When predefined equipment is carried, its values may be queried but not altered.

Examples of branching code structures:

1. A single code branch:
   If ...
   <condition>
   some commands here
   If End
2. Two code branches:
   If ...
   <condition>
   some commands here
   Else
   some commands here
   If End
3. Nested branches:
   If ...
   <condition1>
   some commands here
   If ...
   <condition2>
   some commands here
   If End
   some commands here
   If End

Examples of a multiple choice question:

Answer option "Attack!",attack
Answer option "Run away!",run
Answer option "Have lunch!",lunch
Question What will you do?
Label attack
Whatever you want the character to do
Goto Done
Label run
Whatever you want the character to do
Goto Done
Label lunch
Whatever you want the character to do
Goto Done
Label Done

How to make a new monster type:

1. While editing an NPC script, click "Characters" to go to the Custom Character Management dialog.
2. Type in the name of your new monster and click "Add Character".
3. Specify its base entity type in the "Graphics" list.
4. Click "Edit Default Script" and add Set Var commands to the script to define your monster's stats (_MyHP, _MyATK, _MyDEF, _MyGold, _MyREP).
5. Add Imperatives, Behaviors, and other custom scripting if desired.
6. Import custom tile graphics and an avatar (speech portrait) if needed. Otherwise, you might consider setting the _MyColor var to an alternate value so your monster doesn't look identical to predefined monster types.
7. To place your new monster in your rooms, just place NPCs and set them to your new custom type. They should automatically function according to the Default Script you specified for their type.

Character on tarstuff:

Any Character (whether visible or not) that is standing on any Tarstuff will lend its own attributes to the Tarstuff. If the Character is invisible, then the tarstuff is invulnerable. If the Character is visible and has attackable stats, then the tarstuff can be stabbed once, which reduces the Character's HP to 0, but does not kill the Character. If the Character's HP is restored, then the tarstuff may be stabbed again. If the Character is killed (via the Imperative Die command or a direct stab), then the tarstuff can be cut normally. Essentially, it's being treated as a Tarstuff Mother, although there are certain differences.

How to make custom equipment

1. While editing an NPC script, click "Characters" to go to the Custom Character Management dialog.
2. Type in the name of your new equipment and click "Add Character".
3. To give the player this custom equipment, have an NPC execute "Equipment Swap (type) (equipment name)".
4. When this equipment is acquired, the NPC's default script will begin running from the start as a global script. Click "Edit Default Script" to define how this equipment functions.
5. Provide Set Var commands (_MyATK, _MyDEF) to the beginning of the script to define how the equipment modifies the player's ATK and DEF stats.
6. Add Behaviors to determine any special attributes the equipment has. Monster action behaviors are ignored.
7. Provide an Each Use command and matching Label and script segment to define scripting that is executed whenever the player activates this item. When Each Attack is executed for a custom weapon, script commands after the specified label will be executed each time the weapon is used for attack. When Each Defend is executed for custom armor, script commands after the specified label will be called each time an enemy attacks the player.
8. Add other custom scripting if desired.
9. Import a custom tile graphic for the equipment display icon and, in the case of weapons, eight directional display tiles. If no custom tiles are used, a generic equipment icon is displayed. Defining the _MySword var to a valid index will make a custom weapon appear as that predefined weapon type.
10. The "Graphics" list selection and "Avatar" image are irrelevant for custom equipment.

Character Scripting
Room Editor
Level Editor
Contents