This is going to take a bit of explanation so stay with me. I have bottles in my game which can hold liquids like water and vinegar. I want these bottles to be reusable, like you can drink the water in the bottle and the game gives you an empty bottle. So far I've been able to keep the bottles reusable, but I've ran into a problem. I also have a crafting system in my game (this one) and some recipes require bottles with liquid in them (EX: The player can make pickles and it requires cucumber and a bottle of vinegar to make.) The problem is, with this crafting plugin, the bottles just get deleted once used, effectively ruining the reusability of my bottles.
I've tried a couple solutions, but all of them were either completely un-effective, or cannot be completed without what I'm going to ask. Which leads me to it, is it possible to trigger a common event/switch/variable-change via script/event/plugin after a specific item is added to the inventory?
My current attempt at solving this: I have a parallel event running which checks if the player has Pickles (which require a bottle of vinegar to make.) If they do, it goes to another conditional branch which checks if a variable is set to 0. If it is, it gives the player an empty bottle, making it seem like the bottle was just emptied and not totally deleted then re-added. The first problem with this lies in where to change the variable. Obviously, if the variable is not turned, the game will give the player an infinite amount of bottles if the player has pickles in their inventory. I've tried putting the variable change in a couple places to no real effect. What I really need is a check to trigger when the item is added, not if it persists in the inventory. This way, I can safely add the item to the inventory without the possibility of it giving the player an infinite amount.
I assume this problem dose not have a simple solution. But I hope it does. Thank you guys for the help and suggestions!
I've tried a couple solutions, but all of them were either completely un-effective, or cannot be completed without what I'm going to ask. Which leads me to it, is it possible to trigger a common event/switch/variable-change via script/event/plugin after a specific item is added to the inventory?
My current attempt at solving this: I have a parallel event running which checks if the player has Pickles (which require a bottle of vinegar to make.) If they do, it goes to another conditional branch which checks if a variable is set to 0. If it is, it gives the player an empty bottle, making it seem like the bottle was just emptied and not totally deleted then re-added. The first problem with this lies in where to change the variable. Obviously, if the variable is not turned, the game will give the player an infinite amount of bottles if the player has pickles in their inventory. I've tried putting the variable change in a couple places to no real effect. What I really need is a check to trigger when the item is added, not if it persists in the inventory. This way, I can safely add the item to the inventory without the possibility of it giving the player an infinite amount.
I assume this problem dose not have a simple solution. But I hope it does. Thank you guys for the help and suggestions!