Here is an example of code for a simple Charisma system where you can add and remove Charisma points based on the player's actions, then change the course of the story based on how many Charisma points the player has. This type of system is commonly used in dating SIMS (dating simulation) type games. This code is playable.
Notes:
Code:
// Declare Variable
VAR CHARISMA = 0
// Set variable to random number between 5 and 10
~ CHARISMA = RANDOM(5,10)
Once upon a time...
+ [Continue]
There lived a man.
// Go to first knot to start the game
-> Customize_Man
// First knot where we have a quiz to set the player's CHARISMA. Each question either adds CHARISMA or not based on the answer.
== Customize_Man
The man has {CHARISMA} charisma. // For testing the changes to charisma
Welcome to the story, please answer a few questions so we can understand you better.
+ What are the questions? -> Set_Starting_Charisma
=== Set_Starting_Charisma ===
= question1
Which answer best describes your way of dressing?
* I prefer a nice dress or a suit and tie.
~ CHARISMA += RANDOM(5,10)
-> question2
* I prefer comfortable sweat pants or yoga pants.
~ CHARISMA += 0
-> question2
= question2
The man now has {CHARISMA} charisma. // For testing the changes to charisma
What is your philosophy on tipping?
* I try to tip as much as I can afford.
~ CHARISMA += RANDOM(5,10)
-> question3
* Tipping is a waste of money.
~ CHARISMA += 0
-> question3
= question3
The man now has {CHARISMA} charisma. // For testing the changes to charisma
Are you a good dancer?
* I'm pretty good.
~ CHARISMA += RANDOM(5,10)
-> question4
* I have two left feet.
~ CHARISMA += 0
-> question4
= question4
The man now has {CHARISMA} charisma. // For testing the changes to charisma
Is the glass half full or half empty?
* Half full, I always look on the bright side of life.
~ CHARISMA += RANDOM(5,10)
-> question5
* Half empty, life sucks.
~ CHARISMA += 0
-> question5
= question5
The man now has {CHARISMA} charisma. // For testing the changes to charisma
How are your public speaking skills?
* I love to talk to an audience.
~ CHARISMA += RANDOM(5,10)
-> First_Game_Play_Knot
* I'm okay one on one, but not great with groups.
~ CHARISMA += RANDOM(1,5)
-> First_Game_Play_Knot
* I prefer to keep to myself.
~ CHARISMA += 0
-> First_Game_Play_Knot
// Start playing the game after we get an idea of the player's CHARISMA
== First_Game_Play_Knot
The man now has {CHARISMA} charisma. // For testing the changes to charisma
Now that we know a little more about you, let's get the story started!
+ [Continue]
-> Charisma_Change_On_Choice
// An example of how you can change CHARISMA when players take certain actions in the game
== Charisma_Change_On_Choice
You see beautiful flowers growing in your neighbors yard.
+ Sneak over and pick a bouquet for your upcoming date.
~ CHARISMA -= 10
Oh no, your neighbor caught you and you walk away sulking and flowerless.
-> Arrive_At_Date
+ (ask_flowers) Ask the neighbor if you can pick a few flowers for your upcoming date.
~ CHARISMA += 10
Your neighbor greets you with a smile. She kindly tells you that you can take as many flowers as you want.
-> Arrive_At_Date
// You can use the CHARISMA score to determine the game play
== Arrive_At_Date
The man now has {CHARISMA} charisma. // For testing the changes to charisma
// Change the text based on whether or not the player has flowers
+ [Continue]
You arrive to your date {Charisma_Change_On_Choice.ask_flowers: with a beautiful bouquet of flowers | empty handed}.
- Your date takes a look at you and says...
+ [Continue]
// If the player has high enough CHARISMA they go on a date. If the player's CHARISMA is too low, no date.
{CHARISMA > 40:
- true: I'm so happy to meet you!!
-> Fun_Date
- false: I forgot we were supposed to meet tonight, sorry I'm very busy right now. Can we reschedule?
}
-> END
== Fun_Date
Fun date starts here.
-> END
Notes:
- This is a very simple example of a Charisma system. In a real game, there might be hundreds of different things that change the character's Charisma and many more things that direct the story's action based on the number of Charisma points.
- This system can be used not just for Charisma, but for any type of points you need to manage in a game. A dating SIM will have different requirements than a fighting game or an adventure/RPG, but the game logic is often similar.
- The outputting of the points at each stage in the game code above is only for the author/developer to be able to see those numbers during testing. That code should be removed for actual game play by readers.
- The numbers are technical, so it's often better to completely hide them from players and instead show the player friendly text that changes based on how much Charisma they have (pleasant, magnetic, charming, etc.). Numbers make sense for logic and game development, but for narrative that readers see, words are usually best.