Forum rules - please read before posting.

Inventory filling direction

edited August 2014 in Technical Q&A
Hi again.

I'm creating a 2d game that shows the life of the character in different moments of time.

I'd like to add a specific icon on the screen to show what player did for each time token.
Ex. if player trained on monday he will see  a boxing glove icon on the MondayLabel.
On tuesday maybe he meet a character, and in this case it'll appear the icon of this character on TuesdayLabel.

To do that I want to use an horizontal inventory (with a specific category).

As default the inventory starts from left and continues filling on the right. Is there a way to make the opposite?
I'd like to start from the right and continue on the left.

How could I do that?

Please let me know if there's a better way to implement that.

Thank you very much, as always.

Comments

  • I'm not sure how useful others would find this, so I'm rather hesitant to add this to the official build, but if you don't mind doing a bit of re-coding you could probably do this quite easily by duplicating the Inventory: Set Action to create a custom one.  Check out the manual's section on this, and the ActionTemplate.cs file, which has comments inside.  Basically, it's just the order of the invItems list inside the RuntimeVariables.cs script.  Instead of adding a new item to the end of it, you'd want to insert it at the very start.

    Something like:
    runtimeVariables.invItems.Insert (item, 0);

    should do it.  (From memory, anyway - I don't have the actual script in front of me right now)
  • edited August 2014
    Thanks for the answer but I think this isn't solving my issue.

    The script should be:
    "RuntimeInventory.cs"

    The method should be "Add" but the order is defined inside the method, I can pass just: id, amount, list and a boolean).

    I've a list of a specific number of slots (10)

    Also if I change the method adding a different code the list would change in this way:
    Item 1:
    1, null, null, null

    Item 2
    2, 1, null, null

    Item 3:
    3, 2, 1, null

    On the contrary I'd like to do this:
    Item 1:
    null, null, null, 1

    Item 2:
    null, null, 2, 1

    Item 3
    null, 3, 2, 1

    (I want to implement this for the arabic version of the game, they start from right and move to the left)

    Is it possible to change it directly in the GUI script? To start filling the last (on the right) label/inventorybox?

    If you've the time could I ask also for a tutorial to show how we could use a sub Action to implement a new code method, please (point 11.1 and 11.2 of the manual)?
  • RuntimeInventory - yes, of course.

    The Add function may limit you, but the localItems (I believe, not invItems, after all) is public, so you have complete control over it anyway.  The code you'll want to write can be written all in a custom action - the code in the Add function should be useable just as a basis for your own.

    What exactly are you asking for re: implementing a new code method?  The ActionTemplate script can be copied to be used as a basis - it's annotated to explain things.  A tutorial on this would be useful, but one doesn't exist yet.
  • edited August 2014
    Sorry, wrong choice of words.

    I wanted to say "a tutorial that shows how to implement a new action, with its specific functions".

    If you plan to create some new tutorials in the near future I could use that one.

    Meanwhile I'll use the documents and the base template. Thank you very much.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.