Aller au contenu

Photo

Generic NPC Conversation Scripting


  • Veuillez vous connecter pour répondre
30 réponses à ce sujet

#1
henesua

henesua
  • Members
  • 3 863 messages

I am working on a conversation script for generic NPCs. By generic I mean all the filler NPCs that farm the fields, drink in the taverns, work the regular jobs in your fantasy world. I am using z-dialog as the starting point, and then creating a generic conversation script which can be fed flavor text from local strings set on the creature.

 

Z-dialog script (without includes): v2_dlg_generic

 

Wyvern Crown of Cormyr (the premium module by DLA) did this a little bit. They had the right idea. And I think I've seen some PWs do this too. Sigil Planar Legends for example has particular types of NPCs - Touts, Guides, Gate Keepers, Merchants etc… that seem to each use variations on a typical conversation, but each is a little different (as if settings were adjusted). I think Escape from Undeath does this too, but I've forgotten. And I am sure there are many more that do things like this.

 

First, I am wondering if others are interested in sharing similar work in this vein?

 

Second, I'll share a little but of what I have done so far.

 

Conversation has five basic sections:

(1) If you have a weapon drawn on conversation start, NPC gives a response to the weapon, no greetings are given, and PC has an opportunity to:

  • THREATEN - opportunities for extorting, press ganging etc… uses intimidate skill
  • STOW WEAPON - attempt to smooth over the faux pas, and continue without weapon
  • CONTINUE CONVERSATON with WEAPON DRAWN - continue conversation, with potential to threaten with the weapon. NPC reaction will be negative.

(2) If PC is not currently speaking a language which the NPC speaks, PC has a chance to try other languages until they get it right, or otherwise fail to communicate.

(3) Greeting/Introductions. PC has a chance to introduce self if unknown, or if known provide a pleasant greeting to get things started.

(4) Continuing Conversation. PC is given a response showing reaction of NPC to them (this is basically a patience meter, that when it runs out, the NPC will try to end the convo), and NPC's response to the PCs prior convo option. A variety of options (depending on PC social skills and reputation) to seek information (stores, inns, jobs, quests, news etc…), ask the NPC to join party, convert the NPC to your religion and so on.

(5) NPC tries to end conversation. PC can say goodbye or if social skills are sufficient use one of them to keep the conversation going.

 

Thats it so far. I'm playing with more measurements than just "reputation", but not sure how complex I will get. I have ideas about how "fear" and "trust" could enter into this as values from 0-100 along with "reputation" which is the "how much they like you" measure. Another one I have considered is how well the PC is known.  Each of these metrics can be "personal" and "group" related.

 

Anyhow, just playing so far and am interested to see what others have done in this vein.



#2
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages

<continuing...>

 

I really like this. I like what you're doing and the direction it's taking you.

Now, understanding that you are keeping it (relatively) simple and prototypish...

 

I think it's quite worth considering breaking the stored metrics you use into two categories with multiple entries. Specifically, using Renown (or something) as the *weight* of a relationship vector and the value of the relationship axis (fear/attraction, trust/distrust, contempt/respect) as the direction of the vector.

 

Further, break the renown into multiple, additive parts: Racial, Class, Geographic. Hence a fellow from Helm's Deep is better known there and a fellow from Luskan less well known, but the reputation/relationship they've built is of the same vector/flavor. Likewise, a fighter NPC knows a fighter PC better than a cleric or mage NPC would. This allows for subtle shades of responses that are truly affected by they PCs actions and their character build.

 

As for how many, what kinds of axis to employ, you know I am really trying to develop a three-axis, 3 dimensional relationship model :-) A bit more complicated than what you want... <a *lot* more complicated>

...but it will be necessary for my vapor-ware socio-political engine that will generate emergant behaviors from NPCs. Hush bird. <as long as you don't call *me* an npc>

Wouldn't dream of it, old friend. <*skeptical raven look*>

 

<...from chat>


  • henesua aime ceci

#3
meaglyn

meaglyn
  • Members
  • 807 messages

I've been working on something like this for a while now.  It's in pretty good shape although I started a bit differently so it does not have some of the things yours does (like support for different languages and the drawn weapon thing, but I like those...).  

 

