Help please! Distributing points among stats


#1

Basically, the player is creating a character. All his stats are at 0 and I want to give the player 50 points to distribute among his stats, How can I do that on choicescript


#2
*set stat +10
*set points -10

for every option, and have a *selectable_if or *if choice for when the points hit 0 or dip below a certain number (say, 20). you can use whatever value you like instead of ten, obviously, but it should be one that can eventually bring the points down to zero. so, it should be a number 50 is divisible by. you should also take your number of stats into account and how many clicks it would take to get through the section.

so, it’d look something like this:

*label addpoints
Which stats would you like to put points into? You have ${points} points. 

*choice
  *selectable_if (points != 0)
    #Stat1
      *set stat1 +10
      *set points -10
      *goto addpoints
  *selectable_if (points != 0)
    #Stat2
      *set stat2 +10
      *set points -10
      *goto addpoints
  *selectable_if (points != 0)
    #Stat3
      *set stat3 +10
      *set points -10
      *goto addpoints
  *selectable_if (points != 0)
    #Stat4
      *set stat4 +10
      *set points -10
      *goto addpoints
  *selectable_if (points != 0)
    #Stat5
      *set stat5 +10
      *set points -10
      *goto addpoints
  *selectable_if (points < 20)
    #Finished.
      *goto next_scene

#3

Alright, I think I understand. Thanks for replying


#4
*create points 50
*create stat1 0
*create stat2 0
*create stat3 0
*create stat4 0
*create stat5 0

*label addstats
Which stat would you like to increase by a point?
*fake_choice
  #stat 1
    *set stat1 +1
    *set points -1
  #stat 2
    *set stat2 +1
    *set points -1
  #stat 3
    *set stat3 +1
    *set points -1
  #stat 4
    *set stat4 +1
    *set points -1
  #stat 5
    *set stat5 +1
    *set points -1
*if points != 0
  *goto addstats
(more game)

You can add other factors, like having a maximum you can put into a stat, or displaying how many points a player has left, but I’m just doing the bare bones in the simplest form I can think of.