Alchemy

About

The project

Alchemy is a multipurpose crafting system created by J. Sena and released as CC-BY. The current version of the system requires the 3.1 beta 11 (or newer) version of the Godot Engine. You can change the code to make it work on previous versions but things may not work as they should.

The license

I put a lot of time and effort on this project to make sure it is bug free (as much as possible), easy to use and fits the needs of most projects. By releasing it under the CC-BY license I don't intend to have my name included in the credits of your game (it would be awesome if you do but you don't have to). Just make sure to credit me if you share the code of your project (i.e. game jam projects). Feel free to get in touch to tell me you're using my script on a project. It will greatly help me to keep myself motivated and release new versions.

The setup

The system is in an early stage and requires only a few things to be customized. I plan to make the whole code much more clean and consistent but right now it's very stable and can be used without any trouble if you know GDScript.

1. alchemy.gd

The file containing the features and the recipes.

The variables

item_scene A base item scene to be used for displaying items.
recipes Must be an array of arrays. The first element of each subarray must be the result of the recipe, followed by the ingredients. (See the example bellow)
max_slots The maximum number of items used on a recipe. The minimum is always 2.

Code example of recipes:

var recipes = [ ['small_dagger', 'iron_ore', 'iron_ore'], ['short_sword', 'iron_ore', 'iron_ore', 'steel_ingot'], ['long_sword', 'iron_ore', 'iron_ore', 'steel_ingot', 'steel_ingot'], ['health_potion', 'green_herb', 'green_herb', 'purple_herb'] ]

2. progress.gd

The file where the inventory and the items' informations are stored.

The variables

items A dictionary of dictionaries containing all the items on the game. Each child dictionary should have the item ID as the key and have the 'name' and 'icon' values.
inventory Must be a dictionary. The key should be the item ID and the value must be an integer.

Code example of items:

var items = { 'iron_ore' : { 'name' : 'Iron Ore' ,'icon' : 0}, 'steel_ingot' : { 'name' : 'Steel Ingot' ,'icon' : 1}, 'green_herb' : { 'name' : 'Green Herb' ,'icon' : 2}, 'yellow_herb' : { 'name' : 'Yellow Herb' ,'icon' : 3}, 'purple_herb' : { 'name' : 'Purple Herb' ,'icon' : 4}, 'dragon_blood' : { 'name' : 'Dragon Blood' ,'icon' : 5}, 'dragon_scales' : { 'name' : 'Dragon Scales' ,'icon' : 6}, 'fire_stone' : { 'name' : 'Fire Stone' ,'icon' : 7}, 'small_dagger' : { 'name' : 'Small Dagger' ,'icon' : 8}, 'short_sword' : { 'name' : 'Short Sword' ,'icon' : 9}, 'long_sword' : { 'name' : 'Long Sword' ,'icon' : 10}, 'health_potion' : { 'name' : 'Health Potion' ,'icon' : 11} }

Code example of Inventory:

var inventory = { 'iron_ore' : 7, 'steel_ingot' : 3, 'green_herb' : 4, 'yellow_herb' : 3, 'purple_herb' : 2, 'dragon_blood' : 1, 'dragon_scales' : 3, 'fire_stone' : 1 }

F.A.Q.

Can I use more than 4 ingredients?

Yes. You can use how many ingredients you want. Just make sure your UI supports it.

Is this project still being developed?

If you are reading the online version of this page, the answer is no.

Changelog

Feb 6th, 2019