ageibert Posted December 4, 2014 Share Posted December 4, 2014 Hi @all,i'd like to "insert" crafting into my game. Something like: I pick up item A and afterwards item B. If both find i can craft an item C from both.Does anyone have links/infos or own experience how to implement crafting? Link to comment Share on other sites More sharing options...
InsaneHero Posted December 4, 2014 Share Posted December 4, 2014 In order to make a flexible system I'd have a list of all valid combinations of items and the result: recipes = [{ list: ["a", "b"], result: "c"},{ list: ["a", "a", "c"], result: "d"},etc]; Then it's just a matter of writing some code that runs every time the player's inventory changes which skims the recipe list to see if all the required items for any recipe are in the inventory.Remember: the inventory changes after crafting as well as when the player picks something up! Link to comment Share on other sites More sharing options...
ageibert Posted December 5, 2014 Author Share Posted December 5, 2014 I see. That's a good idea. I'll work it out. Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts