ITEM CRAFTING

Recipe based Item Crafting system for MZ

Overview

This plugin implements a recipe based item crafting system.
In a recipe based crafting system, if you have the recipe and the ingredients, you can craft the item.
This is different from an experimental crafting system where the player chooses the ingredients and gets some kind of result.

This is a re-implementation of my Item Crafting script for VX Ace.
For users of that script, the database setup is very similar. However configuration of the plugin is done through the new plugin parameters screen and plugin commands, rather than needing to edit the script.

Thanks to Muffle, there is a sample game (only 8MB).
If you want an example of setting up a few recipes in the database for crafting and breakdown and a little shop using the event commands, download and take a look.
It's an editable project so you can look at the map and database to see how it was done.

Installation

  • Save the plugin in your project's js/plugins folder
  • Make sure not to change the filename, the MZ plugin system will only work correctly if it is named "CC_ItemCrafting.js"
  • Follow the steps in the RPGMaker MZ help file to activate the plugin
  • This is a standalone plugin, so should be placed somewhere near the bottom after any "core" plugins of other developers
  • When upgrading from a previous version, always open the plugin settings in your project and press OK to apply defaults to any new settings.


Configuration

Use the plugin manager's configuration screen to configure this plugin the way you like it.
An important decision for your game is whether crafting will be available from the menu screen, or only in specific places.
You can configure the crafting menu commands here, and update these later with plugin commands.

The text labels used in the crafting scene can be edited here, in case your game is not in English, or you prefer to use different words.

Also the crafting log window can be turned off or resized here.



Crafting and Breakdown:
With crafting, you choose an item from the recipe list.
The ingredients are consumed, and you get a new item.

With breakdown, you choose an item from the party inventory.
The item is consumed, and you get new items.

The craft and breakdown recipes are independent - you can't unbake a cake
to get eggs, sugar and flour back. (unless that's in your game!)

Items which can be crafted have their recipes specified by notes in the database.

Note tags starting with "craft" refer to the crafting recipe, and
"craft break" refers to the breakdown recipe.

Ingredients:
- An ingredient is consumed by the crafting recipe
- An ingredient is produced by the breakdown recipe
- Crafting is not allowed with missing ingredients
- If you don't specify any ingredient note tags, the item is not
craftable and will not show up in the crafting menu.

<craft armor:id:amount>
<craft item:id:amount>
<craft weapon:id:amount>

<craft break armor:id:amount>
<craft break item:id:amount>
<craft break weapon:id:amount>

The "id" parameter refers to the ID in the database
The "amount" parameter refers to the number of items required.
You can omit the amount, in which case it defaults to one item.

Costs:
- A cost is consumed by both the crafting and breakdown recipes.
- It is useful where crafting is a shop service in your game
- If you don't specify a cost, the crafting is free.

<craft gold:amount>
<craft break gold:amount>

Requirements:
- Requirements are not consumed by the recipe, but you need to have them
- A "tool" needs to be an item in the party inventory,
e.g. needle / hammer & anvil / 3d printer
- A "recipe" also needs to be in the party inventory, and differs from
tools in that the item will not be listed at all unless you have the
recipe.
- A "switch" works like a recipe, hiding the item unless the switch is on.
This is mostly useful for different kinds of shop.
- key items or hidden items are a good choice for tools and recipes, but
any item can be used.
- If you don't add any requirement note tags for the database item, it
will always show up in the crafting menu.

<craft recipe:id>
<craft switch:id>
<craft tool:id>

Yield
- Normally a recipe creates one item.
- The "yield" keyword lets you change the number of items created
- For breakdown, "yield" is the number of items broken at once, which is
wrong language but is symmetric.

<craft yield:count>
<craft break yield:count>

Flavour Text:
- If you want to add extra text to the recipe, use these tags.
- The text is drawn at the bottom of the recipe
- You can use text codes to change colour, insert names etc. like "show text"

<craft text>
Your flavour text here
</craft text>
<craft break text>
Your flavour text here,
can use multiple lines.
</craft break text>

How to let players use crafting:

The first option is to have crafting available from the main menu. This
is configured through the plugin parameters.
The plugin command "changeMenuAccess" can be used to change availability
of the crafting command from an event.
This type of gameplay allows the player to craft items anywhere in the game.

An alternative option is to launch crafting from events.
To do this, use the "openCraftingScene" / "openBreakdownScene" plugin commands.
By setting switches or adding key items to inventory beforehand, you
can make different recipes available in different places.
This type of gameplay is good to restrict the player to crafting at
specific workstations (alchemy lab, forge, etc), or to make crafting
a shop service operated by NPCs.

Plugin command is on the last page of event commands, next to Script Call.
You will need to choose which plugin the command is for, then choose from the list of commands for that plugin.


Terms of Use:
Use in games
  • You may use this in games including commercial without payment
  • Please credit as "Coelocanth" on your credits screen / text file
  • If you use in a commercial game, please send me a key when published*

Redistribution
  • Do not re-upload to other sites, unless all official sources are permanently offline and I can't be contacted.
  • You may edit for private use but distribute only as part of your game
  • Add-ons, visual reskins and compatibility patches must only be distributed for no payment, unless as part of a game
  • You may read and study the code to learn how to do things, but do not copy/paste code into your own plugins.


*I don't want this to be onerous, if your game doesn't have digital distribution or is on a platform I don't have, then don't worry about it. I'm mostly interested to see what people made rather than looking for Free Stuff.

Details

  • 33.4 KB
  • 1521
  • 04/18/2024 12:30 PM

Actions