r3829 WRF_NOSWITCH behaviour?
Posted: Thu Aug 16, 2012 3:38 pm
I'm not sure if this is a bug or not but a discussion in the editing forum leads me to post this just in case.
In short, I am looking to create a weapon that, once selected, cannot be changed away from (unless the weapon is taken using ACS). The WRF_NOSWITCH seemed like it would do the job however, I ran into problems. The behaviour I experienced may well be what is intended but I feel it makes the feature not particularly useful.
I've copied the relevant points of discussion below. FDARI's comment is possibly the most valuable.
In short, I am looking to create a weapon that, once selected, cannot be changed away from (unless the weapon is taken using ACS). The WRF_NOSWITCH seemed like it would do the job however, I ran into problems. The behaviour I experienced may well be what is intended but I feel it makes the feature not particularly useful.
I've copied the relevant points of discussion below. FDARI's comment is possibly the most valuable.
Enjay wrote:What is the best way to prevent a player changing away from a particular weapon (can be ACS or DECORATE).
I'm just trying to get a neater way of making a "mounted gun" weapon like the minigun in my Burghead mod. What I did there was count everything the player had in his inventory, then take it all away and give him the minigun. Then when he stopped using the gun, I gave him his inventory back.
It would be much beater to leave his inventory alone and either create a weapon where its decorate means that you cannot change away from it (making the deselect state jump to the ready state has some unwanted side effects) or some ACS prevents you changing away.
Blue Shadow wrote:Would the WRF_NOSWTICH flag for [wiki]A_WeaponReady[/wiki] help?
Enjay wrote:That looks like it would do the trick. It seems to be meant for exactly what I'm trying to do. Thanks.
[edit] Hmm, nope, it doesn't allow what I want. Changing the ready state to:
does mean that you can't switch away from the weapon when you are in the "ready" state. However, if you start firing and then press the button for another weapon while the weapon is still firing, you can switch away. Even worse, if you press the button for another weapon while you are in the ready state, ZDoom seems to remember that you have tried to switch away so that when you start firing (ie enter a state where the weapon can switch away) you change weapons shortly after entering the firing state. [/edit]Code: Select all
Ready: MINI A 1 A_WeaponReady(WRF_NOSWITCH) Loop
Emphasis mine.FDARI wrote:That may be a bug. It may also be intended behaviour, or perhaps a nigh-unavoidable feature of the design. I would expect and prefer that WRF_NOSWITCH were in effect until a_weaponready was called again.