Custom GUI Inventory screen - No Inventory Window/List Box

Started by Nero_Ace, Tue 16/04/2013 08:08:16

Previous topic - Next topic

Nero_Ace

Greetings,

I've been trying to do a custom Inventory Screen for an adventure game in which the Inventory Window can hold a maximum of 6 objects at any time and this inventory screen is always visible in the game.
So it's basically the entire width of the game screen and around 110 pixels in height at the top of the game screen with 6 item spots. Any time you pick up an object, it get's added to one of these slots. Should I make an Inventory Window and then script it so that it appears how I want or is there another way to do it involving labels and buttons?


Andail

I don't quite understand your question. What is the other way, that which involves "labels and buttons" that you speak of?

An inventory window is just a GUI element. It's the GUI that you control via scripts, and can move around the screen etc, and the inventory window is just a part of it. If you want buttons and labels, for instance "look at" or "interact" etc, you add that to the GUI.

Can you describe in detail what you have tried so far, and why it doesn't work, or exactly what it is that you need assistance with?

Nero_Ace

Well, I thought that instead of an actual Inventory Screen, I could fake it by keeping invisible buttons and labels and tying the images of the items with them when I needed to.

I still don't understand how the InvScreen GUI properly works so I thought I couldn't do it like how I wanted. The following image shows how I want the Inventory to look like -



Basically, the Inventory item will pop up on top of the grey ovals in order any time you pick something up. Can you please tell me how exactly to implement that?

Slasher

QuoteShould I make an Inventory Window and then script it so that it appears how I want
If you mean you only want to show '6' objects at a time you could use the inv item width and height in the inv window events panel to space out the inv items so that the window only shows only 6 inv objects nicely distrubuted. You can use Scroll down arrows to see more inv items if you have any.

Or do you mean only ever '6' max inv objects at a time? You would need to script to check how many inv items you have.

EDIT: your below post is how you would set up the inv window item witdh and height in the inv window events.
You will need to make adjustments to window size and the width and height of the items until they appear as you want them.

Try it and see how it goes. We use this method all the time.



Nero_Ace

Yeah, basically, at any time, the player will have a maximum of 6 objects in the inventory.

So my only option is the trial-and-error method of making sure that the image fits nicely? Okay, thank you for your time and input.

Slasher

This is the default inventory GUI not customised except for width and height. sizes:

Is this what you are looking for?


Slasher

If you only want 6 at a time you should ask for help with inventory count check script.

It should not be that hard to implement.

Good luck


Andail

An inventory window is already invisible. Its appearance depends on how you design the underlying GUI. Note that the graphics for the inventory item can be different from the object found on screen, so you can draw all inventory items with those gray ovals around them if you want to, or you draw the GUI with the ovals in place, and position the inventory window over them.

USe InvWindow.ItemCount; to check if the player has reached the limit, e.g:
Code: ags

// when attempting to pick up an object
if (InvWindow.ItemCount == 6) {
    Display ("I can't carry any more items.");
}


PS:
I really think you should create your own GUI from scratch, so you can get it the way you want to.

Slasher

Beaten by Andail  (laugh) Yep, that's the way to go.


In default you may need to use invCustomInv rather than InvWindow, I'm sure.

Of course you would include an 'else' to allow you to add object to your inventory if you have under 6 items.


Khris

Like Andail explained, an InvWindow is perfectly capable of doing what you want, so far there's no need to work around it using buttons.

Quote from: Nero_Ace on Tue 16/04/2013 09:43:05So my only option is the trial-and-error method of making sure that the image fits nicely? Okay, thank you for your time and input.

No trial-end-error involved; you divide the available space by six, use that as the InvWindow's ItemWidth and as width of the base sprite for the inv item sprites.

Nero_Ace

Thanks a lot, guys. I got it working finally but ran into another problem.
I posted it here - http://www.adventuregamestudio.co.uk/forums/index.php?topic=48042

Thanks for the help with this GUI!

SMF spam blocked by CleanTalk