Jump to content
Raizen

Multiple Choices

Recommended Posts

Multiple Choices

Introduction
This script will allow to have as many choices as you like, very simple

and very fast to use.



Screenshots

X5KS1.png

 



How to Use

The instructions are on the script, please read them carefully,

after doing the first time it is really simple to use.



Script

 

# Multiple Choices
# Autor: Raizen
# Compatible with RMVXAce
# Instructions:

# To use is very simple
# Script Call: @get_choices = [a,b,c,d,e,f,g]
#
# where in the letter you put the choices,
# always between quotes
# Example
# Script Call: @get_choices = ["legs", "ball", "house", "car", "demon head", "glasses"]

# To have a cancel condition, the last choices without quotes needs
# to be the number of the choice that cancels.
# Script Call: @get_choices = ["legs", "ball", "house", "car", "demon head", "glasses", 5]
#
# To decide what each decision does, you only need to put
# a condition after the choices call on the events with the
# variable that represents it
# For Example:
# If I want the secondo choice to make the character Jump, I'll put
# after the choices,
# Condition
# Variable X equals to 2
# Jump.



# Ater Call Script,

# Do as you normally would to to create choices, it doesn't
# matter what choices you choos, after the call script it will
# put the choices on the call script.

# After that put the conditions with the variable chosen from below,
# when the player chooses the first choice, the variable will change
# its value to 1, when he chooses the seventh, it will make the variables
# value to 7, so you can create conditions based on the variable




module Raizen_choices
#variable to control the conditions of each choice
Variable = 1
end

#======================================================================
#=========================Here starts the script============================
#======================================================================

class Game_Interpreter
alias raizen_choices setup_choices
def show_choices(choices)
n = 0
while choices[n].is_a?(String)
$game_message.choices.push(choices[n])
n += 1
end
$game_message.choice_cancel_type = choices[n] - 1 if choices[n].is_a?(Integer)
@get_choices = nil
$game_message.choice_proc = Proc.new {|n| @branch[@indent] = n
$game_variables[Raizen_choices::Variable] = n + 1 }
Fiber.yield while $game_message.choice?
end
def setup_choices(params)
@get_choices.nil? ? raizen_choices(params) : show_choices(@get_choices)
end
end




Tsukihime's edit over the script,
this addition allows to set condition for the options to show up.


# Multiple Choices
# Autor: Raizen
# Edit by: Tsukihime
# Compatible with RMVXAce
# Instructions:

# To use is very simple
# Script Call: @get_choices = [a,b,c,d,e,f,g]
#
# where in the letter you put the choices,
# always between quotes
# Example
# Script Call: @get_choices = ["legs", "ball", "house", "car", "demon head", "glasses"]

# To have a cancel condition, the last choices without quotes needs
# to be the number of the choice that cancels.
# Script Call: @get_choices = ["legs", "ball", "house", "car", "demon head", "glasses", 5]
#
# To decide what each decision does, you only need to put
# a condition after the choices call on the events with the
# variable that represents it
# For Example:
# If I want the secondo choice to make the character Jump, I'll put
# after the choices,
# Condition
# Variable X equals to 2
# Jump.



# Ater Call Script,

# Do as you normally would to to create choices, it doesn't
# matter what choices you choos, after the call script it will
# put the choices on the call script.

# After that put the conditions with the variable chosen from below,
# when the player chooses the first choice, the variable will change
# its value to 1, when he chooses the seventh, it will make the variables
# value to 7, so you can create conditions based on the variable




module Raizen_choices
#variable to control the conditions of each choice
Variable = 1
end

#======================================================================
#=========================Here starts the script============================
#======================================================================

class Game_Interpreter
alias :raizen_choices :setup_choices

def show_choices(choices)
n = 0
choices.each {|choice| #
break if choice.is_a?(Integer)
$game_message.choices.push(choice)
n += 1
}
$game_message.choice_cancel_type = choices[n] if choices[n].is_a?(Integer)
@get_choices = nil
$game_message.choice_proc = Proc.new {|n| @branch[@indent] = n
$game_variables[Raizen_choices::Variable] = n + 1 }
Fiber.yield while $game_message.choice?
end

def setup_choices(params)
@get_choices.nil? ? raizen_choices(params) : show_choices(@get_choices)
end
end

# add-on: color commands

class Window_ChoiceList

