Sort Items by how they're found in-game

_Soysauce_

Villager
Member
Joined
Sep 12, 2018
Messages
19
Reaction score
5
First Language
English
Primarily Uses
RMMV
Hello,
I usually google extensively for the stuff I'm looking for, but I'm just really surprised that this topic seems to never have popped out anywhere. I'm kinda suprised it's not a default option in Rpg Maker MV at all. At this point, I just have to ask directly.

How hard would it be to create a plugin that sorts the Item database (though I can imagine other people would also care for the skills one) by the order those items are found in-game?

Melosx posted a plugin to sort them alphabetically:
https://forums.rpgmakerweb.com/index.php?threads/msx-alphabetical-sort.73991/

While Aloe Guvner posted one to sort them through any order you wish, by the use of notetags:
https://forums.rpgmakerweb.com/index.php?threads/item-and-skill-sort-priority.90931/

Unfortunately, I know next to zero about Java and the internals of Rpg Maker MV - so I can't even theorize how easy this would be. I assume it wouldn't be too hard, if the engine already keeps track somehow of the order items are acquired. But I don't know if that case.

Thanks a lot in advance!
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
30,733
Reaction score
7,378
First Language
German
Primarily Uses
RMMV
it is not as easy as you think.

First, everything ingame works by the ID - which is why that is the default sort. The ID cannot be changed as that would cause a lot of problems.
Usually all other sort options are based on a fixed identification method - because that let's the plugin check everything and use a new value with the fixed order of the other method.

Having the order based on appearance in the game means that the order is not fixed but dynamic - two playthroughs will have a different order because the players might take or purchase items at different times.
But you can't simply have a plugin watch the inventory - that would create a lot of lag for no real cause.
What you need to do is have the engine tell the list "set this item as newest on the list if it is not yet set".

And that command needs to be given at each variant of how the player can gain something - event command change item, battle result item found, shop processing item purchased - and that might or might not include functions if someone uses javascript to add an item.

Yes, it can be done - but it is not quick as the plugin programmer needs to find every possible function that could be used to gain an item and change it.
 

_Soysauce_

Villager
Member
Joined
Sep 12, 2018
Messages
19
Reaction score
5
First Language
English
Primarily Uses
RMMV
it is not as easy as you think.

First, everything ingame works by the ID - which is why that is the default sort. The ID cannot be changed as that would cause a lot of problems.
Usually all other sort options are based on a fixed identification method - because that let's the plugin check everything and use a new value with the fixed order of the other method.

Having the order based on appearance in the game means that the order is not fixed but dynamic - two playthroughs will have a different order because the players might take or purchase items at different times.
But you can't simply have a plugin watch the inventory - that would create a lot of lag for no real cause.
What you need to do is have the engine tell the list "set this item as newest on the list if it is not yet set".

And that command needs to be given at each variant of how the player can gain something - event command change item, battle result item found, shop processing item purchased - and that might or might not include functions if someone uses javascript to add an item.

Yes, it can be done - but it is not quick as the plugin programmer needs to find every possible function that could be used to gain an item and change it.
I see, so the engine doesn't track this at all and it's a mess to find a solution.

Though, in my specific case I wouldn't mind setting up the command once every item is gained in-game, as I have a set limited of items given in very specific circumstances. I don't know if anyone is interested in making such a plugin, though.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
2,994
First Language
Tagalog
Primarily Uses
RMVXA
If you only put the command once all items are found, then during any time before that happens, your inventory will still be on the default ID based sorting. Then suddenly it changes to which was obtained latest. Thats a bit confusing to the players.

Also, the fact is that the game doesnt track when you gain a specific item, so even if you only want it to change after getting all items, we will still need to track the items gained in real time to set the correct order in the end. So when you want to call the sort doesn't actually matter. The "list" of how they will be sorted should always be available, else you cant sort them. Creating this "list" or property is where the bulk of the work comes in and as Andar said, its quite a huge work to do.

Now if you have a controlled time when each item can be gained which will be followed always, you can just sort them on the database.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
30,733
Reaction score
7,378
First Language
German
Primarily Uses
RMMV
@Engr. Adiktuzmiko there is a way without such problems, I just didn't go into thedetails in my post.
a plugin needs to add a new property "order" to each item and that will be used for sorting. it would default to zero and be set automatically when an item is added to inventory.
the functions that add the items to inventory would then check if the order-property of the item is still zero or not, and if it is still zero replace it with the current highest number +1. That is what I meant with the plugin writer having to identify and change every function and place that can add items, because the check for the order property would have to be added there (the game would get a distorted inventory or crash if an item was added without setting the order property)
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
2,994
First Language
Tagalog
Primarily Uses
RMVXA
I know, that is why I said:

"Creating this "list" or property"

And that will still be where the bulk of the plugin will be focused on..

it would default to zero and be set automatically when an item is added to inventory.
the functions that add the items to inventory would then check if the order-property of the item is still zero or not, and if it is still zero replace it with the current highest number +1.
And that's exactly how you track them in real-time, set the property the moment you obtain the item.

As far as Im concerned, we are thinking of the same implementation.

Though I kind of think checking if the property is zero should be optional/changegable due to how multiples of each item get stacked by the system instead of instanced individually..

It should be optional in case the developer wants to either just consider the very first instance you get an item (Check if zero, doesnt update even if you get another piece of that item), or if they want to consider every instance of obtaining the item (everytime you get an item or copy of it, set it to the next higher order)
 
Last edited:

Maliki79

Veteran
Veteran
Joined
Mar 13, 2012
Messages
737
Reaction score
316
First Language
English
Primarily Uses
N/A
Yeah. I was concerned on how this would handle non-instance items.
If I started with a healing potion, got 20 other items then got another potion in the stack, how would that sort? Instance items would be fairly easy to implement by adding the counting element to gainItem() but multiples or stackables would be tricky.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 2)

Latest Threads

Latest Profile Posts

I just like this website:
lol
I streamed Moonfall on 9/25/20
and have started a page to showcase my vids/stream :kaoluv:

Please subscribe and follow, it's free, it's quick and one sub means so much to me, it would really make my day~ :wub

And now to face my worst enemy... adding color :kaocry:
Power has been restored FINALLY to our home in Lake Charles. Hurricane Laura tried to wreck our lives and disrupt my work on the commercial project i have going with Cloud 9 but the key word is TRIED!!! Slowly moving from the shelter to home over the next week or so. I WILL NOT QUIT!

Forum statistics

Threads
103,231
Messages
998,217
Members
134,721
Latest member
isaton
Top