Jump to content

Best way to handle 'points system' in dialogue.


csbx

Recommended Posts

I'm working on dialogue that I'd like to handle in the following way: depending on which bits of dialogue the player chooses, they will be contributing to the npc choosing different courses of action. What I have in mind is a 'points system' wherein some of the dialogue options contribute a point toward one of several outcomes; once a certain threshold has been reached, the npc takes a certain course of action.

 

To simplify things, imagine a points system of 'pissing off the npc'. I allow for the possibility for the player to annoy the npc on multiple occasions; if they do this sufficiently, the npc becomes hostile (or whatever).

 

What is the best way to handle this mechanic ? I'm not a skilled programmer, so without thinking much on it, my first approach would be to use setstages as an increment. So if you insult (or whatever) once,

it checks getstagedone(30), and if it's 0 it sets it to 1; if you carry on until stage(33) then X happens.

 

Is this the best approach ? Do global variables make more sense here ?

Link to comment
Share on other sites

Do you want this for any possible NPC or just specific ones? If you are only looking for a small set of predefined NPCs to have this mechanic, then GlobalVariables will work very well. If you want this for a any possible NPC that meets certain criteria at runtime, then this becomes much more complicated. Alternatively, if you want a specific number of NPCs, but want to set which NPCs they are at runtime, a combination of QuestAliases and GlobalVariables will achieve your goal. Which route are you going with this?

Link to comment
Share on other sites

Ahoy palingard. This is a very limited use mechanic that I would implement for some or all of the custom npcs that I add to my mods. I'm looking for a general way to handle dialogue that offers the player multiple options that have consequences.

 

So if I wanted to track the number of times the player chose the 'evil' option and the 'good' option (I'm being simplistic here) with a particular custom npc I would have 2 global variables for this each of which could increase incrementally until some threshold is reached ?

 

Thanks !

Edited by csbx
Link to comment
Share on other sites

If you want to add this feature to a couple of custom unique NPC's then I would probably have a look at this: http://www.creationkit.com/index.php?title=Relationship

 

Using relationship ranks, I'd try something like this (not 100% sure if this works, but this is where I would start):

1. Make a global variable relationPoints for each NPC. it will store the current relationship to the player.
(e.g. -40 = max hated; 0 = neutral; 40 = max friendly)

2. Create a Relationship quest for each NPC.
Set Stages up for relationship ranks showing here: http://www.creationkit.com/index.php?title=SetRelationshipRank_-_Actor
In Each stage you'll set the specific Relationship rank and add whatever you want the actor to do.
(e.g. give the actor AI packages that only run while this quest stage is active - maybe you want children to flee from the player if he was mean or something like that)

3. So if you have some quest with e.g. an insult dialogue line, you add a script to that dialogue that gets the current value of of the global, subtract any amount you want and react according to the result.
(e.g. you'll get currentValue = 15 (friend), the insult does -20 Relation Points => new Value = -5 (rival)
So you'll set the rival QuestStage)

Also doesnt always have to be a quest/dialogue... For Example: NPC_01 doesnt want the player to enter his garden? -> set up a trigger Box, and when the player does enter the box, you'll calculate the new relationPoints and set the RelationshipQuest to the stage according of the result...


-> Dont forget to end the quest when the NPC dies
-> you also might want to check that the global value doesnt get lower/bigger than the max amount
-> also consider setting the positive max to "ally", so that not everybody can get to rank "lover".
-> In some cases you maybe also want to add the NPC to a certain faction if you need to do certain things.

Link to comment
Share on other sites

Guys--this has been very helpful.

 

Relationship is one aspect I am looking at--that would be one broad variable that would apply to a given NPC and would have long term effects in the game.

 

But the second aspect I'm looking at is more about local kinds of variables that shift how a conversation moves, and how an npc responds. Consider the following example that I'll just make up:

You meet a young boy who is living in the city. Through conversation you find he is not sure about what side of the civil war he is on. In that conversation you can advocate for one side of the other, by telling stories about things you have seen, by lying (given the right speechcraft level he might believe you e.g.), by insulting a side, or by using information about the boy (dialogue would open up if you read the right note e.g.) to convince him one way or the other. Each of these dialogue options may also be handled with different tones, some which would repel him, others which would garner his favor. In this conversation you could track several variables:

1) his affinity for you (relationship)

2) his decision regarding which side of the civil war he agrees with

3) whether or not he will take up the fight to join that side (you could imagine certain bits of dialogue as contributing to his confidence or not)

 

So within this framework, player choice (via dialogue) could potentially 'add points' in one direction or another. So Affinity, Civil War choice, and Confidence could, say, start at a neutral 3 points and, if a given threshold is reached, would trigger the npc to become hostile and attack, or be open to being a follower, to side with the Imperials (or not) and to actually join the war (or sit at home).

 

This all sounds very ambitious, but I'm interested in at least creating proofs of concept for having player choice weigh more heavily in dialogue with npcs.

 

You guys seem to agree that global variable is the way to go--is there some advantage that it has vs. using quest stages as way of keeping track of a variable ? I get that the latter approach may be a little more kludgy with the programming, but if I can just plop it into the quest that already exists for that npc, I'm not sure I see the advantage of the GV option.

Link to comment
Share on other sites

You guys seem to agree that global variable is the way to go--is there some advantage that it has vs. using quest stages as way of keeping track of a variable ? I get that the latter approach may be a little more kludgy with the programming, but if I can just plop it into the quest that already exists for that npc, I'm not sure I see the advantage of the GV option.

 

The global variable is for storing an integer, so you can access it and calculate it from everywhere (every quest, triggerbox, activator...)

You might have an actor involved in multiple quests with dialog, so you dont want to loose the information when quest A is finished, so you can use it in QUest B..

 

According to your example.. its pretty easy imho:

 

1. You set the relationship global, the civilWar global and the confidence global according to the dialog options of your quest(s).

2. after you change the value of a global check if you have to do something

For example:

- if relationshipGlobal >= 50 and <= 75 then setRelationshipRank to Ally

- If civilWarGlobal > 75 add imperialFaction to the actor; if < 25 add stormcloakFaction to the actor,

(dont forget to call setReaction too - http://www.creationkit.com/index.php?title=SetReaction_-_Faction )

-> You can do all kinds of checks like: ; if relationshipGlobal < 15 and confidenceGlobal > 60 add IhateThePlayerKillOnSightFaction to the actor

 

3. You also can set up AIPackages with coditions checking the globals like a stayAtHomeSandboxPackage0x24 with condition confidenceGlobal < 10 to make the NPC never leave its home again

or a patrol package for letting him patrol around the town if he is in imperial faction and has a confidenceGlobal > 50

or a hideInTheWoodsStormcloakSandboxPackage0x24 if stormcloakFaction and Confidence > 50 to make him sandbox in some stormcloak camp...

Edited by azraelb
Link to comment
Share on other sites

  • Recently Browsing   0 members

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