Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # ■ Random Choice Order
- # RandomChoiceList.rb
- #------------------------------------------------------------------------------
- # When specified switch is ON, the order of the choices are randomized.
- #
- # ●How to use
- # 1. Turn on a # switch that's specified through module
- # 2. You'll see choices in randomized order during gameplay
- #
- # ●Terms of Service:
- # It's possible to modify and redistribute without permission from the author.
- # And this plugin licensed under MIT License.
- #-----------------------------------------------------------------------------
- # Copyright (c) 2016 Triacontane
- # This software is released under the MIT License.
- # http://opensource.org/licenses/mit-license.php
- #-----------------------------------------------------------------------------
- # Version
- # 1.0.0 2016/11/22 First release
- # ----------------------------------------------------------------------------
- # [Blog] : http://triacontane.blogspot.jp/
- # [Twitter]: https://twitter.com/triacontane/
- # [GitHub] : https://github.com/triacontane/
- #=============================================================================
- module Triac
- # Number of a switch to enable randomized choice order
- RandomChoiceTriggerSwitch = 1
- end
- #==============================================================================
- # ■ Window_ChoiceList
- #==============================================================================
- class Window_ChoiceList < Window_Command
- #--------------------------------------------------------------------------
- # ● Create command list
- #--------------------------------------------------------------------------
- alias rcts_make_command_list make_command_list
- def make_command_list
- if $game_switches[Triac::RandomChoiceTriggerSwitch]
- @random_sort = (0...$game_message.choices.size).to_a.sort_by{rand}
- @random_sort.each do |index|
- add_command($game_message.choices[index], :choice)
- end
- else
- rcts_make_command_list
- end
- end
- #--------------------------------------------------------------------------
- # ● Call choice handler
- #--------------------------------------------------------------------------
- alias rcts_call_ok_handler call_ok_handler
- def call_ok_handler
- if $game_switches[Triac::RandomChoiceTriggerSwitch]
- $game_message.choice_proc.call(@random_sort[index])
- close
- else
- rcts_call_ok_handler
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement