Jump to content

Creating random variations of npc response via sharedinfo


Recommended Posts

I just successfully figured out how to harness the power of sharedinfo to re-purpose the same response across a range of inputs for a given NPC. For example, he gives an item, he says 'here you go !'

But what I cannot figure out is how to add a couple of variations to that npc response to reduce repetition, add a bit of flavor.

I thought that by adding multiple response texts (and recorded voice for each) in the Topic window for the SharedInfo type (under Misc) and choosing Random End for each of them, that would get it done. But instead the npc just buzzes through all of the lines in quick succession.

How do I get this working ?

Link to comment
Share on other sites

See this for explanation how it works.    https://ck.uesp.net/wiki/Topic_Info

You need to create a bunch of responses to a topic, and these responses can use SharedInfo  lines.

For any given topic, game engine goes along its list of responses, until it finds first response which conditions are satisfied.     

For example, lets say you have a quest where Ysolda will pay premium for any mammoth tusks you get.    Then for her "Hello"  Misc topic you can have following responses:

These have condition that player has at least one mammoth tusk:
(R) Been killing mammoths again, eh?
(R) Is that a mammoth tusk in your pants or you are happy to see me?
(R) Oh, I know why you are here
(RE) Those tusks must weigh a lot!   I am here to help.       <<< if this wan was not marked 'Random  End'  engine would add the ones below to random selection as well.

These don't have such condition:
(R) Hello, nice to see you!
(R) No tusks this time, eh?
(R) Nice to have you visit not just for tusks.

Link to comment
Share on other sites

 

I've attached what I have set up in the sharedInfo section. From what I can see I'm following the above (except not using 'hello') but I'm only ever getting the first response in the stack.

What confuses me is: if I'm making multiple responses that each satisfies the conditions (each is a variant of 'here you go'), then the first line will be used, and the rest of them are therefore never appearing.

I realize I'm very out of my depth here so am misunderstanding something. But the effect I want is for the Infos I add in that sharedinfo section to be selected randomly as an end to the conversation. As of now, only the first every plays.

Screenshot 2024-02-07 225656.png

Link to comment
Share on other sites

No no no.    SharedInfos are just  there to facilitate "use in many places" individual response lines.     In fact,  conditions/flags/scripts on  SharedInfo  topics are 100% ignored.

So, in whatever dialogue branch where you want to want  NPC to randomly select one of those lines:     

You add first response,  set its conditions, mark it Random, set it to use "Here ya go" SharedInfo
You add second response, set its conditions, mark it Random, set it to use "Here you are friend" SharedInfo.

etc.

Link to comment
Share on other sites

On 2/7/2024 at 11:50 PM, scorrp10 said:

No no no.    SharedInfos are just  there to facilitate "use in many places" individual response lines.     In fact,  conditions/flags/scripts on  SharedInfo  topics are 100% ignored.

So, in whatever dialogue branch where you want to want  NPC to randomly select one of those lines:     

You add first response,  set its conditions, mark it Random, set it to use "Here ya go" SharedInfo
You add second response, set its conditions, mark it Random, set it to use "Here you are friend" SharedInfo.

etc.

 

Yep - that worked. Thanks a lot ! It does unfortunately make the task much more bloated than I had hoped--adding e.g. 3 variant lines per player line--because I have about 250 player lines to handle.

I'm definitely building this mod with the elegance of a neanderthal, but I guess I have to build it in a way I understand before I can graduate to a more slick method.

I'm essentially using player dialogue section to create a kind of menu of options for the player to pull info from an npc. Player dialogue is probably not the best way to handle this. hm...

Link to comment
Share on other sites

You can use invisible continue feature.

You create a "Responses" branch topic with no player prompt,  and just a selection of random NPC responses.

You also create a very short  "Silence" SharedInfo response with no text or sound.

Then you create your request topics:
Player prompt:   Tell me about this thing.
Response:  use 'Silence' SharedInfo, on whatever conditions you need, with a script fragment of NPC giving you whatever it is they should, and in the continuing topics list, you put in only  "Responses" branch, and check invisible continue.

Link to comment
Share on other sites

On 2/9/2024 at 8:09 AM, scorrp10 said:

You can use invisible continue feature.

You create a "Responses" branch topic with no player prompt,  and just a selection of random NPC responses.

You also create a very short  "Silence" SharedInfo response with no text or sound.

Then you create your request topics:
Player prompt:   Tell me about this thing.
Response:  use 'Silence' SharedInfo, on whatever conditions you need, with a script fragment of NPC giving you whatever it is they should, and in the continuing topics list, you put in only  "Responses" branch, and check invisible continue.

I really appreciate your help here--I just never would have thought of this. I'll have a long look  -- thanks a lot !

Link to comment
Share on other sites

On 2/9/2024 at 8:09 AM, scorrp10 said:

You can use invisible continue feature.

You create a "Responses" branch topic with no player prompt,  and just a selection of random NPC responses.

You also create a very short  "Silence" SharedInfo response with no text or sound.

Then you create your request topics:
Player prompt:   Tell me about this thing.
Response:  use 'Silence' SharedInfo, on whatever conditions you need, with a script fragment of NPC giving you whatever it is they should, and in the continuing topics list, you put in only  "Responses" branch, and check invisible continue.

The clever method you propose makes sense to me and I've started re-mapping what I have in this structure.

The problem I have is the following:

I have (let's say) 100 possible player topics (a list, really). Each links to an 'invisible continue' dialogue which itself has 3 sharedinfo variant comments where I then handle the fragment code as well.

All good so far and I've avoided creating 300 redundant entries.

The problem is that I'm giving the player a misc.object depending on their selection. How do I write up one fragment in that catchall topic that I've funnelled all the other topics to ?

I write Game.Getplayer().Additem(csbitem, 1)    but I need the property of csbitem to reflect an index rather than a fixed misc.object (the names of the objects are e.g. csbitem1, csbitem2 etc.)

I've used a global var. to carry the index number from the player choice, but I'm lost in terms of how to implement that in the fragment..

Maybe I need to use a massive if elseif endif ? It will be as much as 90 deep !

Edited by csbx
Link to comment
Share on other sites

Okay - I think I found a possible direction. I've created a formlist and added:

Game.Getplayer().Additem(CsbItemChoice.getat(MyGlobal as int), 1)

where csbitemchoice is defined as a formlist.

But it doesn't like 'myglobal as int'. 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...