Full Version : NPC reactions to other NPCs and keywords
xmlspawner >>Q&A >>NPC reactions to other NPCs and keywords


<< Prev | Next >>

privacy- 01-25-2007
Hello,
I have a couple questions regarding xmldialog and [xmledit-function:

xmlspawner/right22.gif In order to get npc to react to keywords, is it always needed to be triggered by another entry? I couldn't get npcs to reply to keywords when dependson was set to -1 but when it was dependent on another entry, it seemed to work fine. Does this mean that the npc always has to start the dialogue?
xmlspawner/right22.gif Can npcs react to other npcs keywords?
xmlspawner/right22.gif Is it possible to use [xmledit-function to add lines to npcs when they are hit or land a successful hit on pc? If so, how does it work?

Thanks to ArteGordon for his excellent scripts!

ArteGordon- 01-25-2007
xmlspawner/right22.gif DependsOn of -1 is special and indicates that you want the entry to only depend on nearby movement and not require a keyword.
You can use DependsOn of zero if you want an entry that doesnt depend on a previous entry at the beginning of your dialog tree and requires a keyword. Entry zero is used as a preexisting default starting condition.

xmlspawner/right22.gif To allow entries that can be triggered by other npcs instead of just players, select the AllowNPCTrig option on the entry
QUOTE

- added the AllowNPCTrigger property to each speech entry in talking NPCs that allows npcs to trigger a speech entry.  This allows conversing npcs to be set up. This is false by default. An example of this is given in whosonfirst.xml that loads the npcs Abbott.npc and Costello.npc in which they perform part of their classic Who's on First routine.

Note that in the whosonfirst.xml example, the npcs are actually talking to each other. The dialog entries are triggered by what the other npc says just as if a player were interacting with them.

xmlspawner/right22.gif the idea of testing for being hit is interesting. One way to do this would be to add a temporary attachment that would detect being hit and the entry could have a Condition that tested for this.
I have to run at the moment but I'll think about that one a bit more.

privacy- 01-26-2007
Thanks for your reply,
I had tried the NPCTrig and DependsOn zero earlier but obviously did something wrong as I couldn't get them work. I don't think I let the dialogue reset, so I think it's probably because of that. I'll check the examples you pointed out and try again later smile.gif

ArteGordon- 01-26-2007
note that you can force a reset of dialogs with an Action like

SETONTHIS/doreset/true

You can add this action to dialog entries that are at the end of dialog branches when you know that there isnt going to be any further interaction and so there is no point in waiting.

Also note that ncps will only respond to speech from other xmlquestnpcs (or any npcs derived from the talkingbasecreature class) since when they speak they dont just display overhead messages but generate actual speech.
Also, the speech must either be generated by specifying text in the Text field of a dialog or by using the SPEECH keyword in an Action field. Text generated by things like the MSG or SAY keywords will not be able to activate speech triggers.

QUOTE

// syntax is SPEECH[,probability][,keywordnumber]
                                // if the object is a mobile then have it speak with optional keyword arg