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
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
and postfix to
to only write
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.
- <type:food>
- <type:fish>
- <type:cooked>
复制代码
Plugin commands
Before using the Select Item command in an event, use the plugin command
to only show items of the type X in the Select Item window.
Use the plugin command
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
- $gameParty.customItemTypeCount('X')
复制代码to get the number of items from custom type X in the party's inventory.
The script call
- 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/