Advertisement
Kakakadafi

[Overwrite] WPN Change Actor Class

Oct 20th, 2017
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.98 KB | None | 0 0
  1. =begin
  2. #===============================================================================
  3.  Title: Weapon Class Changing
  4.  Author: Kadafi
  5.  Date: Aug 8, 2017
  6. --------------------------------------------------------------------------------
  7.  ** Change log
  8.  Aug 10, 2017
  9.    - Bug fixes
  10.  Aug 9, 2017
  11.    - Bug fixes
  12.  Aug 8, 2017
  13.    - Initial release
  14. --------------------------------------------------------------------------------
  15.  ** Description
  16.  
  17.  Change actor class when a weapon equipped.
  18.  
  19. --------------------------------------------------------------------------------
  20.  ** Installation
  21.  
  22.  Place this script below Materials and above Main
  23.  
  24. --------------------------------------------------------------------------------
  25.  ** Usage
  26.  
  27.  Set the weapon notetag
  28.  
  29.    <change actor class: id>
  30.  
  31.  For example,
  32.  
  33.    <change actor class: 3>
  34.    
  35.  Set the Weapon Class based Skill notetag
  36.  
  37.    <ClassSkill>
  38.  
  39. #===============================================================================
  40. =end
  41. $imported = {} if $imported.nil?
  42. $imported["Kadafi_WeaponClassChanging"] = true
  43. #===============================================================================
  44. # ** Configuration
  45. #===============================================================================
  46. module Kadafi
  47.   module Class_Changing
  48.     Keep_Exp = true
  49.   end
  50. end
  51.  
  52. #==============================================================================
  53. # ** RPG::Weapon
  54. #==============================================================================
  55.  
  56. class RPG::Weapon < RPG::EquipItem
  57.   #--------------------------------------------------------------------------
  58.   # * Actor Change Class ID
  59.   #--------------------------------------------------------------------------
  60.   def actor_change_class_id
  61.     note =~ /<change actor class: (\d+)>/i ? $1.to_i : 0
  62.   end
  63. end
  64.  
  65. #==============================================================================
  66. # ** Game_Actor
  67. #==============================================================================
  68.  
  69. class Game_Actor < Game_Battler
  70.   #--------------------------------------------------------------------------
  71.   # * Change Equipment
  72.   #--------------------------------------------------------------------------
  73.   alias old_change_equip change_equip
  74.   def change_equip(slot_id, item)
  75.     old_change_equip(slot_id, item)
  76.     if slot_id == 0
  77.       if item && @equips[slot_id].object == item
  78.         if item.actor_change_class_id > 0
  79.           if @class_id != item.actor_change_class_id
  80.             keep_exp = Kadafi::Class_Changing::Keep_Exp
  81.             change_class(item.actor_change_class_id, keep_exp)
  82.             if @skill_id > 0
  83.               if $data_skills[@skill_id].note =~ /<ClassSkill>/
  84.                 @skill_id = 0
  85.               end
  86.             end
  87.             if @skill2_id > 0
  88.               if $data_skills[@skill2_id].note =~ /<ClassSkill>/
  89.                 @skill2_id = 0
  90.               end
  91.             end
  92.           end
  93.         end
  94.       end
  95.     end
  96.   end
  97. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement