Old Cell ammo counter still shows on HUD

Discuss all aspects related to modding Zandronum here.
Post Reply
User avatar
HellBlade64
Forum Regular
Posts: 100
Joined: Mon Aug 13, 2012 9:03 pm
Contact:

Old Cell ammo counter still shows on HUD

#1

Post by HellBlade64 » Sat Aug 29, 2020 4:07 am

I replaced all vanilla ammo types with new versions of themselves to reduce how much max ammo a player can carry.
For some reason, there are two cell counters.

One is for Cell, and the other is Cell2.
Cell holds the original 600 max while Cell2 holds a max of 300.

On top of that, there is a duplicate of the Plasma Rifle on the HUD, too.
I don't know why any of this is happening. I can only guess sloppy code.
But there's not a single weapon in the mod that uses the original ammo.

Provided below are a screenshot and the whole code lump which contains the ammo replacements.

Screenshot showing the extra plasma rifle and cell counter
Spoiler: (Open)
Image
Notice how there is a second plasma rifle under the bfg10k
And the extra cells counter under the normal 300 max one.
Here is the full "VanillaWeaps" decorate lump
Spoiler: (Open)

Code: Select all

Actor StartFist : Fist
{
Tag "Knuckle Duster"
AttackSound "FistPunch"
States
{
Ready:
PUNG A 0 A_PlaySound("FistUp")
PUNG A 1 A_WeaponReady
Goto Ready+1

Fire:
PUNG B 4
TNT1 A 0 A_JumpIfInventory("PowerStrength", 1, "Berserked")

Normal:
PUNG C 4 A_CustomPunch(2 * random(1, 10), TRUE,0,BulletPuff,74,1)   //Expected ")" but got ","
Goto FireEnd                                                       //Nice, nice.
                                                                   //So I can program the fist to have vampirism,
Berserked:                                                         //but I can't limit how much health the meleer gets from each punch.
PUNG C 4 A_CustomPunch(20 * random(1, 10), TRUE,0,BulletPuff,74,1)  //Fucking genious, I tell you.
																     
FireEnd:                                                             
PUNG D 5                                                             
PUNG C 4                                                             
PUNG B 5 A_ReFire                                                    
Goto Ready+1                                                          
}                                                                    
}

Actor Fist2 : Fist replaces Fist
{
Tag "Knuckle Duster"
States
{
Ready:
PUNG A 0 A_PlaySound("FistUp")
PUNG A 1 A_WeaponReady
Goto Ready+1
}
}															     
																     
Actor Pistol2 : Pistol replaces Pistol                               
{																	 
Tag "Pistol"                                                         
Weapon.AmmoType "Clip2"                                                                                             
Weapon.AmmoUse "1"
Decal BulletChip
States
{
Ready:
PISG A 0 A_PlaySound("PistolUp")
PISG A 1 A_WeaponReady
Goto Ready+1

Fire:
PISG A 4
PISG B 0 A_PlaySound("weapons/pistol")
PISG B 0 A_TakeInventory("Clip",1,TIF_NOTAKEINFINITE)
PISG B 1 Bright A_FireBullets(0,0,1,random(1,3),"BulletPuff",0)
PISG CDEF 2
PISG F 1
PISG F 2 A_ReFire
Goto Ready+1

Flash:
PISF A 7 Bright A_Light1
Goto LightDone
PISF A 7 Bright A_Light1
Goto LightDone
}
}

Actor Shotgun2 : Shotgun replaces Shotgun
{
Tag "Shotgun"
Weapon.AmmoType "Shell2"
States
{
Ready:
SHTG A 0 A_PlaySound("ShotUp")
SHTG A 1 A_WeaponReady
Goto Ready+1
}
}

Actor SuperShotgun2 : SuperShotgun replaces SuperShotgun
{
Tag "Super Shotgun"
Weapon.AmmoType "Shell2"
States
{
Ready:
SHT2 A 0 A_PlaySound("weapons/sshotc")
SHT2 A 1 A_WeaponReady
Goto Ready+1
}
}

Actor Chaingun2 : Chaingun replaces Chaingun
{
Tag "Chaingun"
Weapon.AmmoType "Clip2"
States
{
Ready:
CHGG A 0 A_PlaySound("ChaingunUp")
CHGG A 1 A_WeaponReady
Goto Ready+1
}
}

Actor Minigun2 : Minigun replaces Minigun
{
Tag "Minigun"
Weapon.AmmoType "Clip2"
States
{
Ready:
MNGG A 0 A_PlaySound("MiniGUp")
MNGG A 1 A_WeaponReady
Goto Ready+1
}
}