Most if not all of the text can be specified as variables on the NPC. There can be multiple pages of text for some entries which have [Continue] or "Go on..." for the PC. This specification includes the prompt the PC speaks. When not specified either something random is used or the option is not shown depending on the situation. It also drives my quest system and can open stores  or allow the PC to steal from the store. There's an option to start a sub dialog which can be configured (I use that for say an innkeeper to start the inn zdlg, or for a weaponsmith to repair weapons etc).

 

Anyway, I realized a while ago that this is the only way to go. Write a couple of moderately complicated dialogs and you've got 100 tiny scripts that are all the same except for one number or one word. Been working on it ever since. Fwiw, I used an earlier version of it my old ABC module.

 

It does not have the focus yours seems to on continuing social skills. That's an interesting thought.  There are some uses of skills and PRR plays some role, and there are some more that need to be added. You may have the whole thing collapse if you get too complicated. I was more focused on getting something I can use so I can make progress.  

 

One issue I see though is that this sort of thing is going to be pretty tightly coupled to a lot of other systems in the module (as are many of these things).  How you handle stores, quests, inns jobs news and what not will all be different in different modules.  I was just thinking of how I could share what I have with you and it gets to be a lot of stuff pretty fast :)


  • henesua et Rolo Kipp aiment ceci

#4
MagicalMaster

MagicalMaster
  • Members
  • 2 000 messages

(1) If you have a weapon drawn on conversation start, NPC gives a response to the weapon, no greetings are given, and PC has an opportunity to:

 

A thought to consider: unlike Mass Effect/WoW/Dragon Age/etc, NWN does not have the ability to have a weapon equipped but appear sheathed.  And there's a major difference between having a weapon in evidence (because a Greatsword is clearly going to be visible strapped across a person's back or whatever) and having it pointed at a person in a hostile manner.  NWN does not allow this distinction in terms of animations.

 

Which means you'd literally have to unequip the item (not sheath it, not hold it in an nonthreatening manner).  If it's something like a +1 sword, that's no big deal.  If it's a caster staff with a bonus spell slot or a primary casting stat?  That is a big deal because it messes up your spellbook.  If it's a paladin sword with a bonus to charisma?  That is a big deal because it lowers your Persuade/etc during conversation.  If it's something like the Black Rider Quill?  That is a big deal because it lowers your Lore during the conversation if there's a skill check.

 

So if you want something like that in a conversation then you'd also need to ensure that no weapons or shields have problematic properties.  And the idea of having to put your Greatsword into your backpack (somehow) because otherwise someone would feel threatened seems completely jarring given that fitting a Greatsword into a backpack makes no sense.  The whole of idea of inventory is an abstraction of gameplay and trying to make it "realistic" just seems to make it even MORE unrealistic.


  • Shadooow aime ceci

#5
meaglyn

meaglyn
  • Members
  • 807 messages

Which means you'd literally have to unequip the item (not sheath it, not hold it in an nonthreatening manner).  If it's something like a +1 sword, that's no big deal.  If it's a caster staff with a bonus spell slot or a primary casting stat?  That is a big deal because it messes up your spellbook.  If it's a paladin sword with a bonus to charisma?  That is a big deal because it lowers your Persuade/etc during conversation.  If it's something like the Black Rider Quill?  That is a big deal because it lowers your Lore during the conversation if there's a skill check.

 

"You wouldn't part an old man from his walking stick would you?"

 

Equipped in NWN means in hand and ready to wield. Standing around in polite company with bared steal like the paladin sword example would take a lot of charisma bonus to get over the shear rudeness of it.  I suppose you could rescript all your items to provide the benefit if just in possession, but I'd argue that just having it in it's scabbard at your side should not give you the bonus. "Persuade" with a sword in hand is not really persuade anyway. Also for that example, do you think the charisma bonus of that sword is really for the conversational skill aspect of charisma or more the presence or leadership parts? if we're going to pick nits anyway ;)

 

I don't think having to sheath your sword to have a polite conversation is a problem, even if it means you can't maximize your stats.



#6
MagicalMaster

