Event Handlers and Multiplayer Clarification Needed

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
Sarah
Posts: 551
Joined: Wed Sep 06, 2006 12:36 pm
Preferred Pronouns: She/Her
Operating System Version (Optional): Debian 11 (bullseye), Windows 10
Location: Middle of Nowheresville Il.
Contact:

Event Handlers and Multiplayer Clarification Needed

Post by Sarah »

Might be an odd question but how do event handlers and multiplayer work in respect to UI processing?

Say Player 1 activates UI mode. This sets an event handler to be a UI processor and require the mouse. Player 1 should be frozen with a mouse cursor on the screen and able to interact with whatever Ui is getting drawn.

My question is, what happens to the other players? They don't freeze as well do they?
User avatar
Player701
 
 
Posts: 1710
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support
Contact:

Re: Event Handlers and Multiplayer Clarification Needed

Post by Player701 »

GZDoom does not have actor replication. If you set IsUiProcessor to true for one player, it won't be automatically changed for other players as well. To enable UI input for a certain player only, you can compare the number of the player that activated the event with consoleplayer:

Code: Select all

class MyEventHandler : EventHandler
{
    override void NetworkProcess(ConsoleEvent e)
    {
        if (e.Name == "my_ui" && e.Player == consoleplayer)
        {
            // This code only executes for whoever's triggered the event.
            IsUiProcessor = true;
        }
    }
}
For other players IsUiProcessor will remain false, so they won't freeze.
User avatar
Sarah
Posts: 551
Joined: Wed Sep 06, 2006 12:36 pm
Preferred Pronouns: She/Her
Operating System Version (Optional): Debian 11 (bullseye), Windows 10
Location: Middle of Nowheresville Il.
Contact:

Re: Event Handlers and Multiplayer Clarification Needed

Post by Sarah »

Ah ha, ok thank you! This question cropped up as I'm in the process of overhauling my net command system to isolate commands based on player number. So thanks again, I don't have a good way to test multiplayer so I have to ask the dumb/odd questions. :)
User avatar
Player701
 
 
Posts: 1710
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support
Contact:

Re: Event Handlers and Multiplayer Clarification Needed

Post by Player701 »

Nero wrote:I don't have a good way to test multiplayer so I have to ask the dumb/odd questions. :)
You can always run a local multiplayer session by starting more than one instance of GZDoom, one with -host and the other(s) with -join localhost.
Post Reply

Return to “Scripting”