Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Disabling skill when improper weapon equipped, possible?

Wanna ask, is there any possibilities that skills can be disabled using element tags when an incompatible weapon is equipped.

Lets say, I set an actor that can wield guns and swords and have skill for both of the weapons, and I want all the sword skills to be disabled for use when guns are equipped and vice versa.

Is it possible anyway? I was thinking of using element tags and arrays to disable them.

Please help thanks 8-)
 
I really do need to just finish my EIS Requirements system...


Anyways, you can just this for now:
Code:
class RPG::Skill
  Equipment_Element_Requirement = {}
  def has_equipment_requirement?
    return Equipment_Element_Requirement.has_key?(@id)
  end
  def equipment_element_requirement
    return Equipment_Element_Requirement[@id]
  end
end

class Game_Actor
  alias_method :seph_skilluseequipmentelement_amctr_scu?, :skill_can_use?
  def skill_can_use?(skill_id)
    if $data_skills[skill_id].has_equipment_requirement?
      elements = []
      if $data_weapons[@weapon_id] != nil
        $data_weapons[@weapon_id].element_set.each {|eid| elements << eid}
      end
      for id in [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
        if $data_armors[id] != nil
          $data_armors[id].guard_element_set.each {|eid| elements << eid}
        end
      end
      return false unless elements.include?($data_skills[skill_id].equipment_element_requirement)
    end
    return seph_skilluseequipmentelement_amctr_scu?(skill_id)
  end
end
       
Just modify this:
Equipment_Element_Requirement = {}

With skill_id => element_tag

I haven't tested it, so let me know if it doesn't work.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top