MagicalMaster
  • Members
  • 2 000 messages

I don't think having to sheath your sword to have a polite conversation is a problem, even if it means you can't maximize your stats.

 

You missed my entire point which is that you CANNOT sheath your sword.  Because if putting your sword into your inventory is sheathing it then you're walking around with 20 swords and bows sheathed, which obviously makes no sense.  Every other game I have seen has equipped items sheathed while not in combat -- but they're still considered equipped.

 

And having to redo your spellbook and losing spells if you're "forced" to unequip (NOT sheath) is a big problem because you have to reinsert the proper spells and rest to get them back.  Curiously enough, the same modules that try to do stuff like this also tend to complain about people resting -- even when it's the module's own rules which force the caster to rest to fix a problem the module created in the first place.



#7
henesua

henesua
  • Members
  • 3 863 messages

Alright folks, this conversation project is for a particular PW I am contributing to, so let the team and me worry about the details of equipment. In general MM, the problem you see of lost spell slots will never occur because (1) I am only including weapons in this. staffs, quills, shields are not weapons. and (2) I would never give a weapon an inappropriate property like a stat boost. Magical properties only further enhance what the item does rather than random other benefits to the aspects of the character you think might wield it.

 

As far as the issue of sheathing yet still having an item equipped goes, I just can't worry about such a detail given that the engine doesn't do such things. I could possibly script "sheathing", but until the graphic resources are available as VFX I'm not interested in pursuing it.

 

Meaglyn, in terms of comparing notes, I don't need to see your code (though I wouldn't mind taking a peek) as much as I am interested in hearing how your algorythm works.


  • Rolo Kipp aime ceci

#8
meaglyn

meaglyn
  • Members
  • 807 messages

You missed my entire point which is that you CANNOT sheath your sword.  Because if putting your sword into your inventory is sheathing it then you're walking around with 20 swords and bows sheathed, which obviously makes no sense.  Every other game I have seen has equipped items sheathed while not in combat -- but they're still considered equipped.

 

And having to redo your spellbook and losing spells if you're "forced" to unequip (NOT sheath) is a big problem because you have to reinsert the proper spells and rest to get them back.  Curiously enough, the same modules that try to do stuff like this also tend to complain about people resting -- even when it's the module's own rules which force the caster to rest to fix a problem the module created in the first place.

 

Um, you missed my entire point. I got your point. In NWN sheathing it _is_ unequipping it.  If that's a problem play WoW or some other game that has that state. Or put it in your quickslot if it makes you feel better. Then you can think of that one as sheathed and easily accessible and the other 19 as stowed.  (But if you're running around with 20 swords, one for each type of enemy that's a whole different "realism" issue).

 

Edit. Sorry that sounded more snide than I meant it. Don't go play WoW. I like having you around in the NWN world...

 

And my quote about not taking away the walking stick addressed the issue of staves and spell slots.



#9
meaglyn

meaglyn
  • Members
  • 807 messages

Meaglyn, in terms of comparing notes, I don't need to see your code (though I wouldn't mind taking a peek) as much as I am interested in hearing how your algorythm works.

 

 

Which part?



#10
henesua

henesua
  • Members
  • 3 863 messages

Meaglyn, how do you initialize your NPC with the conversation text? I assume you use local variables, but how do you apply these. If you set them directly on the creature in the toolset, then you still need a separate blueprint each time.

 

One thing I have started to do is to propagate local data to the creature on spawn. One way to do this is to copy particular variables from the NESS spawn point to the spawned creature. This allows me to set the local variables in the toolset, but not on the blueprint itself. The advantage of this is that I can get a lot of variability with a single blueprint and yet still allow a builder in the toolset to achieve all of this (not require a scripter to achieve these ends).

 

And secondarily but related, I am interested in learning how you implement the random array of generic responses.

 

I am interested in more, but I suppose I could look at your ABC module to really dig into the details. In general I'd like to understand your approach to the various problems so as to inform my own.



#11
meaglyn

meaglyn
  • Members
  • 807 messages

Meaglyn, how do you initialize your NPC with the conversation text? I assume you use local variables, but how do you apply these. If you set them directly on the creature in the toolset, then you still need a separate blueprint each time.

 

