Stop mouse input entirely for a brief moment?

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.

Stop mouse input entirely for a brief moment?

Postby Mini--Joe » Tue Apr 06, 2021 5:31 pm

I'm trying to get a glory kill system working, and making the player unable to move is simple enough, but I don't know if its possible to stop the player from aiming at all.

Anyone have any pointers? I was considering using A_Saw to at least adjust the angle towards the monster, but I don't want to use that because you would still be able to turn around if you moved the mouse quickly enough.
User avatar
Mini--Joe
 
Joined: 27 Jul 2014
Discord: 184070402220359692
Operating System: Windows 10 ARM

Re: Stop mouse input entirely for a brief moment?

Postby Jarewill » Tue Apr 06, 2021 11:43 pm

The only way I know how to do it is with SetPlayerProperty and PROP_TOTALLYFROZEN, which is a shame since it's ACS only.
If someone knows of a way to do this with DECORATE or ZScript, I'd appreciate the knowledge too.
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: Stop mouse input entirely for a brief moment?

Postby Player701 » Wed Apr 07, 2021 12:51 am

Code: Select allExpand view
player.cheats |= CF_TOTALLYFROZEN;

upd: To disable:

Code: Select allExpand view
player.cheats &= ~CF_TOTALLYFROZEN;
User avatar
Player701
 
 
 
Joined: 13 May 2009
Location: Russia
Discord: Player701#8214
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Stop mouse input entirely for a brief moment?

Postby Jarewill » Wed Apr 07, 2021 12:58 am

Oh wow, thank you a lot Player701!
Does that work with all SetPlayerProperty values?
If so, maybe the wiki page could be updated with the ZScript method?
I know it could come in handy for me if I forget how to do it again.
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: Stop mouse input entirely for a brief moment?

Postby Player701 » Wed Apr 07, 2021 1:28 am

The relevant code is here.

It looks like PROP_FROZEN, PROP_NOTARGET, PROP_INSTANTWEAPONSWITCH, PROP_TOTALLYFROZEN, and PROP_BUDDHA do correspond to cheat flags: CF_FROZEN, CF_NOTARGET, CF_INSTANTWEAPSWITCH, CF_TOTALLYFROZEN, and CF_BUDDHA respectively.

PROP_FLY is supposed to set the cheat flag CF_FLY, but that is commented out for some reason. Instead, it sets the actor flags NOGRAVITY, FLY, and FLYCHEAT (undocumented but appears to be accessible in ZScript). The FLYCHEAT flag is set only if the first argument is 0 (set for current player only). I have no idea why it works like that, better ask a dev.

There's also a certain compatibility hack for PROP_FROZEN and PROP_TOTALLYFROZEN, but it's only used in one map so it's probably not worth mentioning in detail (if you're interested, open compatibility.txt in gzdoom.pk3 and search for "linkfrozenprops").

Remaining properties (marked "deprecated" in the wiki) do not set or clear any flags but give and take powerups instead. Except for PROP_ALLMAP, which doesn't give anything but toggles the level flag to reveal the map (same as a MapRevealer would do).

Note that it is also possible to call SetPlayerProperty directly from ZScript, but it doesn't do anything unless the first argument is non-zero (set for all players). Probably because the activator is not bound when such a call is made ("toucher.SetPlayerProperty" doesn't work, you can only call it as a global-scope function).
User avatar
Player701
 
 
 
Joined: 13 May 2009
Location: Russia
Discord: Player701#8214
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support


Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests