ITEM CRAFTING
RPG Maker VX Ace
Craft items/weapons/armor from other items
- coelocanth
- 08/12/2013 10:47 PM
- 58513 views
Overview
This script adds an item crafting system to the game.
Crafting recipes are set using note tags.
For example, if you wanted to be able to distil 5 potions to make a Hi-Potion, you would add this tag to the Hi-Potion item's Note:
<craft item:1:5>
And to allow a hi potion to be diluted to make 4 potions from it using the breakdown system, you would add this tag:
<craft break item:1:4>
That makes it possible to create hi-potions through the crafting menu if you have 5 potions in your inventory.
And break hi-potions into potions through the breakdown menu:
Features
Usage
To install the script, open the script editor in RPG Maker VX Ace.
Scroll to the bottom, and select a blank row between Materials and Main Process.
copy/paste the script code into the right hand editing pane.
For any item you want to be craftable, you need to add at least one craft tag to its note.
Each craft tag specified one ingredient of the recipe to create the item.
The tags are as follows:
With these tags, you have the basic crafting system.
If the player has the ingredients you specified, they can craft the item.
But maybe you want the player to find recipe books or need specific tools to craft items.
This is also possible with two more note tags:
These are pretty similar in function, which one to use depends if you want the player to be able to see the recipe or not.
If you want to use item breakdown as well as crafting, the tags are similar:
Finally, do you want the crafting menu to be available all the time?
If not, there are restrictions you can set by editing the configuration variables at the top of the script.
You should use the IDs from your game database.
Configuration for the breakdown system follows the same pattern, in the "module CRAFT_BREAK" section.
It is therefore possible to enable only one system, or have different conditions to enable each one.
Crafting shops
Perhaps you want to have crafting performed at a shop?
Perhaps you want different shops to be able to craft different things?
Both of these are now possible.
First, we need to add note tags to the items:
If you want the same items to be craftable at every shop, you can ignore the switch.
However the switch lets you make a blacksmith, alchemist, etc, each of which can craft different items.
Switches can also be used to enable new items as the player progresses through the game. If you specify multiple switches in a recipe, all of them must be on.
(note that <craft switch> and <craft recipe> perform the same function, so you could use switches exclusively if you don't like using key items)
To launch the crafting from a shop event, you will need to use a script call:
And the equivalent for calling breakdown from an event:
Here is an example of a blacksmith's shop event:
I have given the halberd these notes:
<craft weapon:1>
<craft weapon:13>
<craft gold:100>
<craft switch:10>
And in the game, it looks like this:
This script adds an item crafting system to the game.
Crafting recipes are set using note tags.
For example, if you wanted to be able to distil 5 potions to make a Hi-Potion, you would add this tag to the Hi-Potion item's Note:
<craft item:1:5>
And to allow a hi potion to be diluted to make 4 potions from it using the breakdown system, you would add this tag:
<craft break item:1:4>
That makes it possible to create hi-potions through the crafting menu if you have 5 potions in your inventory.
And break hi-potions into potions through the breakdown menu:
Features
- Craft item/weapon/armour from other items/weapons/armour
- Restrict individual recipes to require a tool
- Hide individual recipes until the player acquires a specific item
- Restrict the crafting system to a specific actor or class
- Control access to the crafting system with a game switch
- Launch the crafting system from an event instead of the menu
- Breakdown items into components (new in 0.9.2)
- Crafting shops - gold price for recipes (new in 0.9.4)
- Crafting shops - use a game switch to control recipe visibility (new in 0.9.4)
Usage
To install the script, open the script editor in RPG Maker VX Ace.
Scroll to the bottom, and select a blank row between Materials and Main Process.
copy/paste the script code into the right hand editing pane.
For any item you want to be craftable, you need to add at least one craft tag to its note.
Each craft tag specified one ingredient of the recipe to create the item.
The tags are as follows:
Tag | Meaning |
<craft item:id> | Consume 1 item with the specified id |
<craft weapon:id> | Consume 1 weapon with the specified id |
<craft armor:id> | Consume 1 armor with the specified id |
<craft item:id:number> | Consume a number of items |
<craft weapon:id:number> | Consume a number of weapons |
<craft armor:id:number> | Consume a number of armors |
With these tags, you have the basic crafting system.
If the player has the ingredients you specified, they can craft the item.
But maybe you want the player to find recipe books or need specific tools to craft items.
This is also possible with two more note tags:
Tag | Meaning |
<craft tool:id> | The tool must be in inventory to craft, but is not consumed |
<craft recipe:id> | The recipe item must be in inventory, or this item will be hidden from the crafting menu |
These are pretty similar in function, which one to use depends if you want the player to be able to see the recipe or not.
If you want to use item breakdown as well as crafting, the tags are similar:
Tag | Meaning |
<craft break item:id> | Give 1 item with the specified id |
<craft break weapon:id> | Give 1 weapon with the specified id |
<craft break armor:id> | Give 1 armor with the specified id |
<craft break item:id:number> | Give a number of items |
<craft break weapon:id:number> | Give a number of weapons |
<craft break armor:id:number> | Give a number of armors |
<craft break tool:id> | The tool must be in inventory to breakdown this item |
<craft break recipe:id> | The recipe item must be in inventory, or this item will be hidden from the breakdown menu |
Finally, do you want the crafting menu to be available all the time?
If not, there are restrictions you can set by editing the configuration variables at the top of the script.
You should use the IDs from your game database.
Variable | Effect | Default |
MENU_COMMAND | Addto the game menu | true |
MENU_COMMAND_TEXT | Name of the menu command | Crafting |
MENU_COMMAND_ENABLE | Always enable the menu command | true |
MENU_COMMAND_SWITCH | Enable the menu, if a switch is on | 0 (disabled) |
MENU_COMMAND_ACTOR | Enable the menu if a specific actor in the party | 0 (disabled) |
TEXT_INGREDIENTS_TITLE | Heading for the ingredients window | Ingredients: |
TEXT_INGREDIENTS_TOOLS | Heading for tools in the ingredients window | Tools: |
TEXT_INGREDIENTS_PRICE | Heading for price in the ingredients window | Tools: |
Configuration for the breakdown system follows the same pattern, in the "module CRAFT_BREAK" section.
It is therefore possible to enable only one system, or have different conditions to enable each one.
Crafting shops
Perhaps you want to have crafting performed at a shop?
Perhaps you want different shops to be able to craft different things?
Both of these are now possible.
First, we need to add note tags to the items:
Tag | Meaning |
<craft gold:amount> | Price to craft this item |
<craft break gold:amount> | Price to break down this item |
<craft switch:id> | Show this recipe only if the game switch is ON |
<craft break switch:id> | Show this recipe only if the game switch is ON |
If you want the same items to be craftable at every shop, you can ignore the switch.
However the switch lets you make a blacksmith, alchemist, etc, each of which can craft different items.
Switches can also be used to enable new items as the player progresses through the game. If you specify multiple switches in a recipe, all of them must be on.
(note that <craft switch> and <craft recipe> perform the same function, so you could use switches exclusively if you don't like using key items)
To launch the crafting from a shop event, you will need to use a script call:
SceneManager.call(Scene_Crafting) Fiber.yield
And the equivalent for calling breakdown from an event:
SceneManager.call(Scene_Craft_Breakdown) Fiber.yield
Here is an example of a blacksmith's shop event:
I have given the halberd these notes:
<craft weapon:1>
<craft weapon:13>
<craft gold:100>
<craft switch:10>
And in the game, it looks like this:
Actions
Posts
Slick! I wasn't planning on having a crafting system in my game, but in retrospect, it fits better than my original plan.
Any chance we could see an "uncraft" feature added, for breaking down items into craftable components?
Any chance we could see an "uncraft" feature added, for breaking down items into craftable components?
author=kentona
Any chance we could see an "uncraft" feature added, for breaking down items into craftable components?
Yes, this looks pretty feasible to implement.
Since you can't uncook a bowl of soup, there'd need to be another set of tags for breakdown.
something like:
<craft break item:id:number>
<craft break weapon:id:number>
<craft break armor:id:number>
<craft break tool:id>
<craft break recipe:id>
With tools and recipes working the same as for crafting.
And the other break tags being the set of items you get for breaking down something.
(For the tag name, I could also just use "<breakdown item...", if it doesn't conflict with any other scripts)
Thank you, I've been looking for a script like this!
A suggestion, how about a confirmation window after we select a craft item? So if somehow players accidentaly select wrong item they still have a second chance. :v
A simple "Are you sure? Yes / No" is more than enough.
A suggestion, how about a confirmation window after we select a craft item? So if somehow players accidentaly select wrong item they still have a second chance. :v
A simple "Are you sure? Yes / No" is more than enough.
Updated the script with version 0.9.2 which contains a breakdown system.
A confirmation window would be possible, but isn't used anywhere else in the default game?
A confirmation window would be possible, but isn't used anywhere else in the default game?
Okay so I have a recipe and it consumes the items but how do I make it give me an item from the consume i.e. a potion, or herb? Like you stated above using 5 potions to create a HI-Potion. How would you make it give you the new item once you consumed the other 5 potions.
I think you add the recipe to the Hi-Potion's notebox? I've been meaning to test this script out. Also awesome about the breakdown feature!
That's right, add to the notebox of the item you'd create - I've added some screenshots to make it clearer.
Hi how can I make it so only certain items can make by certain npc's?
Something like <craft npc:(0-9)>.
I have tried it by myself but I am quite new to it and can still almost nothing with RGSS3.
Would be nice if whoever could help me.
greeting Gawin
Something like <craft npc:(0-9)>.
I have tried it by myself but I am quite new to it and can still almost nothing with RGSS3.
Would be nice if whoever could help me.
greeting Gawin
Right now, the easiest way would be to use <craft recipe>, and in your npc event:
give the recipe
open crafting scene
remove the recipe
Otherwise it sounds like you want something that works like <craft recipe>, but checks a switch or variable instead of an item.
in RGSS, $game_switches gives the value of a switch.
give the recipe
open crafting scene
remove the recipe
Otherwise it sounds like you want something that works like <craft recipe>, but checks a switch or variable instead of an item.
in RGSS, $game_switches gives the value of a switch.
Give and take once again I have not thought about it.
And with $game_switch I tried but always bekomm an error:
And with $game_switch I tried but always bekomm an error:
$game_switch[1]
error: "undefined method` [] 'for nil: NilClass"
That's because it's $game_switches not $game_switch.
nil is the value of an unassigned variable.
I can probably add this feature to the script if a switch would work for you.
nil is the value of an unassigned variable.
I can probably add this feature to the script if a switch would work for you.
Oh I have the misspelled in the post did not notice xD.
Would be great if you could do that.
Switches would be enough and then just simply in the notes <craft switch:id>.
Would be great if you could do that.
Switches would be enough and then just simply in the notes <craft switch:id>.
I've made the switches (and also gold, if you want your shop to charge a fee for crafting), see the crafting shops section in the updated post.
Everything works great but the start and end of game suddenly takes 3-4 times longer. Is this normal?
At startup the script reads the notes from every weapon/armor/item in the database.
This happens in the time between starting the game and the title screen appearing.
It doesn't do anything at shutdown.
I believe the load time is linear with the number of items in the database, so if you have a lot of items it could take some time.
This happens in the time between starting the game and the title screen appearing.
It doesn't do anything at shutdown.
I believe the load time is linear with the number of items in the database, so if you have a lot of items it could take some time.