Choubidou Posted October 17, 2015 Share Posted October 17, 2015 Hi guys , for start im really sorry for my bad english i will try to make me understood . 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 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 More sharing options...
Sykriss Posted October 17, 2015 Share Posted October 17, 2015 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); endendthen 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);endWhen 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, } kinyoshi 1 Link to comment Share on other sites More sharing options...
Choubidou Posted October 17, 2015 Author Share Posted October 17, 2015 I have to put it in my script folder recip.txt ? Link to comment Share on other sites More sharing options...
Sykriss Posted October 18, 2015 Share Posted October 18, 2015 I have to put it in my script folder recip.txt ? No, you would make a .lua file inside of <yourmod>/media/lua and put the top two code snippets inside of it. Link to comment Share on other sites More sharing options...
Choubidou Posted October 18, 2015 Author Share Posted October 18, 2015 It work perfect thx dude ! Thanks u so much . 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