RRWM reloading system [1.5.0] [ZS/DEC/SBARINFO]

Post your example zscripts/ACS scripts/etc here.
Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.
User avatar
Player701
 
 
Posts: 1684
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support

Re: RRWM reloading system [1.3.0a] [ZS/DEC/SBARINFO]

Post by Player701 »

No, you will get a VM abort if you do that, and removing the code that triggers it will almost surely result in all kinds of unexpected behavior and/or errors (e.g. division by zero).
Ultimate Freedoomer
Posts: 225
Joined: Fri Jan 30, 2015 10:32 pm
Location: Pittman Center

Re: RRWM reloading system [1.3.0a] [ZS/DEC/SBARINFO]

Post by Ultimate Freedoomer »

Are you referring to setting the capacity to a null value or making the secondary fire use a normal ammo actor?
User avatar
Player701
 
 
Posts: 1684
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support

Re: RRWM reloading system [1.3.0a] [ZS/DEC/SBARINFO]

Post by Player701 »

Ultimate Freedoomer wrote: Tue Jan 17, 2023 10:35 pm Are you referring to setting the capacity to a null value or making the secondary fire use a normal ammo actor?
The former, although not null but rather zero or negative.
yum13241
Posts: 853
Joined: Mon May 10, 2021 8:08 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): EndeavorOS (basically Arch)
Graphics Processor: Intel with Vulkan/Metal Support

Re: RRWM reloading system [1.3.0a] [ZS/DEC/SBARINFO]

Post by yum13241 »

Quick question: If I want a weapon to use the same type of ammo as all other bullet weapons (pistol, chaingun), is it OK if I do this?

Class RClip : ReloadableAmmo replaces Clip { Default { Inventory.MaxAmount 200 } }

Or will this break other weapons?
User avatar
Player701
 
 
Posts: 1684
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support

Re: RRWM reloading system [1.3.0a] [ZS/DEC/SBARINFO]

Post by Player701 »

There is no limitation that a single ammo type can only be used by one weapon. You can share ammo types between weapons without any issues.
yum13241
Posts: 853
Joined: Mon May 10, 2021 8:08 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): EndeavorOS (basically Arch)
Graphics Processor: Intel with Vulkan/Metal Support

Re: RRWM reloading system [1.3.0a] [ZS/DEC/SBARINFO]

Post by yum13241 »

What I mean is that will the vanilla pistol for example break with the code snippet above?
User avatar
Player701
 
 
Posts: 1684
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support

Re: RRWM reloading system [1.3.0a] [ZS/DEC/SBARINFO]

Post by Player701 »

No, it won't, but it will still use the original Clip ammo type.
yum13241
Posts: 853
Joined: Mon May 10, 2021 8:08 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): EndeavorOS (basically Arch)
Graphics Processor: Intel with Vulkan/Metal Support

Re: RRWM reloading system [1.3.0a] [ZS/DEC/SBARINFO]

Post by yum13241 »

What if I replaced the pistol and made it use my new clip?
User avatar
Player701
 
 
Posts: 1684
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support

Re: RRWM reloading system [1.3.0a] [ZS/DEC/SBARINFO]

Post by Player701 »

As I've said before, sharing ammo types between weapons is a perfectly valid scenario. It doesn't matter whether any of these weapons are reloadable. ReloadableAmmo does not contain any magic to support reloading by itself, and can be used with normal weapons too. It's largely a hack of sorts to prevent the player from automatically switching to a reloadable weapon when there's really no need to - there is one particular case the engine does not handle properly.
yum13241
Posts: 853
Joined: Mon May 10, 2021 8:08 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): EndeavorOS (basically Arch)
Graphics Processor: Intel with Vulkan/Metal Support

Re: RRWM reloading system [1.3.0a] [ZS/DEC/SBARINFO]

Post by yum13241 »

Thanks!
Ultimate Freedoomer
Posts: 225
Joined: Fri Jan 30, 2015 10:32 pm
Location: Pittman Center

Re: RRWM reloading system [1.3.0a] [ZS/DEC/SBARINFO]

Post by Ultimate Freedoomer »

Player701 wrote: Tue Jan 17, 2023 11:56 pm
Ultimate Freedoomer wrote: Tue Jan 17, 2023 10:35 pm Are you referring to setting the capacity to a null value or making the secondary fire use a normal ammo actor?
The former, although not null but rather zero or negative.
so I’ll use the normal ammo actors to handle altfire not using the clip. What about my answers to the other 3 questions?
User avatar
Player701
 
 
Posts: 1684
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support

Re: RRWM reloading system [1.3.0a] [ZS/DEC/SBARINFO]

Post by Player701 »

Ultimate Freedoomer wrote: Wed Jan 18, 2023 7:24 pm What about my answers to the other 3 questions?
Those questions were examples of what you should ask yourself before starting to edit the code, so that you have a clear picture of how your modifications are supposed to work. I don't know what else to say because you didn't ask me to clarify anything.
User avatar
Player701
 
 
Posts: 1684
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support

Re: RRWM reloading system [1.3.0.1] [ZS/DEC/SBARINFO]

Post by Player701 »

RRWM reloading system has been updated to version 1.3.0.1. Download the new release HERE. The link in the first post has been updated too.

This version adds the following convenience features:
  • ZScript only: IsFullClip method for ReloadableWeapon to easily check if the clip is full. Previously, you had to compare GetClipAmount() with GetClipCapacity() for that.
  • ZScript and DECORATE: Jump functions A_JumpIfClipAmount and A_JumpIfFullClip. Although they are available in both ZScript in DECORATE, usage of the former makes them redundant, and A_JumpIf should be used instead. Please refer to the manual (or the first post in this thread) for more info, search for "DECORATE jump functions". Thanks to Ultimate Freedoomer for the idea.
NB: Please do NOT PM me if you have a question, post it here instead. Thank you very much.
yum13241
Posts: 853
Joined: Mon May 10, 2021 8:08 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): EndeavorOS (basically Arch)
Graphics Processor: Intel with Vulkan/Metal Support

Re: RRWM reloading system [1.3.0.1] [ZS/DEC/SBARINFO]

Post by yum13241 »

I have a problem:


When I use this code, it's possible for the weapon to "fire" visually, when there's no ammo.


BDL_Weapon
Spoiler:


BDL_Pistol:
Spoiler:
User avatar
Player701
 
 
Posts: 1684
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support

Re: RRWM reloading system [1.3.0.1] [ZS/DEC/SBARINFO]

Post by Player701 »

Sorry for a somewhat late reply.

First of all, there is no DryReload state, this state label does not actually do anything.

And to fix your issue, you need to change A_ReFire("Fire") to just A_ReFire. This is necessary because if you pass a state label to A_ReFire, there is no way to override it from weapon code. I suppose I haven't mentioned that in the manual, so I'll fix it when I have the time.

Return to “Script Library”