Actor class depends on weapon equip

● ARCHIVED · READ-ONLY
Started by xein 10 posts View original ↗
  1. I need a script where when the player changes an actor's weapon in the equip scene, the actor's class will change depending on the weapon's notetag. 

    e.g <classchange:1>

    This should take effect in the equip scene and change equipment events.

    Since all class will use the same weapon types, I believe this is achievable.

    I'm using the following scripts that I believe may effect this:

    https://www.dropbox.com/s/7hc0kuxfpgjxepj/Ace_Equip_Engine.rb

    thank you.
  2. Tsukihime has made a script that calls a common event whenever something is equipped or unequipped. You could then place the class change commands into these common events.

    However, that way might be difficult if you have too many different weapons and classes. I suggest you try this out if it works for you while waiting if someone can write such a script for you.
  3. Looking at the script, I believe it'll be a pain to setup. I have about 50 classes and atleast 4 actors. 
  4. Here try this:

    Spoiler
    Code:
    #===============================================================================# ***Change Class On Weapon Equip***## Author:     Evgenij (eugene222)# Version:    1.0# Date:       11.07.2014# Requires:   ---#===============================================================================# Changelog:##   11.07.2014 - V. 1.0 - script created##===============================================================================# Terms of Use:#   You can use this script for free and commercial projects as long as you give#   credits.#===============================================================================# Description:#   With this Script you can define weapons which will force a class change on#   equip. You need to take care, that the new class can carry the weapon type#   or you will equip yourself with the weapon change the class and the weapon#   will be unequipped again, because the class cant handle the type.#   #   Weapon Notetag:#   <classchange: class_id>##===============================================================================module EVG  module WeaponClassChange    #---------------------------------------------------------------------------    # Keep EXP on Class Change?    #---------------------------------------------------------------------------    KEEP_EXP = true    #---------------------------------------------------------------------------  endend#===============================================================================class << DataManager  #---------------------------------------------------------------------------  alias :evg_dm_ld_wc     :load_database  #---------------------------------------------------------------------------  def load_database    evg_dm_ld_wc    $data_weapons.compact.each(&:load_wc_notetags)  end  #---------------------------------------------------------------------------end#===============================================================================class RPG::Weapon  #---------------------------------------------------------------------------  def load_wc_notetags    @class_change_weapon = false    @class_change_id     = 0    info = /<classchange:\s*(?<id>\d+)\s*>/i.match(@note)    return unless info    @class_change_weapon = true    @class_change_id = info[:id].to_i  end  #---------------------------------------------------------------------------  def class_change_weapon?    return @class_change_weapon  end  #---------------------------------------------------------------------------  def class_change_id    return @class_change_id  end  #---------------------------------------------------------------------------end#===============================================================================class Game_Actor  #---------------------------------------------------------------------------  alias :evg_ga_ce_wc               :change_equip  #---------------------------------------------------------------------------  def change_equip(slot_id, item)    evg_ga_ce_wc(slot_id, item)    process_class_change(item)  end  #---------------------------------------------------------------------------  alias :evg_ga_fce_wc              :force_change_equip  #---------------------------------------------------------------------------  def force_change_equip(slot_id, item)    evg_ga_fce_wc(slot_id, item)    process_class_change(item)  end  #---------------------------------------------------------------------------  def process_class_change(item)    return unless class_change_item?(item)    self.change_class(item.class_change_id, EVG::WeaponClassChange::KEEP_EXP)  end  #---------------------------------------------------------------------------  def class_change_item?(item)    return false unless item.is_a?(RPG::Weapon)    return item.class_change_weapon?  end  #---------------------------------------------------------------------------end#===============================================================================
  5. Thanks, that worked but a few problem came up.

    1. When the class change the hp and mp became lower than the max hp and max mp. Can you please make it so when class change / any equipment change the current hp and mp is fully healed.

    thank you.
  6. I know what I'll be doing when I'm low on HP/MP.
  7. I dont think that this is a problem but here(do you want this for any equipment or only for class change equipment?):

    Spoiler
    Code:
    #===============================================================================# ***Change Class On Weapon Equip***## Author:     Evgenij (eugene222)# Version:    1.0# Date:       11.07.2014# Requires:   ---#===============================================================================# Changelog:##   11.07.2014 - V. 1.0 - script created##===============================================================================# Terms of Use:#   You can use this script for free and commercial projects as long as you give#   credits.#===============================================================================# Description:#   With this Script you can define weapons which will force a class change on#   equip. You need to take care, that the new class can carry the weapon type#   or you will equip yourself with the weapon change the class and the weapon#   will be unequipped again, because the class cant handle the type.#   #   Weapon Notetag:#   <classchange: class_id>##===============================================================================module EVG  module WeaponClassChange    #---------------------------------------------------------------------------    # Keep EXP on Class Change?    #---------------------------------------------------------------------------    KEEP_EXP = true    #---------------------------------------------------------------------------  endend#===============================================================================class << DataManager  #---------------------------------------------------------------------------  alias :evg_dm_ld_wc     :load_database  #---------------------------------------------------------------------------  def load_database    evg_dm_ld_wc    $data_weapons.compact.each(&:load_wc_notetags)  end  #---------------------------------------------------------------------------end#===============================================================================class RPG::Weapon  #---------------------------------------------------------------------------  def load_wc_notetags    @class_change_weapon = false    @class_change_id     = 0    info = /<classchange:\s*(?<id>\d+)\s*>/i.match(@note)    return unless info    @class_change_weapon = true    @class_change_id = info[:id].to_i  end  #---------------------------------------------------------------------------  def class_change_weapon?    return @class_change_weapon  end  #---------------------------------------------------------------------------  def class_change_id    return @class_change_id  end  #---------------------------------------------------------------------------end#===============================================================================class Game_Actor  #---------------------------------------------------------------------------  alias :evg_ga_ce_wc               :change_equip  #---------------------------------------------------------------------------  def change_equip(slot_id, item)    evg_ga_ce_wc(slot_id, item)    process_class_change(item)    @hp = mhp    @mp = mmp  end  #---------------------------------------------------------------------------  alias :evg_ga_fce_wc              :force_change_equip  #---------------------------------------------------------------------------  def force_change_equip(slot_id, item)    evg_ga_fce_wc(slot_id, item)    process_class_change(item)    @hp = mhp    @mp = mmp  end  #---------------------------------------------------------------------------  def process_class_change(item)    return unless class_change_item?(item)    self.change_class(item.class_change_id, EVG::WeaponClassChange::KEEP_EXP)  end  #---------------------------------------------------------------------------  def class_change_item?(item)    return false unless item.is_a?(RPG::Weapon)    return item.class_change_weapon?  end  #---------------------------------------------------------------------------end#===============================================================================
  8. Any equipment, please.

    Thank you.
  9. Editet the script above for every equipment.
  10. Thank you. I'll post up again if there's any problem.