X2 am inc

From NWN Lexicon



[edit] x2_am_inc

Generic system for town life and encapsulates all 'townie' behavior.

[edit] Constants

Name Value Brief Description
DISTANCE_OBJECT_TALK 10.0 Distance that objects will request works.
DISTANCE_TALKHUB 4.0
EVENT_IAMTHEHUNTER 5003 Tells hunter to broadcast its hunter message every second.
EVENT_IT_SHOUTS 5001
EVENT_NEEDMOREPATRONS 5000 Event number when one HUB asks another for extra patrons.
EVENT_NOTIT_SHOUTS 5002
fDelayBetweenBarmaidAskingForDrinks 60.0
FPATRONDELAY 40.0 Delay between patrons spawning in when others leave.
JOB_BARMAID 1000 JOB: Will wander around a room and serve drinks to NPCs and PCs.
JOB_BLACKSMITH 1001 JOB: Moves around room.
JOB_FRIEND 1006
JOB_GUARD1 1002 JOB: Patrols. Will occasionally interrogate people on the street.
JOB_GUARD2 1009 JOB: Stationary Guard. Should do nothing but stand there.
JOB_HUNTER 1008 Same job as JOB_WANDER but used to differentiate them.
JOB_PATRON 1003 JOB: Wanders.
Will let self be drawn into conversations.
Will occasionally leave and return later with more gold.
JOB_TAG_IT 1005
JOB_TAG_NOTIT 1004
JOB_WANDER 1007 Same job as JOB_HUNTER but used to differentiate them.
LEISURE_THRESHHOLD 100 This is the number when NPCs will stop using Leisure objects.
LISTEN_GOAWAY 995 Stray dog goes away if told to.
LISTEN_IAMNOTIT 996 If I am not it, I tell it this, so it comes and gets me.
LISTEN_MOVETOTOWNHUB 999 Listen pattern to get people moving towards a town hub.
LISTEN_SOMEONEISIT 998 IT shouts this every heartbeat.
LISTEN_IHUNTYOU 997 Hunters say this to scare prey.
PLOT_COST_ALE 1
PLOT_COST_SPIRITS 5
PLOT_COST_WINE 10
TASK_LEISURE_READBOOK 1003 Read a book if not busy.
TASK_LEISURE_SIT 1004 Sit on the chair.
TASK_WORK_ANVIL 1001 Objects may request anviling.
TASK_WORK_CLEANING 1000 Objects may request cleaning.
TASK_WORK_LAMPPOST 1002 Lampposts want to be turned on/off.


[edit] Functions

Name Brief Description
AskPatronToLeave Makes patron leave randomly, or if another hub asks for him.
BarmaidMakeDrink Internal function. NPC will drink from a bottle or player will be given the specified template. Can only be run from a conversation.
BarmaidMakeDrunk Loses a few points of intelligence.
CreateCritter Internal function. Creates a creature at a specific location and tells it to move to a different location. Also creates gold on the creature.
CreateRat Creates a rat (called by Rat 'see baddy' and Garbage scripts).
CreatureValidForHubUse Creatures true if this is an acceptable creature for use in the conversation hub.
DecrementLeisure Certain objects increase a character's Leisure rating. Once this rating gets above the LEISURE_THRESHHOLD they do not want to do leisure things anymore.
DoJob Main performing a job function for creatures.
Face Makes one object face another object.
GetAmbientBusy Returns TRUE if the ambient is currently working on a task assigned by a placeable object(s).
GetInTransition Returns TRUE if the character is in transition.
GetJob Returns the Job that this NPC should perform.
GetLeisure Certain objects increase a character's Leisure rating. Once this rating gets above the LEISURE_THRESHHOLD they do not want to do leisure things anymore.
GetReady Only returns TRUE if the object is ready to be given more actions or to be interrupted.

Set "X2_G_LEAVEMEALONE" on characters that don't want to be bugged by tasks or jobs.
GoToRandomPersonAndInit Will go up to a valid bar patron (not associates).
HeadTurn Internal function. Called from objects when NPC's leisure is too high to want to use object.
IncrementLeisure Certain objects increase a character's Leisure rating. Once this rating gets above the LEISURE_THRESHHOLD they do not want to do leisure things anymore.
IsAtJob Returns TRUE if the NPC is in their 'at work' area.

This is a variable set on the Area with the Tag of the NPC.

If the tag is 10, it means the NPC is at work.
JobBarPatron Bar patron job task.

The Bar patron will wander if not near a 'CONVERSATION HUB'.

Will leave if run low on gold.

Door he leaves by will recreate him in an arbitrary amount of time.
NoPlayerInArea Returns TRUE if there is no player in the area. This function has to be run from an object.
PlayerSeen Returns TRUE if a player can be seen.
PlayRandomImmobileAnimation Plays a random animation.
Request Asks the appropriate creature to perform a LEISURE or WORK task.

The object MUST be the nearest object to be able to comply with the request.

This will only take place if the NPC is of the appropriate job, close enough, not involved in conversation and not currently busy performing another task.
SetAmbientBusy Sets ambient on.
SetInTransition Transit is set when the character is walking between areas like the barmaid going home during the day.
SetJob Defines why this NPC exists. Called from the spawn in script.
SetupInn1DrinkPrices Internal function. Sets up the drink prices for an Inn.



  author: Mistress, contributor: Graewerld

Personal tools
Categories