Page 1 of 1

ACS: Inventory Tutorial?

Posted: Sun Jan 05, 2025 1:21 am
by CoderGrizzly
Hello everyone, ๐Ÿ––

over the New Year I got back into Doom mapping - after 30 years or so. ๐Ÿ˜…
And, men, things have gotten really convenient, but also a lot more complicated.

I have read and watched now I few tutorials and get (almost) everything running the way I wanted. โœŒ๏ธ
Also there seems often to be some issues as some of the tutorials are pretty old, so they can't be applied any more or have to be heavily modified to be able to run. ๐Ÿคจ
So I often run from issue A to issue B to issue C.

But anyway, since yesterday I'm looking for a tutorial or any information which is a little bit more than just describing the basic functions related to inventory support in GZDoom. So far no luck.
And it is really a pity as I saw some really crazy stuff, e.g. a Diablo I/II like inventory in which the player could put things in, arrange them within the inventory and of course use or drop them. Jaw-dropping! ๐Ÿ˜ฎ

Also I'm more thinking of a much more simple approach, like the inventory from The Legend Of Zelda: A Link To The Past - if some of you still remember that game. ๐Ÿ˜‰
The Legend Of Zelda - A Link To The Past - Inventory.png
The Legend Of Zelda - A Link To The Past - Inventory.png (5.35 KiB) Viewed 2676 times
So is anyone aware of any good tutorial about an inventory? ๐Ÿ™

Re: ACS: Inventory Tutorial?

Posted: Sun Jan 12, 2025 7:42 am
by Jarewill
I am not aware of any good tutorials about scripting custom inventory menus, because that generally is not simple.
If I understand what you want correctly is just a menu that displays the current items in a static order and only has basic functionality for using or maybe even dropping them.

First thing you will want to do is start drawing things when the script starts, for that you will want to use SetHudSize to make sure it's all scaled correctly and then SetFont and HudMessage for actually drawing things. (SetFont also allows you to set images as the font for HudMessage)
Then for managing the inventory, CheckInventory can be used to see if the player has an item on them, while Use/DropInventory can be used for using (for example using weapons will equip them, while CustomInventory items have a special Use state for it) and dropping them respectively.
For having a cursor and moving it, GetPlayerInput will allow you to retrieve player input and then move your cursor accordingly, either with movement keys or mouse input.
You will also have to remember to put it all within a While(true) loop to keep updating the cursor and Delay(1) to prevent it from terminating.

Here is a very basic inventory I just put together quickly.
Basic Inventory.wad
(6.47 KiB) Downloaded 49 times
If you want more examples, my mod Lost Frontier utilizes similar scripts for its shop menus.