ACS: Inventory Tutorial?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
User avatar
CoderGrizzly
Posts: 8
Joined: Sun Jan 05, 2025 12:38 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: ATI/AMD (Modern GZDoom)

ACS: Inventory Tutorial?

Post 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
So is anyone aware of any good tutorial about an inventory? ๐Ÿ™
You do not have the required permissions to view the files attached to this post.
Jarewill
ย 
ย 
Posts: 1845
Joined: Sun Jul 21, 2019 8:54 am

Re: ACS: Inventory Tutorial?

Post 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
If you want more examples, my mod Lost Frontier utilizes similar scripts for its shop menus.
You do not have the required permissions to view the files attached to this post.

Return to โ€œScriptingโ€