GetPlayerInput with other buttons

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
GleasSpty
Posts: 48
Joined: Tue Apr 19, 2016 6:17 am

GetPlayerInput with other buttons

Post by GleasSpty »

I am working on a mod that allows you to revive your comrades when playing coop (see http://forum.zdoom.org/viewtopic.php?f=3&t=51692). When incapacitated, the player is only allowed to use a pistol or fists. The way the code is currently set up is so that, upon incapacitation, the player automatically switches to the pistol, unless either they don't have a pistol or already are using fists, in which case it switches to their fists. I would additionally like to allow players to switch between these two options when incapacitated.

To implement incapacitation, I give the player the PROP_TOTALLYFROZEN property, which implies in particular that the usual change weapon keys won't work. The idea then is to manually implement the weapon switching using GetPlayerInput. The problem with this, however, is that, at least according to the wiki, it doesn't seem as if GetPlayerInput has access to the usual change weapon keys, and that the only workaround would be having another key be used to change weapons when incapacitated.

Can GetPlayerInput really not detect when any of the change weapon keys has been pressed? If so, any suggested workarounds?
User avatar
wildweasel
Posts: 21706
Joined: Tue Jul 15, 2003 7:33 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): A lot of them
Graphics Processor: Not Listed
Contact:

Re: GetPlayerInput with other buttons

Post by wildweasel »

The weapon keys are not seen as input, as such; the weapon slots are essentially an interface construct that handles the "use [weaponname]" commands. Because there are so many ways to select a specific weapon (slot numbers, mousewheel, inventory items or weapons calling A_SetWeapon, etc), what gets read is not the key being pressed, but the weapon being selected.

In short, you'll have to find another way to achieve the effect you're going for.
User avatar
kodi
 
 
Posts: 1361
Joined: Mon May 06, 2013 8:02 am

Re: GetPlayerInput with other buttons

Post by kodi »

It *can* be worked around by binding a script puke as well as the normal weapon switching to the number key in keyconf though.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: GetPlayerInput with other buttons

Post by Matt »

Wouldn't APROP_TOTALLYFROZEN stop you from turning and thus prevent you from aiming? It also seems horribly unnatural to be completely frozen like that... why not just reduce the player's speed and prevent switching to any other weapon than fist or pistol?

EDIT: would a morph possibly be appropriate? (The morph could also check to see if you have the real pistol, then give you a shitty pistol that bobs even while you're still and sprays all over the place that is then taken away when you are healed and unmorph.)
User avatar
randi
Site Admin
Posts: 7749
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Re: GetPlayerInput with other buttons

Post by randi »

GetPlayerInput already provides access to every button that is tracked over the network (and thus available to the game simulation―even in single player).
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: GetPlayerInput with other buttons

Post by Matt »

Even weaponslots!? :shock:

What about drop?


EDIT: If not, how exactly does the game check to see if someone's dropping something?
User avatar
Arctangent
Posts: 1235
Joined: Thu Nov 06, 2014 1:53 pm
Contact:

Re: GetPlayerInput with other buttons

Post by Arctangent »

Weapon slots are abstractions for "use x" commands; they're not 1-to-1, because of the whole fact that you can have multiple weapons per slot, but no actual button command is processed over the network I'd imagine.

Same with drop; it's just an abstraction for "drop x"

EDIT: In hindsight, I'm not sure if I'm using abstraction correctly here, but I can't really think of another term and it makes sense to me so hopefully the point still goes across.
GleasSpty
Posts: 48
Joined: Tue Apr 19, 2016 6:17 am

Re: GetPlayerInput with other buttons

Post by GleasSpty »

"Wouldn't APROP_TOTALLYFROZEN stop you from turning and thus prevent you from aiming? It also seems horribly unnatural to be completely frozen like that... why not just reduce the player's speed and prevent switching to any other weapon than fist or pistol?" --- That's correct. To account for this, I had to code to manually change the player's view. (Actually, the code I wound up using was essentially due to Nash---see http://forum.zdoom.org/viewtopic.php?f=3&t=51770.)
Locked

Return to “Editing (Archive)”