Skip to content

Library: Compliant NPCs

ThePix edited this page Jul 27, 2018 · 1 revision

This allows the player to ask an NPC to do certain things:

  • pick things up
  • drop them
  • give them to the player or another NPC
  • go a certain direction
  • follow the player or wait

It can be downloaded here.

Just add the library, then give the NPC the inherited type "compliant_npc", and it should be good to go. The player can use various forms, such as:

ASK MARY TO GO EAST

BORIS, GET TEAPOT

TELL BORIS TO GIVE THE TEAPOT TO MARY

An NPC will only do as requested if his compliance is greater than the level of the action. By default, that the level 12 for give/drop/give and 8 for go/follow/wait. Compliance is an integer attribute of the NPC, and defaults to 10; you may want this to rise and fall during a game, reflecting how the NPC feels about the player.

NPCs have a "yesmsg" attrbute, which is what the NPC says when agreeing to do something. There are then "nomsg0", "nomsg1", "nomsg2", "nomsg3" and "nomsg4"; used when the NPC refuses, getting increasingly forceful. Note that the no messages are complete sentences, with quote marks, allowing some colourful responses and gestures.

You can give an object an "npc_take" attribute, either a script or a Boolean. When the NPC tries to take an object the script will run (with "npc" as a local variable), just as with "take" when the player picks up an object. If it is a Boolean, that will determine if the object can be taken or not. If there is no "npc_take", the usual "take" attribute is used, if a Boolean.

An "npc_drop" attribute is used similarly for dropping.

For give, if the NPC has a script "give_[object]_to_[npc]" this will be run when the NPC gives that object.

Clone this wiki locally