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

[转载发布] Custom Item Types and Choices (now with demo!)

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

    连续签到: 2 天

    [LV.7]常住居民III

    7959

    主题

    864

    回帖

    3万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 4 天前 | 显示全部楼层 |阅读模式
    Custom Item Choices v1.1.1

    LadyBaskerville


    (This plugin was originally posted in my JS Snippets thread along with the rest of my small plugins, but even though this plugin is still short in terms of code, I feel like it deserves its own thread for the functionality it can provide.)

    Introduction
    This plugin allows you to designate any item as belonging to one or more custom types. It also lets you show only items of one specific custom type in the Select Item window, for when the Item Type distinction in the database isn't enough.

    With some creativity, you can use this plugin to event a full crafting system / cooking system with variable ingredients. (This was part of my motivation for writing it in the first place - a demo can be found at the end of the post.)





    How to use

    To specify a custom item type, add a notetag of the format
    1. <type:X>
    复制代码
    to the item, where X is the custom item type (can be any string that does not contain spaces).

    You can change the brackets in the plugin parameters, e.g. set prefix to
    1. [
    复制代码
    and postfix to
    1. ]
    复制代码
    to only write
    1. [X]
    复制代码
    in the item note field in order to specify custom type X. If you leave both parameters empty, an item will belong to custom type X if the string X appears anywhere in the note field.

    Items can have multiple custom types. Simply add more notetags, e.g.
    1. <type:food>
    2. <type:fish>
    3. <type:cooked>
    复制代码

    Plugin commands

    Before using the Select Item command in an event, use the plugin command
    1. SetSelectItemType X
    复制代码
    to only show items of the type X in the Select Item window.

    Use the plugin command
    1. SetSelectItemType 0
    复制代码
    to return to the default behavior (showing all items in the selection window).


    Script calls (advanced)

    These script calls will probably be most useful in the Script fields of the Change Variables and Conditional Branch event commands.

    Use the script call
    1. $gameParty.customItemTypeCount('X')
    复制代码
    to get the number of items from custom type X in the party's inventory.

    The script call
    1. DataManager.isItemCustomType($dataItems[n], 'X')
    复制代码
    returns true if the item with ID n has the custom type X, otherwise false.

    Spoiler: Usage Examples
    This is the event from the picture above (both the "Common Fish" and "Rare Fish" items are tagged with <type:fish> in the database):



    Here's an bare-bones example for how this plugin can be used to select seeds for planting as part of a simple farming game:

    Terms of use
    - Free for use in both non-commercial and commercial games.
    - Please credit me as LadyBaskerville if you use this plugin (version 1.1.0 and higher).
    - You may edit this plugin.
    - You may redistribute this plugin and edits of it. In that case, please give credit and, if possible, link back to the original plugin thread.

    Download
    LB_CustomItemChoices.js
    Plugin Demo (7.5 MB )

    Spoiler: Changelog
    Version 1.1.1
    - Fixed a bug where the item selection screen would come up empty if no select item type was set.

    Version 1.1.0
    - Added parameters for prefix and postfix.
    - Added support for more than one custom type per item.
    - Added script calls for advanced functionality

    Version 1.0.0
    - Finished the plugin.


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

    本帖子中包含更多资源

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

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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-8-1 07:33 , Processed in 0.091180 second(s), 52 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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