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

[转载发布] SAI Key Item Button

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    慵懒
    昨天 15:43
  • 签到天数: 207 天

    连续签到: 1 天

    [LV.7]常住居民III

    3122

    主题

    862

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 昨天 22:04 | 显示全部楼层 |阅读模式
    SAI Key Item Button v1.0

    Bishop Myers ("Sailerius")



    Introduction

    Inspired by Chrono Cross, this script allows you to call the Key Item dialog box at any time on the map. You can make it such that selecting an item from the dialog box will activate an adjacent action button events so that they can respond to the item used.

    Features

    - Adds the ability to call the key item dialog box at any time with a key

    - Allows doing so to cause events to respond

    - Stores ID number of used item into a variable for easy checking

    How to Use

    Just paste it in. Follow the instructions in the script and customize the callback methods to get the effect that you want.

    Script



                    Code:        
    #============================================================================== # # ▼ SAI Key Item Button v1.0 # -- Last Updated: 2012.04.22 # -- Author: Bishop Myers ("Sailerius") # -- Requires: n/a # #============================================================================== $imported = {} if $imported.nil? $imported["SAI-KeyItemButton"] = true #============================================================================== # ▼ Updates # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # 2012.01.12 - First release # #============================================================================== # ▼ Introduction # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # Inspired by Chrono Cross, this script allows you to call the Key Item dialog # box at any time on the map. You can make it such that selecting an item from # the dialog box will activate an adjacent action button events so that they # can respond to the item used. # #============================================================================== # ▼ Instructions # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # To install this script, open up your script editor and copy/paste this script # to an open slot below ▼ Materials but above ▼ Main. Remember to save. # # To customize the script, make any edits you wish to the callback methods # defined below. # # key_item_trigger? #   When this method returns true, the key item dialog will be called. By #   default, it checks if the X button (A key) is triggered. Feel free to change #   this to a different button, or give it a different condition altogether. # # key_item_variable #   This method returns an integer which tells the script which variable to #   save the ID number of the key item used to. By default, it returns 2, #   meaning that using a key item will save its ID to variable #2. # # call_action_events_after_key_item_dialog? #   This method returns true if using a key item from the key item dialog should #   trigger action button events. By default, it returns true. # # call_action_events_after_key_item_dialog_cancelled? #   This method returns true if cancelling the key item dialog should trigger #   action button events. By default, it returns false. # # can_call_key_item_dialog_while_moving? #   This method returns true if the player should be able to call the key item #   dialog while moving. By default, it returns false. #============================================================================== # ▼ Compatibility # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # This script should be fully compatible with any other well-written Ace # scripts. # #=============================================================================== # ■ Game_Player #=============================================================================== class Game_Player < Game_Character   #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=   # ▼ Callback Methods   #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=   # These methods are designed to be customized and redefined to suit the needs   # of your project. They are called throughout the script, so it is crucial   # that you do not change the method name or arguments unless you know what   # you're doing.   #-----------------------------------------------------------------------------   # Function to determine what condition triggers the key item dialog   #-----------------------------------------------------------------------------   def key_item_trigger?         Input.trigger?(:X)   end   #-----------------------------------------------------------------------------   # Variable number in which to store the key item the player selects   #-----------------------------------------------------------------------------   def key_item_variable         return 2   end   #-----------------------------------------------------------------------------   # Should adjacent action events be called if the key item dialog is called?   #-----------------------------------------------------------------------------   def call_action_events_after_key_item_dialog?         return true   end   #-----------------------------------------------------------------------------   # Should adjacent action events be called if the key item dialog was cancelled?   #-----------------------------------------------------------------------------   def call_action_events_after_key_item_dialog_cancelled?         return false   end   #-----------------------------------------------------------------------------   # Should the player be able to use the key item dialog while moving?   #-----------------------------------------------------------------------------   def can_call_key_item_dialog_while_moving?         return false   end #=============================================================================== # ▼ Editing below is not intended for beginners. Change at your own risk. #===============================================================================   #-----------------------------------------------------------------------------   # Adds functionality to check for key item button   #-----------------------------------------------------------------------------   alias :gameplayer_update_saikib :update   def update         gameplayer_update_saikib         if ((movable? || can_call_key_item_dialog_while_moving?) && key_item_trigger?)           setup_item_choice(key_item_variable)         end     end   #-----------------------------------------------------------------------------   # Brings up the key item choice dialog and sets result to variable_number   #-----------------------------------------------------------------------------   def setup_item_choice(variable_number)         $game_message.item_choice_variable_id = variable_number   end end #=============================================================================== # ■ Window_KeyItem #=============================================================================== class Window_KeyItem < Window_ItemList   #-----------------------------------------------------------------------------   # Added functionality to call action events after an item is selected   #-----------------------------------------------------------------------------   alias :window_keyitem_on_ok_saikib :on_ok   def on_ok         window_keyitem_on_ok_saikib         if $game_player.call_action_events_after_key_item_dialog?           $game_player.check_action_event         end   end   #-----------------------------------------------------------------------------   # Added functionality to call action events after cancelling the key item dialog   #-----------------------------------------------------------------------------   alias :window_keyitem_on_cancel_saikib :on_cancel   def on_cancel         window_keyitem_on_cancel_saikib         if $game_player.call_action_events_after_key_item_dialog_cancelled?           $game_player.check_action_event         end   end end

    FAQ

    No questions yet asked.


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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-7-8 00:55 , Processed in 0.151431 second(s), 60 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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