def make_command_list
$game_message.choices.each do |choice|
if choice.is_a?(Array)
add_command(choice[0], :choice, eval(choice[1]))
elsif choice.is_a?(String)
add_command(choice, :choice)
end
end
end

alias :th_multiple_choice_draw_item :draw_item
def draw_item(index)
change_color(normal_color, command_enabled?(index))
th_multiple_choice_draw_item(index)

end

# not important
def reset_font_settings
end
end



Usage:

# normal usage
@get_choices = [
"one",
"two"
]

# with a condition
@get_choices = [
"one",
["two", "$game_actors[1].level > 4"] # an array is used
]

The choice will be disabled if the condition is not met.
FAQ


Credit and Thanks
- Raizen

- Tsukihime for the second script.

Edited by Raizen884

Share this post


Link to post
Share on other sites

Nice script, very helpful as well :)

 

Although, I'd advise in making the editable region more clear, as non-scripters probably won't see the difference between what they can and cannot edit. ^_^

Share this post


Link to post
Share on other sites

Nice script, very helpful as well :)

 

Although, I'd advise in making the editable region more clear, as non-scripters probably won't see the difference between what they can and cannot edit. ^_^

 

You think that 23-line script is hard to read and modify? xD ... anyway, users need only edit the variable number, which is right at the top, so...should he circle the line with stars and banners? ;D

 

Anyway, thanks Tsukihime Raizen!, nice script once again! With this, I can finally make more choices without having to edit the script in the script editor (like you have to with the other popular More Choices script).

Comfortable and easy, as it should be.

Edited by Caveras

Share this post


Link to post
Share on other sites

@Caveras: Actually its my script .-., well hope you use it ^^.

 

@Tsukihime: Thanks ^^, well I heard about you here, getting a positive comment from you is always satisfying.

 

@DP3: I put 2 extra lines, I usually do that on other scripts, dunno why I did it on this one, well thanks ^^

Share this post


Link to post
Share on other sites

I only mentioned it because in one of the first scripts I made which looked similar to that, someone couldn't tell the difference between the editable part and script and modified what they shouldn't.

It took quite a few posts for me to ask them to show me what they did; now whenever I make a script I always make damn sure they are far far apart, like so:

 

 

# Editable Part

#===================

















class ThingyHere

 

Share this post


Link to post
Share on other sites

I've added choice-enabling/disabling to the script.

 

 

 

# Multiple Choices
# Autor: Raizen
# Compatible with RMVXAce
# Instructions:

# To use is very simple
# Script Call: @get_choices = [a,b,c,d,e,f,g]
#                                 
# where in the letter you put the choices,
# always between quotes
# Example
# Script Call: @get_choices = ["legs", "ball", "house", "car", "demon head", "glasses"]

# To have a cancel condition, the last choices without quotes needs
# to be the number of the choice that cancels.
# Script Call: @get_choices = ["legs", "ball", "house", "car", "demon head", "glasses", 5]
#  
# To decide what each decision does, you only need to put
# a condition after the choices call on the events with the
# variable that represents it
# For Example:
# If I want the secondo choice to make the character Jump, I'll put
# after the choices,
# Condition
# Variable X equals to 2
# Jump.



# Ater Call Script,

# Do as you normally would to to create choices, it doesn't
# matter what choices you choos, after the call script it will
# put the choices on the call script.

# After that put the conditions with the variable chosen from below,
# when the player chooses the first choice, the variable will change
# its value to 1, when he chooses the seventh, it will make the variables
# value to 7, so you can create conditions based on the variable




module Raizen_choices
#variable to control the conditions of each choice
Variable = 1
end

#======================================================================
#=========================Here starts the script============================
#======================================================================

class Game_Interpreter
 alias :raizen_choices :setup_choices

 def show_choices(choices)
   n = 0
   choices.each {|choice| # 
     break if choice.is_a?(Integer)
     $game_message.choices.push(choice)
     n += 1
   }
   $game_message.choice_cancel_type = choices[n] if choices[n].is_a?(Integer)
   @get_choices = nil
   $game_message.choice_proc = Proc.new {|n| @branch[@indent] = n
   $game_variables[Raizen_choices::Variable] = n + 1 }
   Fiber.yield while $game_message.choice?
 end

 def setup_choices(params)
   @get_choices.nil? ? raizen_choices(params) : show_choices(@get_choices)
 end
