Jump to content
  • 0

Creating Ui and Keybinds


Ghost_Ellis

Question

I want to make a toggle open/close inventory menu, kind of like the style used in Resident Evil, The Evil Within and Darksouls. Anyone know if this is possible, or what i'd need to learn to do this? I can do Hudmsg images etc, but, idk how to make a menu that can be set to a toggle keybind

Share this post


Link to post

1 answer to this question

Recommended Posts

  • 0
Posted (edited)

You'll need to add a LMP to your WAD called KEYCONF. The below is one I set up for a flashlight toggle:

addkeysection "Flashlight" SHFlashlightKeySection // Add a new control to the controls menu and store in user's INI under that section name.
    addmenukey "Toggle Flashlight" toggleflashlight_bind // Text for menu entry, command run.
    alias toggleflashlight_bind "pukename toggleflashlight"  // command name, command it runs.
    defaultbind J toggleflashlight_bind // identify default binding.

This sets up a menu option for my flashlight object (named, originally enough, "Flashlight") and gives it a single menu option ("Toggle Flashlight"). The default key assigned here is J, but this allows players to amend the key they use.

 

The first line's "SHFlashlightKeySection" is used in the player's INI file (so different players running the game from different logins can have different key bindings).

 

This is what appears in the "Customize Controls" area - see my extra option at the end:

image.png.8b610278f5af33032a9360b288c05621.png

 

The "alias" third line tells the game what to do. In this case, it's running a pukename command that allows it to run an ACS script by the given name (you can just use "puke" if you have numbered scripts).

 

In your case, you'll want a script to display/hide your inventory list on the screen. Since you can't easily amend the HUD through ACS, I'd create a dummy inventory object in your ZScript (call it InvToken, say) and then give it to the player or remove it from their inventory whenever the ACS function is called. I'd also have your HUD display draw your custom inventory screen ONLY if the player has this InvToken in their inventory.

I'm not sure this is the best approach (setting up HUD displays was a nightmare to figure out, and I'm not entirely there yet) but at least the keybinding is easy enough!

 

Edited by Artinum

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...