RANDOM ITEM CHESTS AREN'T WORKING [RMMV]

Posts

Pages: 1
Sometimes my chests give an item, but just as often, they don't.

I've tried to do it by using the common event command to select an item from a list, but often the chest opens, and no item is given.

Here's the chest event, and the common event. If someone can tell me what's going wrong here, that would be great. I put the "wait" in there, thinking that might help, but nothing's changed.

Chest Event


Common Event (Random Item List)








Seems your random variable range is from 1 to 159, have you set conditionals for each range? Is that how many random items you want?
Yes. There's a conditional for every item, which are arranged like the two shown.
Hmmm, I don't see anything wrong with the eventing. If you're getting the randomized items only sometimes then the only thing I can think of is that you've missed a few conditional branches. 159 conditionals is a lot to keep track of!

I don't have experience with a random conditional with that high of a range or if there's a processing delay or some such. Maybe place the wait command after the common event call? Hopefully someone else can chime in to help you.
I'll elaborate on this a bit more. This is supposed to be mimicking the random loot chests out of the Elderscrolls games. Do you think it would be better if I made a few other conditionals, so it randomly chooses a category (say potions), and then it would pick randomly from about the 32 different types of potions which are in the game.

Is the current scheme a bit too much for it to handle?

The wait looks useless to me in this part of the code (you might want to test one frame wait before the begining of your conditions). I did something similar on RM2003 for encounters (with as much conditions, I guess) and it works fine. The only thing I could think of to lighten a little bit your code is adding a label in your event to jump at the end of the code (but it's more utility than a must, and checking your last condition doesn't have a "else" (but it only avoids to get two objects). Other than that, it could be as said ten_blue_egyptians (but testing it several times would have made it work at least once or two), an error of MV when handling message (it doesn't show, but the item/gold is still added), or your local button A cutting the event (I don't know why though).
If you're using a plugin, maybe one of them wrote over something ?
I'd personally put the wait after the common event (and just 1 frame should be enough). Check that and see if it helps any. A pause after chunking the bigger event might be all you need.
Marrend
Guardian of the Description Thread
21781
I think my general response to this would be to check the value of the variable, and see what it's value is when the chest comes up empty. You can pass the value into the debugger (not sure what that would look like for MV, though), check it with F9 (I think it's F9?) or doing a Show Message of "\v[81]".

It might be really tedious to perform this check multiple times if there is a self-switch enabling Page 2's processing. For the purposes of testing, maybe temporarily remove that line?
Having done the suggested method of checking the variable, with it's corresponding number in the variable event, it should be giving an item, and every number is correct. I had the common event opened at the same time, so I could compare the numbers.

What I assume is that once it hits a certain number then it starts having issues. I could try making more narrowed lists, because it seems to cope with it up to about 50-60 items. If I make chests with narrowed lists (say, Gold), then the most that one would have would to pick from would probably be about 30 different items.
The narrowed list approach worked.

Thanks for the suggestions.
I got here a bit late, but I have noticed that in Rm2k3 if an event (in my case it was also a common event) gets too long the engine simply ignores the last chunk of it, partially or completely, skipping event instructions. I've had it happen a few times; shortening an event or splitting an event into smaller ones usually helps. I'm shocked that it still seems to be happening in RMMV, but... not that shocked.
Pages: 1