Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Distributing stat values for a player character

I'm trying to create a system whereby a player can assign up to six stat points to three different stats. I'd like it to look something like this:

You have 6 points left to distribute.

Brains
Brawn
Boogie

I'd like there to be up and down arrow buttons next to each stat, and I'd like the value in the preceding sentence to decrease each time an individual stat is increased, and vice versa, in real time.

Can someone shed some light on how to do this, or is this functionality unavailable in Twine (1.4.2)?

Comments

  • My advice is for the SugarCube format. You'll need to look into the story format you use for comparable functions if not SugarCube.

    I use a similar system for my game, but it took me hours to design and bugtest, so I can't give you a template, but rather some things to look at.

    You're best off using a horizontal layout for the buttons:

    Up arrow down arrow "Brains"
    All on one line like that. Otherwise you're going to need to really wrangle with the CSS just to get the button positions correct, which is not worth the hassle imo.


    Instead of arrows, you may also want to consider simply using + and - signs for the buttons, as that is easy to put on a button. For example in SugarCube you'd write it like:

    <<button "+" "next passage">> <<button "-" "next passage">> Brains

    For the real time updates, simply make 2 duplicate passages and use passage tag selectors to remove transitions between passages. Whenever you click on an arrow, have the user progress to the other passage, and have the click update the $points variable. When the new passage reloads, the points value will update if you have the points variable written like this:

    You have <<print $points>> left to distribute.
    Because these two passages will not have any screen transitions, players will be unable to detect they are moving back and forth between two different passages, and will just see the real time updating.


    Finally, to easily change variables with the buttons, you can just have each button link to a specific passage that changes that stat once they arrive on that passage. E.g:

    <<button "+" "brainsgoesup">> <<button "-" "brainsgoesdown">> Brains
    Then in the passage brainsgoesup you'd use a <<set>> macro to increase the value of brains stat by 1, and decrease $points by 1, and then your points display would update as long as it came after those set macros.


    While it should be possible to attach variable changing to the buttons themselves, it's far simpler to do it with several different identical passages like this. I use a similar system for something I have in my game and actually use 9 identical passages just to manage 3 stats. The user isn't aware that they're actually moving between 9 different passages.
  • Thank you, Claretta! It would never have occurred to me to use identical passages without transitions. I will definitely play with your suggestions.
  • I also suggest simplifying it by only have one "increase stat" button for each stat, without any option to subtract points.

    Then at the bottom have a "reset all points" button if someone makes a mistake that will reset all variables to base values and take the user back to the starting passage. Or you could have a reset button for each stat down the bottom for more customization.

    This will both cut down on the coding work required as well as make it easier to understand for the reader.
Sign In or Register to comment.