Trying to fix a reload bug in 3D Doom Mod

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
raynorkap
Posts: 2
Joined: Sun Nov 13, 2022 1:34 am

Trying to fix a reload bug in 3D Doom Mod

Post by raynorkap »

Hey all,

I am attempting to make a more vanilla friendly version of Alchee66's mod DOOM3D with the no reload (https://www.moddb.com/mods/doom3d) by removing the new added weapons and grenades to just going back to the vanilla version. (NOTE: I AM MODIFYING THIS MOD BECAUSE ALCHEE66 HAS NOT UPDATED THE MOD IN OVER TWO YEARS AND HAS AN UNLICENSE.TXT IN THE FILES CLAIMING THAT THE MOD IS IN THE PUBLIC DOMAIN AND CAN BE COPIED, MODIFIED, AND PUBLISHED THAT STATES) :
Spoiler:
I about got it all figured out but there was a glitch with the super shotgun where it needs to reload in order to start using it even though the mod is no reload. This the the code found for the super shotgun under the "weapons" file in the pk3 file

Code: Select all

ACTOR NewSuperShotgun : NewWeaponBase replaces SuperShotgun
{
  Weapon.SelectionOrder 1500
	Weapon.AmmoUse1 0
	Weapon.AmmoUse2 0
	Weapon.AmmoType1 "Shell"
	Weapon.AmmoType2 "SuperShotgunAmmo"
  Weapon.AmmoGive1 8
  Weapon.SlotNumber 3
  Weapon.SlotPriority 2
  Weapon.AmmoType "Shell"
  Inventory.PickupMessage "$GOTSHOTGUN2"
  Obituary "$OB_MPSSHOTGUN"
  Tag "$TAG_SUPERSHOTGUN"
  States
  {
  Ready:
    SHT2 A 1 A_WeaponReady(WRF_ALLOWRELOAD)
    Loop
  Deselect:
  TNT1 AAAAAAAAAA 0 A_Lower
    Loop
	Select:
		TNT1 A 1
		TNT1 A 1 A_Raise
		TNT1 AAAAAAAAAA 0 A_Raise
		Goto SelectAnimation
	SelectAnimation:
		TNT1 A 1
		SHTG A 0 A_StartSound("SHPULL",1,CHANF_OVERLAP)
        SHT2 B 1 Offset(60,78)
		SHT2 B 1 Offset(50,68)
		SHT2 B 1 Offset(40,58)
		SHT2 A 1 Offset(30,48)
		SHT2 A 1 Offset(10,38)
		SHT2 A 1 Offset(0,32)
		Goto Ready
  Fire:
  	TNT1 A 0 A_JumpIfInventory("SuperShotgunAmmo",2,1)
    Goto NoAmmo
	TNT1 A 0 A_TakeInventory("SuperShotgunAmmo",2)
	SHT2 A 0 A_FireBullets (11.2, 7.1, 20, 5, "SuperShotgunPuff")
	TNT1 AAAAAAAAA 0 A_FireCustomMissile("Tracer",random(-5.6,5.6),0,5,3,0,random(-3.6,3.6))
    SHT2 A 0 A_StartSound ("SSGFire",1)
	TNT1 A 0 A_FireCustomMissile("ShakeYourAssDouble", 0, 0, 0, 0)
	TNT1 A 0 A_FireCustomMissile("GunFlasher", 0, 0, 0, 0, 0, 0)
	TNT1 A 0 A_GunFlash
	TNT1 A 0 A_Zoomfactor(0.98)
	S2TF BB 2 A_SetPitch(pitch-1.0,SPF_INTERPOLATE)
	TNT1 A 0 A_Zoomfactor(1.0)
	S2TF CDEF 2 A_SetPitch(pitch+0.5,SPF_INTERPOLATE)
    Goto Reload
	AltFire:
  	TNT1 A 0 A_JumpIfInventory("SuperShotgunAmmo",1,1)
    Goto NoAmmo
	TNT1 A 0 A_TakeInventory("SuperShotgunAmmo",1)
	SHT2 A 0 A_FireBullets (11.2, 7.1, 10, 5, "SuperShotgunPuff")
	TNT1 AAAAA 0 A_FireCustomMissile("Tracer",random(-5.6,5.6),0,5,3,0,random(-3.6,3.6))
    SHT2 A 0 A_StartSound ("SSGFire",1)
	TNT1 A 0 A_FireCustomMissile("ShakeYourAssDouble", 0, 0, 0, 0)
	TNT1 A 0 A_FireCustomMissile("GunFlasher", 0, 0, 0, 0, 0, 0)
	TNT1 A 0 A_GunFlash
	TNT1 A 0 A_Zoomfactor(0.99)
	S2TF B 2 A_SetPitch(pitch-0.8,SPF_INTERPOLATE)
	TNT1 A 0 A_Zoomfactor(1.0)
	S2TF CDEF 2 A_SetPitch(pitch+0.2,SPF_INTERPOLATE)
    Goto Ready
	Reload:
	TNT1 A 0 A_JumpIfInventory("Shell",2,1)
	Goto Ready
	TNT1 A 0 A_JumpIfInventory("SuperShotgunAmmo",2,"Ready")
    SHT2 A 2
	SHT2 BCD 2
	SHT2 EEE 1 A_SetPitch(pitch-0.5,SPF_INTERPOLATE)
	SHT2 FGH 2 A_SetPitch(pitch+0.5,SPF_INTERPOLATE)
	SHT2 I 1 A_StartSound ("SSGOPEN",1,CHANF_OVERLAP)
	ReloadRepeat:
		TNT1 A 0 A_JumpIfInventory("SuperShotgunAmmo", 2, "ReloadFinish")
		TNT1 A 0 A_JumpIfInventory("Shell", 2, 1)
		Goto ReloadFinish
		TNT1 A 0 A_GiveInventory("SuperShotgunAmmo", 1)
		TNT1 A 0 A_Takeinventory("Shell",1)	
		Goto ReloadRepeat
	ReloadFinish:
    SHT2 JKL 2 A_SetPitch(pitch-0.1,SPF_INTERPOLATE)
    SHT2 M 2 Offset(0,48)A_startSound("SSGShell",1,CHANF_OVERLAP)
	SHT2 NOP 2
	SHT2 QQQ 1 A_SetPitch(pitch+1.0,SPF_INTERPOLATE)
	SHT2 RST 2 Offset(0,32) A_SetPitch(pitch-1.0,SPF_INTERPOLATE)
    SHT2 O 1 A_startSound ("SSGCLOSE",1,CHANF_OVERLAP)
	SHT2 UUVW 1
	SHT2 A 6
	SHT2 A 5 A_WeaponReady
		Goto Ready
	NoAmmo:
		SHT2 A 15 A_PlaySound("weapons/empty")
		Goto Ready
  Flash:
  TNT1 A 0 A_Recoil(4.0)
    SHTF A 2
    Goto LightDone
  Spawn:
    SGN2 A -1
    Stop
  }
}
I am new to coding and was able to get the weapons and grenades removed but this is one thing thats stumped me without breaking the file. Any help is appreciated!

