Advertisement
neutale

Show Face in Choices

Jun 23rd, 2017
615
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.92 KB | None | 0 0
  1. #==============================================================================
  2. #                       「Show Face in Choices」(ACE) ver1.0
  3. #   Script: Nana
  4. #   Happy Nana- http://heptanas.mamagoto.com/
  5. #
  6. #   ◇Terms of Use
  7. #   Please credit "Nana" and link http://heptanas.mamagoto.com/ if possible.
  8. #   Feel free to modify this script and/or distribute it.
  9. #   Also please include the credit in the readme or somewhere it's accessible. (Not from credit roll)
  10. #  
  11. #   ◇Non-commercial use
  12. #
  13. #------------------------------------------------------------------------------
  14. #
  15. #   Insert "Show Choice" as a message window
  16. #   (No need to set the scripts in a particular order)
  17. #  
  18. #   Display "choices" after the "message display"
  19. #   You can use the face graphics and window settings.
  20. #   (If you leave the message text blank, you can display options only)
  21. #   If it fits in the window, the choices are displayed below the text.
  22. #
  23. #==============================================================================
  24.  
  25.  
  26. #==============================================================================
  27. # ■ Game_Message
  28. #------------------------------------------------------------------------------
  29. #  It handles the message that displays sentences and choices.
  30. #  Instances of this class are referenced in $game_message.
  31. #==============================================================================
  32.  
  33. class Game_Message
  34.   #--------------------------------------------------------------------------
  35.   # ● Public instance variable
  36.   #--------------------------------------------------------------------------
  37.   attr_accessor :texts                    # Sentence arrangements (line units)
  38. end
  39.  
  40. #==============================================================================
  41. # ■ Window_ChoiceList
  42. #------------------------------------------------------------------------------
  43. #  Event window used for "Show Choice."
  44. #==============================================================================
  45.  
  46. class Window_ChoiceList < Window_Command
  47.   #--------------------------------------------------------------------------
  48.   # ● Object initialization
  49.   #--------------------------------------------------------------------------
  50.   alias cc_initialize initialize
  51.   def initialize(message_window)
  52.     cc_initialize(message_window)
  53.     self.opacity = 0
  54.     self.z  = @message_window.z + 1
  55.   end
  56.   #--------------------------------------------------------------------------
  57.   # ● Start input processing
  58.   #--------------------------------------------------------------------------
  59.   def start(y_mod)
  60.     update_placement(y_mod)
  61.     refresh
  62.     select(0)
  63.     open
  64.     activate
  65.   end
  66.   #--------------------------------------------------------------------------
  67.   # ● Update window position
  68.   #--------------------------------------------------------------------------
  69.   def update_placement(y_mod)
  70.     self.width = @message_window.width - @message_window.new_line_x
  71.     self.height = fitting_height($game_message.choices.size)
  72.     self.x = @message_window.x + @message_window.new_line_x
  73.     self.y = @message_window.y + y_mod
  74.   end
  75. end
  76.  
  77. #==============================================================================
  78. # ■ Window_Message
  79. #------------------------------------------------------------------------------
  80. #  Message window used for text display.
  81. #==============================================================================
  82.  
  83. class Window_Message < Window_Base
  84.   #--------------------------------------------------------------------------
  85.   # ● Input processing options
  86.   #--------------------------------------------------------------------------
  87.   def input_choice
  88.     if $game_message.texts == [""]
  89.       @choice_window.start(0)
  90.     elsif $game_message.texts.size + $game_message.choices.size > visible_line_number
  91.       input_pause unless @pause_skip
  92.       new_page("", {})
  93.       @choice_window.start(0)
  94.     else
  95.       @choice_window.start($game_message.texts.size * line_height)
  96.     end
  97.     Fiber.yield while @choice_window.active
  98.   end
  99. end
  100.  
  101. #==============================================================================
  102. # ■ Game_Interpreter
  103. #------------------------------------------------------------------------------
  104. #  An interpreter that executes event commands. This is a Game_Map class,
  105. #  Game_Troop Used inside class、Game_Event class.
  106. #==============================================================================
  107.  
  108. class Game_Interpreter
  109.   #--------------------------------------------------------------------------
  110.   # ● Display choices
  111.   #--------------------------------------------------------------------------
  112.   def command_102
  113.     wait_for_message
  114.     $game_message.face_name = ""
  115.     $game_message.face_index = 0
  116.     $game_message.background = 0
  117.     $game_message.position = 2
  118.     $game_message.add("")
  119.     setup_choices(@params)
  120.     wait_for_message
  121.   end
  122. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement