Swap weapon

I know there is a script call to change party order, that’s $game_party.swap_order(n, n)
Anyone know a script call like this that is available in RGSS3 but to swap weapons?
Here's my version of how to swap weapons by force.

You can find the instructions HERE (once it gets approved by the moderators).
Here's my version of how to swap weapons by force.

You can find the instructions HERE (once it gets approved by the moderators).

Ruby:
# * Weapons Swap ACE * #
#   Scripter : Kyonides Arkanthes
#   2023-01-14

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

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

class Game_BaseItem
  attr_accessor :item_id
end

class Game_Actor
  def just_equips() @equips end
end

class Game_Party
  def swap_equip_item_ids(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
  end
  private :swap_equip_item_ids

  def swap_weapons(*indexes)
    return if indexes[0] == indexes[1]
    heroes = indexes.map{|n| $game_actors[@actors[n]] }
    if heroes[0].dual_wield? and heroes[1].dual_wield?
      swap_equip_item_ids(1, *heroes)
    end
    swap_equip_item_ids(0, *heroes)
  end
end
One potential issue with your script, kyonides: you don't check whether the actors who are swapping weapons are able to use the weapon type IDs of the weapons they're receiving.
One potential issue with your script, kyonides: you don't check whether the actors who are swapping weapons are able to use the weapon type IDs of the weapons they're receiving.

I told them it would be done BY FORCE. That should prevent them from doing it on every single ocassion that might show up during gameplay.

And it would be interesting to let a monster use that against the heroes via casting a skill with such horrible consequences for the poor actors. (Skill Batteries Not Included. 😛 )

EDIT

I'm including a flag to let the game developer decide whether it will be by force or not.
The reason why I do that is that during battles it does unequip those unequippable weapons by default.
Rh
I told them it would be done BY FORCE. That should prevent them from doing it on every single ocassion that might show up during gameplay.

And it would be interesting to let a monster use that against the heroes via casting a skill with such horrible consequences for the poor actors. (Skill Batteries Not Included. 😛 )

EDIT

I'm including a flag to let the game developer decide whether it will be by force or not.
The reason why I do that is that during battles it does unequip those unequippable weapons by default.
Thanks, I’ll try your script

Original thread: https://forums.rpgmakerweb.com/threads/swap-weapon.154098/