Creating an NPC

From Rusted Promises
Revision as of 03:36, 18 September 2013 by Sveta (talk | contribs)
Jump to: navigation, search

(Currently under construction, but will eventually cover most aspects of NPC writing from a player contributor's point of view.)

NPC Writing

So, you've seen some NPCs about in the MUCK, and would like to learn how to create your own. That's great! NPCs in Rusted Promises are made via the talk script editor, and can be made to interact with the player in a variety of ways. This, also, is how NPCs and objects are make if you purchase a work contract or elect to have one of those made with your major land deed.

Some basic information on talk scripting may be found in the help database via "help talk script". This page is made to expand upon that. If you need reminding, hovering your cursor over the appropriate field while in the editor will bring up a helpful tooltip straight from the file.

Beginning

The first thing you want to do is click the "edit" button on the big yellow header, then click "story mode". It should now turn into "talk script", which is what you need; story mode is a holdover from when the editor was designed for another game.

From here, you can begin creating blocks, individual units from which the NPC's actions are created. When an NPC is interacted with using the check or talk commands, the program will begin running, looking in numerical order for the first available block that is valid for processing. However, unlike the web mission creator, after a block is processed no more code will be run by default and the program will terminate there if a goto or mprompt is not used. So for example:

  • A talk script has three blocks, 1, 2 and 3.
  • A player interacts with the NPC the talk script is attached to.
  • They do not meet the requirements for 1, and so it is skipped over to 2.
  • Block 2 is run, but 3 remains as it is and no code from that block is processed.

If you need more than one block to process per interaction, goto or mprompt is required. More on that later.

From here on out, you may add new blocks (new), edit a block you've already created (edit) or move said block (move). If a block is already referenced to by another block via goto or mprompt, moving it either via move or the scroll arrows in the sidebar will automatically update the values in the referring block, so you don't have to go back and manually update things. Convenient!

Editing Blocks

This is the meat of what you're going to do. When you click the edit button on a block, it'll expand out into a number of field which may or may not need to be filled in, depending on what you intend to have the NPC do. As mentioned before, hovering above each field will bring up a tooltip which will tell you what the field represents and the proper syntax for filling it in.

If you need a list of what's available on-hand, you may refer to the help for a list of props and actions which are used to build the NPC.

Important notes not covered in help talk script:

  1. If a NPC does not have any items in their inventory, or has the wrong-numbered item that giveitem calls for, a bad dud item (0) will be placed into the player's inventory when the code is run. Seek a staffer for assistance to deal with your corrupted inventory.
  2. Inequalities in the requirements field (when created via the editor) are not strict inequalities, hence > 2 actually means >= 2, or in words, "greater than or equals to 2".
  3. A block containing an autoquest function will still give its quest so long as the block is scanned/passed over for eligibility to be run, even if the block's requirements prevent it from being run. This is important, if you do not wish for the player to be able to sequence break. If you need to pass over such a block, use goto or mprompt to skip it.
  4. Some values are not meant to be negative, so be careful when subtracting stats and be sure to have a requirement check to ensure awkward situations don't happen. For example, if a player needs to pay 200 crowns as a bribe, use requirements freecred > 200 to ensure that the player has enough cash on hand to pay the bribe!
  5. Checkitem and Requireitem both ignore crafting mods on crafted items, so a dull sword will work just as well as an unmodified one. Keep this in mind when appraising the value of items you're requiring players to turn in.
  6. Blocks with mprompt in them will not run any stats actions. Those with goto will, though. Plan accordingly.
  7. Do not run multiple autoquests within the same block. This will result in the quest being mangled, with a) the resultant quest item being collectable in all specified areas, b) the number required being dependent on the first quest in the block, 3) all other quests being unable to collect associated items, and d) when turning in, all quest items will be destroyed regardless of affiliation to the quest. In short, don't do it.