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

Discussion in 'Learning Javascript' started by Nilom, Jun 6, 2019.

  1. Nilom

    Nilom Veteran Veteran

    Messages:
    178
    Likes Received:
    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:
     
    #1
  2. gstv87

    gstv87 Veteran Veteran

    Messages:
    1,711
    Likes Received:
    725
    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)

    precisely that.
     
    #2
  3. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,459
    Likes Received:
    2,850
    Location:
    Philippines
    First Language:
    Tagalog
    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: Jun 6, 2019
    #3
  4. Andar

    Andar Veteran Veteran

    Messages:
    28,138
    Likes Received:
    6,372
    Location:
    Germany
    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.
     
    #4
  5. Nilom

    Nilom Veteran Veteran

    Messages:
    178
    Likes Received:
    39
    First Language:
    German
    Primarily Uses:
    RMMV
    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.

    Oh okay I see. Then I will just use an array for that. Thanks.
     
    #5
  6. gstv87

    gstv87 Veteran Veteran

    Messages:
    1,711
    Likes Received:
    725
    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.
     
    #6
    Engr. Adiktuzmiko likes this.
  7. Jonforum

    Jonforum Veteran Veteran

    Messages:
    1,574
    Likes Received:
    1,339
    Location:
    Canada / Qu├ębec
    First Language:
    French
    Primarily Uses:
    RMMV

Share This Page