Here is the modified version of the file as well that I have been working on: https://drive.google.com/file/d/1wPkY47 ... share_link
Jarewill
 
 
Posts: 1768
Joined: Sun Jul 21, 2019 8:54 am

Re: Trying to fix a reload bug in 3D Doom Mod

Post by Jarewill »

So let me confirm something, you just want to fix the issue with the super shotgun reloading before being able to fire, correct?
Not completely rip reloading out of the weapon?

If that is the case, then you should just make the player start with 2 of SuperShotgunAmmo
To do that, you can add a line like this to your player class: Player.StartItem "SuperShotgunAmmo", 2
raynorkap
Posts: 2
Joined: Sun Nov 13, 2022 1:34 am

Re: Trying to fix a reload bug in 3D Doom Mod

Post by raynorkap »

Jarewill wrote: Mon Nov 14, 2022 12:26 pm So let me confirm something, you just want to fix the issue with the super shotgun reloading before being able to fire, correct?
Not completely rip reloading out of the weapon?

If that is the case, then you should just make the player start with 2 of SuperShotgunAmmo
To do that, you can add a line like this to your player class: Player.StartItem "SuperShotgunAmmo", 2
So the version I'm using already has the reload taken out. But it's the only item you pick up out of the classic arsenal that still needs to be reloaded when you pick it up. It doesnt start firing until after its reloaded evem though the reload feature was "taken out". Probably some glitch left behind by the creator of the mod. But would this code still work if added? Do I want to input it in the weapons.txt? Thank you for your help
Last edited by raynorkap on Mon Nov 14, 2022 9:24 pm, edited 4 times in total.
raynorkap
Posts: 2
Joined: Sun Nov 13, 2022 1:34 am

