Jump to content
Sign in to follow this  
kyonides

KDualWield & Accessory Skills XP + VX + ACE

Recommended Posts

KDualWield & Accessory Skills

XP + VX + ACE

by Kyonides

Introduction


Do you want to force your heroes to equip two weapons and probably even an accessory before they can use that super cool skill you have come up with? :think: 
Now you can do it! 😀

XP handles it in an entirely different way, so I prefer not to post the code here. XP users will feel more comfortable by testing the demo.

You will need to use 1 out of 2 Note Tags to that Skill Notes to make it happen! 😉

VX Script

# * KDualWield & Accessory Skills VX * #
#   Scripter : Kyonides Arkanthes
#   2023-02-09

# * Free as in beer * #

# Force your heroes to equip specific weapons or even an accessory as well
# in order to be enabled to cast a specific skill.
# NOTE: The Weapons Order does NOT matter here!

# * Note Tags * #
# - For Dual Weapons:        _dual 1 2_
# - For Weapons & Accesory:  _dual 1 2 acc 1_

module KDualWield
  REGEX_WEAPONS = /_dual (\d+) (\d+)_/i
  REGEX_WEAPONS_ACCESSORY = /_dual (\d+) (\d+) acc (\d+)_/i
end

class Game_Battler
  alias :kyon_dual_wpn_skill_can_use? :skill_can_use?
  def skill_can_use?(skill)
    result = kyon_dual_wpn_skill_can_use?(skill)
    return result if self.class == Game_Enemy or !two_swords_style
    if skill.note[KDualWield::REGEX_WEAPONS]
      return both_weapons?($1.to_i, $2.to_i)
    elsif skill.note[KDualWield::REGEX_WEAPONS_ACCESSORY]
      return weapons_acessory?($1.to_i, $2.to_i, $3.to_i)
    end
    result
  end
end

class Game_Actor
  def weapon_ids
    [@weapon_id, @armor1_id]
  end

  def both_weapons?(w1, w2)
    weapon_ids.sort == [w1, w2].sort
  end

  def weapons_acessory?(w1, w2, a1)
    both_weapons?(w1, w2) and @armor4_id == a1
  end
end

VX ACE Script

# * KDualWield & Accessory Skills ACE * #
#   Scripter : Kyonides Arkanthes
#   2023-02-08

# * Free as in beer * #

# Force your heroes to equip specific weapons or even an accessory as well
# in order to be enabled to cast a specific skill.
# NOTE: The Weapons Order does NOT matter here!

# * Note Tags * #
# - For Dual Weapons:        _dual 1 2_
# - For Weapons & Accesory:  _dual 1 2 acc 1_

module KDualWield
  REGEX_WEAPONS = /_dual (\d+) (\d+)_/i
  REGEX_WEAPONS_ACCESSORY = /_dual (\d+) (\d+) acc (\d+)_/i
end

class Game_Battler
  alias :kyon_dual_wpn_skill_cond_met? :skill_conditions_met?
  def skill_conditions_met?(skill)
    result = kyon_dual_wpn_skill_cond_met?(skill)
    return result if self.class == Game_Enemy or !dual_wield?
    if skill.note[KDualWield::REGEX_WEAPONS]
      return both_weapons?($1.to_i, $2.to_i)
    elsif skill.note[KDualWield::REGEX_WEAPONS_ACCESSORY]
      return weapons_acessory?($1.to_i, $2.to_i, $3.to_i)
    end
    result
  end
end

class Game_Actor
  def equip_weapons
    @equips[0..1].map{|w| w.object ? w.object.id : -1 }
  end

  def both_weapons?(w1, w2)
    equip_weapons.sort == [w1, w2].sort
  end

  def weapons_acessory?(w1, w2, w3)
    both_weapons?(w1, w2) and @equips[4].object.id == w3
  end
end

Download Now!


Terms & Conditions

Free as in beer.
Include me in your game credits!
Do not repost it anywhere!

Edited by kyonides
XP & VX & ACE

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted