Difference between revisions of "NPC (Programming)"

From Hellmoo Wiki Archive
Jump to navigation Jump to search
(New page: ---++ $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...)
 
imported>Zell
(Mediawiki formatting)
Line 1: Line 1:
---++ $npc (#138)
=$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:
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
==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.
'''.wander_chance''' = 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.
'''.public_wander_only''' = INT (0-1).  If set to 1, the NPC will only wander into rooms which have .public == 1.


---+++Fighting
==Fighting==


<B>.wields_weapons</B> = INT (0-1).  If set to 1, the NPC will wield her best weapon, if she's carrying any.
'''.wields_weapons''' = 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.
'''.bravery''' = 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
==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.
'''.conversation''' = 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).
You can find more functionality on '''$monster''' ([[ProgMonster]]).
    
    
-- Main.GilMore - 30 Apr 2004
-- Main.GilMore - 30 Apr 2004

Revision as of 08:27, 1 January 2009

$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

.wander_chance = INT (0-100). This is a chance, on each suggest_next_action call (see ProgActionsNPC), that the NPC will decide to wander.

.public_wander_only = INT (0-1). If set to 1, the NPC will only wander into rooms which have .public == 1.

Fighting

.wields_weapons = INT (0-1). If set to 1, the NPC will wield her best weapon, if she's carrying any.

.bravery = 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

.conversation = 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 $monster (ProgMonster).

-- Main.GilMore - 30 Apr 2004