Actor RocketLauncher2 : RocketLauncher replaces RocketLauncher
{
Tag "Rocket Launcher"
Weapon.AmmoType "RocketAmmo2"
States
{
Ready:
MISG A 0 A_PlaySound("RocketUp")
MISG A 1 A_WeaponReady
Goto Ready+1
}
}

Actor GrenadeLauncher2 : GrenadeLauncher replaces GrenadeLauncher
{
Tag "Grenade Launcher"
Weapon.AmmoType "RocketAmmo2"
States
{
Ready:
GRLG A 0 A_PlaySound("GrenUp")
GRLG A 1 A_WeaponReady
Goto Ready+1
}
}

Actor CoopPlasmaRifle : PlasmaRifle replaces PlasmaRifle
{
Tag "Plasma Gun"
Weapon.AmmoType "Cell2"
States
{
Ready:
PLSG A 0 A_PlaySound("PlasmaUp")
PLSG A 1 A_WeaponReady
Goto Ready+1

Fire:
PLSF A 1 A_FireCustomMissile("PlasmaBall",0,1)
PLSF BA 1
PLSG B 20 A_ReFire
Goto Ready+1
}
}

Actor CoopBFG9000 : BFG9000 replaces BFG9000
{
Weapon.AmmoType "Cell2"
States
{
Ready:
BFGG A 0 A_PlaySound("BFGUp")
BFGG A 1 A_WeaponReady
Goto Ready+1

Fire:
BFGG A 20 A_BFGSound
BFGG B 15 A_GunFlash
BFGG C 6 A_FireBFG
BFGG BA 5 A_ReFire
Goto Ready+1
}
}

Actor CoopBFG10k : BFG10K replaces BFG10K 
{
Tag "BFG10k"
Weapon.AmmoType "Cell2"
Decal BFGLightning
States
{
Ready:
BG2G A 20 A_PlaySound("10kUp")
BG2G A 0 A_PlaySound("weapons/bfg10kidle")
BG2G A 1 A_WeaponReady
BG2G A 1 A_WeaponReady
BG2G A 1 A_WeaponReady
BG2G B 1 A_WeaponReady
BG2G B 1 A_WeaponReady
BG2G B 1 A_WeaponReady
BG2G C 1 A_WeaponReady
BG2G C 1 A_WeaponReady
BG2G C 1 A_WeaponReady
BG2G D 1 A_WeaponReady
BG2G D 1 A_WeaponReady
BG2G D 1 A_WeaponReady
Goto Ready+1

Fire:
BG2G E 20 A_PlaySound ("weapons/bfg10kf")
BG2G F 4
BG2G G 1
BG2G H 1
BG2G I 1
BG2G J 1
Goto Hold

Hold:
BG2G K 2 A_GunFlash
BG2G L 2 A_FireBullets(0,0,1,0,"BFG10kShot")
BG2G M 2
BG2G N 0 A_ReFire
BG2G O 35 A_PlaySound ("weapons/bfg10kcool")
Goto Ready+1
}
}

Actor Clip2 : Ammo replaces Clip
{
Inventory.PickupMessage "$GOTCLIP"
Inventory.Amount 10
Inventory.MaxAmount 200
Ammo.BackpackAmount 10
Ammo.BackpackMaxAmount 200
Inventory.Icon "CLIPA0"
States
{
Spawn:
CLIP A -1
Stop
}
}

Actor ClipBox2 : Clip2 replaces ClipBox
{
Inventory.PickupMessage "$GOTCLIPBOX"
Inventory.Amount 50
States
{
Spawn:
AMMO A -1
Stop
}
}

Actor Shell2 : Ammo replaces Shell 
{
Inventory.PickupMessage "$GOTSHELLS"
Inventory.Amount 4
Inventory.MaxAmount 50
Ammo.BackpackAmount 4
Ammo.BackpackMaxAmount 50
Inventory.Icon "SHELA0"
States
{
Spawn:
SHEL A -1
Stop
}
}

Actor ShellBox2 : Shell2 replaces ShellBox
{
Inventory.PickupMessage "$GOTSHELLBOX"
Inventory.Amount 20
States
{
Spawn:
SBOX A -1
Stop
}
}

