Best way to build a GUI for shop in the game's world?

Started by JLM_82, Mon 08/02/2021 09:05:36

Previous topic - Next topic

JLM_82

Hi,

I'm thinking what would be the best and the most convenient way to build a GUI for a shop in the game's world?

There should be at least a buttons to scroll items that are for sale, and show a price for each of them. Something like in the shop of KQ3VGA (see https://youtu.be/zRRoefOnQm4?t=8134).

Besides, the player should be able to buy each type of the supplies just one time, to prevent a situation where he/she has spent all the money, and ends up in a dead-end situation (being unable to complete game, as all the money is spent for wrong supplies).

I have thought, if it would be a good idea to use AGS's inventory-GUI for that purpose? If the GUI of shop would be actually an inventory-GUI of the shopkeeper-character, there would be at least the scroll-buttons (up and down arrows) at the ready.

Slasher

You could do something like that making shopkeeper player at that time but make sure you give items to main player...and return play back to main player once done.. No doubt other ways as well.. like clicking on a brochure etc to open inventory.. Or even a gui with buttons as items...


JLM_82

Quote from: Slasher on Mon 08/02/2021 10:02:54
You could do something like that making shopkeeper player at that time but make sure you give items to main player...and return play back to main player once done.. No doubt other ways as well.. like clicking on a brochure etc to open inventory.. Or even a gui with buttons as items...

Is it necessary to make the player character to "be a shopkeeper", in order to show the shopkeeper's inventory-GUI on the screen? Isn't it possible to show an inventory-GUI that belongs for someone else than the player's current character?

Slasher

No...You can only see the inventory of a main player... You can't have more than 1 inventory per player..

I'd be more inclined to use gui with buttons and labels and have it look like an oniine shopping cart...You will need a few variables...like money etc..

Khris

Each character has their own inventory, and you can absolutely show another player's inventory on the screen, simply by adding an InventoryWindow to a GUI and setting its character value accordingly.

Handling a click on an item is where it gets slightly more complicated but it should be doable using for instance on_event, eEventGUIMouseUp and InventoryItem.GetAtScreenXY.

SMF spam blocked by CleanTalk