Weapons Swap ACE
Weapons Swap ACEby Kyonides Arkanthes
Yes, the script will swap your party members' weapons either by force or unequipping those that they cannot handle.
Just call:
Here Force? is a placeholder for true or false.
Ruby:
$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.
It does NOT ALTER the Actor's Dual Wield feature at all.
Ruby:
# * 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]
end
def swap_equip_item_ids(force, pos, hero1, hero2)
he1 = hero1.just_equips
he2 = hero2.just_equips
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 == indexes
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
With Weapons Swap Skill
NOTE: VX Ace will always attempt to remove the forbidden weapons as stated in the comments embedded in my script. What I did was creating a WS state to prevent it from doing it while in battle. Once you go back to the map, you will find your weapons in your party's inventory.
Ruby:
# * Weapons Swap & Skill ACE * #
# Scripter : Kyonides Arkanthes
# 2023-01-15
# - Free for use in Non Commercial Projects - #
# * Script Call - #
# - Swap Weapons - Force? Options: true or false - #
# $game_party.swap_weapons(Force?, PartyIndex1, PartyIndex2)
# - Define the WS Skill by leaving a comment in the Skill's Note Box:
# <weapon swap force>or<weapon swap lazy>
# - Create a Weapons Swap State in the States DB and Set the value of the
# STATE Constant accordingly. It is found in the KWSwap Module.
# * Warning * #
#VX ACE will ALWAYS attempt to REMOVE unequippable weapons whenever ANY
#State Change or Buff or Debuff and other alterations takes place.
module KWSwap
STATE = 26
REGEX = /<weapon swap (force|lazy)>/i
end
class Game_BaseItem
attr_accessor :item_id
end
class Game_Battler
alias :kyon_weapon_swap_skill_item_user_fx :item_user_effect
def apply_weapon_swap(user, skill)
return unless skill.note and user.is_a?(Game_Enemy)
heroes = $game_party.member_ids
if heroes.size < 2
@result.missed = true
return
end
pos1 = self.index
pos2 = rand(heroes.size)
force = $1 != nil
success = $game_party.swap_weapons(force, pos1, pos2)
if success
hero2 = heroes
$game_actors.add_state(KWSwap::STATE)
add_state(KWSwap::STATE)
end
@result.used = success
end
def item_user_effect(user, item)
swapped = false
swapped |= apply_weapon_swap(user, item) if item.is_a?(RPG::Skill)
kyon_weapon_swap_skill_item_user_fx(user, item) unless swapped
end
end
class Game_Actor
alias :kyon_weapon_swap_skill_refresh :refresh
def refresh
if state?(KWSwap::STATE)
super
return
end
kyon_weapon_swap_skill_refresh
end
def just_equips() @equips end
end
class Game_Party
def get_hero(pos)
$game_actors[@actors]
end
def swap_equip_item_ids(force, pos, hero1, hero2)
he1 = hero1.just_equips
he2 = hero2.just_equips
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 == indexes
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
Free for use anywhere.
Just keep in mind that you should mention me in your game credits.
Do Not Repost It!
本贴来自国际rpgmaker官方论坛作者:kyonides处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/weapons-swap-ace.154109/
页:
[1]