Actor RocketAmmo2 : Ammo replaces RocketAmmo
{
Inventory.PickupMessage "$GOTROCKET"
Inventory.Amount 1
Inventory.MaxAmount 50
Ammo.BackpackAmount 1
Ammo.BackpackMaxAmount 50
Inventory.Icon "ROCKA0"
States
{
Spawn:
ROCK A -1
Stop
}
}

Actor RocketBox2 : RocketAmmo2 replaces RocketBox
{
Inventory.PickupMessage "$GOTROCKBOX"
Inventory.Amount 5
States
{
Spawn:
BROK A -1
Stop
}
}

Actor Cell2 : Ammo replaces Cell
{
Inventory.PickupMessage "$GOTCELL"
Inventory.Amount 20
Inventory.MaxAmount 150
Ammo.BackpackAmount 20
Ammo.BackpackMaxAmount 300
Inventory.Icon "CELLA0"
States
{
Spawn:
CELL A -1
Stop
}
}

Actor CellPack2 : Cell2 replaces CellPack
{
Inventory.PickupMessage "$GOTCELLBOX"
Inventory.Amount 100
States
{
Spawn:
CELP A -1
Stop
}
}
Also here is the full KEYCONF lump
Spoiler: (Open)

Code: Select all

ClearPlayerClasses

AddPlayerClass FistStart
AddPlayerClass PistolStart
AddPlayerClass ShotgunStart
AddPlayerClass ChaingunStart

WeaponSection FistStart
SetSlot 1 StartFist Chainsaw AbyssClaw
SetSlot 2 Pistol2 AbyssRevolver
SetSlot 3 Shotgun2 SuperShotgun2 QuadShotgun  AbyssShrapnelGun
SetSlot 4 Chaingun2 Minigun2
SetSlot 5 RocketLauncher2 GrenadeLauncher2
SetSlot 6 CoopPlasmaRifle SonicRailgun
SetSlot 7 CoopBFG9000 CoopBFG10k
SetSlot 8 AbyssHands AbyssLightning

WeaponSection PistolStart
SetSlot 1 StartFist Fist2 Chainsaw AbyssClaw
SetSlot 2 Pistol2 AbyssRevolver
SetSlot 3 Shotgun2 SuperShotgun2 QuadShotgun  AbyssShrapnelGun
SetSlot 4 Chaingun2 Minigun2
SetSlot 5 RocketLauncher2 GrenadeLauncher2
SetSlot 6 CoopPlasmaRifle SonicRailgun
SetSlot 7 CoopBFG9000 CoopBFG10k
SetSlot 8 AbyssHands AbyssLightning

WeaponSection ShotgunStart
SetSlot 1 StartFist Fist2 Chainsaw AbyssClaw
SetSlot 2 Pistol2 AbyssRevolver
SetSlot 3 Shotgun2 SuperShotgun2 QuadShotgun  AbyssShrapnelGun
SetSlot 4 Chaingun2 Minigun2
SetSlot 5 RocketLauncher2 GrenadeLauncher2
SetSlot 6 CoopPlasmaRifle SonicRailgun
SetSlot 7 CoopBFG9000 CoopBFG10k
SetSlot 8 AbyssHands AbyssLightning

WeaponSection ChaingunStart
SetSlot 1 StartFist Fist2 Chainsaw AbyssClaw
SetSlot 2 Pistol2 AbyssRevolver
SetSlot 3 Shotgun2 SuperShotgun2 QuadShotgun  AbyssShrapnelGun
SetSlot 4 Chaingun2 Minigun2
SetSlot 5 RocketLauncher2 GrenadeLauncher2
SetSlot 6 CoopPlasmaRifle SonicRailgun
SetSlot 7 CoopBFG9000 CoopBFG10k
SetSlot 8 AbyssHands AbyssLightning

User avatar
HellBlade64
Forum Regular
Posts: 100
Joined: Mon Aug 13, 2012 9:03 pm
Contact:

Re: Old Cell ammo counter still shows on HUD

#2

Post by HellBlade64 » Sat Aug 29, 2020 4:35 am

Addition/correction:
NONE of the ammo types are actually being replaced for some reason.
If I spawn in as a shotgun class or chaingun class a duplicate clip or shell ammo counter will appear.

User avatar
Ænima
Addicted to Zandronum
Posts: 3523
Joined: Tue Jun 05, 2012 6:12 pm

Re: Old Cell ammo counter still shows on HUD

#3

Post by Ænima » Sun Sep 06, 2020 5:46 pm

Your replacement code looks fine. Not sure why it isn’t replacing those actors.

