Determining Usable Skills

My apologies for maybe a basic question but...

In scripting, what script is it to know if the skill performed by any actor is available to use? like the skill_can_use? on xp...
try:


$game_actors[actor_id].usable?($data_skills[skill_id])
Oh, how about the method?

I was meaning to do a method on either Game_Actor or Game_Battler for it.
Just look at how it's defined?
Here in Game_Actor we have:

#-------------------------------------------------------------------------- # * Get Array of Currently Usable Skills #-------------------------------------------------------------------------- def usable_skills skills.select {|skill| usable?(skill) } endAnd over in Window_SkillList we have:

#-------------------------------------------------------------------------- # * Display Skill in Active State? #-------------------------------------------------------------------------- def enable?(item) @actor && @actor.usable?(item) endAnd for enemies in Game_Enemy we have:

#-------------------------------------------------------------------------- # * Determine if Action Is Valid in Current State # action : RPG::Enemy::Action #-------------------------------------------------------------------------- def action_valid?(action) conditions_met?(action) && usable?($data_skills[action.skill_id]) endOver in Game_BattlerBase we have these two:

Code:
  #--------------------------------------------------------------------------  # * Check Usability Conditions for Skill  #--------------------------------------------------------------------------  def skill_conditions_met?(skill)    usable_item_conditions_met?(skill) &&    skill_wtype_ok?(skill) && skill_cost_payable?(skill) &&    !skill_sealed?(skill.id) && !skill_type_sealed?(skill.stype_id)  end
Code:
  #--------------------------------------------------------------------------  # * Determine Skill/Item Usability  #--------------------------------------------------------------------------  def usable?(item)    return skill_conditions_met?(item) if item.is_a?(RPG::Skill)    return item_conditions_met?(item)  if item.is_a?(RPG::Item)    return false  end
That's a lot of help kerbonklin. Another worries solved. 🙂

Original thread: https://forums.rpgmakerweb.com/threads/determining-usable-skills.23368/