Jump to content

How to add multiples of an item into inv?


MRB

Recommended Posts

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 by MRB
Tags
Link to comment
Share on other sites

my way is

 

for i=0,10 do

getPlayer():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.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...