Weapons Swap VX + ACE
#1
Weapons Swap VX + ACE

by Kyonides


Introduction

The title makes it extremely clear, but just case here we go: your party members can now swap their weapons at any given time. It will do it either BY FORCE or Lazily (by running a couple of internal checks).

Just call:
Force? is a placeholder for true or false.
Code:
$game_party.swap_weapons(Force?, FirstPosition, SecondPosition)

...and it will let you make the change swiftly!

It will ignore your request if for ANY REASON you provide it with identical positions.

Just in Case you are using VX or VX ACE:

It does NOT ALTER the Actor's Two Swords Style or Dual Wield feature at all.

To get the corresponding Skill Scripts, click Here!

The Scripts

VX Script

Code:
# * Weapons Swap VX * #
#   Scripter : Kyonides Arkanthes
#   2023-01-14

# - It's free as in beer. - #

# * Script Call * #
#   $game_party.swap_weapons(PartyIndex1, PartyIndex2)

class Game_Actor
  attr_writer :weapon_id, :armor1_id
end

class Game_Party
  def swap_weapons(*indexes)
    return if indexes[0] == indexes[1]
    heroes = indexes.map{|n| $game_actors[@actors[n]] }
    if heroes[0].two_swords_style and heroes[1].two_swords_style
      swap_armor_ids(*heroes)
    end
    swap_weapon_ids(*heroes)
  end
  private
  def swap_weapon_ids(hero1, hero2)
    hero1.weapon_id, hero2.weapon_id = hero2.weapon_id, hero1.weapon_id
  end

  def swap_armor_ids(hero1, hero2)
    hero1.armor1_id, hero2.armor1_id = hero2.armor1_id, hero1.armor1_id
  end
end

VX ACE Script

Code:
# * Weapons Swap ACE * #
#   Scripter : Kyonides Arkanthes
#   2023-01-15

# - It's free as in beer. - #

# * Script Call - #

# - Swap Weapons - Force? Options: true or false - #
#   $game_party.swap_weapons(Force?, PartyIndex1, PartyIndex2)

class Game_BaseItem
  attr_accessor :item_id
end

class Game_Actor
  def just_equips() @equips end
end

class Game_Party
  def get_hero(pos)
    $game_actors[@actors[pos]]
  end

  def swap_equip_item_ids(force, pos, hero1, hero2)
    he1 = hero1.just_equips[pos]
    he2 = hero2.just_equips[pos]
    he1.item_id, he2.item_id = he2.item_id, he1.item_id
    return if force
    hero1.refresh
    hero2.refresh
  end
  private :get_hero, :swap_equip_item_ids

  def swap_weapons(force, *indexes)
    return if indexes[0] == indexes[1]
    hero1 = get_hero(indexes.shift)
    hero2 = get_hero(indexes.shift)
    if hero1.dual_wield? and hero2.dual_wield?
      swap_equip_item_ids(force, 1, hero1, hero2)
    end
    swap_equip_item_ids(force, 0, hero1, hero2)
    return true
  end
  def member_ids() @actors end
end


Terms & Conditions

Check out the comments embedded in each script! Happy with a sweat
Just keep in mind you should mention me in your game credits. Winking
Do Not Repost It!
"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 }


Messages In This Thread
Weapons Swap VX + ACE - by kyonides - Yesterday, 07:38 AM
RE: Weapons Swap VX + ACE - by kyonides - Yesterday, 07:41 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
   [split] Variable Swap [Snippet] PK8 0 63 11-15-2009, 08:49 PM
Last Post: PK8
   Switch Swap [Snippet] PK8 0 73 11-14-2009, 05:23 AM
Last Post: PK8



Users browsing this thread: 1 Guest(s)