One thing I have started to do is to propagate local data to the creature on spawn. One way to do this is to copy particular variables from the NESS spawn point to the spawned creature. This allows me to set the local variables in the toolset, but not on the blueprint itself. The advantage of this is that I can get a lot of variability with a single blueprint and yet still allow a builder in the toolset to achieve all of this (not require a scripter to achieve these ends).

 

Yes, that's one of the issues. I've actually gone one step farther than that recently.  I modified NESS to have a NT (New Tag) flag which is the tag to use for the spawned creature. I then have a NESS spawn script which can run code (either directly or executing an appropriate sub script) to configure the NPC based in its tag (or area and tag or whatever). This provides all the basic variables for the NPC, including store tag, all the dlg data, name, description, etc . And it can set heads, skin and hair color and give clothing as well so one blueprint for each race and gender. Important NPCs have their own of course, but all those named minor characters can just be scripted.

 

Quests, which also need a lot of information is done by a string variable that lists all the quests this NPC can offer in order. That variable is set using the generic NESS spawn code above. Then the conversation init routine calls questInitQuest(oPC, oNPC) to figure out which if any quest the NPC can offer this PC (or if already offered one need to use that one all the time etc). Then it puts all the info to drive the quest as needed.   PC's can only have one quest outstanding with a given NPC at a time. Quests are configured currently in two scripts. One that provides all the conditions needed to offer the quest and the other that provides all the quest details.  All of these are of course cleared when the conversation ends so the next PC to start a convo gets re-initialized correctly.

 

Rumor/news code is similar but a bit simpler. If the NPC does not have a quest to offer then a call is made to getRumor. If this finds something it will set the rumor text on the NPC. If not you get something like "No news is good news" or "I haven't heard anything new". etc

 

Some if it is still underway. Like I realized when I read your post that started this that I left of a quest condition relating to the NPCs current feelings about the PC. That will be needed.

 

And secondarily but related, I am interested in learning how you implement the random array of generic responses.

 

This is really just a collection of simple routines which all return string. Then they are just put in the zdlg script where needed.

 

This one gets the text for the PC option to ask the NPC about him or herself.

string dlgGetPCSelfTalk(object oPC) {
    switch (Random(4)) {
    case 0: return "Tell me about yourself.";
    case 1: return "What do you do around here?";
    case 2: return "What brings you here?";
    case 3: return "Who are you?";
    }
    return  "Tell me about yourself.";
}

Then in the main page of the dialog:

if(!PRR_GetPersistentInt(oPC, "PRR_" + PRR_GetTargetId(OBJECT_SELF) + "_DID_ASK_ABOUT_ME")) {
        AddStringElement(dlgGetPCSelfTalk(oPC), sPage, oPC);
        ReplaceIntElement(nIndex++, 1, sPage, oPC);
}

Similar is used for NPC lines when nothing specific is provided. Or he doesn't want to tell or whatever. That can be more or less complex depending on if you want to have reputation influence how he responds.  Just have to be a little careful about grammar so that the combinations that go together actually make sense. Sometimes that leads to slightly odd sentences.  There's always more that can be added to something like this...


  • henesua et Rolo Kipp aiment ceci

#12
henesua

henesua
  • Members
  • 3 863 messages

I modified NESS to have a NT (New Tag) flag which is the tag to use for the spawned creature.


That is a good idea, and I can't believe I hadn't thought of that. Allowing a spawn to have a custom tag is really useful.

I then have a NESS spawn script which can run code (either directly or executing an appropriate sub script) to configure the NPC based in its tag (or area and tag or whatever).


Interesting method. I end up in the same place, but by a different road. Yours seems like a good way to go about it.

My method is a bit more cumbersome as it requires a builder to know what various local variables do, and to make use of them. It seems like you provide a number of options for builders based on tag, and so builders just need to know the tags while the scripters do all the heavy lifting.

That said as a builder and a scripter I like making use of local variables directly on the NESS tag or creature. I just need to consider usability since this results in me doing most of the technical/fiddily stuff, and others just ignoring all the cool features.

With regards to conversation text however it seems to me that you'd want to specify unique lines for a creature rather than populate them based on tag.

In addition you indicated you had a system for a multiple page response. That is an interesting idea. How do you indicate when this is the case? And how do you key particular dialog like this to a particular PC "response"? Do you key NPC dialog text to PC options/responses?

Basically I am wondering how you establish topics that a NPC can talk about.

I am guessing that it could be done by creating a list of key words/responses that a PC can select, and then store under the same keyed label, the dialog text which the NPC speaks in response to the PC selecting that particular option. I imagine such an approach would be cool, but also flat because all those options would presumably be laid out in the beginning rather than gradually unveiled when conditions are met.

However if you have a state model for the NPC like I was talking about earlier tracking things like NPC interest in talking with the PC and this can be influenced by a combination of charisma, social skill use, reputation, and certain conversation options I suppose you could model a fairly interesting little mini-game of socializing with the undefined NPCs in the game even when the DM isn't around. I am trying to achieve a semblance of this without creating too much complexity. You'd set as a requirement certain thresholds of the NPCs state before they offer certain conversation options.

With regards to quests and news, I'm not sure if'll be setting up any generic NPC give those out, but it would be great to model what knowledge their group has (NPCs typically belong to a group - kinda like a faction) and enable them to dole out this knowledge. So that if a unique NPC in their group has a quest, any given NPC might know about it and direct the PC to talk with the special NPC. Likewise this would be done for merchants, inn keepers and various other NPC "types" that PCs are always looking for.
  • Rolo Kipp aime ceci

#13
Proleric

Proleric
  • Members
  • 2 346 messages
A stimulating discussion!

I take the point that since there are so many systems for influence, language, weapons and so on, a common approach is not so easy, but learning about other people's rules and techniques here is very helpful.

I like some NPCs to initiate conversation, too. I'm classifying clothing (e.g. rich / poor, drab / attractive etc) and playing around with concealed weapons (sword-stick etc) because even a sheathed sword will attract attention if carried by a peasant.

It's possible to make lots of conversations with few scripts by using a standard set (condition1, 2, 3... response1, 2, 3...) which pass control to master check and action scripts. I also find it useful to switch dialogue files in mid-conversation, between bespoke and commonplace chat, so that the logic only has to be done once. I'll definitely be borrowing some ideas here, though. Thanks for sharing.
  • Rolo Kipp aime ceci

#14
meaglyn

meaglyn
  • Members
  • 807 messages

That is a good idea, and I can't believe I hadn't thought of that. Allowing a spawn to have a custom tag is really useful.

 

I can probably cook up a patch easily enough if you want it.

 

That said as a builder and a scripter I like making use of local variables directly on the NESS tag or creature. I just need to consider usability since this results in me doing most of the technical/fiddily stuff, and others just ignoring all the cool features.

With regards to conversation text however it seems to me that you'd want to specify unique lines for a creature rather than populate them based on tag.

 

I started with a bunch of variables but since I'm both the builder and the scripter I just find it easier to put it in code. When I hit the same realization you did about needing blueprints for all the different ones I just went all the way to code. Plus then it takes a few lines in a script that may or may not run. Following Funky's wisdom from a different thread I started doing the same thing with all the area variables.  On enter checks for initialization of the area and does that first if needed. I can just scroll through or search one or two files and see that all the areas have the right setting for variable FOO.

 

As to the tags, my plan with this is for named minor characters, bar tenders, shop owners, smiths, each would generally be uniquely tagged. But if you have some other characteristic along with the tag you could easily code different actual words for different same tagged NPCs.  You can have most of it common and then just conditionalize part of it. I use several different NESS spawn script numbers.  You could do that. Same tag, different spawn script number, mostly the same code.

 

In addition you indicated you had a system for a multiple page response. That is an interesting idea. How do you indicate when this is the case? And how do you key particular dialog like this to a particular PC "response"? Do you key NPC dialog text to PC options/responses?

 

It's not an AI or anything. The multipage stuff is for cases where the PC has asked the NPC to tell him something and the NPC has agreed and is telling. Be it introduction, back story, some local flavor text, a quest etc. The PC responses are just [Continue] or "Go on...".   I should probably add an "okay, enough already" option.  Some of the text variables just support it and some don't. Most do. There's a generic zdlg page builder and handler for it which tracks the current page. Variables are like "dlg_back", "dlg_back1", "dlg_back2", it just goes until it gets "". (for some reason I did not want to have to type the 0 on the first one, don't ask).

 

 

For some of it like the flavor text and quest continuation information you can specify the PC text (or let it default to something if possible). Some of those PC text entries are required for it to make sense, some have a random selection of defaults. For the quest continuation info you can make the NPC require a bribe or persuasion or intimidation before saying anything or giving up the item or whatever.

 

You're giving me some food for thought...


  • Rolo Kipp aime ceci

#15
meaglyn

meaglyn
  • Members
  • 807 messages

It's possible to make lots of conversations with few scripts by using a standard set (condition1, 2, 3... response1, 2, 3...) which pass control to master check and action scripts. I also find it useful to switch dialogue files in mid-conversation, between bespoke and commonplace chat, so that the logic only has to be done once. I'll definitely be borrowing some ideas here, though. Thanks for sharing.

 

True enough. I have some of those helper scripts too. More important NPCs can need real TLC and a regular DLG.

 

As to the switching dialogs I use a subdlg system where you can specify another zdlg script or regular DLG file and appropriate PC text and if that is selected you go off to the new dialog. I use this for among other things my inn keeper, which is it's own fairly complicated zdlg. PC gets the option to say "I'd like to see about a room." or some such on the main page. Can't get back to the original conversation as easily, but I could probably fix that.

 

You can also set an override conversation which will always fire first until something marks it as done. This way you can have a more specific conversation on an NPC first and then have them settle into the generic one.

 

Always more to add though ...



#16
MagicalMaster

MagicalMaster
  • Members
  • 2 000 messages

Last post on this subject in this thread given Henesua's comment (though many modules do give stat boosts to weapons if you weren't aware, Henesua, if you're trying to ultimately make this publicly available).  Meaglyn, feel free to make another thread or PM me if you want.

 

Um, you missed my entire point. I got your point. In NWN sheathing it _is_ unequipping it.

 

Unequipping it is putting into the same magical scaling backpack as your other items rather than sheathing it, there is zero reason to think otherwise.  Nor does your point about quickslots hold as you can (and most often do) quickslot several sets of weapons -- and there's no way you have a greataxe, greatsword, AND heavy flail all sheathed (but you could easily have those and more quickslotted).  The magic inventory is an example of Gameplay and Story Segregation.

 

And my quote about not taking away the walking stick addressed the issue of staves and spell slots.

 

I took it to mean the reverse -- that precisely because of that scene that people WOULD take away a stave.  And I have actually seen persistent worlds that DO expect you to unequip a staff while going into a town because they consider it a weapon.  So the issue definitely exists even if you have not personally experienced it.



#17
henesua

henesua
  • Members
  • 3 863 messages

Last post on this subject in this thread given Henesua's comment (though many modules do give stat boosts to weapons if you weren't aware, Henesua, if you're trying to ultimately make this publicly available).


Don't sweat it, MM. My comment was to let you know that this conversation project is for a specific module in which I have anticipated these kinds of concerns, and so it won't be a problem.
 

I can probably cook up a patch easily enough if you want it.


I am already coding it. :) I have modified NESS significantly so I just maintain it for myself at this point.
 

It's not an AI or anything. The multipage stuff is for cases where the PC has asked the NPC to tell him something and the NPC has agreed and is telling.


I was just curious as to how you set this up. If the string for a particular topic is beyond a certain length do you break it down into sections?

Also, how do you indicate whether an NPC has some long tale to tell on a particular subject? Thats what I was getting at with the pairing of PC Response with the NPC's dialog text.

Example lets say you want to indicate that NPC Foo has backstory to tell for Quest #A13Z. How do you initialize the NPC so that when in conversation with the PC the possibility for telling the backstory shows up? Is it simply the fact that you keep it to one quest at a time on an NPC so that if they have a long tale to tell on something it will be about the currently active quest?

With my approach I was thinking more of having a number of bits of information floating about amongst each "group" and each of these tied to a particular "keyword". Each NPC would have a couple of these, but not all. I'm thinking of flagging the NPC with the keyword. Alternatively rather than set keyword flags, I could populate a pseudo array of possible topics on the NPC and as long as this is populated the NPC can talk about them.
  • Rolo Kipp aime ceci

#18
Shadooow

Shadooow
  • Members
  • 4 468 messages

Why every discussion with you MM turns into, "what I've said, what you've said, what I meant, what you meant, what word have you used, where you have been wrong" ?



#19
meaglyn

meaglyn
  • Members
  • 807 messages

Also, how do you indicate whether an NPC has some long tale to tell on a particular subject? Thats what I was getting at with the pairing of PC Response with the NPC's dialog text.

Example lets say you want to indicate that NPC Foo has backstory to tell for Quest #A13Z. How do you initialize the NPC so that when in conversation with the PC the possibility for telling the backstory shows up? Is it simply the fact that you keep it to one quest at a time on an NPC so that if they have a long tale to tell on something it will be about the currently active quest.

 


I broke it down into different types of information.  Back story is usually that NPC's story. It is triggered by a random "what do you do around here?, what brings you here?" sort of question. But the NPC could go in any direction you wanted from that starting point. 

 

Then there is what I call flavor text. This is fully controlled, you must specify the PC line and then at least on page of NPC output. Whether this shows or not is controlled by a prerequisite variable which, if configured, must be set non-zero on the module or PC for the text to fire. This text could be anything the story requires since you have control over the PC line.  These are used for things that aren't required to advance quests. Flavor text is usually once per NPC per PC.

 

The quests are in two parts really. There's the quest giver's part. This is where the quest is explained, requirements laid out etc and returning to complete the quest.  The former is provided from the generic "anything going on around here?" prompt in the main page, which also delivers rumors if no quest is available. The PC text for the later is usually defined as part of the quest, along with what the NPC says after the PC reports completion, but if not there are a few generic ones like "It is done."  That's the first part.

 

The second part is what I call quest info. This is configured the same way as quests (an ordered list of quest IDs). On dlg init the NPC is given the quest info for the first quest listed for which the PC is in the right state. What quest state is required, along with any item(s) needed to be

the PC's possession etc are part of the configuration for that quest info segment. The text the PC speaks for this is required to be provided.

It can be anything appropriate for the quest.  And then what the NPC replies with is a possibly multipage response (along with optionally taking the items, given other items etc).  It can also be configured to require a bribe or intimidation/persuade to get the NPC to give the quest info.

Usually delivering the quest info advances the quest state, but that is not required.

 

All of these (flavor, quest assignment and completion, and quest info anyway) allow for an arbitrary script to be specified as well. Together all of these give a fair amount of flexibility.  There are few other things like support for doing the work before being assigned the quest and saying, "oh yeah, those goblins, I already took care of that.".  Opening stores, opening special stores base on race, class etc, stealing from the store, doing the subdlg I mentioned earlier.

 

Anyway, that's pretty much where I am now. I was aiming for something I could drop in place and have it more or less just work and be easily configurable outside of the toolset. This discussion has given me a few things to add and clean up as well.  It never ends :) 


  • Rolo Kipp aime ceci

#20
henesua

henesua
  • Members
  • 3 863 messages
I've found a minor annoyance that I'd like to remove.

I have enabled conversations to happen in different languages. This means that eavesdropping PCs should not necessarily understand what an NPC says to the PC they are conversing with.

My approach then is to make the conversation private. Only the PC speaking with the NPC hears the text in the conversation. And then I take all of the text in the conversation and put it through a language cypher. With SpeakString(), the NPC publicly says the garbled version of the text, and nearby PCs who understand them receive the translation in a message.

The problem is that to the PC speaking with them the NPC appears to be speaking their lines twice. How do I exclude the original PC from hearing both?

