IceDragon200

IEO002-Custom Actor Command

Jun 30th, 2011
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 14.98 KB | None | 0 0
  1. #==============================================================================#
  2. # ** IEO(Icy Engine Omega) - Custom Actor Command
  3. #-*--------------------------------------------------------------------------*-#
  4. # ** Author        : IceDragon (http://www.rpgmakervx.net/)
  5. # ** Script-Status : Change (Actor, Battle)
  6. # ** Script Type   : ActorBattleCommand
  7. # ** Date Created  : 02/15/2011
  8. # ** Date Modified : 02/15/2011
  9. # ** Script Tag    : IEO-002(Custom Actor Command)
  10. # ** Difficulty    : Easy, Lunatic
  11. # ** Version       : 1.0
  12. # ** IEO ID        : 002
  13. #-*--------------------------------------------------------------------------*-#
  14. #==============================================================================#
  15. # ** CREDITS/USED STUFF/EDITING
  16. #-*--------------------------------------------------------------------------*-#
  17. # You may:
  18. # Edit and Adapt this script as long you credit aforementioned author(s).
  19. #
  20. # You may not:
  21. # Claim this as your own work, or redistribute without the consent of the author.
  22. #
  23. #------------------------------------------------------------------------------#
  24. #==============================================================================#
  25. # ** INTRODUCTION
  26. #-*--------------------------------------------------------------------------*-#
  27. # Adding new commands to your actors has never been this fun, you can rearrange
  28. # the defaults, or crack out your scripting skills, and make some of your own.
  29. #------------------------------------------------------------------------------#
  30. #==============================================================================#
  31. # ** COMPATABLITIES
  32. #-*--------------------------------------------------------------------------*-#
  33. #
  34. # Well has only been tested with the DBS. No need for this with BEM.
  35. #
  36. #------------------------------------------------------------------------------#
  37. #==============================================================================#
  38. # ** INSTALLATION
  39. #-*--------------------------------------------------------------------------*-#
  40. # To install this script, open up your script editor and copy/paste this script
  41. # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
  42. #
  43. #-*--------------------------------------------------------------------------*-#
  44. # Below
  45. #   Materials
  46. #   CBS
  47. #  
  48. # Above
  49. #   Main
  50. #   Anything that makes changes to:
  51. #   execute_action_skill (Scene_Battle), and skill_can_use? (Game_Battler)
  52. #  
  53. #------------------------------------------------------------------------------#
  54. #==============================================================================#
  55. # ** CHANGES
  56. #-*--------------------------------------------------------------------------*-#
  57. # Classes
  58. #   Game_Actor
  59. #     new-method :battle_vocab
  60. #     new-method :battle_commands
  61. #   Window_ActorCommand
  62. #     new-method :draw_command
  63. #     overwrite  :initialize
  64. #     overwrite  :setup
  65. #     overwrite  :refresh
  66. #     overwrite  :draw_item
  67. #   Scene_Battle
  68. #     overwrite  :execute_action_skill
  69. #
  70. #------------------------------------------------------------------------------#
  71. #==============================================================================#
  72. # ** CHANGE LOG
  73. #-*--------------------------------------------------------------------------*-#
  74. # (DD/MM/YYYY)
  75. #  02/14/2011 - V1.0  Started Script and Finished Script
  76. #
  77. #------------------------------------------------------------------------------#
  78. #==============================================================================#
  79. # ** KNOWN ISSUES
  80. #------------------------------------------------------------------------------#  
  81. #
  82. #  The Actor Command has been totally rewritten so, if you had any fancy
  83. #  ones, then your screwed here.
  84. #
  85. #------------------------------------------------------------------------------#
  86. #==============================================================================#
  87. # $imported - Is mostly used by Japanese RPG Maker XP/VX scripters.
  88. #             This acts as a flag, or signal to show that "x" script is present.
  89. #             This is used for compatability with other future scripts.
  90. $imported = {} if $imported == nil
  91. $imported["IEO-CustomActorCommand"] = true
  92. #==============================================================================#
  93. # $ieo_script - This is a hash specific to IEO scripts
  94. #               they work just like the $imported, but there key is slightly
  95. #               different, it is an array conatining an integer
  96. #               and a string, since IEO script all have an ID, the value
  97. #               is the scripts version number.
  98. #               A version number of nil, or 0 means the script isn't present
  99. # EG. $ieo_script[[ScriptID, "ScriptName"]]
  100. $ieo_script = {} if $ieo_script == nil
  101. $ieo_script[[2, "CustomActorCommand"]] = 1.0
  102. #-*--------------------------------------------------------------------------*-#
  103. #==============================================================================#
  104. #==============================================================================#
  105. # IEO::CUSTOM_ACTOR_COMMAND
  106. #==============================================================================#
  107. module IEO
  108.   module CUSTOM_ACTOR_COMMAND
  109. #==============================================================================#
  110. #                      Start Primary Customization
  111. #------------------------------------------------------------------------------#
  112. #==============================================================================#    
  113.     module_function
  114.   #--------------------------------------------------------------------------#
  115.   # * battle_command
  116.   #--------------------------------------------------------------------------#
  117.     def battle_command(actor)
  118.       case actor.id
  119.       when 0  ; return []
  120.       when 2  ; return [:attack, :skill, :item, :guard]    
  121.       else    ; return [:attack, :skill, :item, :guard, :mp_recharge]  
  122.       end  
  123.     end  
  124. #==============================================================================#
  125. #                        End Primary Customization
  126. #------------------------------------------------------------------------------#
  127. #==============================================================================#      
  128.   end
  129. end  
  130.  
  131. #==============================================================================#
  132. # Game_Actor IEO002-Game_Actor
  133. #==============================================================================#
  134. class Game_Actor < Game_Battler
  135. #==============================================================================#
  136. #                      Start Lunatic Customization
  137. #------------------------------------------------------------------------------#
  138. #==============================================================================#    
  139.   #--------------------------------------------------------------------------#
  140.   # * Public Instance Variables
  141.   #--------------------------------------------------------------------------#
  142.   attr_accessor :last_command
  143.  
  144.   #--------------------------------------------------------------------------#
  145.   # * alias method :initialize
  146.   #--------------------------------------------------------------------------#
  147.   alias ieo002_lun_initialize initialize unless $@
  148.   def initialize(actor_id)
  149.     @last_command = nil
  150.     ieo002_lun_initialize(actor_id)
  151.   end  
  152.  
  153.   #--------------------------------------------------------------------------#
  154.   # * new method :battle_vocab
  155.   #--------------------------------------------------------------------------#
  156.   def battle_vocab( command )
  157.     case command
  158.     # Default
  159.     when :attack ; return Vocab::attack
  160.     when :guard  ; return Vocab::guard
  161.     when :item   ; return Vocab::item
  162.     when :skill  ; return self.class.skill_name_valid ? self.class.skill_name : Vocab::skill
  163.     # Custom
  164.     when :mp_recharge ; return "Recharge"  
  165.     end  
  166.   end
  167.  
  168.   #--------------------------------------------------------------------------#
  169.   # * new method :battle_commands
  170.   #--------------------------------------------------------------------------#
  171.   def battle_commands()
  172.     return IEO::CUSTOM_ACTOR_COMMAND.battle_command(actor)
  173.   end
  174.  
  175. end
  176.  
  177. #==============================================================================#
  178. # Scene_Battle IEO002-Scene_Battle
  179. #==============================================================================#
  180. class Scene_Battle < Scene_Base
  181.  
  182.   #--------------------------------------------------------------------------#
  183.   # * new method :custom_actor_command
  184.   #--------------------------------------------------------------------------#
  185.   def custom_actor_command( command )
  186.     case command
  187.     when :mp_recharge
  188.       Sound.play_decision
  189.       @active_battler.action.set_custom( :mp_recharge )
  190.       next_actor()
  191.     end  
  192.   end
  193. #==============================================================================#
  194. #                       End Lunatic Customization
  195. #------------------------------------------------------------------------------#
  196. #==============================================================================#  
  197. end
  198.  
  199. #==============================================================================#
  200. # IEO::Icon
  201. #==============================================================================#
  202. module IEO
  203.   module Icon
  204.     module_function ; def actor_command(actor, command) ; return 0 end
  205.   end  
  206. end  
  207.  
  208. #==============================================================================#
  209. # Game_System
  210. #==============================================================================#
  211. class Game_System
  212.  
  213.   #--------------------------------------------------------------------------#
  214.   # * Public Instance Variables
  215.   #--------------------------------------------------------------------------#    
  216.   attr_accessor :wac_displaymode
  217.  
  218.   #--------------------------------------------------------------------------#
  219.   # * alias method :initialize
  220.   #--------------------------------------------------------------------------#  
  221.   alias :ieo002_gs_initialize :initialize unless $@
  222.   def initialize()
  223.     ieo002_gs_initialize()
  224.     @wac_displaymode = 1
  225.   end
  226.  
  227. end  
  228.  
  229. #==============================================================================#
  230. # Window_ActorCommand
  231. #==============================================================================#
  232. class Window_ActorCommand < Window_Selectable #ICY_Window_MiniCommand
  233.  
  234.   include ICY_Window_MiniCommand
  235.   #--------------------------------------------------------------------------#
  236.   # * Public Instance Variables
  237.   #--------------------------------------------------------------------------#  
  238.   attr_accessor :actor
  239.  
  240.   #--------------------------------------------------------------------------#
  241.   # * new method :display_mode
  242.   #--------------------------------------------------------------------------#  
  243.   def display_mode ; return $game_system.wac_displaymode end
  244.    
  245.   #--------------------------------------------------------------------------#
  246.   # * overwrite method :setup_commands
  247.   #--------------------------------------------------------------------------#  
  248.   def setup_commands( type )
  249.     @commands = []
  250.     case type
  251.     when :standard
  252.       @commands = @actor.battle_commands unless @actor.nil?()
  253.     end  
  254.     @last_setup   = type
  255.     @item_max = @commands.size()
  256.   end
  257.    
  258.   #--------------------------------------------------------------------------#
  259.   # * overwrite method :setup
  260.   #--------------------------------------------------------------------------#
  261.   def setup( actor )
  262.     @actor       = actor
  263.     setup_commands( :standard )
  264.     @column_max = 1
  265.     @column_max = 3 if display_mode == 1
  266.     refresh
  267.     self.index = 0
  268.   end
  269.  
  270.   #--------------------------------------------------------------------------#
  271.   # * new method :get_icon
  272.   #--------------------------------------------------------------------------#
  273.   def get_icon(obj) ; return IEO::Icon.actor_command(@actor, obj) end
  274.   #--------------------------------------------------------------------------#
  275.   # * new method :get_vocab
  276.   #--------------------------------------------------------------------------#  
  277.   def get_vocab(obj); return @actor.battle_vocab(obj) end  
  278.   #--------------------------------------------------------------------------#
  279.   # * new method :lastindex_command
  280.   #--------------------------------------------------------------------------#    
  281.   def lastindex_command ; return @actor.nil? ? :nil : @actor.last_command end  
  282.   #--------------------------------------------------------------------------#
  283.   # * new method :set_lastcommand
  284.   #--------------------------------------------------------------------------#        
  285.   def set_lastcommand ; @actor.last_command = command unless @actor.nil? end
  286.  
  287. end
  288.  
  289. #==============================================================================#
  290. # Scene_Battle
  291. #==============================================================================#
  292. class Scene_Battle < Scene_Base
  293.  
  294.   #--------------------------------------------------------------------------#
  295.   # * overwrite method :start_actor_command_selection
  296.   #--------------------------------------------------------------------------#
  297.   def start_actor_command_selection
  298.     @party_command_window.active = false
  299.     @actor_command_window.setup(@active_battler)
  300.     @actor_command_window.active = true
  301.     @actor_command_window.index = 0
  302.   end
  303.  
  304.   #--------------------------------------------------------------------------#
  305.   # * overwrite method :update_actor_command_selection
  306.   #--------------------------------------------------------------------------#
  307.   def update_actor_command_selection
  308.     if Input.trigger?(Input::B)
  309.       Sound.play_cancel
  310.       prior_actor
  311.     elsif Input.trigger?(Input::C)
  312.       actor_command_case
  313.     elsif Input.trigger?(Input::L)  
  314.       Sound.play_cursor
  315.       prior_actor
  316.     elsif Input.trigger?(Input::R)    
  317.       Sound.play_cursor
  318.       next_actor
  319.     end
  320.   end
  321.  
  322.   #--------------------------------------------------------------------------#
  323.   # * new method :actor_command_case
  324.   #--------------------------------------------------------------------------#
  325.   def actor_command_case
  326.     case @actor_command_window.command
  327.     when :attack
  328.       Sound.play_decision
  329.       if $imported["IEO-Handy"]
  330.         return if start_weapon_selection == :cancel
  331.       else  
  332.         @active_battler.action.set_attack
  333.       end  
  334.       start_target_enemy_selection
  335.     when :skill
  336.       Sound.play_decision
  337.       start_skill_selection
  338.     when :guard
  339.       Sound.play_decision
  340.       @active_battler.action.set_guard
  341.       next_actor
  342.     when :item
  343.       Sound.play_decision
  344.       start_item_selection
  345.     else
  346.       custom_actor_command(@actor_command_window.command)
  347.     end
  348.   end
  349.  
  350. end
  351.  
  352. IEO::REGISTER.log_script( 2, "CustomActorCommand", 1.0 ) if $imported["IEO-Register"]
  353. #=*==========================================================================*=#
  354. # ** END OF FILE
  355. #=*==========================================================================*=#
Advertisement
Add Comment
Please, Sign In to add comment