Custom Episode and Skill Menu

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!)
Post Reply
User avatar
22alpha22
Posts: 308
Joined: Fri Feb 21, 2014 5:04 pm
Graphics Processor: nVidia with Vulkan support
Location: Montana, USA

Custom Episode and Skill Menu

Post by 22alpha22 »

For my project I have different episodes that need different skills depending on which episode is chosen. In addition, I would like to add additional skills than can be unlocked for an episode after it has been completed, NewGame+ style. The new skills would only be accessible from the skill menu once the chosen episode had been completed once.

I thought this would all be fairly trivial to implement with MENUDEF and a few global CVars to track episode progress but it seems that the functionality of both the episode and skill menus are hardcoded. After some research, it seems the episode and skill menu functionality isn't even exposed to ZScript. As such, I've spent more hours than I care to admit, trying to learn ZScript menus and replace the episode and skill menus entirely. I mostly failed but rather than giving up, I've come up with a hacky workaround for my issues. Rather than create a new skill menu from scratch, I've repurposed the existing menu and did my best to disable the undesired existing functionality.

First I wanted different skill choices depending on the episode chosen but I couldn't find access to any variable that held the selected episode. The SetMenu param variable is set to the chosen episode during the episode menu but where it is stored upon moving to the skill menu, I have no idea. I worked around this by creating a new CVar and overriding the MenuEvent and setting the new episode CVar to the chosen episode. Seems somewhat hacky but at least the skill menu will be able access the CVar and retrieve what episode was chosen.

Even with being able to retrieve the chosen episode in the skill menu, it was going to be very tricky to implement different skill choices because of the hardcoded skill selection functionality. I came up with a even more hacky workaround; I removed the rendering of all skill options by override the Drawer function and added all possible skill options as static text via MENUDEF. I aligned the static text skills with where the skill options would normally be so that I wouldn't have to mess with the cursor's location. I used the drawer function to filter the static skills by episode, and override MenuEvent to override the normal skill selection and instead start new game with whatever skill is chosen filtered by episode.

All together it is a hacky solution but it does work, still I'm sure there must be a better way to do this, surely? I haven't even implemented my NewGame+ skills yet, but it shouldn't be to hard to tack them on to this system if I don't find a better solution. Does anyone have any experience with this? Is this the best I can do or is there a cleaner way to implement this?

MENUDEF:
Spoiler:
ZScript:
Spoiler:
User avatar
Sir Robin
Posts: 537
Joined: Wed Dec 22, 2021 7:02 pm
Graphics Processor: Intel (Modern GZDoom)
Location: Medellin, Colombia

Re: Custom Episode and Skill Menu

Post by Sir Robin »

I'm not sure how to do it in the menus, but have you considered creating a 3d episode / skill selection map? Then you could easily do it how ever you wanted
User avatar
Dan_The_Noob
Posts: 880
Joined: Tue May 07, 2019 12:24 pm
Graphics Processor: nVidia with Vulkan support
Contact:

Re: Custom Episode and Skill Menu

Post by Dan_The_Noob »

for NG+, you might be better off just offering the option at the end of the episode and have it jump back to MAP01 or whatever the start of episode is...else maybe consider making a hub map to jump to after episodes.
Post Reply

Return to “Scripting”