Can I track variables to determine a character's personality?


Hey all. New to CS, trying to nail down a few particulars.

I apologize if someone has asked this question already, but I haven’t seen it, so I figured I’d throw this out there.

So, I’ve been toying with a way to give a protagonist a bit of a determinate personality, in a fashion that hopefully doesn’t jar the player too much. The way I’d like to do this is by tracking some choices at the beginning of the game, looking at how many instances of, say, diplomatic or kind responses they chose vs. how many sarcastic or humorous ones, etc. I was planning on using hidden variables to track this (i.e., ones not visible on the stats page), and then at the end of the first chapter, asking the game to spit out a boolean based on the numbers.

So, if the player chose humorous responses most often of the three options, the game would “*set funny true” or something, and keep the other two false, and then at certain dialogue/thought parts of the game, I could make some changes based on which of the variables was true. Of course, the player still can override this “default” personality in their actual choices, but I’d like the dialogue they don’t directly select to be something other than bland or neutral.

So… is there a way to get CS to compare three variables, then set a boolean based on which is highest? Maybe something like

*if ((funny > kind) and (funny > mean))
(indent)*set funny true

Can I use a construction like (funny > kind), assuming both have tracked numeric values? Is there some other way to do this that I’m not seeing? I’ve read through the basic CS guide, though I might have missed something like this.


yes you can. In fact you can implement werever algoritmical logic to the player choices as long that the test result don’t result in a contradiction nether or logical closed loophole (like a *if option that send a gosub command into it selfe)


Awesome. Thank you. I suppose I could have just tried it, but I was a little wary of doing so for some reason.


If personality is that important to your game, I’d actually suggest making it a stat that you can alter right throughout the game. In these sorts of story games surely Kindness and Funniness should be every bit as important as boring stats like strength and stamina.

I’d even suggest making it an opposed stat.

Some of my favourite games have personality or morality based stats. Then throughout just do

*if (niceness> 50) You say nice stuff.
*if (niceness <51) You say nasty stuff.

And you can do it as more than just flavour text, allowing for different choices, and people treating you differently depending on your personality.


That’s not a bad idea. I don’t suppose it would be any more difficult in the end than writing for three distinct personalities anyway, and it might make more sense to do it as two opposed pairs, one for something like kind/unkind and one for humor/seriousness.

Thanks, @FairyGodfeather, I appreciate the input.


I’d say think about it at least, and have a look at the other games that have personality based stats. Choice of the Dragon for instance doubles up and has your physical stats tied with your personality. So you’re not just Brutal with an aggressive, charge into things head first personality, you’re also physically strong.


I have a fairly similar system in the game I’m currently working on. It’s by no means perfect, I haven’t quite figured out a satisfactory way to deal with equivalent values. But it’s already functional and tracks which dialogue choices you make, setting the most common as your “dominant trait” out of four available. I’d be more than happy to send you the code if you think it’ll help you. I’ve read the description for your WIP “The Surface” and it seems really interesting, albeit ambitious.


@Left4Bed That sounds like something that might help. I’d appreciate it if you sent it my way. Thanks so much!


It can sometimes be hard to find relevant info on the forums, so I’ve changed the title to something more descriptive and searchable. Carry on. :smile:


Fairygodfeather’s idea is a good one- it would perhaps be easier to

*create personality “unknown”

And then, for what you’re trying to do, at some point,

*if ((funny > kind) and (funny > mean))
  *set personality "funny"
*if ((kind > funny) and (kind > mean))
  *set personality "kind"
*if ((mean > funny) and (mean > kind))
  *set personality "mean"
  *set personality "mixed"
  • because unless you have an odd number of choices, it’s possible that, say, kind and funny are equal, and it will give you an error if you don’t account for that.


@Shawn_Patrick_Reed Ah, thanks. I had briefly forgotten about the possibility of an even number of points in two or more categories. At this stage, it looks like the most feasible thing is going to be two sets of opposed variables, which will also allow for the protagonist’s personality to change over the course of the story. It will also give me the flexibility to require, say, 75% humor in order for something to show up, rather than just “more humor than solemnity” or something like that.


Which I basically agree with. It seems like Dragon Age 2 had a personality tracking system based on simple points like that. The game I’m working on is all based on sliding scales too, It’s a rather large personality spectrum- but for the game personality stats are basically the end all be all.


The issue I have with funny/serious in pair is that, when it’s time to be funny (and say you’re a funny guy) you’ll be funny, while when it’s time to be serious, you’ll be serious.

Instead of funny/serious, a better pair would be:


When being serious is appropriate, and the player decides to cause trouble and be funny in a disrespectful way, seriousness (or professsionalism?) decreases. When nothing important/dangerous is happening and the player is funny, funniness increases (without penalty to seriousness/professionalism)

As for “Nice” (empathic would be a better word) and “mean”, the inbetween could be “indifferent” (your cat died? Hum, sorry. What are we eating tonight?"

A third one would be rude/polite.

    *if (mean) #Sorry but your dress is disgusting. Looks like a farmer made it.
        *set rude +10
        *set mean +10
    *if (rude) #You really shouldn't wear this..
        *set rude +10
        *set mean +10
*comment in this case, if the player has been rude enough time, he might have unlocked "mean",
*comment allowing him to use replies like the first one)
    *if (polite) #Yeah, it's a good dress.
        *set polite + 5
        *set nice + 5
    #Your dress is fine.
    *set nice+5
    *if (nice) #I expected you to look great in this, but I was wrong: you look *marvelous*.

I quickly wrote this so it might (probably will) not work, but I’m sure you’ll have understood what I tried explaining.

I recommend you use numbers rather than boolean since it allows more diversity (nice 20 = “rude”, nice 35-65 is “indifferent”, nice 36 or more is “rude” (you can use a *temp variable in the stat chart to make the percentage show “rude”, “indifferent” or “nice”)


I get where you’re coming from on the “even people who are generally trait x will be otherwise if the situation calls for it” sort of thought. With that though, I think it might make sense and be simpler just to adjust the thresholds. So in a normal situation, it doesn’t take a really skewed humor stat for the character to make a joke, but in a more serious situation, the *if command would require a serious commitment to being humorous over being solemn. I do think that some people deal with stressful situations by cracking jokes, even if it’s inappropriate, and I’d like to reflect a player’s consistent choices to react to things with humor by not imposing my own sense of when it’s appropriate or not to be doing so.

The variables I’ve chosen are humor/solemnity and kindness/efficiency, where being efficient doesn’t necessarily entail being “mean,” (though there are some options to act like an out-and-out jerk), but it does entail not being willing to stop whatever important thing you’re doing and help someone get their cat out of a tree. As with humor, there are degrees of this, of course; even a mostly nice person might not do that, especially if whatever else they were doing was suitably important.

I’m definitely using scales rather than booleans. Personalities are a bit too complicated for yes and no answers. In any case, all the really important decisions will be choices; I just needed a way to figure out how to flavor some of the text, and make some choices available or invisible. :smile:


I like what you decided to do and how you saw it

And I admit, the “being humor in bad, bad situation” you effectively do need to be committed at being humous. With how you explained you’d do it (normal situation, making a joke is easy, etc) it really, really makes sense.

Cause regardless of how you do the variables it’s really how you apply them that matters, and you did find a good way to do it.