Perhaps there is a better way to do this? Or perhaps since roleplaying between PCs is really the focus, I should just keep all of this private between the NPC and the PC? Why I don't like this later option is that I am enabling NPCs to be followers, mentors etc... of PCs. And so it makes sense that if one PC hears another abusing one of their wards or even luring the NPC to another cause, that the eavesdropping PC could step up to intervene.
  • Rolo Kipp aime ceci

#21
meaglyn

meaglyn
  • Members
  • 807 messages

@henesua, I'm just looking at adding some of the language stuff myself. How do you make the NPC's conversation private? Maybe I missed it somewhere. ActionStartConversation takes a private argument, but what about the one that runs on the NPC directly?

The zdlg conversation file is started that way usually.



#22
henesua

henesua
  • Members
  • 3 863 messages

Z-dialog uses ActionStartConversation() through its wrapper function:

StartDlg( oSpeaksWith, oCreature, sDialog, bPrivate, bPlayHello, bZoom);

I set bPrivate to TRUE, to make a conversation using z-dialog private.

 

I have my own wrapper function for NPC conversation which sorts out the parameters for StartDlg() along with a variety of other things, and it is launched by the OnConversation creature AI event. So thats what gets used when a PC clicks on an NPC with the "Talk" action.

 

As to how one toggles a conversation's privacy on the creature blueprint, I do not know. Does this exist?
 
As to BeginConversation(). I suggest not using that function unless you have to because it lacks all of the settings which ActionStartConversation() has.


#23
meaglyn

meaglyn
  • Members
  • 807 messages

I have my own wrapper function for NPC conversation which sorts out the parameters for StartDlg() along with a variety of other things, and it is launched by the OnConversation creature AI event. So thats what gets used when a PC clicks on an NPC with the "Talk" action.

 

As to how one toggles a conversation's privacy on the creature blueprint, I do not know. Does this exist?

 

Yeah, i know about the wrapper, wasn't sure about the other other part. That makes sense. Don't configure a conversation and let the on conversation event handle it all in scripting.  I may have to look into that... That would make it easier to have NPCs who don't like the PC brush him/her off with a one-liner too.  Thanks.



#24
henesua

henesua
  • Members
  • 3 863 messages

I was working on a portion where the PC can frighten the NPC and found a problem with the default state script nw_g0_fear.

 

nw_g0_fear only forces the frightened creature to run away from enemies rather than the person who applies the frighten effect to the subject. One potential solution to this would be to find the creator of the frightened/fear effect, but I wasn't sure if this would eat up too many resources on each heartbeat. So instead I created a local integer flag to check for.

int GetCreatureIsAfraidOfTarget(object oCreature, object oTarget)
{
    return GetLocalInt(oCreature, "AI_AFRAID_"+ObjectToString(oCreature));
}

The downside of this is that I have to delete the flag with a delay if the fear has a particular duration. Say a Delay of 30 seconds.

 

So which is worse? Having a 30 second delay or once a heartbeat iterating through all the affects on an NPC looking for the creature which caused the fear effect in the first place?



#25
Shadooow

Shadooow
  • Members
  • 4 468 messages

I was working on a portion where the PC can frighten the NPC and found a problem with the default state script nw_g0_fear.

 

nw_g0_fear only forces the frightened creature to run away from enemies rather than the person who applies the frighten effect to the subject. One potential solution to this would be to find the creator of the frightened/fear effect, but I wasn't sure if this would eat up too many resources on each heartbeat.

Absolutely fine approach. The heartbeat is already fires and such small addition doesnt make a difference neither in long term run. Local is nice idea, but would have to be initiated somewhere - fear spell or in a first time nw_g0_fear is called. I dont think its worth it because the NPC might be target of different fear effect. Not sure whether she can be a target of a multiple fear effects but if she can, this could be also taken into consideration.

 

Anyway, are you sure is it wise idea? It can be exploited - the creature cant do anything so different player in multiplayer environment might go there and kill her - she wont run from him. Same for a player - if he wont run from the enemies then those who hasnt frightened him can kill him with easy if he will just stand there.

 

 

So which is worse? Having a 30 second delay or once a heartbeat iterating through all the affects on an NPC looking for the creature which caused the fear effect in the first place?

Neither. The concerns on both mechanism that are spreading on these forums are overexaggerated.