Does A_SelectWeapon work with altfire?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
grodzio
Posts: 4
Joined: Mon Oct 26, 2020 8:01 am
Graphics Processor: nVidia with Vulkan support

Does A_SelectWeapon work with altfire?

Post by grodzio »

I want to make it so when I use altfire while holding the pistol it switches to another weapon. I tried this:

Code: Select all

AltFire:
 TNT1 A 1 A_SelectWeapon("StealthPistol")
 Stop
Sadly, it doesn't do anything at all, and I don't know if I did something something wrong or if the function simply doesn't work with when used in altfire.
Guest

Re: Does A_SelectWeapon work with altfire?

Post by Guest »

Try making it jump to the Ready state instead of stopping.
A_SelectWeapon only puts that weapon on the selection queue, so it still needs to call A_WeaponReady to switch.
grodzio
Posts: 4
Joined: Mon Oct 26, 2020 8:01 am
Graphics Processor: nVidia with Vulkan support

Re: Does A_SelectWeapon work with altfire?

Post by grodzio »

Basil Pockfield wrote:Try making it jump to the Ready state instead of stopping.
A_SelectWeapon only puts that weapon on the selection queue, so it still needs to call A_WeaponReady to switch.
Still doesn't work.
Guest

Re: Does A_SelectWeapon work with altfire?

Post by Guest »

Could you post a stripped down file with only the two weapond with the issue?
Guest

Re: Does A_SelectWeapon work with altfire?

Post by Guest »

[quote="Basil Pockfield"]Could you post a stripped down file with only the two weapond with the issue?[/quote]
Hero you go: https://gofile.io/d/VPvH3W
grodzio
Posts: 4
Joined: Mon Oct 26, 2020 8:01 am
Graphics Processor: nVidia with Vulkan support

Re: Does A_SelectWeapon work with altfire?

Post by grodzio »

Cornelius Chasslespear wrote:
Basil Pockfield wrote:Could you post a stripped down file with only the two weapond with the issue?
Hero you go: https://gofile.io/d/VPvH3W
Forgot to log in, lol.
Jarewill
 
 
Posts: 1853
Joined: Sun Jul 21, 2019 8:54 am

Re: Does A_SelectWeapon work with altfire?

Post by Jarewill »

1. Does the player start with the new pistol? You cannot replace the pistol like that, you have to add a new player class.
2. The player also needs to have StealthPistol in his inventory to select it.
3. NewPistol's Ready state doesn't loop and jumps to altfire instead.
grodzio
Posts: 4
Joined: Mon Oct 26, 2020 8:01 am
Graphics Processor: nVidia with Vulkan support

Re: Does A_SelectWeapon work with altfire?

Post by grodzio »

I have added a new player class and now it works perfectly. Thank you so much.
Post Reply

Return to “Scripting”