Jump to content

Recommended Posts

KSkillNeedsState
XP + VX + ACE

by Kyonides Arkanthes

Introduction

Do you need to restrict the usage of a skill by forcing the hero to get a specific state first?

Now you can do that! :D

In XP's case

Adjust the Constants you can see below as deemed necessary.

module KSkillNeedsState
  SKILL_IDS = [57]
  STATE_ID = 17
end

In VX & VX ACE

The only thing you need to do is leaving a very specific note in the skill's note box.

_need state ID_

Replace ID with a number.

Download the Demos!

XP Version

# * KSkillNeedsState XP * #
#   Scripter : Kyonides Arkanthes
#   2023-01-29

# * Free as in Beer * #

# Adjust the values of the SKILL_ID and STATE_ID Constants at will.

module KSkillNeedsState
  SKILL_IDS = [57]
  STATE_ID = 17
end

class Game_Battler
  alias :kyon_gm_btlr_skill_can_use? :skill_can_use?
  def skill_need_state?(skill_id)
    KSkillNeedsState::SKILL_IDS.include?(skill_id)
  end

  def has_state_dependent_skill?
    state?(KSkillNeedsState::STATE_ID)
  end

  def skill_can_use?(skill_id)
    result = kyon_gm_btlr_skill_can_use?(skill_id)
    if result and skill_need_state?(skill_id)
      result = has_state_dependent_skill?
    end
    result
  end
end


VX Version

# * KSkillNeedsState VX * #
#   Scripter : Kyonides Arkanthes
#   2023-01-29

# * Free as in Beer * #

# Leave this note _need state ID_ in the Skill's Note box.
# There ID stands for any existing State ID.

module KSkillNeedsState
  SKILL_REGEX = /_need state (\d+)_/i
end

class Game_Battler
  alias :kyon_gm_btlr_skill_can_use? :skill_can_use?
  def skill_need_state?(skill)
    return true if skill.note[KSkillNeedsState::SKILL_REGEX] == nil
    state?($1.to_i)
  end

  def skill_can_use?(skill)
    result = kyon_gm_btlr_skill_can_use?(skill)
    result = skill_need_state?(skill) if result
    result
  end
end


VX ACE Version

# * KSkillNeedsState ACE * #
#   Scripter : Kyonides Arkanthes
#   2023-01-29

# * Free as in Beer * #

# Leave this note _need state ID_ in the Skill's Note box.
# There ID stands for any existing State ID.

module KSkillNeedsState
  SKILL_REGEX = /_need state (\d+)_/i
end

class Game_Battler
  alias :kyon_gm_btlr_skill_cond_met? :skill_conditions_met?
  def skill_need_state?(skill)
    return true if skill.note[KSkillNeedsState::SKILL_REGEX] == nil
    state?($1.to_i)
  end

  def skill_conditions_met?(skill)
    result = kyon_gm_btlr_skill_cond_met?(skill)
    result = skill_need_state?(skill) if result
    result
  end
end


Terms & Conditions

Free as in beer.
Include my nickname in your game credits.

Edited by kyonides

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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted