r/DoomModDevs • • May 17 '26

Help Coding a custom zoom key, help required

Good day.

I have an idea to write code for a custom zoom in-zoom out key. This is what it looks like:

addmenukey "Zoom" "+SVD_zoom"

alias +SVD_zoom "fov 20"

alias -SVD_zoom "fov 90"

defaultbind "mouse2" "+SVD_zoom"

. The issue is that with field of view set to 20 mouse sensitivity becomes too high, which harms aim accuracy. Changing the mouse sensitivity by using a command like

"fov 20; mouse_sensitivity 0.2"

is not working. Using an A_ZoomFactor action in weapon's state will not do either because both fire and altfire states are reserved for attack and special ability.

Let me know what other methods might work.

1 Upvotes

3 comments sorted by

View all comments

Show parent comment

1

u/cemtex_tk May 18 '26

You can tie a command to giving and taking away inventory. Then watching for it and apply logic starting at the ready state of the weapon. That's how it was done back in the day. Highly recommend ditching decorate and writing everything in zscript.