end

# add-on: color commands

class Window_ChoiceList

 def make_command_list
   $game_message.choices.each do |choice|
     if choice.is_a?(Array)
       add_command(choice[0], :choice, eval(choice[1]))
     elsif choice.is_a?(String)
       add_command(choice, :choice)
     end
   end
 end

 alias :th_multiple_choice_draw_item :draw_item
 def draw_item(index)
   change_color(normal_color, command_enabled?(index))
   th_multiple_choice_draw_item(index)

 end

 # not important
 def reset_font_settings
 end
end

 

 

 

Usage:

 

# normal usage
@get_choices = [
"one",
"two"
] 

# with a condition
@get_choices = [
"one",
["two", "$game_actors[1].level > 4"] # an array is used
] 

 

The choice will be disabled if the condition is not met.

Edited by Tsukihime

Share this post


Link to post
Share on other sites

Tsukihime thanks to add that option, sorry for the time to edit the main post, I was kind of out for some days xD, well didn't do it since it was possible by events also, but it might be very usefull for some people, I'll add it to the post.

Share this post


Link to post
Share on other sites

well, not that quick way xD, I meant like the normal way to do it by events, to make a condition with variables and things like that before script calling, so I think your addition is very useful for a faster way to put conditions ^-^

Share this post


Link to post
Share on other sites

Love this script! Fairly simple and (as stated before) handled in the event itself. I have come across one minor annoyance though.

 

The choice window seems to expand when using conditional choices (For example: greying out a choice when a switch is off) even if the text itself is really small.

This can make the choice window unnecessarily large.

 

This could well be something I overlooked, I just though it might be well to report this.

 

For the rest: keep up the good work!

Share this post


Link to post
Share on other sites

Oh wait is that about tsukihime's edit xD?

Well if you correct that tsuki I'll change in the main topic, I mean, I don't know if it is an issue since I didn't quite test your edit x].

 

Anyway thanks Major and Tsuki :)

Share this post


Link to post
Share on other sites

I'm really sorry! I've tried so hard to get this to work, but I'm clueless.

Where do I put the { @get_choices = ["legs", "ball", "house", "car", "demon head", "glasses"] }

In the actual script?

And when I go to 'call' these options how would I do this?

I really wish I understood scripts..

Share this post


Link to post
Share on other sites

Okay I've got the Script Calls to show up in the events, but now I have a problem even making them 'happen' in the event.

 

On my first attempt I had a NPC ask you whether you wanted to 'Mix', with a yes and no choice.

As in here:

 

Script1_zpsda570269.png

Under the yes choice I called the script, but for some reason when I said yes on the Mix choice it closed, and then I had to interact with the NPC again to make the choices show up. Sometimes the extra choices didn't even show up.

 

I am sorry for this!

Share this post


Link to post
Share on other sites

You don't use show choices command.

 

You just say

 

Script call: @choices = [...]

 

And then you use conditional branches checking the value of the variable that stores the selected option.

 

Share this post


Link to post
Share on other sites

I did that and now whenever I 'action button' the NPC nothing happens,

I swear I'm not stupid.

Here's the script screenshot.

 

Untitled2_zpsc7831c03.png

 

I do really want to get this working, and I appreciate the help.

Share this post


Link to post
Share on other sites

I've still got a problem >_<

 

For some reason the script call doesn't show the choices immediately after a show choice selection, I have to click the NPC again to get the choices up.

 

So I need to fix the problem that the choices don't show up via script call, is there a way to make it just show after what it recedes like an event should?

 

So for example, I'll have a show choice, and then the script call, but for some reason after the show choice it'll just go, no choices show up until I click it again, obviously this isn't what I want.

 

How do I fix this?

Share this post


Link to post
Share on other sites

 

Can you please, please, please provide a demo for this now, it would really help?

 

Oh, and I ran into a problem. It won't work. What am I doing wrong?

 

@get_choices = [["Eric", "$game_switches[1] = on"], ["Natalie", "$game_switches[2] = on"], "Ariel", ["Terence", "$game_switches[3] = on"], ["Ernest", "$game_switches[4] = on"], "Cancel"]

Oh, made a demo as well now.

 

You can find it at here http://home.comcast.net/~nekohibiki/Testing_The_Script.zip

Edited by Nightgazer Starlight

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted