Advertisement
Archeia

Archeia Engine Ace - Simple Bust Script

Sep 23rd, 2014
801
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 8.75 KB | None | 0 0
  1. #==============================================================================
  2. # ■ Archeia Engine Ace - Simple Bust Script
  3. #------------------------------------------------------------------------------
  4. # This is a simple bust script that merely shows pictures on specified
  5. # coordinates.
  6. #
  7. # screen.pictures[101].show("#{name}-#{emotion}", 0, -200, 129, 100, 100, 0, 0)
  8. # (Filename-Emotion, Origin, X, Y, Zoom X, Zoom Y, Opacity, Blending)
  9. # Filenames should be like Name-Emotion, EX: Rita-Happy.
  10. # To call, show_textbox_face("Name", "Emotion", X-value)
  11. #
  12. # Example: show_textbox_face("Rita", "Happy", -31, 200)
  13. # To clear the bust, just use this on a call script:
  14. # clear_textbox_face
  15. #
  16. # To make it appear above the message box, make sure to use the Z value script.
  17. #==============================================================================
  18.  
  19. class Game_Interpreter
  20.   #--------------------------------------------------------------------------
  21.   # * Show Pictures
  22.   #--------------------------------------------------------------------------
  23.   def show_textbox_face(name, emotion, move_x, move_y)
  24.       screen.pictures[101].show("#{name}-#{emotion}", 0, move_x, move_y, 100, 100, 0, 0)
  25.       screen.pictures[101].move(0, move_x, move_y, 100, 100, 255, 0, 15)
  26.   end    
  27.  
  28.   #--------------------------------------------------------------------------
  29.   # * Clear Pictures
  30.   #--------------------------------------------------------------------------
  31.   def clear_textbox_face
  32.       screen.pictures[101].erase
  33.   end    
  34. end
  35.  
  36. #--------------------------------------------------------------------------
  37. # * Adjust line position
  38. #--------------------------------------------------------------------------
  39.  class Window_Message < Window_Base
  40.     #--------------------------------------------------------------------------
  41.     # * Get New Line Position
  42.     #--------------------------------------------------------------------------
  43.     def new_line_x
  44.       $game_message.face_name.empty? ? 0 : 200
  45.     end
  46.   end
  47.  
  48. #==============================================================================
  49. # ** TDS Change Message Window Z
  50. #    Ver: 1.0
  51. #------------------------------------------------------------------------------
  52. #  * Description:
  53. #  This script allows you to change the Z value of the message window.
  54. #------------------------------------------------------------------------------
  55. #  * Instructions:
  56. #    To set the default message z variable ID (Message Z will be the same as
  57. #    variable value) change this constant in the script:
  58. #
  59. #      DEFAULT_MESSAGE_Z_VARIABLE_ID = variable_ID
  60. #
  61. #      variable_ID = ID of the variable (If 0 it is ignored)
  62. #
  63. #      Example:
  64. #
  65. #      DEFAULT_MESSAGE_Z_VARIABLE_ID = 1
  66. #      
  67. #    To make the Default Message Z Variable update when the message window
  68. #    Z script calls are used, change this constant in the script:
  69. #
  70. #      UPDATE_DEFAULT_MESSAGE_Z_VARIABLE = True or False
  71. #
  72. #    To make the message window appear below pictures, use this in a script
  73. #    call:
  74. #
  75. #      put_message_window_below_pictures
  76. #
  77. #   To reset the message window Z back to it's default value (200), use
  78. #   this in a script call:
  79. #
  80. #     reset_message_window_z
  81. #
  82. #   To set an exact Z value for the message window, use this in a script
  83. #   call:
  84. #    
  85. #     change_message_window_z(Z)
  86. #
  87. #     Z = Z Value
  88. #
  89. #     Example:
  90. #
  91. #     change_message_window_z(500)
  92. #------------------------------------------------------------------------------
  93. #  * Notes:
  94. #------------------------------------------------------------------------------
  95. # WARNING:
  96. #
  97. # Do not release, distribute or change my work without my expressed written
  98. # consent, doing so violates the terms of use of this work.
  99. #
  100. # If you really want to share my work please just post a link to the original
  101. # site.
  102. #
  103. # * Not Knowing English or understanding these terms will not excuse you in any
  104. #   way from the consequenses.
  105. #==============================================================================
  106. # * Import to Global Hash *
  107. #==============================================================================
  108. ($imported ||= {})[:TDS_Change_Message_Window_Z] = true
  109.  
  110. #==============================================================================
  111. # ** Game_Interpreter
  112. #------------------------------------------------------------------------------
  113. #  An interpreter for executing event commands. This class is used within the
  114. # Game_Map, Game_Troop, and Game_Event classes.
  115. #==============================================================================
  116.  
  117. class Game_Interpreter  
  118.   #--------------------------------------------------------------------------
  119.   # * Constants (Settings)
  120.   #--------------------------------------------------------------------------
  121.   # Default Message Z Variable ID (Set to 0 to not use)
  122.   DEFAULT_MESSAGE_Z_VARIABLE_ID = 6
  123.   # Update Default Message Z Variable when changing message window z flag
  124.   UPDATE_DEFAULT_MESSAGE_Z_VARIABLE = true
  125.   #--------------------------------------------------------------------------
  126.   # * Alias Listings
  127.   #--------------------------------------------------------------------------
  128.   alias tds_change_window_message_z_game_interepeter_command_101 command_101
  129.   #--------------------------------------------------------------------------
  130.   # * Show Text
  131.   #--------------------------------------------------------------------------
  132.   def command_101(*args, &block)
  133.     # If Message Z Variable ID is more than 0
  134.     if DEFAULT_MESSAGE_Z_VARIABLE_ID > 0
  135.       # Set Message Window Z Value to Default Message Z Variable
  136.       change_message_window_z($game_variables[DEFAULT_MESSAGE_Z_VARIABLE_ID])
  137.     end    
  138.     # Run Original Method
  139.     tds_change_window_message_z_game_interepeter_command_101(*args, &block)
  140.   end
  141.   #--------------------------------------------------------------------------
  142.   # * Reset Message Window Z Value to original
  143.   #--------------------------------------------------------------------------
  144.   def reset_message_window_z
  145.     # Change Message Window Z and Update Default Message Z Variable
  146.     change_message_window_z(200) ; update_default_message_z_variable(200)
  147.   end
  148.   #--------------------------------------------------------------------------
  149.   # * Put Message Window Below Pictures
  150.   #--------------------------------------------------------------------------
  151.   def put_message_window_below_pictures
  152.     # Change Message Window Z and Update Default Message Z Variable
  153.     change_message_window_z(49) ; update_default_message_z_variable(49)    
  154.   end    
  155.   #--------------------------------------------------------------------------
  156.   # * Get Target of Screen Command
  157.   #     z : z value
  158.   #--------------------------------------------------------------------------
  159.   def change_message_window_z(z)
  160.     # Update Default Messsage Z Variable
  161.     update_default_message_z_variable(z)    
  162.     # If on Scene Map or Scene Battle
  163.     if SceneManager.scene_is?(Scene_Map) or SceneManager.scene_is?(Scene_Battle)  
  164.       # Get Window
  165.       window = SceneManager.scene.instance_variable_get(:@message_window)  
  166.       # Set Window Z if window is not nil
  167.       window.z = z if !window.nil?
  168.     end    
  169.   end
  170.   #--------------------------------------------------------------------------
  171.   # * Update the Default Message Z Variable Value
  172.   #     z : z value
  173.   #--------------------------------------------------------------------------
  174.   def update_default_message_z_variable(z)
  175.     # If Default Message Z Variable ID is more than 0 and it should update    
  176.     if DEFAULT_MESSAGE_Z_VARIABLE_ID > 0 and UPDATE_DEFAULT_MESSAGE_Z_VARIABLE
  177.       # Set Default Message Z Value
  178.       $game_variables[DEFAULT_MESSAGE_Z_VARIABLE_ID] = z
  179.     end    
  180.   end
  181. end
  182.  
  183. #==============================================================================
  184. # ** Window_Message
  185. #------------------------------------------------------------------------------
  186. #  This message window is used to display text.
  187. #==============================================================================
  188.  
  189. class Window_Message < Window_Base
  190.   #--------------------------------------------------------------------------
  191.   # * Alias Listings
  192.   #--------------------------------------------------------------------------
  193.   alias tds_change_window_message_z_window_message_update_back_sprite update_back_sprite
  194.   #--------------------------------------------------------------------------
  195.   # * Update Background Sprite
  196.   #--------------------------------------------------------------------------
  197.   def update_back_sprite(*args, &block)
  198.     # Run Original Method
  199.     tds_change_window_message_z_window_message_update_back_sprite(*args, &block)
  200.     # Update Back Sprite Z Value
  201.     @back_sprite.z = z
  202.   end  
  203. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement