[ZScript] Event Handlers and Titlemaps

Sun Sep 12, 2021 8:22 pm

Hello everyone! Quick question about event handlers and titlemaps, are network events not processed by event handlers in a titlemap? That's pretty much it, thanks! :D

Re: [ZScript] Event Handlers and Titlemaps

Tue Sep 14, 2021 1:33 am

No, events are only processed within playable levels, there is a check in the source code for that. On titlemaps, gamestate is GS_TITLELEVEL and not GS_LEVEL, so events do not work.

Re: [ZScript] Event Handlers and Titlemaps

Tue Sep 14, 2021 4:10 pm

Ok, that's a wrench in my gears, I have code trying to communicate through net events during the titlemap. So what is the reason behind disabling net events on titlemaps? Also what if the titlemap is nothing more than a launch point to transfer to one of the actual game maps to be used as the titlemap? The gamestate remains the same but now I've potentially got a broken level. Just curious, I can investigate a workaround, thanks for the response!

Re: [ZScript] Event Handlers and Titlemaps

Wed Sep 15, 2021 12:11 am

Nero wrote:So what is the reason behind disabling net events on titlemaps?

I can't say for sure, but I know that network events are primarily intended for the user (i.e. player) to send information to the playsim in a multiplayer-friendly way. But on a titlemap, there is no multiplayer, and the player is not supposed to interact with the map at all, which makes this mechanism kind of pointless. It's quite likely that what you are trying to do can be accomplished in some other way, without using network events.

Re: [ZScript] Event Handlers and Titlemaps

Wed Sep 15, 2021 5:41 pm

I'm trying to display graphics on the screen during the title sequence, which I could do with ACS, but I kinda spent a bunch of time writing ZScript Windows to do that so I don't have to write ACS :P
The net events are a critical component of making ZScript Windows multiplayer-friendly, and if ZScript Windows actors can't communicate with the event handler, then everything's broke. That's a pickle.

Re: [ZScript] Event Handlers and Titlemaps

Wed Sep 15, 2021 11:46 pm

UI-related functions such as UiTick and RenderOverlay should work on titlemaps, so you can add a special check there (e.g. if (Level.MapName == "TITLEMAP")) and create your windows directly instead of using an event. This shouldn't break anything because titlemaps themselves do not support multiplayer, like I said before.

Re: [ZScript] Event Handlers and Titlemaps

Thu Sep 16, 2021 5:57 pm

Looks like this will be a fairly straightforward workaround, but new question, is it possible to check the gamestate? Looking for the map name to be "TITLEMAP" breaks teleporting to a different map.

Scratch that, yes it is. Looks like I got this handled, no pun intended :P Thanks!