Jump to content

Need some help for my mod .


Choubidou

Recommended Posts

Hi guys , for start im really sorry for my bad english i will try to make me understood  (tophat)  .

 

Im actually working for a item mod and im blocked for some things  :???:  ( hope u understand , when i try to read myself its like read in Chinese )

 

I would like to add a fix contener when people start a new game , like "the key ring" in vanilla game. I know how to add a contener but not imediately like this 1445053876-screenshot-17-10-2015-05-49-2

 

 

 

And my second problem is , i would  like to add 2 or more result if i open a box , like this .

 

Vanilla code :

 recipe Open Box of Nails    {        NailsBox,        Result:Nails=20,        Sound:PZ_PutInBag,        Time:5.0,    }

What i want:

 recipe Open Box of Nails    {        NailsBox,        Result:Nails=20, + blabla=10  + blablou = 20   ....        Sound:PZ_PutInBag,        Time:5.0,    }

Im really sorry i try to do my best but its really hard when i have stop study at 15 years .

 

 

Thanks for ur help <3

Link to comment
Share on other sites

To add more than one item to the players inventory with a recipe, you need to have a function like this:

function AddMultipleItems(item, count, player)	for x=0, count do		player:getInventory():AddItem(item);	endend

then add a different function to call the function you just made and specify the items you want to add (note: you'll need to make the count 1 less than what you want):

function recipe_additems(items, result, player)	AddMultipleItems("Modname.Exampleitem1", 25, player);	AddMultipleItems("Modname.Exampleitem2", 1, player);end

When called, the above function will add 26 of Exampleitem1 and 2 of Exampleitem2 to the players inventory.

 

To call this in a recipe, you would want to set it up like this:

 recipe Open Box of Nails    {        NailsBox,        Result:Nails=20,        Sound:PZ_PutInBag,        Time:5.0,        OnCreate:recipe_additems,    }
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...