Spawn one ingame, then type “printinv” and confirm if they’re actually two different items.

Also, what you’re describing as “duplicate” HUD icons is infact standard althud behavior. IIRC all inventory items that are internally classified as “ammo” will be listed on the right column. I’m not sure if there are flags to explicitly disable this. I also don’t use althud so i can’t help you much there. :/

What does the DECORATE for your playerclass look like?
­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­
Doom64: Unabsolved: New weapons, monsters, and gameplay features for coop !


ZandroSkins
: a pack made by our community

User avatar
HellBlade64
Forum Regular
Posts: 100
Joined: Mon Aug 13, 2012 9:03 pm
Contact:

Re: Old Cell ammo counter still shows on HUD

#4

Post by HellBlade64 » Tue Sep 15, 2020 12:27 am

So I have made a few more discoveries about this issue.
Mainly it seems to just be cosmetic with the althud, the cells and plasmarifle themselves are replaced in a normal game but (to me) it's kind of an annoyance to see the old cell counter and old plasma rifle apppear on the hud when that doesn't happen with ANY other replaced ammos or weapons.

As for the player DECORATE code?

Here it is:
Spoiler: (Open)

Code: Select all

ACTOR ShotgunStart : DoomPlayer replaces DoomPlayer
{
Tag "Shotgun Start"
Speed 1
Health 100
Radius 16
Height 56
Mass 100
PainChance 255
+NoSkin
Player.SoundClass "Marine"
Player.ColorRange 112, 127
Player.DisplayName "Shotgun Start"
Player.CrouchSprite "PLYC"
Player.StartItem "Shotgun2"
Player.StartItem "Fist2"
Player.StartItem "Shell2", 30
Player.StartItem "QuadShell", 4
Player.StartItem "RevolverShot", 6
Player.StartItem "ShrapnelShot", 4
Player.StartItem "StarterArmor"
Player.WeaponSlot 1, Fist2, Chainsaw
Player.WeaponSlot 2, Pistol2
Player.WeaponSlot 3, Shotgun2, SuperShotgun2
Player.WeaponSlot 4, Chaingun2, Minigun2			// [BC] Create default binding for the minigun.
Player.WeaponSlot 5, RocketLauncher2, GrenadeLauncher2	// [BC] Create default binding for the grenade launcher.
Player.WeaponSlot 6, PlasmaRifle2, SonicRailgun		// [BC] Create default binding for the railgun.
Player.WeaponSlot 7, CoopBFG9000, CoopBFG10K
/*Player.ColorSet 0, "Green",         0x70, 0x7F,  0x72
Player.ColorSet 1, "Gray",          0x60, 0x6F,  0x62 // Called "Indigo" originally so as to have a unique initial
Player.ColorSet 2, "Brown",         0x40, 0x4F,  0x42
Player.ColorSet 3, "Red",           0x20, 0x2F,  0x22
// Doom Legacy additions
Player.ColorSet 4, "Light Gray",    0x58, 0x67,  0x5A
Player.ColorSet 5, "Light Brown",   0x38, 0x47,  0x3A
Player.ColorSet 6, "Light Red",     0xB0, 0xBF,  0xB2
Player.ColorSet 7, "Light Blue",    0xC0, 0xCF,  0xC2*/
States
{
Spawn:
PLAY A -1
Loop

See:
PLAY ABCD 4
Loop

Missile:
PLAY E 12 
Goto Spawn

Melee:
PLAY F 6 BRIGHT
Goto Missile

Pain:
PLAY G 4 
PLAY G 4 A_Pain
Goto Spawn

/*Death:
PLAY H 10
PLAY I 10 A_PlayerScream
PLAY J 10 A_NoBlocking
PLAY KLM 10
PLAY N -1
Stop*/

Death:
TNT1 A 0 A_Jump(255,"RegularDeath","AltDeath")

RegularDeath:
PLAY H 10
PLAY I 10 A_PlayerScream
PLAY J 10 A_NoBlocking
PLAY KLM 10
PLAY N -1
Stop

AltDeath:
PARM A 10
PARM B 10 A_PlayerScream
PARM C 10 A_NoBlocking
PARM DEF 10
PARM G -1
Stop

/*XDeath:
PLAY O 5
PLAY P 5 A_XScream
PLAY Q 5 A_NoBlocking
PLAY RSTUV 5
PLAY W -1
Stop*/

XDeath:
TNT1 A 0 A_Jump(255,"XDeathNormal","SplitInHalf")

XDeathNormal:
PLAY O 5
PLAY P 5 A_XScream
PLAY Q 5 A_NoBlocking
PLAY RSTUV 5
PLAY W -1
Stop

SplitInHalf:
PLEG A 2 A_PlayerScream
PLEG B 5 A_XScream
PLEG C 2 A_NoBlocking
PLEG C 0 A_SkullPop("MarineTorso")
PLEG DEFG 10 A_NoBlocking
PLEG H -1 A_NoBlocking
Stop
}
}

