How can I add more than 2 "Required Weapon" to skills?

I'm trying to make a skill called "Impale", but I want the "Required Weapons" to be a Sword, Longsword, AND spear. You can only choose two though T-T

How can I make more than 2 "Required Weapons"?
you cannot do it via the default methods if you want it to be completely unusable...

you can use skill restriction scripts to do it though... or you can also opt to simply make use of the formula so that it won't do any damage if used with other weapons
Or a custom script.

Here you go. Paste this into a new slot in your script list. If you have any custom scripts that alias the Game_Actor.skill_wtype_ok? method, this script should go BEFORE them.

Spoiler
module DataManager class << self alias shaz_3weapons_load_normal_database load_normal_database end def self.load_normal_database shaz_3weapons_load_normal_database $data_skills.compact.each { |skill| skill.note.split(/[\r\n+]/).each do |line| case line when /<require\s*(\d+)>/i # <require id> in note skill.required_wtype_id3 = $1.to_i end end } endend class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # * Determine if Skill-Required Weapon Is Equipped #-------------------------------------------------------------------------- def skill_wtype_ok?(skill) wtype_id1 = skill.required_wtype_id1 wtype_id2 = skill.required_wtype_id2 wtype_id3 = skill.required_wtype_id3 return true if wtype_id1 == 0 && wtype_id2 == 0 && wtype_id3 == 0 return true if wtype_id1 > 0 && wtype_equipped?(wtype_id1) return true if wtype_id2 > 0 && wtype_equipped?(wtype_id2) return true if wtype_id3 > 0 && wtype_equipped?(wtype_id3) return false endend class RPG::Skill < RPG::UsableItem alias shaz_3weapons_skill_initialize initialize def initialize super @required_wtype_id3 = 0 end attr_accessor :required_wtype_id3end
Then in your skill, add a note like this:

<require id>where id is the id of the third weapon type (shown in your Terms tab; do not include leading zeros - so 04:Sword would be shown as <require 4>)If you want MORE than 3 required weapons, I'd have to modify that.
shaz's script isn't working for me so made a new one

Spoiler
module DataManager  class <<self; alias load_database_3rwt load_database; end  def self.load_database    load_database_3rwt    load_notetags_3rwt  end   def self.load_notetags_3rwt    for obj in $data_skills      next if obj.nil?      obj.load_notes    end  endendclass RPG::Skill < RPG::UsableItem  attr_accessor :required_wtype_id3  def load_notes    @required_wtype_id3 = []    self.note.split(/[\r\n]+/).each { |line|      case line      when /<require\s*(\d+(?:\s*[, ]\s*\d+)*)>/i        $1.scan(/\d+/).each { |num|        @required_wtype_id3.push(num.to_i) if num.to_i > 0}      end      }    endendclass Game_Actor < Game_Battler  def skill_wtype_ok?(skill)    wtype_id1 = skill.required_wtype_id1    wtype_id2 = skill.required_wtype_id2    wtype_id3 = skill.required_wtype_id3    return true if wtype_id1 == 0 && wtype_id2 == 0 && wtype_id3.empty?    return true if wtype_id1 > 0 && wtype_equipped?(wtype_id1)    return true if wtype_id2 > 0 && wtype_equipped?(wtype_id2)    return true if (weapons.any? {|weapon| wtype_id3.include?(weapon.wtype_id)})    return false  endend
same notetag as shaz's except with multiple id support.

so use <require id> or <require id, id, id, id> or <require id id id> in a skill's notebox
Thank you! It's just what I was looking for!
I don't know why it wouldn't work for you Xypher. Worked fine for me.


This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/how-can-i-add-more-than-2-required-weapon-to-skills.20325/