Re: Trying to fix a reload bug in 3D Doom Mod

Post by raynorkap »

Bump

Any ideas?
raynorkap
Posts: 2
Joined: Sun Nov 13, 2022 1:34 am

Re: Trying to fix a reload bug in 3D Doom Mod

Post by raynorkap »

UPDATE: I fixed the issues with the reload by adding a checkforreload command to the ready state however, when the ammo gets to two it reloads only "one" bullet but it doesnt fire after that. also when I run it has a jank to it. I'll post a video down below:

video: https://imgur.com/a/7PFLR4S

Here is my code I am using

Code: Select all

ACTOR NewSuperShotgun : NewWeaponBase replaces SuperShotgun
{
  Weapon.SelectionOrder 1500
	Weapon.AmmoUse1 0
	Weapon.AmmoUse2 0
	Weapon.AmmoType1 "Shell"
	Weapon.AmmoType2 "SuperShotgunAmmo"
  Weapon.AmmoGive1 8
  Weapon.SlotNumber 3
  Weapon.SlotPriority 2
  Weapon.AmmoType "Shell"
  Inventory.PickupMessage "$GOTSHOTGUN2"
  Obituary "$OB_MPSSHOTGUN"
  Tag "$TAG_SUPERSHOTGUN"
  States
  {
  Ready:
    SHT2 A 1 A_CheckForReload (2, "reload")
    SHT2 A 1 A_WeaponReady(WRF_ALLOWRELOAD)
    Loop
  Deselect:
  TNT1 AAAAAAAAAA 0 A_Lower
    Loop
	Select:
		TNT1 A 1
		TNT1 A 1 A_Raise
		TNT1 AAAAAAAAAA 0 A_Raise
		Goto SelectAnimation
	SelectAnimation:
		TNT1 A 1
		SHTG A 0 A_StartSound("SHPULL",1,CHANF_OVERLAP)
        SHT2 B 1 Offset(60,78)
		SHT2 B 1 Offset(50,68)
		SHT2 B 1 Offset(40,58)
		SHT2 A 1 Offset(30,48)
		SHT2 A 1 Offset(10,38)
		SHT2 A 1 Offset(0,32)
		Goto Ready
  Fire:
  	TNT1 A 0 A_JumpIfInventory("SuperShotgunAmmo",2,1)
    Goto NoAmmo
	TNT1 A 0 A_TakeInventory("SuperShotgunAmmo",2)
	SHT2 A 0 A_FireBullets (11.2, 7.1, 20, 5, "SuperShotgunPuff")
	TNT1 AAAAAAAAA 0 A_FireCustomMissile("Tracer",random(-5.6,5.6),0,5,3,0,random(-3.6,3.6))
    SHT2 A 0 A_StartSound ("SSGFire",1)
	TNT1 A 0 A_FireCustomMissile("ShakeYourAssDouble", 0, 0, 0, 0)
	TNT1 A 0 A_FireCustomMissile("GunFlasher", 0, 0, 0, 0, 0, 0)
	TNT1 A 0 A_GunFlash
	TNT1 A 0 A_Zoomfactor(0.98)
	S2TF BB 2 A_SetPitch(pitch-1.0,SPF_INTERPOLATE)
	TNT1 A 0 A_Zoomfactor(1.0)
	S2TF CDEF 2 A_SetPitch(pitch+0.5,SPF_INTERPOLATE)
    Goto Reload
	AltFire:
  	TNT1 A 0 A_JumpIfInventory("SuperShotgunAmmo",0,1)
    Goto NoAmmo
	TNT1 A 0 A_TakeInventory("SuperShotgunAmmo",1)
	SHT2 A 0 A_FireBullets (11.2, 7.1, 10, 5, "SuperShotgunPuff")
	TNT1 AAAAA 0 A_FireCustomMissile("Tracer",random(-5.6,5.6),0,5,3,0,random(-3.6,3.6))
    SHT2 A 0 A_StartSound ("SSGFire",1)
	TNT1 A 0 A_FireCustomMissile("ShakeYourAssDouble", 0, 0, 0, 0)
	TNT1 A 0 A_FireCustomMissile("GunFlasher", 0, 0, 0, 0, 0, 0)
	TNT1 A 0 A_GunFlash
	TNT1 A 0 A_Zoomfactor(0.99)
	S2TF B 2 A_SetPitch(pitch-0.8,SPF_INTERPOLATE)
	TNT1 A 0 A_Zoomfactor(1.0)
	S2TF CDEF 2 A_SetPitch(pitch+0.2,SPF_INTERPOLATE)
    Goto Ready
	Reload:
	TNT1 A 0 A_JumpIfInventory("Shell",2,1)
	Goto Ready
	TNT1 A 0 A_JumpIfInventory("SuperShotgunAmmo",2,"Ready")
    SHT2 A 2
	SHT2 BCD 2
	SHT2 EEE 1 A_SetPitch(pitch-0.5,SPF_INTERPOLATE)
	SHT2 FGH 2 A_SetPitch(pitch+0.5,SPF_INTERPOLATE)
	SHT2 I 1 A_StartSound ("SSGOPEN",1,CHANF_OVERLAP)
	ReloadRepeat:
		TNT1 A 0 A_JumpIfInventory("SuperShotgunAmmo", 2, "ReloadFinish")
		TNT1 A 0 A_JumpIfInventory("Shell", 2, 1)
		Goto ReloadFinish
		TNT1 A 0 A_GiveInventory("SuperShotgunAmmo", 1)
		TNT1 A 0 A_Takeinventory("Shell",1)	
		Goto ReloadRepeat
	ReloadFinish:
    SHT2 JKL 2 A_SetPitch(pitch-0.1,SPF_INTERPOLATE)
    SHT2 M 2 Offset(0,48)A_startSound("SSGShell",1,CHANF_OVERLAP)
	SHT2 NOP 2
	SHT2 QQQ 1 A_SetPitch(pitch+1.0,SPF_INTERPOLATE)
	SHT2 RST 2 Offset(0,32) A_SetPitch(pitch-1.0,SPF_INTERPOLATE)
    SHT2 O 1 A_startSound ("SSGCLOSE",1,CHANF_OVERLAP)
	SHT2 UUVW 1
	SHT2 A 6
	SHT2 A 5 A_WeaponReady
		Goto Ready
        SHT2 A 0 A_JumpIfNoAmmo("Reload")
        goto Noammo
	NoAmmo:
                TNT1 A 0
		SHT2 A 15 A_PlaySound("weapons/empty")
		Goto Ready
  Flash:
  TNT1 A 0 A_Recoil(4.0)
    SHTF A 2
    Goto LightDone
  Spawn:
    SGN2 A -1
    Stop
  }
}
Hope someone can help!
User avatar
Dan_The_Noob
Posts: 872
Joined: Tue May 07, 2019 12:24 pm
Graphics Processor: nVidia with Vulkan support
Contact:

Re: Trying to fix a reload bug in 3D Doom Mod

Post by Dan_The_Noob »

gotta be honest, that whole reload sequence is really confusing. what is "ReloadRepeat" ?
raynorkap
Posts: 2
Joined: Sun Nov 13, 2022 1:34 am

Re: Trying to fix a reload bug in 3D Doom Mod

Post by raynorkap »

Dan_The_Noob wrote: Tue Nov 29, 2022 3:31 am gotta be honest, that whole reload sequence is really confusing. what is "ReloadRepeat" ?
You know looking at it, the guy that modded this did it very strangely. (This is not my original mod) I think he did that with the shotgun because the mod originally had a Reload function and the "reloadrepeat" is to play the animation and functionwhen you reload a weapon. However, I downloaded the no reload version he offered and it appears he did not try to get everything working right because in the base mod, it still needs to manually be reloaded I ended up getting it figured out though before the "ready state" I did a "pickup" state that adds "A_checkforreload" And it appears to have fixed the jankiness and was able to go under reload and set the right ammo values and it fixed having only the one. However when the weapon runs out of ammo, its still selectable. The ammo was zeroed out and it looks like he had his own way to have it fire. I'm wondering though is there a function or action I can use to "disable" the weapon until you pick up more? Or do you think I need to recode it with the ammo use? (I am not planning on using reload besides for how its set up in the orignal game with the super shotgun)
Last edited by raynorkap on Tue Nov 29, 2022 6:17 pm, edited 1 time in total.
Post Reply

Return to “Scripting”