Need help with sink event.

index.php

here is what i've made so far with some help, but it doesn't work, i was wondering if anyone could tell me what i've done wrong. my goal is to get it to fill empty vials with water vials, and if it goes over 99, it will stop without removing all the empty vials you have. currently it doesn't change the vials at all, so theres probably an issue in one of the variables im guessing. thanks everyone. EDIT: was thinking maybe its the conditional branch that messes it up somehow too possibly. one idea i had was to make a variable where you make the variable the amount you need, then set that to 0 again afterwards, though not sure how that would be set up exactly.
I coded up the same thing. It worked as expected. If I had 80 empty vials and 50 water vials. It printed a message about filling 49 vials and I had 31 empty vials and 99 water vials. Do you get the message about how many you fill? Is the number correct? If you do but the item counts don't change I would look at parallel events and see if they are using the same variables.
You should have just kept this in your original thread rather than starting a new one.

You have too much inside the conditional branch - the only thing you want to do in there is adjust the number of vials if you have too many. What you've done instead is said "if I have 5 empty vials and I can carry another 94 filled vials, don't do anything"

Code:
When Fill all
  # see how many vials we have available
  Control Variables: 65 empty vials = the number of empty vials
  # see how many we can fill until we reach the limit of filled vials
  Control Variables: 66 available to fill = 99
  Control Variables: 66 available to fill -= the number of vial of water
  # if we have more vials than we can fill, only fill that amount
  If 65 empty vials > 66 available to fill
    Control Variables: 65 empty vials = 66 available to fill
  End
  Text: you fill \v[65] vials
  Change Items: Vial of Water + {empty vials}
  Change Items: Empty vial - {empty vials}
When Fill 1
...


In the "fill 1", you'll just have to have conditions to say "do I have an empty vial" and "do I have less than 99 filled vials" and add/subtract one from the appropriate item.
Thanks, ill try this out 🙂 i didn't see a reply on the other post so i attempted to make a new one ^.^ ill let you know how it turns out. edit: it looks like the fill all one doesn't work? what did you change compared to what i have already? am i missing something obvious? edit2: how do i fix it? cause right now it shows the wrong number when trying to fill it, and on top of it, it doesn't fill the empty vials even if i have less than 99. not sure how to fix it. edit 3: after checking it looks like the conditional branch i had was swapped? ill try changing that and hopefully thatll fix it. edit 4: i changed the options, for some reason it made 4 empty vials into 99 filled vials... 😳 edit 5: oh, noticed the > was < in my game, ill change it n test it now... 1min later, no that broke it, made nothing happen..
upload_2019-3-10_7-7-49.png

changed it back to <, though unsure of what to do next.
Just because nobody replies doesn't mean you need to create a new thread. You can bump after 3 days of waiting, just in case the people helping you have been busy.

Please look carefully at the difference between yours and mine. I said that you have too much inside that conditional branch, and you haven't moved any of it out. The one thing you did change, I didn't say to change.

Change < back to >

Get the Text and Change Items commands, and move them after the End of the conditional branch.
ooh, thank you 🙂 seems like that fixed it. i didnt know having too much inside a conditional branch didn't work. 😀
edit: if i have itemcore, can i change the amount to 999 instead of 99? will it still work?
upload_2019-3-10_8-6-21.png
i didnt know having too much inside a conditional branch didn't work.
That is not the case - technically you can have as many commands inside a conditional branch as you want.
The problem is that if you add wrong or unneeded commands there, you can break your entire event.

That is why you should not add commands anywhere unless you know exactly what they will do - guessing how to event or program something will NEVER work out.
@kalfax Please do not start new threads for the same query. One query = one thread.

Moderator note: I am closing this thread. Please continue this in the original one.

Original thread: https://forums.rpgmakerweb.com/threads/need-help-with-sink-event.106620/