This is the NPC editor. Here you can design NPCs to be used as townspeople, treasure chests, vehicles, script triggers, pushable barriers, and many other purposes.  In short, anything that the player can interact with on the map will be an NPC.

Use the Up and Down arrow keys (or PgUp, PgDn, Home, and End) to navigate the menu, or type part of menu item to jump to it. Press the Left and Right arrow keys to change values. You can also type in numbers.

Picture: This is the ID number of the walkabout sprite that the NPC will use. You can see a preview below the menu.

Palette: This is the 16-color palette used for the picture. "default" is the palette you used to draw the selected sprite, so you will normally not need to change it. Besides being able to type in a palette number you can also press ENTER or SPACE to use the palette browser.


Movement:

---------------
Move Type: This determines how the NPC will move around the map. If this NPC is not supposed to move, choose "Stand Still".

* "Stand Still": Just stands there.

* "Wander": Randomly take steps or stand still. Doesn't make any large movements.

* "Walk In Place": Same as "Stand Still", but the NPC plays the walking animation as it stands.

* "Left/Right Turns": the NPC moves in a straight line until it hits an obstacle, and then it turns left or right. If it can't move anywhere at all, it'll spin in place.

* "Random Turns": As above, but the NPC randomly turns either left or right.

* "Pace": the NPC moves in a straight line until it hits an obstacle, then it bounces and goes back the way it came.
Remember that you can control which direction an NPC is facing by pressing CTRL+Left/Right/Up/Down.

* The different "Chase You" and "Avoid You" options attempt to move towards/away from the player in various ways. They will all work correctly on wrapping maps.

* "Chase You/Avoid You (Direct)" move directly towards/away from the player, don't make any random decisions, and stay still when stuck behind an obstacle. These NPCs easily get stuck.

* "Chase You/Avoid You (Meandering)" are like the "Direct" versions, except they make random decisions sometimes. If on the same row or column as the hero they will even somethings move backwards. They still get stuck on corners when diagonal to the hero.

* "Chase You (Pathfinding)" finds the shortest path to the hero, moving around any obstacle. If the map is a very large maze then pathfinding may fail to find the path. If no path can be found, the NPC will instead move to the nearest tile to the hero which it can reach. The path is recomputed every step.
Pathing NPCs respect zone restrictions.
NOTE: In future engine versions, pathfinding may make decisions slightly differently! Don't rely on it being completely reliable and deterministic.
When this option is selected, the "Pathfinding rule" option appears:
- "NPCs Obstruct" should normally be used. It causes other NPCs to be treated as solid walls, and assumes they won't move. Note that the NPC might dither back and forth beween going in two opposite directions if the shortest path changes due to the movement of other NPCs blocking bottlenecks.
- "Ignore NPCs" means that if the NPC bumps into another NPC, it'll stop and wait for that NPC instead of moving around it. It'll remain stuck, like "Chase You (Direct)"! You may want to use this if you have a large crowd of chasing NPCs, so that the ones at the back follow those at the front instead of trying to find an alternative route.
- The "Default" value is set in the General Map Data submenu.

* "Follow walls (Left/Right)": This is the method for finding your way out of a maze by following a wall with your left/right hand.  Heroes and other NPCs are treated as walls (they're walked around, or bounced off of if they block a passage).

* "Follow walls (Left/Right) stop for others": As above, but if stops and waits if an NPC/hero blocks a passage. You can use this to make NPCs follow paths by giving them a movement zone which traces out the path.

---------------

Move Speed: This is the speed that the NPC will move. 1 is very slow. 4 is the heroes' default speed. 10 is fast. Notice that you can't just put in any number you want? That is because move speed needs to be evenly divisible into the tile size, which is 20x20 pixels.
NOTE: If the speed is zero, the NPC can't move. This is a very common mistake!

Movement Zone: this restricts this NPC to only move onto tiles that are in a certain zone.

Avoidance Zone: the NPC treats tiles in this zone as walls. This overrides the movement zone.

Ignore Passmap: turning this on makes the NPC walk through walls placed on the wallmap, but it is still blocked by zones, other NPCs, the player, and the map edge (on non-wrapping maps). (You can use the "set NPC ignores walls" and "set NPC obstructs" script commands to make the NPC move through these obstacles). This might be useful for flying NPCs. Use zones to contain the NPC instead.
Note that walls are still considered for the "Follow Walls" Movetype.

Pushability: Here you can choose whether or not it is possible for the player to push the NPC. This is useful for barrier boxes, or for annoying townspeople who get in the players way. Be aware that pushable NPCs won't work unless you give them a "Move Speed" higher than zero.


Activation by player:

Activation: This controls how an NPC is activated. It also controls whether or not the player is allowed to walk over an NPC.

  "Use" means that the player must
  face the NPC from one space away
  and press the use button. This is
  most often used for townspeople
  and treasure chests.

  "Touch" means that the player only
  needs to be one tile away, no
  buttons. This is most often used
  for NPCs that represent monsters,
  or for NPCs that trigger scripts.

  "Step on" means that the player can
  walk over the NPC without being
  blocked. This is most often used
  for script triggers and tag
  triggers. Another nice side-effect
  is that Step-on NPCs can be used to
  make walls that heroes can walk
  over, even though other NPCs are
  blocked by them.

Display Text: Here you can choose a text box that will be displayed if the player activates the NPC. A preview of the first line of the text box will be displayed at the bottom of the screen.
Press ENTER or SPACE or CLICK to browse for the text box. Hold CTRL or SHIFT with ENTER/SPACE/CLICK to jump to the textbox editor. Press INSERT or + to quickly add a new text box.

Give Item: Here you can choose an item which will be added to the player's inventory when they activate the NPC. This is most often useful for treasure chests. Note that there will be no visual display of the item being added. You might want to use a text box for that.

Run Script: A plotscript that will be run when the NPC is activated. You can press ENTER or SPACE here to open the script browser. This script will automatically receive two arguments. The script argument defined below is first, and an NPC reference number for the activating NPC is second.

Script Argument: If you have specified a plotscript, you can also provide a number which will be passed as the first argument to the script.

Vehicle: This allows you to turn this NPC into a vehicle. Activating the NPC will cause you to mount the vehicle. See the Edit Vehicles menu (from the Main Menu) for more info.

When Activated: This controls whether or not the NPC changes directions to face the player when the NPC is activated. "Change Direction" leaves the NPC in the new direction after it's done talking, while "Face Player" means that the NPC will turn back to its original direction after talking.

Usable Repeatedly/Usable Only Once: This allows you to make an NPC disappear permanently after being activated once. This is most often used for treasure chests or for one-time plotscript triggers.
NOTE: All copies of an NPC will disappear when any of them is activated! Use multiple NPC definitions, or the "delete NPC" script command to remove a single NPC.
"(onetime #)" indicates the ID number of the flag, which you can set or check with a script using the "set onetime"/"check onetime" commands.
If the NPC also shows a textbox, then the NPC won't disappear until that chain of textboxes is closed.


Appears when...:

Appear if Tag: These two tags can be used to control when the NPC appears. You can type in a tag number, or press ENTER or SPACE to bring up the tag browser. Press - to switch between requiring the tag to be OFF or ON. If either tag condition isn't met then the NPC immediately vanishes.
