Advertisement
roninator2

Yanfly Class System Addons - no Subclass

Dec 9th, 2024
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.97 KB | None | 0 0
  1. =begin
  2. redesigns the class script to have classes changed only, not subclasses
  3.  
  4. =end
  5.  
  6. class Window_ClassList < Window_Selectable
  7.  
  8.   def select_last
  9.     select(@data.index(@actor.class))
  10.   end
  11.  
  12.   def update_param_window
  13.     return if @last_item == item
  14.     @last_item = item
  15.     class_id = item.nil? ? @actor.class_id : item.id
  16.     temp_actor = Marshal.load(Marshal.dump(@actor))
  17.     temp_actor.temp_flag = true
  18.     temp_actor.change_class(class_id, YEA::CLASS_SYSTEM::MAINTAIN_LEVELS)
  19.     @status_window.set_temp_actor(temp_actor)
  20.   end
  21.  
  22. end
  23.  
  24. class Scene_Class < Scene_MenuBase
  25.  
  26.   def start
  27.     super
  28.     create_help_window
  29.     create_command_window
  30.     create_status_window
  31.     create_param_window
  32.     create_item_window
  33.     relocate_windows
  34.     command_class_change # added in
  35.   end
  36.   #--------------------------------------------------------------------------
  37.   # create_status_window
  38.   #--------------------------------------------------------------------------
  39.   def create_item_window
  40.     dy = @status_window.y + @status_window.height
  41.     @item_window = Window_ClassList.new(0, dy)
  42.     @item_window.help_window = @help_window
  43.     @item_window.command_window = @command_window
  44.     @item_window.status_window = @param_window
  45.     @item_window.viewport = @viewport
  46.     @item_window.actor = @actor
  47.     @command_window.item_window = @item_window
  48.     @item_window.set_handler(:ok,     method(:on_class_ok))
  49.     @item_window.set_handler(:cancel, method(:on_class_cancel))
  50.     @item_window.set_handler(:pagedown, method(:next_actor)) # added in
  51.     @item_window.set_handler(:pageup,   method(:prev_actor)) # added in
  52.   end
  53.   #--------------------------------------------------------------------------
  54.   # create_status_window
  55.   #--------------------------------------------------------------------------
  56.   def create_status_window
  57.     wy = @help_window.height
  58.     @status_window = Window_ClassStatus.new(0, wy)
  59.     @status_window.viewport = @viewport
  60.     @status_window.actor = @actor
  61.   end
  62.   #--------------------------------------------------------------------------
  63.   # create_command_window
  64.   #--------------------------------------------------------------------------
  65.   def create_command_window
  66.     wy = @help_window.height
  67.     @command_window = Window_ClassCommand.new(-200, wy)
  68.     @command_window.viewport = @viewport
  69.     @command_window.help_window = @help_window
  70.     @command_window.actor = @actor
  71.     @command_window.set_handler(:cancel,   method(:return_scene))
  72.     @command_window.set_handler(:primary,  method(:command_class_change))
  73.     @command_window.set_handler(:subclass, method(:command_class_change))
  74.     process_custom_class_commands
  75.     return if $game_party.in_battle
  76.     @command_window.set_handler(:pagedown, method(:next_actor))
  77.     @command_window.set_handler(:pageup,   method(:prev_actor))
  78.     @command_window.set_handler(:learn_skill, method(:command_learn_skill))
  79.   end
  80.  
  81.   def on_actor_change
  82.     @command_window.actor = @actor
  83.     @status_window.actor = @actor
  84.     @param_window.actor = @actor
  85.     @item_window.actor = @actor
  86.     @item_window.activate # added in
  87.   end
  88.  
  89.   def on_class_cancel
  90.     SceneManager.return
  91.   end
  92.  
  93.   def command_class_change
  94.     @command_window.deactivate # added in
  95.     @item_window.activate
  96.     @item_window.select(0)
  97.   end
  98. end
  99.  
  100. class Window_ClassStatus < Window_Base
  101.  
  102.   #--------------------------------------------------------------------------
  103.   # initialize
  104.   #--------------------------------------------------------------------------
  105.   def initialize(dx, dy)
  106.     super(dx, dy, Graphics.width, fitting_height(4))
  107.     @actor = nil
  108.   end
  109.   #--------------------------------------------------------------------------
  110.   # refresh
  111.   #--------------------------------------------------------------------------
  112.   def refresh
  113.     contents.clear
  114.     return if @actor.nil?
  115.     draw_actor_face(@actor, 0, 0)
  116.     draw_actor_simple_status(@actor, Graphics.width / 3 , line_height / 2)
  117.   end
  118.  
  119. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement