+ Glasses 606 Posted March 28, 2016 (edited) Author: Mr. Trivel Name: Crafting Created: 2016-03-27 Version: 1.0 What does it do? Allows players to craft items. Video: How to use? First, you'll need 2 new files in data folder:Recipes.jsonDisciplines.json Recipes file will hold all recipe data and Disciplines file will hold data about disciplines. I *highly* recommend checking sample files that are located in the demo of this plugin. Discipline object looks like this: { "ID": 999, "Name": "NAME", "IconID": 1337, "ExpFormula": "10000*level", "MaxLevel": 2, "Categories": ["1", "2", "3", ... , "n"], "Background": "FileName"} And file structure looks like this: [null,object,object,...,object] "ID" - to identify which disciiplice is which and for plugin calls. ID > 0"Name" - how discipline is called"IconID" - icon for discipline"ExpFormula" - leveling formula for discipline, level stands for current discipline level"MaxLevel" - max possible discipline level"Categories" - Categories to organize items when crafting"Background" - Give a background to crafting. Leave it empty - "" to use default background. Images go into img\System Recipe object looks like this: { "ID": 192312, "Name": "Ultimate Sword of Ascension", "IconIndex": 122, "Result": [ { "Type": "weapon", "ID": 99999, "Amount": 1 } ], "Requires": [ { "Type": "item", "ID": 1337, "Amount": 99 } ], "Discipline": ID, "Category": ["Swords", "Weapons"], "XP": 999999999, "LevelReq": 150, "Learned": "command"} And file structure looks like this: [null,object,object,...,object] "ID" - To know which recipe is which. ID > 0"Name" - How it appears in crafting window"IconIndex" - Icon for recipe"Result" - What items and how many of them result by crafting it, can be more than one item."Requires" - What items and how many of them are required to craft it.{"Type" - item type - "weapon", "item", "armor""ID" - item ID"Amount" - how much of the item}"Discipline" - which disicipline's recipe is this"Category" - under which categories will item be shown, can be multiple"XP" - XP given for the discipline"LevelReq" - Discipline level requirement to craft it"Learned" - how is the recipe learned - "start" - from the start, "command" by plugin command, "levelhit" - unlocks automatically when hits required level Plugin Commands: Crafting Start [DISCIPLINE_ID] - opens scene to craft with disciplineCrafting GainExp [DISCIPLINE_ID] [EXP] - give exp to certain disciplineCrafting Learn [RECIPE_ID] - learn a specific recipeExamples:Crafting Start 3Crafting GainExp 1 100Crafting Learn 5 Script Calls: $gameSystem.getDisciplineExp(DISCIPLINE_ID) - returns EXP of a discipline$gameSystem.getDisciplineLevel(DISCIPLINE_ID) - returns LEVEL of a discipline$gameSystem.isRecipeKnown(RECIPE_ID) - returns if recipe is learned$gameSystem.knownRecipesNumber(DISCIPLINE_ID) - returns amount of recipes known Plugin: <Link: Github> How to download the Plugin: Click the link above, there will be a button named Raw, press Right Click -> Save As. Demo: <Link: Mediafire> Terms of Use: Don't remove the header or claim that you wrote this plugin. Credit Mr. Trivel if using this plugin in your project. Free non-commercial projects. For commercial use contact Mr. Trivel. Edited March 28, 2016 by Glasses 2 Share this post Link to post Share on other sites
Ragnos 122 Posted May 31, 2016 (edited) Well I decided to use your script, I wanted to start by setting up one item to be crafted, but every time I go to test the game it crashes with the message: "Uncaught Syntax Error: Unexpected String". I've included the code in this post that you can check for below. I know I'm doing something wrong here. Discipline Code [ null, { "ID": 1, "Name": "Smithing", "IconID": 223, "ExpFormula": "25*level", "MaxLevel": 25, "Categories": ["Weapon", "Armor", "Parts"], "Background": "Lava1" }, { "ID": 2, "Name": "Smelting", "IconID": 313, "ExpFormula": "25*level", "MaxLevel": 25, "Categories": ["Ingots", "Compress"], "Background": "" }, { "ID": 3, "Name": "Alchemy", "IconID": 183, "ExpFormula": "25*level", "MaxLevel": 25, "Categories": ["Mixing"], "Background": "" } ] Recipe Code [ null, { "ID": 1, "Name": "Enhanced Iron Sword", "IconIndex": 97, "Result": [{ "Type": "weapon", "ID": 11, "Amount": 1 }], "Requires": [{ "Type": "item", "ID": 366, "Amount": 1 "Type": "item", "ID": 359, "Amount": 1 "Type": "item", "ID": 358, "Amount": 1 "Type": "item", "ID": 357, "Amount": 1 }], "Discipline": 1, "Category": ["weapons"], "XP": 7, "LevelReq": 1, "Learned": "start" } ] EDIT: I guess I'll go look for another crafting script then... since no reply. Edited June 2, 2016 by Ragnos Share this post Link to post Share on other sites
+ Glasses 606 Posted June 6, 2016 @Ragnos, Haven't tested it, but from I see, the "Requires" items aren't split into objects. This should make it work: "Requires": [{ "Type": "item", "ID": 366, "Amount": 1 }, "Type": "item", "ID": 359, "Amount": 1 }, "Type": "item", "ID": 358, "Amount": 1 }, "Type": "item", "ID": 357, "Amount": 1 }], Share this post Link to post Share on other sites
Excessum 0 Posted October 13, 2017 So I have been using this plugin for my game... and I am having issues with testing it. Every time I make a mistake in recipes I go back in and fix it... but I have to start a new game every time I want to check my fix. Since I like to play test my games a lot I was wondering if I am doing something wrong. If so what is the best way to reset the mod each time I make a change to recipes? Share this post Link to post Share on other sites