Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 KChangeSkill XP
#1
KChangeSkill XP

by Kyonides-Arkanthes


Introduction

Did you ever want to add weird states to force any hero waste his SP? Did you try to force him cast a spell or perform a physical technique whenever there was no need for it or his foe was immune to that specific move? Now you are able to make the hero's life miserable for sure! Laughing

Side Notes

You still need to create the states listed in this script in your game's states tab.

Script


Code:
# * KChangeSkill XP
#   Scripter : Kyonides-Arkanthes
#   2019-01-26

#   This script will let you automatically change the skill the player chooses
#   whenever the current hero has not gotten rid of an unusual status.

#   Available Options  #

#   Weak or Strong or Random or Weak Healing Skill

#   Warning!  #
#   Two of Scene_Battle original methods have been overwritten, namely
#   update_phase3_skill_select and update_phase3_item_select.

module KChangeSkill
  EFFECTIVENESS = 75
  STATE_IDS = { 17 => :weak, 18 => :strong, 19 => :random, 20 => :healing }
end

class Scene_Battle
  def update_phase3_skill_select
    @skill_window.visible = true
    @skill_window.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      end_skill_select
      return
    elsif Input.trigger?(Input::C)
      @skill = @skill_window.skill
      unless @skill and @active_battler.skill_can_use?(@skill.id)
        return $game_system.se_play($data_system.buzzer_se)
      end
      $game_system.se_play($data_system.decision_se)
      effective = KChangeSkill::EFFECTIVENESS > rand(100)
      sid = effective ? get_skill_id(true) : @skill.id
      @active_battler.current_action.skill_id = sid
      @state_kind = @pos = nil
      @skill_window.visible = false
      check_skill_scope
    end
  end

  def check_skill_scope
    if @skill.scope == 1
      start_enemy_select
    elsif @skill.scope == 3 or @skill.scope == 5
      start_actor_select
    else
      end_skill_select
      phase3_next_actor
    end
  end

  def update_phase3_item_select
    @item_window.visible = true
    @item_window.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      end_item_select
      return
    elsif Input.trigger?(Input::C)
      @item = @item_window.item
      unless $game_party.item_can_use?(@item.id)
        return $game_system.se_play($data_system.buzzer_se)
      end
      $game_system.se_play($data_system.decision_se)
      sid = 0
      if KChangeSkill::EFFECTIVENESS > rand(100)
        sid = get_skill_id
        @active_battler.current_action.skill_id = sid
      end
      @item_window.visible = false
      if sid == 0
        @active_battler.current_action.item_id = @item.id
        check_item_scope
      else
        @skill = $data_skills[sid]
        check_skill_scope
        @state_kind = nil
        @skill = nil
        @pos = nil
      end
    end
  end

  def check_item_scope
    if @item.scope == 1
      start_enemy_select
    elsif @item.scope == 3 or @item.scope == 5
      start_actor_select
    else
      end_item_select
      phase3_next_actor
    end
  end

  def get_skill_id(found_id=nil)
    sid = found_id ? @skill.id : 0
    @active_battler.states.each do |state_id|
      next unless (@state_kind = KChangeSkill::STATE_IDS[state_id])
      @pos = case @state_kind
      when :weak, :heal then 0
      when :strong then -1
      when :random then rand(@active_battler.skills.size)
      end
      break
    end
    return sid unless @state_kind
    skills = @active_battler.skills.map {|skid| SkillPower.new(skid) }
    skills = skills.sort_by{|sd| sd.power }
    if @state_kind == :heal
      heal_skills = skills.select{|s| s.can_heal }
      return heal_skills[0].id unless heal_skills.empty?
    end
    return skills[@pos].id
  end
end

class SkillPower
  def initialize(new_id)
    @id = new_id
    pow = $data_skills[@id].power
    @power = pow.abs
    @can_heal = pow < 0
  end
  attr_reader :id, :power, :can_heal
end


Terms and Conditions

You may use it in any kind of game. If you go commercial, I will ask you to make a small payment for using in your game project. Do never forget to include me in your game credits.
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }




Users browsing this thread: