NPC (Programming)
---++ $npc (#138)
The NPC is the basic object parent for non-player-creatures. It includes a fair bit of behavior which you can customize by setting various properties and messages on it. Let's run it down by behavior category:
---+++Wandering
<B>.wander_chance</B> = INT (0-100). This is a chance, on each suggest_next_action call (see ProgActionsNPC), that the NPC will decide to wander.
<B>.public_wander_only</B> = INT (0-1). If set to 1, the NPC will only wander into rooms which have .public == 1.
---+++Fighting
<B>.wields_weapons</B> = INT (0-1). If set to 1, the NPC will wield her best weapon, if she's carrying any.
<B>.bravery</B> = INT (0-100+). The higher this is, the less likely the NPC is to run from combat when wounded. At 0 the NPC is fairly cautious; at 100, she will fight to the death against all but the most terrifying foes.
---+++Talking
<B>.conversation</B> = LIST text. This is a list of strings of the form: word1,word2|Here's what I say about that. If the NPC hears any of the listed words in a directed-say to her, she will say the given text back to the person who said it. By including words in these lists from previous spoken text, you can create a simple simulated conversation. Some words you should probably respond to, if you define this property: name, hi, hello, job. NOTE: when changing this property, you must '@compile <my NPC>' to make the changes take effect.
You can find more functionality on <B>$monster</B> (ProgMonster).
-- Main.GilMore - 30 Apr 2004