khanhdu

skill

Nov 26th, 2017
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 10.88 KB | None | 0 0
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Ace Skill Menu v1.01
  4. # -- Last Updated: 2012.01.08
  5. # -- Level: Normal, Hard
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-SkillMenu"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.01.08 - Compatibility Update: Learn Skill Engine
  17. # 2012.01.02 - Started Script and Finished.
  18. #
  19. #==============================================================================
  20. # ▼ Introduction
  21. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  22. # This is a menu reordering script for the Skill Menu for RPG Maker VX Ace. The
  23. # script lets you add, remove, and rearrange skill menu additions added by
  24. # other scripts. This script will update periodically to provide better updated
  25. # compatibility with those other scripts.
  26. #
  27. #==============================================================================
  28. # ▼ Instructions
  29. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  30. # To install this script, open up your script editor and copy/paste this script
  31. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  32. #
  33. # Adjust the module's settings to adjust the skill command window.
  34. #
  35. #==============================================================================
  36. # ▼ Compatibility
  37. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  38. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  39. # it will run with RPG Maker VX without adjusting.
  40. #
  41. #==============================================================================
  42.  
  43. module YEA
  44.   module SKILL_MENU
  45.    
  46.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  47.     # - Command Window Settings -
  48.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  49.     # Adjust the command window that appears in the skill command window. Add,
  50.     # remove, or rearrange the commands as you see fit. If you would like to
  51.     # add in custom commands, please refer to the custom hash. Here's a list of
  52.     # what does what:
  53.     #
  54.     # -------------------------------------------------------------------------
  55.     # :command         Description
  56.     # -------------------------------------------------------------------------
  57.     # :stype_list      Displays all of the actor's usable skill types.
  58.     #
  59.     # :tp_mode         Requires YEA - TP Manager
  60.     # :learn_skill     Requires YEA - Learn Skill Engine
  61.     #
  62.     # :grathnode       Requires Kread-EX - Grathnode Install
  63.     # :sslots          Requires YSA - Slots Battle
  64.     #
  65.     # And that's all of the currently available commands. This list will be
  66.     # updated as more scripts become available.
  67.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  68.     COMMANDS =[
  69.       :stype_list,   # Displays all of the actor's usable skill types.
  70.       :learn_skill,  # Requires YEA - Learn Skill Engine
  71.       :tp_mode,      # Requires YEA - TP Manager
  72.       :grathnode,    # Requires Kread-EX - Grathnode Install
  73.       :sslots,       # Requires YSA - Slots Battle.
  74.     # :custom1,      # Custom Skill Command 1
  75.     # :custom2,      # Custom Skill Command 2
  76.     ] # Do not remove this.
  77.    
  78.     #--------------------------------------------------------------------------
  79.     # - Skill Custom Commands -
  80.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  81.     # For those who use scripts to that may produce unique effects for
  82.     # equipping, use this hash to manage the custom commands for the Skill
  83.     # Command Window. You can disable certain commands or prevent them from
  84.     # appearing by using switches. If you don't wish to bind them to a switch,
  85.     # set the proper switch to 0 for it to have no impact.
  86.     #--------------------------------------------------------------------------
  87.     CUSTOM_SKILL_COMMANDS ={
  88.     # :command => ["Display Name", EnableSwitch, ShowSwitch, Handler Method],
  89.       :grathnode => ["Grathnodes",            0,          0, :command_grath],
  90.       :sslots  => [  "Pick Slots",            0,          0, :command_sslot],
  91.       :custom1 => [ "Custom Name",            0,          0, :command_name1],
  92.       :custom2 => [ "Custom Text",           13,          0, :command_name2],
  93.     } # Do not remove this.
  94.    
  95.   end # SKILL_MENU
  96. end # YEA
  97.  
  98. #==============================================================================
  99. # ▼ Editting anything past this point may potentially result in causing
  100. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  101. # halitosis so edit at your own risk.
  102. #==============================================================================
  103.  
  104. #==============================================================================
  105. # ■ Game_Temp
  106. #==============================================================================
  107.  
  108. class Game_Temp
  109.  
  110.   #--------------------------------------------------------------------------
  111.   # public instance variables
  112.   #--------------------------------------------------------------------------
  113.   attr_accessor :scene_skill_index
  114.   attr_accessor :scene_skill_oy
  115.  
  116. end # Game_Temp
  117.  
  118. #==============================================================================
  119. # ■ Window_SkillCommand
  120. #==============================================================================
  121.  
  122. class Window_SkillCommand < Window_Command
  123.  
  124.   #--------------------------------------------------------------------------
  125.   # alias method: make_command_list
  126.   #--------------------------------------------------------------------------
  127.   alias window_skillcommand_make_command_list_asm make_command_list
  128.   def make_command_list
  129.     unless SceneManager.scene_is?(Scene_Skill)
  130.       window_skillcommand_make_command_list_asm
  131.       return
  132.     end
  133.     return unless @actor
  134.     for command in YEA::SKILL_MENU::COMMANDS
  135.       case command
  136.       #--- Imported YEA ---
  137.       when :stype_list
  138.         add_skill_types
  139.       #--- Imported YEA ---
  140.       when :tp_mode
  141.         next unless $imported["YEA-TPManager"]
  142.         add_tp_modes
  143.       when :learn_skill
  144.         next unless $imported["YEA-LearnSkillEngine"]
  145.         add_learn_skill_command
  146.       #--- Imported Other ---
  147.       when :grathnode
  148.         next unless $imported["KRX-GrathnodeInstall"]
  149.         process_custom_command(command)
  150.       when :sslots
  151.         next unless $imported["YSA-SlotBattle"]
  152.         process_custom_command(command)
  153.       #--- Custom Commands ---
  154.       else
  155.         process_custom_command(command)
  156.       end
  157.     end
  158.   end
  159.  
  160.   #--------------------------------------------------------------------------
  161.   # new method: add_skill_types
  162.   #--------------------------------------------------------------------------
  163.   def add_skill_types
  164.     @actor.added_skill_types.each do |stype_id|
  165.       name = $data_system.skill_types[stype_id]
  166.       add_command(name, :skill, true, stype_id)
  167.     end
  168.   end
  169.  
  170.   #--------------------------------------------------------------------------
  171.   # new method: process_custom_command
  172.   #--------------------------------------------------------------------------
  173.   def process_custom_command(command)
  174.     return unless YEA::SKILL_MENU::CUSTOM_SKILL_COMMANDS.include?(command)
  175.     show = YEA::SKILL_MENU::CUSTOM_SKILL_COMMANDS[command][2]
  176.     continue = show <= 0 ? true : $game_switches[show]
  177.     return unless continue
  178.     text = YEA::SKILL_MENU::CUSTOM_SKILL_COMMANDS[command][0]
  179.     switch = YEA::SKILL_MENU::CUSTOM_SKILL_COMMANDS[command][1]
  180.     enabled = switch <= 0 ? true : $game_switches[switch]
  181.     add_command(text, command, enabled, @actor.added_skill_types[0])
  182.   end
  183.  
  184.   #--------------------------------------------------------------------------
  185.   # new method: process_ok
  186.   #--------------------------------------------------------------------------
  187.   def process_ok
  188.     if SceneManager.scene_is?(Scene_Skill)
  189.       $game_temp.scene_skill_index = index
  190.       $game_temp.scene_skill_oy = self.oy
  191.     end
  192.     super
  193.   end
  194.  
  195. end # Window_SkillCommand
  196.  
  197. #==============================================================================
  198. # ■ Scene_Skill
  199. #==============================================================================
  200.  
  201. class Scene_Skill < Scene_ItemBase
  202.  
  203.   #--------------------------------------------------------------------------
  204.   # alias method: create_command_window
  205.   #--------------------------------------------------------------------------
  206.   alias scene_skill_create_command_window_asm create_command_window
  207.   def create_command_window
  208.     scene_skill_create_command_window_asm
  209.     if !$game_temp.scene_skill_index.nil? && SceneManager.scene_is?(Scene_Skill)
  210.       @command_window.select($game_temp.scene_skill_index)
  211.       @command_window.oy = $game_temp.scene_skill_oy
  212.     end
  213.     $game_temp.scene_skill_index = nil
  214.     $game_temp.scene_skill_oy = nil
  215.     process_custom_skill_commands
  216.   end
  217.  
  218.   #--------------------------------------------------------------------------
  219.   # new method: process_custom_skill_commands
  220.   #--------------------------------------------------------------------------
  221.   def process_custom_skill_commands
  222.     for command in YEA::SKILL_MENU::COMMANDS
  223.       next unless YEA::SKILL_MENU::CUSTOM_SKILL_COMMANDS.include?(command)
  224.       called_method = YEA::SKILL_MENU::CUSTOM_SKILL_COMMANDS[command][3]
  225.       @command_window.set_handler(command, method(called_method))
  226.     end
  227.   end
  228.  
  229.   #--------------------------------------------------------------------------
  230.   # new method: command_grath
  231.   #--------------------------------------------------------------------------
  232.   def command_grath
  233.     SceneManager.call(Scene_Grathnode)
  234.   end
  235.  
  236.   #--------------------------------------------------------------------------
  237.   # new method: command_sslot
  238.   #--------------------------------------------------------------------------
  239.   def command_sslot
  240.     SceneManager.call(Scene_PickSlots)
  241.   end
  242.  
  243.   #--------------------------------------------------------------------------
  244.   # new method: command_name1
  245.   #--------------------------------------------------------------------------
  246.   def command_name1
  247.     # Do nothing.
  248.   end
  249.  
  250.   #--------------------------------------------------------------------------
  251.   # new method: command_name2
  252.   #--------------------------------------------------------------------------
  253.   def command_name2
  254.     # Do nothing.
  255.   end
  256.  
  257. end # Scene_Skill
  258.  
  259. #==============================================================================
  260. #
  261. # ▼ End of File
  262. #
  263. #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment