Use item and get another

Hey guys.


Mabye a easy thing, but i want to create a water bottle. And if you use it, than the item removes, but i want to get an empty bottle at the same moment.


I know, i can do it with common events, but i have many items where this will be happend and i dont want to create a few common events for such a small feature.


thanks for help, greez BD
I'm not sure you can do this without common event. Maybe a plugin could help you, but as it can be done with common events, there may not be one to do that. Why you don't want to use common events?
I'm not sure you can do this without common event. Maybe a plugin could help you, but as it can be done with common events, there may not be one to do that. Why you don't want to use common events?

Because there must be more than one common event. I want to create many items with this functions. I have tried to link more than one item to a single common event and trigger a variable with the formular field. But i can not figure out the right command. I tried: $gameVariables.setValue(457, 1) for my books.

In the common event a cond. branch an variable = 1 bla bla bla end


than variable = 2 bla bla end


etc.

But everytime the console opens and such things xD It dont crashs because i have yanflys debugger. Without it, it will crashs instandly.
There is no way to do it without using multiple common events. If you are worried about using too many common events don't  be, you can have a maximum of 9999 common events and I do not know anybody who has come close to that ammount. If you are more worried about all the work required I understand but tbh copy/paste and then a tiny edit will save you a lot of time.
If it crashes, show us what the console says so we can help you figure it out.


Actually, you could do it in the damage formula.  If your damage formula is 10 (to restore 10 HP), and your empty bottle item is 18, just change the damage formula (on the full bottle) to this:

Code:
$gameParty.gainItem($dataItems[18], 1); 10



So it gives the party one of item 18 (the empty water bottle), and then gives 10 HP.  The actual damage value should always come last.
There is no way to do it without using multiple common events. If you are worried about using too many common events don't  be, you can have a maximum of 9999 common events and I do not know anybody who has come close to that ammount. If you are more worried about all the work required I understand but tbh copy/paste and then a tiny edit will save you a lot of time.

I only can create 1000 common events and i use already the half.

 

If it crashes, show us what the console says so we can help you figure it out.


Actually, you could do it in the damage formula.  If your damage formula is 10 (to restore 10 HP), and your empty bottle item is 18, just change the damage formula (on the full bottle) to this:

Code:
$gameParty.gainItem($dataItems[18], 1); 10



So it gives the party one of item 18 (the empty water bottle), and then gives 10 HP.  The actual damage value should always come last.

Yeah!


This is the way i searched about! Works pretty! And this solve my other problem, too. I dont write a anything after the $gameVariables.setValue(457, 1). This have to be:
$gameVariables.setValue(457, 1); 0


And now it works.


Thanks at all BD
Yep, as long as the syntax & arguments are right, and the damage calculation is at the end, you should be good 🙂

Original thread: https://forums.rpgmakerweb.com/threads/use-item-and-get-another.72407/