设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 107|回复: 0

[转载发布] Weapons Swap ACE

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9071

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    58883
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    68848

    灌水之王

    发表于 2026-8-2 22:01:41 | 显示全部楼层 |阅读模式
    Weapons Swap ACE

    by 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:       
    1. $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:       
    1. # * Weapons Swap ACE * #
    2. #   Scripter : Kyonides Arkanthes
    3. #   2023-01-15
    4. # - It's free as in beer. - #
    5. # * Script Call - #
    6. # - Swap Weapons - Force? Options: true or false - #
    7. #   $game_party.swap_weapons(Force?, PartyIndex1, PartyIndex2)
    8. class Game_BaseItem
    9.   attr_accessor :item_id
    10. end
    11. class Game_Actor
    12.   def just_equips() @equips end
    13. end
    14. class Game_Party
    15.   def get_hero(pos)
    16.     $game_actors[@actors[pos]]
    17.   end
    18.   def swap_equip_item_ids(force, pos, hero1, hero2)
    19.     he1 = hero1.just_equips[pos]
    20.     he2 = hero2.just_equips[pos]
    21.     he1.item_id, he2.item_id = he2.item_id, he1.item_id
    22.     return if force
    23.     hero1.refresh
    24.     hero2.refresh
    25.   end
    26.   private :get_hero, :swap_equip_item_ids
    27.   def swap_weapons(force, *indexes)
    28.     return if indexes[0] == indexes[1]
    29.     hero1 = get_hero(indexes.shift)
    30.     hero2 = get_hero(indexes.shift)
    31.     if hero1.dual_wield? and hero2.dual_wield?
    32.       swap_equip_item_ids(force, 1, hero1, hero2)
    33.     end
    34.     swap_equip_item_ids(force, 0, hero1, hero2)
    35.     return true
    36.   end
    37.   def member_ids() @actors end
    38. 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:       
    1. # * Weapons Swap & Skill ACE * #
    2. #   Scripter : Kyonides Arkanthes
    3. #   2023-01-15
    4. # - Free for use in Non Commercial Projects - #
    5. # * Script Call - #
    6. # - Swap Weapons - Force? Options: true or false - #
    7. #   $game_party.swap_weapons(Force?, PartyIndex1, PartyIndex2)
    8. # - Define the WS Skill by leaving a comment in the Skill's Note Box:
    9. #   <weapon swap force>  or  <weapon swap lazy>
    10. # - Create a Weapons Swap State in the States DB and Set the value of the
    11. #   STATE Constant accordingly. It is found in the KWSwap Module.
    12. # * Warning * #
    13. #  VX ACE will ALWAYS attempt to REMOVE unequippable weapons whenever ANY
    14. #  State Change or Buff or Debuff and other alterations takes place.
    15. module KWSwap
    16.   STATE = 26
    17.   REGEX = /<weapon swap (force|lazy)>/i
    18. end
    19. class Game_BaseItem
    20.   attr_accessor :item_id
    21. end
    22. class Game_Battler
    23.   alias :kyon_weapon_swap_skill_item_user_fx :item_user_effect
    24.   def apply_weapon_swap(user, skill)
    25.     return unless skill.note[KWSwap::REGEX] and user.is_a?(Game_Enemy)
    26.     heroes = $game_party.member_ids
    27.     if heroes.size < 2
    28.       @result.missed = true
    29.       return
    30.     end
    31.     pos1 = self.index
    32.     pos2 = rand(heroes.size)
    33.     force = $1[/force/] != nil
    34.     success = $game_party.swap_weapons(force, pos1, pos2)
    35.     if success
    36.       hero2 = heroes[pos2]
    37.       $game_actors[hero2].add_state(KWSwap::STATE)
    38.       add_state(KWSwap::STATE)
    39.     end
    40.     @result.used = success
    41.   end
    42.   def item_user_effect(user, item)
    43.     swapped = false
    44.     swapped |= apply_weapon_swap(user, item) if item.is_a?(RPG::Skill)
    45.     kyon_weapon_swap_skill_item_user_fx(user, item) unless swapped
    46.   end
    47. end
    48. class Game_Actor
    49.   alias :kyon_weapon_swap_skill_refresh :refresh
    50.   def refresh
    51.     if state?(KWSwap::STATE)
    52.       super
    53.       return
    54.     end
    55.     kyon_weapon_swap_skill_refresh
    56.   end
    57.   def just_equips() @equips end
    58. end
    59. class Game_Party
    60.   def get_hero(pos)
    61.     $game_actors[@actors[pos]]
    62.   end
    63.   def swap_equip_item_ids(force, pos, hero1, hero2)
    64.     he1 = hero1.just_equips[pos]
    65.     he2 = hero2.just_equips[pos]
    66.     he1.item_id, he2.item_id = he2.item_id, he1.item_id
    67.     return if force
    68.     hero1.refresh
    69.     hero2.refresh
    70.   end
    71.   private :get_hero, :swap_equip_item_ids
    72.   def swap_weapons(force, *indexes)
    73.     return if indexes[0] == indexes[1]
    74.     hero1 = get_hero(indexes.shift)
    75.     hero2 = get_hero(indexes.shift)
    76.     if hero1.dual_wield? and hero2.dual_wield?
    77.       swap_equip_item_ids(force, 1, hero1, hero2)
    78.     end
    79.     swap_equip_item_ids(force, 0, hero1, hero2)
    80.     return true
    81.   end
    82.   def member_ids() @actors end
    83. 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/
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-17 08:29 , Processed in 0.125049 second(s), 55 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表