MRB Posted November 1, 2013 Share Posted November 1, 2013 (edited) Using: Spoiler if getPlayer():getInventory():contains("Plank") == false then getPlayer():getInventory():AddItem("Base.Plank"); to add items to inv on keypress, how do I set it to add more than one of that item? Is there a command reference doc somewhere? Cheers! Edited November 1, 2013 by MRB Tags Link to comment Share on other sites More sharing options...
Ramibuk Posted November 1, 2013 Share Posted November 1, 2013 my way is for i=0,10 dogetPlayer():getInventory():AddItem("Base.Plank");end; Change 5 for whatewer you want,but you need to remove if getPlayer():getInventory():contains("Plank") == false then...........................end; it prevent code at ................ to be readed if you have "plank" in inventory and about second question,all possible methods are at http://theindiestone.com/zomboidjavadocs/,but it took me time to orient myself there.Also discovered Lua language only week ago so im no expert on this. MRB 1 Link to comment Share on other sites More sharing options...
MRB Posted November 1, 2013 Author Share Posted November 1, 2013 Cheers! Not sure what happened but I ended up with 78 planks on the game loading, so will play around a bit. Having a look at that command repository as well. Bleargh. Link to comment Share on other sites More sharing options...
Ramibuk Posted November 1, 2013 Share Posted November 1, 2013 also in http://theindiestone.com/zomboidjavadocs/zombie/inventory/ItemContainer.html there is method .AddItems() Link to comment Share on other sites More sharing options...
RoboMat Posted November 2, 2013 Share Posted November 2, 2013 getSpecificPlayer(0):getInventory():AddItems("Base.Axe", 3); Would add three axes. 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