When creating a list, how can you allow someone to make more than one choice from it?


#1

hi all,

i’ve been awake all night working on my game but I’ve ran in to a brick wall.

How do I allow someone to make a number of choices from the same list without them being moved to the next section of the game?

and also, how can I limit the number of choices they make from that list?

thanks in advance .
:slight_smile:


#2
  1. At the beginning of the scene, set *disable_reuse globally
  2. Alternatively, set *disable_reuse on each option in the multiple-choice list they’re selecting from
  3. After the player picks an option, give them a bit of text telling them they can pick additional options
  4. Add a *goto before_question at this point, and a *label before_question before the option they’re re-picking
  5. To get them out of this loop, either give them an option to say “I’m done picking” (if it’s allowable to choose every option on the list) OR
  6. Add a temp variable that counts choices; each of the options also has a line that says *set options_picked +1
  7. If options_picked = (however many they get), send the player to a label after rather than the “you get another option” text.

There are slightly more complicated things you can do with this system; for example, in Zombie Exodus, @JimD allows you to choose up to a certain amount of weight for your inventory. Each item you pick to add to your backpack adds +(however many pounds) to your total weight. When you get to your weight limit, the only way to carry more is to take something back out (go to a list of currently chosen items, where you can choose to subtract the item from your inventory as well as its weight from your total.)


#3

If its only for that chapter I use *temp variables otherwise make the variables global. Here’s how i would do it off the top of my head. (As an example.)

Eg.
(Under start up)
*create agility 0
*create intelligence 0
*create strength 0
*create dexterity 0

(At the top of the scene/chapter)
*temp skills_limit 3

(Somewhere in that scene/chapter)
*label skill_upgrade

You have ${skills_limit} skill points to use.
*choice
*selectable_if ((agility <= 2) and (skills_limit <= 3)) #Increase agility by 1
*set agility + 1
*set skills_limit - 1
*goto label skill_upgrade

*selectable_if ((intelligence <= 2) and (skills_limit <= 3)) #Increase intelligence by 1
*set intelligence + 1
*set skills_limit - 1
*goto label skill_upgrade

#Finished increasing skills.
*goto next_label

(You get the idea for adding the other skills.)

It takes time tweaking this type of code. There can be many errors and bugs that pop up. I spend ages on these types of choices. Anyway, hope that helps with your coding.


#4

Thanks for that but would you mind explaining to me how to implement steps six and seven? I didn’t really understand those two steps.
Sorry… It’s just that I have only begun using choicescript yesterday.


#5

Try something like this:

*temp pick_count 0
*temp pick_left 3

*disable_reuse

*label pick 

*if pick_left < 3
    Select ${pick_left} more options
    
*if pick_left = 3
    Select ${pick_left} options

*fake_choice
    #1
        *set pick_count + 1
        *set pick_left - 1
    #2
        *set pick_count + 1
        *set pick_left - 1
    #3
        *set pick_count + 1
        *set pick_left - 1
    #4
        *set pick_count + 1
        *set pick_left - 1
        
*if pick_count < 3
    *goto pick

Let's get started!

#6

If fantom’s explanation didn’t clarify it, here’s the exact code I was thinking of:

*temp hats_bought 0
What hat do you want to buy? (You can buy more than one, but only have space in your wardrobe for three at the most.)

*label hats_for_sale
You buy...
*choice
   #A fancy hat.
      *set hats_bought +1
      *goto more_hats
   #A feathery hat.
      *set hats_bought +1
      *goto more_hats
   #A jester hat with bells.
      *goto more_hats
      *set hats_bought +1
   #A hat with fake flowers.
      *goto more_hats
      *set hats_bought +1
   #A hat shaped like a cat.
      *goto more_hats
      *set hats_bought +1
   *if hats_bought>=1
      #You are done buying hats.
         *goto check_out
*label more_hats
*if hats_bought=3
   *goto check_out
*if hats_bought<3
   You may still buy another hat, if you wish.
   *goto hats_for_sale
*label check_out
You pay the cashier and leave with your new 
*if hats_bought=1
   hat.
*if hats_bought>1
   hats.
*goto after_the_hat_shop

#7

To confuse matters, there’s also a way of making multiple choices. Scroll down the linked page page to ‘multiple choice’.


#8

Whaaaaat? How did I not realize this existed? I have some new homework to do.

The way I just stated works for multiple items in the same category, but to choose three categories of things at once? Bananas.


#9

It’s a little known, and rarely implemented feature. I’ve never used it myself. The way you explained is the standard way to do things.


#10

Thanks for the help. One last question though:
say if I have *create name “”, how do I use that label for a number of people?
say if character one was called Jack and character to was called Gill, how will Choicescript know what character I’m talking about.
for instance you can’t write:
You tell {name} your name which is {name}.


#11

You need different variables. Like, if Jack is a dairy farmer and Gill is a haberdasher, you could create a variable {df_name} and one called {h_name}. Or number them (name1, name2, etc.) Whatever works to keep them straight, but no, you can’t use the same one.


#12

Haha I know I said that was my last question but i’ve unfortunately got one more.
say if you previously have the option of choosing a characters gender, how can you implement a consequence as a result of that choice?
for example, say you get to choose one of the characters gender in my game and you choose male, how can you for instance make him flex his biceps or a female brush her hair but later on in the game?


#13

Have you tried my guide? (And the conversation on it if you want)


#14
*if gender = "male"
    flex biceps
*if gender = "female"
    brush hair

That’s pretty much basic stuff.


#15

again. Thanks everyone. You’ve been a great help. :slight_smile:


#16

I’m sure @Reaperoa’s guide is better at it. I’ve a guide specifically on gender things though.