Actor MarineTorso : PlayerChunk
{
Mass 100
Radius 8
Height 8
Gravity 0.2
Speed 15
BounceCount 2
+Missile
+DoomBounce
+DropOff
+NOBLOCKMAP
-LOWGRAVITY
+CANNOTPUSH
+SKYEXPLODE
+NOBLOCKMONST
+NOSKIN
+CLIENTSIDEONLY
States
{
Spawn:
TNT1 A 0 NoDelay A_ChangeVelocity(velx*4,vely*4,velz*4,CVF_REPLACE) //Doubles current velocity
SpawnLoop:
PTOR A 1 //Why were there several copied lines if they all were the same?
PTOR AAAAAAAA 0 A_SpawnItemEx("Blood2",random(-5,5),random(-5,5),0,random(-5,5),random(-5,5))
Loop
Death:
PTOR BCD 4
PTOR E -1 A_NoBlocking
Stop
}
}

Actor AutistTorso : MarineTorso
{
States
{
Spawn:
TNT1 A 0 NoDelay A_ChangeVelocity(velx*4,vely*4,velz*4,CVF_REPLACE) //Doubles current velocity
SpawnLoop:
PTOR A 1 //Why were there several copied lines if they all were the same?
PTOR AAAAAAAA 0 A_SpawnItemEx("AutistTorso2",random(-5,5),random(-5,5),0,random(-5,5),random(-5,5))
Loop
Death:
PTOR BCD 4
PTOR E -1 A_NoBlocking
Stop
}
}

Actor AutistTorso2 : AutistTorso
{
States
{
Spawn:
TNT1 A 0 NoDelay A_ChangeVelocity(velx*4,vely*4,velz*4,CVF_REPLACE) //Doubles current velocity
SpawnLoop:
PTOR A 1 //Why were there several copied lines if they all were the same?
PTOR AAAAAAAA 0
Loop
Death:
PTOR BCD 4
PTOR E -1 A_NoBlocking
Stop
}
}

Actor TestMarine : ShotgunStart
{
States
{
Death:
PLEG A 2 A_PlayerScream
PLEG B 5 A_XScream
PLEG C 2 A_NoBlocking
PLEG C 0 A_SkullPop("MarineTorso")
PLEG EFG 2 A_NoBlocking
PLEG H -1 A_NoBlocking
Stop

AltDeath:
Goto Death
XDeath:
Goto Death
}
}

Actor what
{
States
{
Spawn:
PLEG DEFGHGFE 4 A_NoBlocking
Loop
}
}

Actor ChaingunStart : ShotgunStart
{
Tag "Chaingun Start"
Player.DisplayName "Chaingun Start"
Player.StartItem "Chaingun2"
Player.StartItem "Fist2"
Player.StartItem "Clip2", 100
Player.StartItem "QuadShell", 4
Player.StartItem "RevolverShot", 6
Player.StartItem "ShrapnelShot", 4
}

Actor PistolStart : ShotgunStart
{
Tag "Pistol Start"
Player.DisplayName "Pistol Start"
Player.StartItem "Pistol2"
Player.StartItem "Fist2"
Player.StartItem "Clip2", 50
Player.StartItem "GreenArmor"
Player.StartItem "QuadShell", 4
Player.StartItem "RevolverShot", 6
Player.StartItem "ShrapnelShot", 4
}

Actor FistStart : ShotgunStart
{
Player.DisplayName "Melee Start"
Player.StartItem "StartFist" //This special version of the fists have vampirism.
Player.StartItem "PowerStrength" //In other words: punch enemy - get health. XD
Player.StartItem "StarterBlueArmor"
Player.StartItem "QuadShell", 4
Player.StartItem "RevolverShot", 6
Player.StartItem "ShrapnelShot", 4
}

Actor StarterArmor : GreenArmor
{
Armor.SavePercent 33.335
Armor.SaveAmount 50
}

Actor StarterBlueArmor : BlueArmor
{
Armor.SavePercent 50
Armor.SaveAmount 50
}

Post Reply