So I posted on here back in May for a personality trait system (I’m using @SpokesWriter’s code for it and it’s been working great!) but I’m finding that the mixed trait I needed for characters that had the same numbers in multiple traits is falling…flat.
Logistically it works, but I can’t write text that feels personalized for the characters in this case, whereas characters with a dominant trait get specifically tailored text to that personality.
SO what I’m thinking is, I want the mixed trait to ping which of those traits are equal and then randomly pick from those to present that trait’s text in-game.
i.e.
Character has the following personality
Aggressive: 3
Shy: 1
Emotional: 3
They’ll show up as having a mixed personality but only between aggressive and emotional. The game will then pick, randomly per playthrough, either the aggressive or emotional text to display in-game.
Except I have no idea how to code for this or where to even begin.
I imagine it’d start with
*if dom_trait = “mixed”
*gosub_scene mixedtrait
Then create a gosub that fits the code I need for it to ping which traits are causing the mixed trait.
So, if anyone has any ideas, I’d appreciate it!
Here is the code for the gosub_scene I have for the personality trait system.
Having the game randomly pick between the two is dangerous; as tedious as it may be, allowing the reader pick between the two might be more effective and also allow for more replayability (the reader wonders what would change if they were more aggressive instead of emotional.)
With that in mind:
the following code should be adaptable for your use:
scene = random_cards
*label startofreading
*comment Są to pierwsze możliwe z 26 kart. Dla drugiej i trzeciej opcji będzie również 26 do wyboru./ / /
*temp tarotcard
*if have_made_random_roll1 = false
*rand tarotcard 1 10
*set have_made_random_roll1 true
*if (tarotcard=1)
*set t_fool true
*gosub_scene cardsandmeaning
*elseif (tarotcard=2)
*set t_empress true
*gosub_scene cardsandmeaning
*elseif (tarotcard=3)
*set t_lovers true
*gosub_scene cardsandmeaning
*elseif (tarotcard=4)
*set t_hermit true
*gosub_scene cardsandmeaning
*elseif (tarotcard=5)
*set t_hanged_man true
*gosub_scene cardsandmeaning
*elseif (tarotcard=6)
*set t_devil true
*gosub_scene cardsandmeaning
*elseif (tarotcard=7)
*set t_moon true
*gosub_scene cardsandmeaning
*elseif (tarotcard=8)
*set t_world true
*gosub_scene cardsandmeaning
*elseif (tarotcard=9)
*set ace_of_c true
*gosub_scene cardsandmeaning
*elseif (tarotcard=10)
*set a4_of_c true
*gosub_scene cardsandmeaning
Okay so, I didn’t end up using that code but it really helped me wrap my head around trying to figure out what I was going for! So thank you!
I’ve made a code that works for what I want it to do, its probably horribly inelegant and rip-shod, but now going to the stat screen causes it to randomize again and, therefore, changes the text–which isn’t what I want at all.
So, say the character has the following personality.
Aggressive: 3
Benevolent: 1
Charming: 3
Stoic: 3
The game randomizes between the dominant traits of aggressive, charming, and stoic and goes as follows.
“I have an aggressive personality” goto stat screen return to game
“lol nvm I have a stoic personality type!”
etc.
In-game code
*set aggressive 3
*set stoic 3
*set charming 3
*gosub_scene findtrait
Testing randomization in mixed personality, dominant trait.
*if dom_trait = "mixed"
*gosub_scene mixedtrait
*if mixed_trait = "aggressive"
"I have an aggressive personality"
*if mixed_trait = "benevolent"
Benevolent text
*if mixed_trait = "charming"
"I have a charming personality"
*if mixed_trait = "cruel"
Cruel text
*if mixed_trait = "diplomatic"
Diplomatic text
*if mixed_trait = "emotional"
Emotional text
*if mixed_trait = "shy"
Shy text
*if mixed_trait = "stoic"
"lol nvm I have a stoic personality type!"
Is there anyway to stop this?
If there isn’t, I totally don’t mind players going to the stats and back to try and get the response they want from their mixed personality traits, so mostly just wondering if it is indeed a fixable issue?
I’m kinda iffy about the random selection between the two tbh . None the least because of that much code. That’s a lot of checks for something that will only occur a small percentage of the time. If you don’t want to have the player pick which text is displayed, maybe consider a priority system instead? So if you’re using the example you gave there, have it prioritize Aggressive > Benevolent > Charming > Stoic.
So if you have:
Aggressive: 3
Benevolent: 1
Charming: 3
Stoic: 3
It’ll display the text for Aggressive (which takes priority). And if instead you have
Aggressive: 1
Benevolent: 1
Charming: 3
Stoic: 3
It displays Charming (the next one on the priority list). If you want variant personalities, just switch up the priority list for the next set of text you call this in, so Aggressive is the one called last in this scenario. Remember that most people are only going to play through once, or are going to be playing different character builds, so the odds of them noticing this aren’t especially high.
That being said, if you are going this route, the bug you’re encountering is on the documentation page for this (in the Known bugs section): https://choicescriptdev.fandom.com/wiki/Rand. The fix is to have a *page_break in the code after you run the subroutine and before you display the text.
This is their example
You carefully open the chest at arm's length, wary of traps . . .
*temp treasure
*rand treasure 50 100
*page_break It creaks open . . .
You gasp in amazement, finding ${treasure} gold coins in the chest!
*set gold + treasure
Yeah I was going to consider the priority option too and I’ll probably re-visit this thing several times going forward.
I do kind of have a priority system set up for some personality checks, this is my attempt at a work around with the mixed trait personality to try and avoid having to write out a mixed trait dialog that just won’t be as personal as the other trait’s dialogs (for obvious reasons).
Thank you for the link and the input! I think with the way my personality trait tests are in-game it’d be awkward to just slam a page break in the middle of them. It’ll probably work for some, and it’s good to know going forward!
I’ll go ahead and mark this as resolved though so this can be put to rest, for now.
Is it possible for you to do it a little ahead of time? (Maybe have it *set mixed_trait before the last page break already in the code, or run the subroutine to update whenever the stats themselves change), so you don’t have to force a new page break in text? It’s a bit ugly, but so long as you’re mindful about where you adjust personality stats, it should work.
Sorry if this is harping ^^. Either way, good luck to you!
Ooooh no you’re totally right I can definitely do that. I don’t expect my game to be pretty coding wise just so long as it works!
I hadn’t even thought about that which is funny because that’s what I already do for the dominant trait tests, run the sub routine whenever theres a choice that changes the personality traits, so throwing the mixed trait routine in there should work great!
It feels like an ‘oh duh’ moment for me but that’ll totally work so thanks for pointing it out