Shivster Posted August 3, 2013 Share Posted August 3, 2013 I want to be able to make a item in game that takes more then 4 items is it even possible or is it something LUA is unable to handle? Here is the Code i want to be able to use:recipe Basicmarinad{Soysauce,Worcestershire,Pepper,Salt,Liquidsmoke,Result: Basicmarinad=3,Time:800,}I do not want to make that and the Boring and Tasty versions into more then one recipe. But if i must i will Link to comment Share on other sites More sharing options...
Shivster Posted August 3, 2013 Author Share Posted August 3, 2013 I think i found it. now the question is can i make a file that will change the base File without editing the base file. C:\Program Files (x86)\Desura\Common\Project Zomboid\media\lua\TimedActions\ISCraftAction.LUA Think i need to change:require "TimedActions/ISBaseTimedAction"ISCraftAction = ISBaseTimedAction:derive("ISCraftAction");function ISCraftAction:isValid() -- do you still have the required item in your inventory if self.character:getInventory():contains(self.itemsCraft[1]) and ((self.itemsCraft[2] and self.character:getInventory():contains(self.itemsCraft[2])) or not self.itemsCraft[2]) and ((self.itemsCraft[3] and self.character:getInventory():contains(self.itemsCraft[3])) or not self.itemsCraft[3]) and ((self.itemsCraft[4] and self.character:getInventory():contains(self.itemsCraft[4])) or not self.itemsCraft[4]) then return true; end return false;endAnd Thisfunction ISCraftAction:perform() self.item:getContainer():setDrawDirty(true); self.item:setJobDelta(0.0); local resultItemCreated = RecipeManager.PerformMakeItem(self.recipe, self.itemsCraft[1], self.itemsCraft[2], self.itemsCraft[3], self.itemsCraft[4], self.character); if resultItemCreated then local itemsAdded = self.character:getInventory():AddItems(resultItemCreated:getModule() .. "." .. resultItemCreated:getType(), self.recipe:getResult():getCount()); if itemsAdded and instanceof(resultItemCreated, "Food") then for i=0, itemsAdded:size()-1 do local newItem = itemsAdded:get(i); newItem:setCooked(resultItemCreated:isCooked()); end end end Link to comment Share on other sites More sharing options...
Shivster Posted August 3, 2013 Author Share Posted August 3, 2013 Ok i changed above code adding in more items like so.function ISCraftAction:isValid() -- do you still have the required item in your inventory if self.character:getInventory():contains(self.itemsCraft[1]) and ((self.itemsCraft[2] and self.character:getInventory():contains(self.itemsCraft[2])) or not self.itemsCraft[2]) and ((self.itemsCraft[3] and self.character:getInventory():contains(self.itemsCraft[3])) or not self.itemsCraft[3]) and ((self.itemsCraft[4] and self.character:getInventory():contains(self.itemsCraft[4])) or not self.itemsCraft[4]) and ((self.itemsCraft[5] and self.character:getInventory():contains(self.itemsCraft[5])) or not self.itemsCraft[5]) and ((self.itemsCraft[6] and self.character:getInventory():contains(self.itemsCraft[6])) or not self.itemsCraft[6]) and ((self.itemsCraft[7] and self.character:getInventory():contains(self.itemsCraft[7])) or not self.itemsCraft[7]) then return true; end return false;endand herefunction ISCraftAction:perform() self.item:getContainer():setDrawDirty(true); self.item:setJobDelta(0.0); local resultItemCreated = RecipeManager.PerformMakeItem(self.recipe, self.itemsCraft[1], self.itemsCraft[2], self.itemsCraft[3], self.itemsCraft[4], self.itemsCraft[5], self.itemsCraft[6], self.itemsCraft[7], self.character); if resultItemCreated then local itemsAdded = self.character:getInventory():AddItems(resultItemCreated:getModule() .. "." .. resultItemCreated:getType(), self.recipe:getResult():getCount()); if itemsAdded and instanceof(resultItemCreated, "Food") then for i=0, itemsAdded:size()-1 do local newItem = itemsAdded:get(i); newItem:setCooked(resultItemCreated:isCooked()); end end endStill not working in fact it broke crafting Must be another file that has the 4 Limit will keep looking! Link to comment Share on other sites More sharing options...
kinyoshi Posted August 3, 2013 Share Posted August 3, 2013 (edited) It wont work, the crafting recipe limit is controlled by a java file. If we had a new java file with the amount of items increased, then the lua could be changed to the same limit and it would work fine. So no, not without replacing the base class java file. Edit: I am 99% sure it is this java file. Project Zomboid\zombie\scripting\objects\recipe.class Edited August 3, 2013 by kinyoshi Link to comment Share on other sites More sharing options...
Shivster Posted August 3, 2013 Author Share Posted August 3, 2013 Making this Solved i know java a little bit took a class on it on Coursera about a year ago but im not going to play with base compiled files. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now