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

[转载发布] Party Member Select Script

[复制链接]
累计送礼:
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 21:02:01 | 显示全部楼层 |阅读模式
    Party Member Select Script
    by NinjaChicle


    Introduction
    This script lets you select an actor from your party and save their ID in a variable. Also saves the name of the actor in a different variable too if you want to.

    How to Use
    Put this script above Main. Then put SceneManager.call(Scene_ActorSelect) in a script call in an event, and after that put a wait command for at least 1 frame. Then you can use the variable with your saved actor id for whatever you want.





    Script

                    Code:       
    1. #--------------------------------------------------------------------------
    2. #* Party Member Select Script
    3. #
    4. # A script for RPG Maker VX Ace projects
    5. #
    6. # script by: NinjaChicle
    7. #
    8. # This script lets you select an actor from your party and save their ID
    9. # in a variable. Also saves the name of the actor in a different
    10. # variable too if you want to.
    11. #
    12. # To use it, just put SceneManager.call(Scene_ActorSelect) in a script call and then add the wait command for one frame,
    13. # and you will be able to select an actor and then use the ID for
    14. # whatever you want.
    15. #
    16. # credit me if you want to use it but idc anymore if you dont
    17. #--------------------------------------------------------------------------
    18. module YAHOO
    19.   ACTOR_ID_VAR = 1 #the variable in which the actor id will be saved in
    20.   ACTOR_NAME = 2   #this variable will save the name of the selected actor.
    21.                    #set ACTOR_NAME to 0 if you don't need it.
    22.   SELECT_TEXT = "Choose who \nshould be \nselected." #the \n moves the text after it one line down.
    23. end
    24. class Scene_ActorSelect < Scene_MenuBase
    25.   def start
    26.     super
    27.     @okay = false
    28.     create_actor_window
    29.     show_sub_window(@actor_window)
    30.   end
    31.   def update
    32.     super
    33.     return if @okay != true
    34.     do_stuff
    35.     return if @actor_window.opacity != 0
    36.     @actor_window.hide.deactivate
    37.     @text_window.hide
    38.     return_scene
    39.   end
    40.   def do_stuff
    41.     move_window(@actor_window, 550, 13)
    42.     ghost_actor_window(0)
    43.     @text_window.opacity = @actor_window.opacity
    44.     @actor_window.contents_opacity = @actor_window.opacity
    45.     move_window(@text_window, -450, 13)
    46.   end
    47.   def move_window(window, x, speed)
    48.     current_x = window.x
    49.     window.x = [x, current_x + speed].min if current_x < x
    50.     window.x = [x, current_x - speed].max if current_x > x
    51.   end
    52.   def ghost_actor_window(opacity)
    53.     current_o = @actor_window.opacity
    54.     @actor_window.opacity = [opacity, current_o + 13].min if current_o < opacity
    55.     @actor_window.opacity = [opacity, current_o - 13].max if current_o > opacity
    56.   end
    57.   #--------------------------------------------------------------------------
    58.   # show_sub_window
    59.   #--------------------------------------------------------------------------
    60.   def show_sub_window(window)
    61.     width_remain = Graphics.width - window.width
    62.     window.x = width_remain
    63.     @viewport.rect.x = @viewport.ox = 0
    64.     @viewport.rect.width = width_remain
    65.     window.show.activate
    66.   end
    67.   #--------------------------------------------------------------------------
    68.   # on_actor_ok
    69.   #--------------------------------------------------------------------------
    70.   def on_actor_ok
    71.       Sound.play_ok
    72.       $game_party.menu_actor = $game_party.members[@actor_window.index]
    73.       $game_variables[YAHOO::ACTOR_ID_VAR] = $game_party.menu_actor.id
    74.       window = @actor_window
    75.       @okay = true
    76.       $game_variables[YAHOO::ACTOR_NAME] = $game_actors[$game_party.menu_actor.id].name unless YAHOO::ACTOR_NAME == 0
    77.   end
    78.   #--------------------------------------------------------------------------
    79.   # on_actor_cancel
    80.   #--------------------------------------------------------------------------
    81.   def on_actor_cancel
    82.     Sound.play_buzzer
    83.     @actor_window.activate
    84.   end
    85.   def create_actor_window
    86.     @actor_window = Window_MenuActor.new
    87.     @actor_window.set_handler(:ok,     method(:on_actor_ok))
    88.     @actor_window.set_handler(:cancel, method(:on_actor_cancel))
    89.     @actor_window.select_last
    90.     @text_window = Window_Base.new(0,0,200,120)
    91.     @text_window.width = Graphics.width - @actor_window.width
    92.     @text = YAHOO::SELECT_TEXT
    93.     @text_window.draw_text_ex(0,0,@text)
    94.   end
    95. end
    复制代码

    Terms of use
    credit me if you want to.


    本贴来自国际rpgmaker官方论坛作者:NinjaChicle处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/party-member-select-script.149322/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-8-17 08:33 , Processed in 0.133673 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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