Advertisement
Guest User

Yanfly Engine Ace - Command Equip v1.02

a guest
Feb 17th, 2015
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.82 KB | None | 0 0
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Command Equip v1.02
  4. # -- Modified by : Doogy
  5. # -- Last Updated: 2015.02.17
  6. # -- Level: Easy, Normal
  7. # -- Requires: Yanfly Engine Ace - Equip Engine
  8. #
  9. #==============================================================================
  10.  
  11. $imported = {} if $imported.nil?
  12. $imported["YEA-CommandEquip"] = true
  13.  
  14. #==============================================================================
  15. # ▼ Updates
  16. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  17. # 2012.01.10 - Compatibility Update: Ace Battle Engine v1.15+
  18. # 2011.12.13 - Started Script and Finished.
  19. #
  20. #==============================================================================
  21. # ▼ Introduction
  22. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  23. # This command allows your actors to be able to change equipment in the middle
  24. # of battle by directly accessing the equip scene in the middle of battle, and
  25. # returning back to the battle scene exactly as it was. Furthermore, you can
  26. # limit how frequently your player can switch equipment for each of the actors.
  27. #
  28. #==============================================================================
  29. # ▼ Instructions
  30. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  31. # To install this script, open up your script editor and copy/paste this script
  32. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  33. #
  34. #==============================================================================
  35. # ▼ Compatibility
  36. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  37. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  38. # it will run with RPG Maker VX without adjusting.
  39. #
  40. #==============================================================================
  41.  
  42. module YEA
  43. module COMMAND_EQUIP
  44.  
  45. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  46. # - Battle Equip Settings -
  47. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  48. # This is just how the text appears visually in battle for your actors and
  49. # how often they can change equips in battle.
  50. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  51. COMMAND_TEXT = "Equip" # Text used for the command.
  52. EQUIP_COOLDOWN = 1 # Turns to wait before re-equipping.
  53. EQUIP_SKIPTURN = true # If true, it will cost an action to equip.
  54. EQUIP_SEALSLOT = [2,3] # list of sealed slots in combat.
  55.  
  56. end # COMMAND_EQUIP
  57. end # YEA
  58.  
  59. #==============================================================================
  60. # ▼ Editting anything past this point may potentially result in causing
  61. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  62. # halitosis so edit at your own risk.
  63. #==============================================================================
  64.  
  65. #==============================================================================
  66. # ■ SceneManager
  67. #==============================================================================
  68.  
  69. module SceneManager
  70.  
  71. #--------------------------------------------------------------------------
  72. # new method: self.force_recall
  73. #--------------------------------------------------------------------------
  74. def self.force_recall(scene_class)
  75. @scene = scene_class
  76. end
  77.  
  78. end # SceneManager
  79.  
  80. #==============================================================================
  81. # ■ Game_Battler
  82. #==============================================================================
  83.  
  84. class Game_Battler < Game_BattlerBase
  85.  
  86. #--------------------------------------------------------------------------
  87. # alias method: on_battle_start
  88. #--------------------------------------------------------------------------
  89. alias game_battler_on_battle_start_ceq on_battle_start
  90. def on_battle_start
  91. game_battler_on_battle_start_ceq
  92. reset_equip_cooldown
  93. end
  94.  
  95. #--------------------------------------------------------------------------
  96. # new method: reset_equip_cooldown
  97. #--------------------------------------------------------------------------
  98. def reset_equip_cooldown
  99. @equip_cooldown = 0
  100. end
  101.  
  102. #--------------------------------------------------------------------------
  103. # alias method: on_turn_end
  104. #--------------------------------------------------------------------------
  105. alias game_battler_on_turn_end_ceq on_turn_end
  106. def on_turn_end
  107. game_battler_on_turn_end_ceq
  108. update_equip_cooldown
  109. end
  110.  
  111. #--------------------------------------------------------------------------
  112. # new method: update_equip_cooldown
  113. #--------------------------------------------------------------------------
  114. def update_equip_cooldown
  115. reset_equip_cooldown if @equip_cooldown.nil?
  116. @equip_cooldown = [@equip_cooldown - 1, 0].max
  117. end
  118.  
  119. #--------------------------------------------------------------------------
  120. # new method: battle_equippable?
  121. #--------------------------------------------------------------------------
  122. def battle_equippable?
  123. reset_equip_cooldown if @equip_cooldown.nil?
  124. return @equip_cooldown <= 0
  125. end
  126.  
  127. #--------------------------------------------------------------------------
  128. # new method: set_equip_cooldown
  129. #--------------------------------------------------------------------------
  130. def set_equip_cooldown
  131. @equip_cooldown = YEA::COMMAND_EQUIP::EQUIP_COOLDOWN
  132. end
  133.  
  134. #--------------------------------------------------------------------------
  135. # alias method: on_battle_end
  136. #--------------------------------------------------------------------------
  137. alias game_battler_on_battle_end_ceq on_battle_end
  138. def on_battle_end
  139. game_battler_on_battle_end_ceq
  140. reset_equip_cooldown
  141. end
  142.  
  143. end # Game_Battler
  144.  
  145. #==============================================================================
  146. # ■ Window_EquipCommand
  147. #==============================================================================
  148.  
  149. class Window_EquipCommand < Window_HorzCommand
  150.  
  151. #--------------------------------------------------------------------------
  152. # overwrite method: handle?
  153. #--------------------------------------------------------------------------
  154. def handle?(symbol)
  155. if [:pageup, :pagedown].include?(symbol) && $game_party.in_battle
  156. return false
  157. end
  158. return super(symbol)
  159. end
  160.  
  161. end # Window_EquipCommand
  162.  
  163. #==============================================================================
  164. # ■ Window_ActorCommand
  165. #==============================================================================
  166.  
  167. class Window_ActorCommand < Window_Command
  168.  
  169. #--------------------------------------------------------------------------
  170. # alias method: make_command_list
  171. #--------------------------------------------------------------------------
  172. alias window_actorcommand_make_command_list_ceq make_command_list
  173. def make_command_list
  174. window_actorcommand_make_command_list_ceq
  175. return unless @actor
  176. return if $imported["YEA-BattleCommandList"]
  177. add_equip_command
  178. end
  179.  
  180. #--------------------------------------------------------------------------
  181. # new method: add_equip_command
  182. #--------------------------------------------------------------------------
  183. def add_equip_command
  184. text = YEA::COMMAND_EQUIP::COMMAND_TEXT
  185. add_command(text, :equip, @actor.battle_equippable?)
  186. end
  187.  
  188. end # Window_ActorCommand
  189.  
  190. #==============================================================================
  191. # ■ Scene_Battle
  192. #==============================================================================
  193.  
  194. class Scene_Battle < Scene_Base
  195.  
  196. #--------------------------------------------------------------------------
  197. # alias method: create_actor_command_window
  198. #--------------------------------------------------------------------------
  199. alias create_actor_command_window_ceq create_actor_command_window
  200. def create_actor_command_window
  201. create_actor_command_window_ceq
  202. @actor_command_window.set_handler(:equip, method(:command_equip))
  203. end
  204.  
  205. #--------------------------------------------------------------------------
  206. # new method: command_equip
  207. #--------------------------------------------------------------------------
  208. def command_equip
  209. remove = []
  210. seal_slot = YEA::COMMAND_EQUIP::EQUIP_SEALSLOT
  211. Graphics.freeze
  212. @info_viewport.visible = false
  213. hide_extra_gauges if $imported["YEA-BattleEngine"]
  214. SceneManager.snapshot_for_background
  215. actor = $game_party.battle_members[@status_window.index]
  216. for etype_id in seal_slot
  217. if not actor.equip_type_sealed?(etype_id)
  218. actor.actor.sealed_equip_type.push(etype_id)
  219. remove.push(etype_id)
  220. end
  221. end
  222. $game_party.menu_actor = actor
  223. previous_equips = actor.equips.clone
  224. index = @actor_command_window.index
  225. oy = @actor_command_window.oy
  226. #---
  227.  
  228. SceneManager.call(Scene_Equip)
  229. SceneManager.scene.main
  230. SceneManager.force_recall(self)
  231.  
  232. #---
  233. show_extra_gauges if $imported["YEA-BattleEngine"]
  234. actor.set_equip_cooldown if previous_equips != actor.equips
  235. @info_viewport.visible = true
  236. @status_window.refresh
  237. @actor_command_window.setup(actor)
  238. @actor_command_window.select(index)
  239. @actor_command_window.oy = oy
  240. for etype_id in remove
  241. actor.actor.sealed_equip_type.delete(etype_id)
  242. end
  243. perform_transition
  244. next_command if YEA::COMMAND_EQUIP::EQUIP_SKIPTURN
  245. end
  246.  
  247. end # Scene_Battle
  248.  
  249. #==============================================================================
  250. #
  251. # ▼ End of File
  252. #
  253. #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement