KPartners VX
#1
KPartners VX

by Kyonides


Introduction

Did you ever wanna add special skills to a hero if he had a partner? Shocked
Or has a hero lost a partner? Cry
Then now they could access those extra skills during battles! Shocked

Just follow the instructions included in my scriptlet! Grinning

The Script for XP & VX
Code:
# * KPartners VXP
#   Scripter : Kyonides Arkanthes
#   v 0.1.5 - 2020-07-13

# This scriptlet allows a hero to get access to extra skills if he currently
# has a partner or he has already lost one.
# The chosen hero should have enough mana to perform the skill.
# They should never share the same class.
# If the game developer or the player removes a hero and he had a partner, both
# of them will get their PartnerID's reset to zero.
# Heroes might share the same skill set if you want to.

# PARTNER_SKILLS[ [ActorID, PartnerID] ] = [SkillID1, SkillID2, etc.]
# Examples:
#   PARTNER_SKILLS[[1, 2]] = [1, 4, 5]
#   PARTNER_SKILLS[[2, 1]] = [3, 7, 9] #-> Here they don't share them!
# The same is valid for the LOST_PARTNER_SKILLS.

# * Script Calls * #

# First Step: Pick a specific teammate (Starting from Zero! 0!)
#   actor = $game_party.actors[Actor's Current Position in Your Team]

# To set a partner
#   actor.partner_id = ActorID

# To set a lost partner
#   actor.lost_partner_id = ActorID

# To remove any partner
#   actor.no_partner!

# To remove any lost partner
#   actor.no_lost_partner!

# To check whether or not a hero is a current teammate
#   $game_party.has_actor?(actor)
#   $game_party.has_member?(actor)

module KPartners
  PARTNER_SKILLS = {}
  PARTNER_SKILLS.default = [] # Do Not Edit This Line!
  LOST_PARTNER_SKILLS = {}
  LOST_PARTNER_SKILLS.default = [] # Do Not Edit This Line!
  # Add as many Partner and Lost Partner Skills below as you see fit
  # End of Setup
  def has_partner_skill?(partner_key, skill_id)
    PARTNER_SKILLS[partner_key].include?(skill_id)
  end

  def has_lost_partner_skill?(lost_key, skill_id)
    LOST_PARTNER_SKILLS[lost_key].include?(skill_id)
  end
end

class Game_Actor
  alias kyon_bond_gm_actor_init initialize
  alias kyon_bond_gm_actor_scu? skill_can_use?
  def initialize
    kyon_bond_gm_actor_init
    @partner_id = 0
    @lost_partner_id = 0
  end

  def skills
    xskills = []
    if $game_temp.in_battle
      if @partner_id > 0
        xskills = KPartners::PARTNER_SKILLS[partner_key]
      elsif @lost_partner_id > 0
        xskills = KPartners::LOST_PARTNER_SKILLS[lost_partner_key]
      end
    end
    @skills + xskills
  end

  def skill_can_use?(skill)
    result = kyon_bond_gm_actor_scu?(skill)
    if $game_temp.in_battle
      skill = skill.id if skill.is_a?(RPG::Skill)
      if @partner_id > 0 and $game_actors[@partner_id].hp > 0
        return KPartners.has_partner_skill?(partner_key, skill)
      elsif @lost_partner_id > 0
        return false if $game_party.has_actor?($game_actors[@lost_partner_id])
        return KPartners.has_lost_partner_skill?(lost_partner_key, skill)
      end
    end
    result
  end

  def partner_id=(actor_id)
    return @partner_id if actor_id < 1
    actor = $game_actors[actor_id]
    return @partner_id unless $game_party.has_actor?(actor)
    return @partner_id if actor.class_id == @class_id
    @partner_id = actor_id
  end

  def lost_partner_id=(actor_id)
    return @lost_partner_id if actor_id < 1
    actor = $game_actors[actor_id]
    return @lost_partner_id if $game_party.has_actor?(actor)
    return @lost_partner_id if actor.class_id == @class_id
    @lost_partner_id = actor_id
  end
  def partner_key() [@actor_id, @partner_id] end
  def lost_partner_key() [@actor_id, @lost_partner_id] end
  def no_partner!() @partner_id = 0 end
  def no_lost_partner!() @lost_partner_id = 0 end
  attr_reader :partner_id, :lost_partner_id
end

class Game_Party
  alias kyon_bond_gm_party_aa add_actor
  alias kyon_bond_gm_party_ra remove_actor
  def add_actor(actord_id)
    kyon_bond_gm_party_aa(actor_id)
    @actors.each{|a| a.no_lost_partner! if a.lost_partner_id == actor_id }
  end

  def remove_actor(actor_id)
    actor = $game_actors[actor_id]
    had_actor = @actors.include?(actor)
    kyon_bond_gm_party_ra(actor_id)
    return unless had_actor
    @actors.each{|a| a.no_partner! if a.partner_id == actor_id }
    actor.no_partner!
  end
  def has_actor?(actor) @actors.include?(actor) end
  alias :has_member? :has_actor?
end

FAQs

I know it should run on RM XP and VX!
Sad Sadly I can't say the same about VX Ace because some wolf full of fleas let me know it has no skill_can_use? method at all.

Terms & Conditions

Free for use in non commercial games. Grinning
Be honest and include me in your game credits. Winking
Give me a free copy of your completed game if you include at least 2 of my scripts! Laughing + Tongue sticking out
"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: 1 Guest(s)