I’m just starting to try out choicescript, and I’m running into an issue with some of the beginning of the “test game” I’m trying out. I wanted to make a scene where the user chooses three skills out of six different options. The problem is that I can’t seem to figure out how to stop the player from selecting skills once they’ve reached three.
Here’s my code for the scene:
*label Magic
*hide_reuse
*temp options 0
Now every magician has some sort of raw, natural talent on them. Something that they can understand and perform better than any other kind of magic. What is your strength? (Choose 3)
*choice
*selectable_if (options < 3) #Fire Magic
*set Fire_Magic +10
*set options +1
*goto Magic
*selectable_if (options < 3) #Ice Magic
*set Ice_Magic +10
*set options +1
*goto Magic
*selectable_if (options < 3) #Wind Magic
*set Wind_Magic +10
*set options +1
*goto Magic
*selectable_if (options < 3) #Lightning Magic
*set Lightning_Magic +10
*set options +1
*goto Magic
*selectable_if (options < 3) #Telekinesis
*set Telekinesis +10
*set options +1
*goto Magic
*selectable_if (options < 3) #Necromancy
*set Necromancy +10
*set options +1
*goto Magic #Done
*finish
I’m not sure if there’s a more efficient way of doing this, but I created a temporary variable (options) in order to count how many choices had been made, and then just put the selectable_if command depending on the value of options.
I’ve tested out a few things, and I believe the fault lies in the relationship between the temp variable options and the selectable_if command I have. I think that I’m somehow typing the (options < 3) part wrong, but if so I’m not sure how to do it “right.”
(edit: for some reason my indenting isn’t transferring well through the post. Trust me my indenting is fine I believe, and it shouldn’t be the issue)
I tried that as well, but I get an error saying, “Non-existent variable ‘options,’” in the scene right before this one, I think because it is temporary only in the scene it is placed in.
If that’s true, this method probably just leaves me to a dead end, correct?
There is no need for a *hide_choice at the start, these are used for *choice options.
The *temp needs to be outside of this loop otherwise it will be reset every time to 0. You can have it at the beginning of the file you are now, right at the top. Once the file is loaded, the *temp will be created and will be usable for as long as you are in this scene file.
It stops reuse for the entire scene, or until using *allow_reuse.
@Idriel One way to do this would be to use two different labels. One to *goto from other parts, and one below the *temp, that you can *goto from the choices.
bla bla bla
*goto magic
*label magic
*hide_reuse
*temp options 0
*label magic2
bla bla
*choice #blabla
*goto magic2