[ZScript] Weapon input shortcuts: no more Refire headaches!

Handy guides on how to do things, written by users for users.

Moderators: GZDoom Developers, Raze Developers

Forum rules
Please don't start threads here asking for help. This forum is not for requesting guides, only for posting them. If you need help, the Editing forum is for you.
User avatar
Posts: 9666
Joined: Sun Jan 04, 2004 5:37 pm
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

[ZScript] Weapon input shortcuts: no more Refire headaches!

Post by Matt »

Here's a guide that no one asked for, but hopefully can prove helpful to someone trying something that can easily turn into a not-exactly-flying spaghetti monster without sufficient planning.

Your weapon controls allow up to 8 buttons. This is quite a lot, but sometimes you want to accomplish things through specific combinations of buttons - without getting trapped in a maze of A_(Clear)Refire hacks trying to trace a unique path for every possibility.

  • Dual-wield (or double-barreled, double-triggered) weapons: each of the two fire buttons handles one weapon, and each weapon (which is on a different overlay from the other, of course) can be fired totally independently of what the other is doing - even if the other fire button is still being held down.
  • Heavy Weapon Guy-style gun spinup: hold altfire to keep your gun ready to fire at any time.
  • Slam fire shotgun: hold trigger down, hold altfire to rack the shotgun, gun immediately goes off once you chamber the new round.
  • Panic shot: shoot in the middle of a reload sequence, spending whatever happens to be in the chamber already.
  • Check for holding Zoom/Reload/other non-A_Refire-able inputs outside of a ready state.
  • Daggerfall-style melee weapons: hold button, move mouse in the direction to swing.
  • Wacky weapon with a "jamming typewriter" interface that prevents the weapon from operating if you mash the buttons too fast.
  • Spellcasting decision trees.
  • Crude musical instruments.
  • You have actually run out of buttons for calling all the various weapon functions you have coded.
I've developed some shortcuts that massively improve my own quality of life while trying to do stuff like this. It occurs to me that my setup is not self-evident and might be good to share.


EDIT: Example of how this looks in application:
Last edited by Matt on Thu Jun 25, 2020 2:39 pm, edited 11 times in total.
User avatar
Posts: 17283
Joined: Mon Oct 27, 2003 12:07 am
Twitch ID: nashmuhandes
Github ID: nashmuhandes
Location: Kuala Lumpur, Malaysia

Re: [ZScript] Cheating with weapons

Post by Nash »

Thanks for these timesavers.

Return to “Tutorials”