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

[转载发布] Switch Party

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

    连续签到: 2 天

    [LV.7]常住居民III

    4455

    主题

    864

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 6 天前 | 显示全部楼层 |阅读模式
    Copern's Switch Party Members





    Version 1.0



    Introduction

      Designed as a complement to Victors Follower Control but it can be used without it. Allows you to switch party members with a single comment and then revert it later. I made this just for a youtuber I frequently watch but was suggested I release it to the wild so here it is.

    Features


    • Switch the party members out for different ones
    • Revert the party members back

    Script

    Spoiler                 Code:        
    #============================================================================== # Switch Party Members #------------------------------------------------------------------------------ # Author : Copern # # Version History: # 1.0 - 2012.07.07 > First release #------------------------------------------------------------------------------ # This script can be used to switch the party during an event/cutscene. At the # end of the event, the party can be reverted back to the original party if # desired. It is recommended to have party members on the same tile before # switching and reverting as the actors will visibly change on the map. #------------------------------------------------------------------------------ # Instructions: # Copy and paste this script into the Materials section of the script editor. #------------------------------------------------------------------------------ # Comment commands: # These are the tags to use in event comments # # <switch party: x1..xN> # Switches the party members to the specified actor ID's. # For example, <switch party: 3, 4, 7> or <switch party: 5, 6, 1, 9 -k> #         x : Actor ID (starting from 1) #         Optional Parameters #         -k : Keep the currently stored party to revert to. # # <revert party> # Reverts to the currently stored party. # #------------------------------------------------------------------------------ # Additional instructions: # # The -k optional parameter can be used to switch the party multiple times and # revert to the party before the first switch. # # The current party is 1, 2, 3 # <switch party: 3, 5> # <switch party: 9, 6, 2 -k> # <switch party: 1, 8 -k> # <revert party> # The party will become 1, 2, 3 again. # #============================================================================== #============================================================================== # ** Game_Party #------------------------------------------------------------------------------ # Adds a new variable and switch party functions #============================================================================== class Game_Party < Game_Unit  #---------------------------------------------------------------------------- # * Initialize # Add the actors_revert variable #---------------------------------------------------------------------------- alias :initialize_base_party :initialize def initialize         initialize_base_party         @actors_revert = [] end  #---------------------------------------------------------------------------- # * Switch Party # Switches the party out with the new one. Replaces actors_revert with # the current party before switching unless the -k option is active. #---------------------------------------------------------------------------- def switch_party(actor_ids, options)         @actors_revert.replace(@actors) if !options || @actors_revert.empty?         @actors.replace(actor_ids)         refresh_map end  #---------------------------------------------------------------------------- # * Revert Party # Reverts the party to the one stored in actors_revert #---------------------------------------------------------------------------- def revert_party         return unless !@actors_revert.empty?         @actors.replace(@actors_revert)         @actors_revert.clear         refresh_map end  #---------------------------------------------------------------------------- # * Refresh Map # Refreshes the map and party #---------------------------------------------------------------------------- def refresh_map         $game_player.refresh         $game_map.need_refresh = true end end #============================================================================== # ** Game_Interpreter #------------------------------------------------------------------------------ # Adds comment command parsing for switching parties #============================================================================== class Game_Interpreter  #---------------------------------------------------------------------------- # * Command 108 # Inject comment command parsing #---------------------------------------------------------------------------- alias :command_108_base :command_108 def command_108         command_108_base         comment_command end  #---------------------------------------------------------------------------- # * Command Switch Party # Parses a switch party command #---------------------------------------------------------------------------- def command_switch_party         matches = /<switch party: ((?:\d+,?\s*)+)(-k)?>/i.match(comments_s)         return unless matches         actor_ids = matches[1].scan(/\d+/).map(&:to_i)         $game_party.switch_party(actor_ids, matches[2]) end  #---------------------------------------------------------------------------- # * Command Revert Party # Parses a revert party command #---------------------------------------------------------------------------- def command_revert_party         $game_party.revert_party if comments_s =~ /<revert party>/i end #---------------------------------------------------------------------------- # * Comment Command # Begins parsing comment commands #---------------------------------------------------------------------------- def comment_command         command_switch_party         command_revert_party end  #---------------------------------------------------------------------------- # * Comments_s # Create the comments string #---------------------------------------------------------------------------- def comments_s         @comments ? @comments.join("\r\n") : "" end end





    Instructions

    Use these in comments in the event sequence.

    <switch party: x1..xN>

      Switches the entire party to the specified actor ID's.

      For example, <switch party: 3, 4, 7> or <switch party: 5, 6, 1, 9 -k>

            x : Actor ID (starting from 1)

            Optional Parameters

              -k : Keep the currently stored party to revert to.

    <revert party>

      Reverts the party to the currently stored party.

    The -k optional parameter can be used to switch the party multiple times and revert to the party before the first switch.

    The current party is 1, 2, 3

    <switch party: 3, 5>

    <switch party: 9, 6, 2 -k>

    <switch party: 1, 8 -k>

    <revert party>

    The party will become 1, 2, 3 again

    Credits

      Victor's scripts as inspiration and ideas for this one.

    Edit: I've renamed this to Switch Party Members since that more accurately describes what it does. If a mod could change the title I would be grateful.


    本贴来自国际rpgmaker官方论坛作者:Copern处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/switch-party.3060/
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-7-14 15:39 , Processed in 0.129295 second(s), 52 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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