Jump to content

How to get two items when the item are exhausted? (Solved)


eva08maicy02

Recommended Posts

I want to create a drink and get a Glass Tumbler and a straw when the drink is done. I know ReplaceOnUse, but it seems to only can set one item, how do I set two?

 

I tried setting two ReplaceOnUse and it only worked one;
I tried "ReplaceOnUse = GlassTumbler;straw," and it makes the item all-you-can-drink;
Maybe OnCreate also works on items? So I tried doing it on items, but it didn't work.

 

Does anyone know how to implement it? Or know of any mod that implements it, I'd like to refer to it.

 

Edited by eva08maicy02
(Solved)
Link to comment
Share on other sites

On possible way is to use the OnEat proprty:

 

For example, vanilla cigarettes uses:  OnEat = OnEat_Cigarettes,

 

OnEat_Cigarettes is a function that deals with happiness / stress changes from smoking.

 

You could write your own function to just add the two items to the player's inventory, although you might need to check that the food has been completely consumed to prevent the player getting the items every time they drink 1/4 of it.

 

Alternatively, you could create a 'TumblerAndStraw' item and return that from ReplaceOnUse, and use that in the create recipe (and create a recipe to to make a TumblerAndStraw from the two items).

 

Link to comment
Share on other sites

17 hours ago, Hugo Qwerty said:

On possible way is to use the OnEat proprty:

 

For example, vanilla cigarettes uses:  OnEat = OnEat_Cigarettes,

 

OnEat_Cigarettes is a function that deals with happiness / stress changes from smoking.

 

You could write your own function to just add the two items to the player's inventory, although you might need to check that the food has been completely consumed to prevent the player getting the items every time they drink 1/4 of it.

 

Alternatively, you could create a 'TumblerAndStraw' item and return that from ReplaceOnUse, and use that in the create recipe (and create a recipe to to make a TumblerAndStraw from the two items).

 

Since I don't know anything about functions, I'm glad I can use the second method to solve this problem: make them a set of dirty dishes, then make the recipe to wash them, use OnCreate to separate them.

 

Your reply helped me a lot, thank you very much :lol:

Link to comment
Share on other sites

  • eva08maicy02 changed the title to How to get two items when the item are exhausted? (Solved)

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...