Method or Function to return right order of item pick-ups

Nilom

Veteran
Veteran
Joined
Sep 9, 2013
Messages
178
Reaction score
39
First Language
German
Primarily Uses
RMMV
Hello!

Is there a method or a function in the RPG Maker built-in methods/functions that will return the inventory items in the correct order which they have been picked up?

$gameParty._items seems to just sort the items by database ID.

I know an array could be used for this but that would make the person using this need to handle script commands instead of just handling items within the database and the eventing system.

Thanks in advance. :LZSsmile:
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,151
Reaction score
1,120
First Language
Spanish
Primarily Uses
RMVXA
no, because the item pool stacks items by class, so there's no way to track individual pickups. (outside of reworking the item pool itself, obviously)

$gameParty._items seems to just sort the items by database ID.
precisely that.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,696
Reaction score
3,006
First Language
Tagalog
Primarily Uses
RMVXA
Is there a method or a function in the RPG Maker built-in methods/functions that will return the inventory items in the correct order which they have been picked up?
I know an array could be used for this but that would make the person using this need to handle script commands instead of just handling items within the database and the eventing system.
What do you intend to do? Where do you need it to return the pick-up order?

Even if a built in JS function exists, as long as its a JS function then the person using it will still be using a script call...

Anyway as gstv said, it needs a modification of the system because right now it doesnt track the moment when you obtained an item..

When you add an item (or weapon or armor) to the inventory, all the game does is increase the amount of that item in the ._item array using the database ID as its key/index. This is why it defaults to simply using the database ID for sorting..
 
Last edited:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
30,262
Reaction score
7,138
First Language
German
Primarily Uses
RMMV
@XZINED
What you want does not exist, because the engine never stores the order in which items are gained.
You would need a plugin to store that order - and that would NOT be a simple plugin because you want a dynamic order (changes based on player actions) and not a static order (always the same).

About two month ago someone else asked the same and we gave a detailed description on the complexity of a plugin that could do this - you might want to search for that topic to get those details, but I think the idea was shelved and never happened.
 

Nilom

Veteran
Veteran
Joined
Sep 9, 2013
Messages
178
Reaction score
39
First Language
German
Primarily Uses
RMMV
What do you intend to do? Where do you need it to return the pick-up order?

Even if a built in JS function exists, as long as its a JS function then the person using it will still be using a script call...
It is for a grid based inventory. If such a function would have existed it would have been possible to just use database items and handle the inventory based on that. But as it doesn't exist I guess that needs an array.

@XZINED
What you want does not exist, because the engine never stores the order in which items are gained.
You would need a plugin to store that order - and that would NOT be a simple plugin because you want a dynamic order (changes based on player actions) and not a static order (always the same).

About two month ago someone else asked the same and we gave a detailed description on the complexity of a plugin that could do this - you might want to search for that topic to get those details, but I think the idea was shelved and never happened.
Oh okay I see. Then I will just use an array for that. Thanks.
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,151
Reaction score
1,120
First Language
Spanish
Primarily Uses
RMVXA
there are native methods to handle all operations related to an inventory management, from a simple array (adding, removing, retrieving, accounting, etc)
the problem is tying that to the GUI and the party and troop events, and making it compatible with other plugins you might have.

if you're going to make a new GUI, you're better off designing it from scratch.
 

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

Latest Threads

Latest Profile Posts

Imagine every unfunny joke gets a laugh track, and it doesn't top until you genuinely laugh at that unfunny joke.
I miss lockdown already. Since the pubs reopened, there's been nothing but loudmouthed drunks wandering about my neighbourhood.
Twitter is making me embarrassed to be a Persona 5 fan rn
I don't wanna be called out when I say P5R is my favorite game :kaoswt2:
And my first batch of gobbo battlers is up *yay* (images should show now as they first didnt - Just my luck lol)

Forum statistics

Threads
99,555
Messages
966,698
Members
131,187
Latest member
Bibunbun
Top