Novice to Master skill leveling?

Hey, I’m still kind of a noob, so any advice would be appreciated! I’m trying to work out something like a novice to master leveling for skills, but when testing it says that “Non-existing variable cha_text”. My code looks like this (only the relevant parts, lol):

*temp cha_text
*if charisma <= 20
  *set cha_text "Novice"
  *goto chart
*if (charisma > 20) and (charisma <= 40)
  *set cha_text "Apprentice"
  *goto chart
*if (charisma > 40) and (charisma <= 60)
  *set cha_text "Adept"
  *goto chart
*if (charisma > 60) and (charisma <= 80)
  *set cha_text "Expert"
  *goto chart
*if (charisma > 80) and (charisma <=100)
  *set cha_text "Master"

*label chart
*stat_chart
  text Name
  text gender_text Gender

Skills
*stat_chart
  text cha_text Charisma
1 Like

Try creating the cha_text on the startup as a variable, not a temp.
startup.txt:
*create cha_text “”

1 Like

Huh, that actually kind of worked? It passed the quick test, though I’m facing another problem— when I make choices that increase the charisma value, the stats screen still displays it as blank. Everything else has been left basically untouched, except I removed the *temp command in the stats file and added the *create command for cha_text.

As for the choices that increase “charisma”, I did make sure they actually do have the *set charisma +(insert number) command! Just to clarify since that’s the first thing I checked I actually did.

stat_text.txt

*if charisma <= 20
  *set cha_text "Novice"
  *goto chart
*if (charisma > 20) and (charisma <= 40)
  *set cha_text "Apprentice"
  *goto chart
*if (charisma > 40) and (charisma <= 60)
  *set cha_text "Adept"
  *goto chart
*if (charisma > 60) and (charisma <= 80)
  *set cha_text "Expert"
  *goto chart
*if (charisma > 80) and (charisma <=100)
  *set cha_text "Master"
  *return

choicescript_stats.txt

*gosub_scene stat_text
*stat_chart
  text Name
  text gender_text Gender

Skills
*stat_chart
  text cha_text Charisma

I have the stat text divided in another file and last time I checked it worked fine, I remember having an issue where the text string wasn’t updated as I intended it to do, so I experiment and came up with this. If you try it remember to add the “stat_text” to the startup file. Let me know if it works like that.

Oh no, wait, I’d jus saw it. You are using *if *if *if, when you should use *if *elseif *else, like this:

*if charisma <= 20
  *set cha_text "Novice"
  *goto chart
*elseif (charisma > 20) and (charisma <= 40)
  *set cha_text "Apprentice"
  *goto chart
*elseif (charisma > 40) and (charisma <= 60)
  *set cha_text "Adept"
  *goto chart
*elseif (charisma > 60) and (charisma <= 80)
  *set cha_text "Expert"
  *goto chart
*else (charisma > 80) and (charisma <=100)
  *set cha_text "Master"

This one should work too, less words, same output. You can start from the top also, if charisma >=80, elseif charisma >=60, elseif charisma >=40, and so on…

*if charisma <= 20
  *set cha_text "Novice"
  *goto chart
*elseif charisma <= 40
  *set cha_text "Apprentice"
  *goto chart
*elseif charisma <= 60
  *set cha_text "Adept"
  *goto chart
*elseif charisma <= 80
  *set cha_text "Expert"
  *goto chart
*else charisma <=100
  *set cha_text "Master"
3 Likes

A bit of tip when it comes to case-listing issues such as this one: instead of using a series of *if followed by specific brackets of value, instead use *if *elseif *else with “singular” but descending value.

*if char > 80
   *set text "master"
*elseif char > 60
   *set text "expert"
*elseif char > 35
   *set text "novice"
*else
   *set text "noob"
3 Likes

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