A_CheckReload equivalent when ammo not empty?

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
User avatar
Xaser
 
 
Posts: 10774
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

A_CheckReload equivalent when ammo not empty?

Post by Xaser »

Is there some way to trigger an A_CheckReload "switch to highest priority weapon" change even if the player isn't out of ammo?

Before someone mentions it, A_SelectWeapon isn't what I'm looking for since it requires a specific weapon name.
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: A_CheckReload equivalent when ammo not empty?

Post by NeuralStunner »

A_CheckReload also doesn't seem to work if the weapon is empty but flagged for optional ammo. I don't know of any alternative, but I sure would like one too.

(Something something "just" [convoluted hack])
User avatar
Xaser
 
 
Posts: 10774
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Re: A_CheckReload equivalent when ammo not empty?

Post by Xaser »

If it doesn't exist, it's probably something I'll code up. Just checking first to make sure I don't dupe it. :P
User avatar
DoomRater
Posts: 8270
Joined: Wed Jul 28, 2004 8:21 am
Preferred Pronouns: He/Him
Location: WATR HQ
Contact:

Re: A_CheckReload equivalent when ammo not empty?

Post by DoomRater »

Xaser wrote:Is there some way to trigger an A_CheckReload "switch to highest priority weapon" change even if the player isn't out of ammo?

Before someone mentions it, A_SelectWeapon isn't what I'm looking for since it requires a specific weapon name.
I can think of a particular use for A_SelectWeapon that makes it go to previously selected weapon, or to select a certain priority instead. Consider extending A_SelectWeapon for these functions instead?
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: A_CheckReload equivalent when ammo not empty?

Post by NeuralStunner »

That's a possibility. An extra parameter could specify the mode:
  • Previous (like weapprev)
  • Next (like weapnext)
  • Best (lowest SelectionOrder)
  • Worst (highest SelectionOrder)
Though the question is how it should behave if the given class name isn't null ("").
User avatar
DoomRater
Posts: 8270
Joined: Wed Jul 28, 2004 8:21 am
Preferred Pronouns: He/Him
Location: WATR HQ
Contact:

Re: A_CheckReload equivalent when ammo not empty?

Post by DoomRater »

If we keep track of the last weapon seclected, I'd like to recall that too. Greaser Enhanced keeps track of this internally and then specifically calls the last weapon selected, but boy is that a mess for quick weapons. I know there's now a better way to do it- embed the weapon on another layer. But that didn't exist back when I made it and it's so dependent on knowing what weapons are in a modpack, where it would be really nice to make it so that a quick weapon switch doesn't depend on the modder knowing every weapon present to make it work.
User avatar
Xaser
 
 
Posts: 10774
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Re: A_CheckReload equivalent when ammo not empty?

Post by Xaser »

For the sake of syntactic sanity, I'd probably make it a new action function so you don't have a bum extra parameter... or A_SelectWeaponEx. D:

"Last Selected" is a neat idea that doesn't seem like it'd be that hard to add in theory. Speaking without looking, though.
User avatar
arookas
Posts: 265
Joined: Mon Jan 24, 2011 6:04 pm
Contact:

Re: A_CheckReload equivalent when ammo not empty?

Post by arookas »

NeuralStunner wrote:Though the question is how it should behave if the given class name isn't null ("").
Maybe filter to select only weapons that are derived from the specified weapon class (e.g. best weapon inheriting from shotgun)?
Xaser wrote:For the sake of syntactic sanity, I'd probably make it a new action function so you don't have a bum extra parameter... or A_SelectWeaponEx. D:
This is where overloading would come in handy :lol: I'm in favor of a specific function for this.
User avatar
zrrion the insect
Posts: 2432
Joined: Thu Jun 25, 2009 1:58 pm
Location: Time Station 1: Moon of Glendale

Re: A_CheckReload equivalent when ammo not empty?

Post by zrrion the insect »

NeuralStunner wrote:Though the question is how it should behave if the given class name isn't null ("").
Prioritize that weapon over all other weapons. If the player does not have that weapon, then look at the other args to see what to switch to.
Locked

Return to “Editing (Archive)”