Hello there, I wanted to know if there is any way to detect when a player hits one of the weapon slots keys. The mod I'm trying to make only has 1 weapon so I wanted to use the weapon slot keys for other binds, as it would make things easier and player won't need to bind some extra keys when the weapon keys are unused. I already checked GetPlayerInput but it doesn't seem to be able to detect weapon switches.
Note: I can't use weapons to detect the key presess. If I do that, then the main weapon the mod uses gets lowered which is exactly what I'm trying to avoid. If there is no other solution then I will have to add extra keybinds to the KEYCONF thing, but I like this method and I wanted to see if it's possible.
Detect when a player hits a weapon slot key
- SwordGrunt
- Forum Regular
- Posts: 377
- Joined: Thu Jun 07, 2012 8:43 pm
RE: Detect when a player hits a weapon slot key
You can avoid weapon lowering by using the instant weapon switch player property. I can't think of any possible way to detect what you want, only hacky workarounds by creating multiple versions of your weapon and using the aforementioned property.
RE: Detect when a player hits a weapon slot key
Nice, I managed to get it to work. By using the property you mentioned and by adding this to the select state of the weapon:SwordGrunt wrote: You can avoid weapon lowering by using the instant weapon switch player property. I can't think of any possible way to detect what you want, only hacky workarounds by creating multiple versions of your weapon and using the aforementioned property.
Code: Select all
Select:
TNT1 A 0 A_FireCustomMissile ("Rocket")
TNT1 A 0 A_SelectWeapon("Pistol2")
TNT1 A 1 A_Raise
Loop
- SwordGrunt
- Forum Regular
- Posts: 377
- Joined: Thu Jun 07, 2012 8:43 pm
RE: Detect when a player hits a weapon slot key
Hacky workarounds are a big part of this engine! You came up with a pretty damn good solution using A_SelectWeapon. I wonder if using tag "" would work for no tag, meaning the player wouldn't notice the weapon switch was attempted (by seeing the weapon's name in yellow text at the bottom of the screen). That's just a nitpicky thing though. I'm glad you got it to work!