A question about adding stats depending on your name

Hello!

I wanted to add a feature to my WIP where you gain a boost in some stats if you enter a special name at the start of the game.

To put it into an example, the game would prompt you to choose your name, and every name besides A and B would proceed as normal. If your name is A or B, you would receive +5 in, say, Charm and Agility.

Is this possible? I am having some trouble coming up with a code for it, and would be grateful for some assistance!

Yep this is possible!

After the code where the player selects or types their name, you’d put a line to the effect of:

*if mcnamevariable = "specialname"
  *set charm +5
  *set agility +5

Then you’d just move on to the next goto or label as normal and the stats would be boosted. :slight_smile:

1 Like

Forgive my ignorance, but would it be possible for you to give me a simple example of how this code would be applied?

Sure thing. This assumes the variable you’ve created for the MC’s name is simply a string called mcname

Hey, do you remember your name?

Your name, it's...
*choice
  #Dante
      *set mcname "Dante"
      *goto nameselected
  #Delia
      *set mcname "Delia"
      *goto nameselected
  #Bill
     *set mcname "Bill"
     *goto nameselected
  #Juliette
     *set mcname "Juliette"
     *goto nameselected
  #[Input my own]
     *input_text mcname
     *goto nameselected

*label nameselected
*if mcname = "Alex"
  *set charm +5
  *set agility + 5

*elseif mcname = "Vivienne"
  *set strength +5
  *set intellect + 5

Right, you do remember. Your name is $!{mcname}.

(technically if you used implicit control flow, the goto wouldn’t be necessary, but yeah)

2 Likes

Thank you so much, you’ve been a tremendous help!

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.