Zombie makes a gun sound??

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
User avatar
Hidden Hands
Posts: 1053
Joined: Tue Sep 20, 2016 8:11 pm
Location: London, England
Contact:

Zombie makes a gun sound??

Post by Hidden Hands »

I have a zombie in my game which has a melee only attack. It comes over and claws at you. But for some reason, as it begins each swing with its arm, a gun shot can be heard. I'm not sure why because there is nothing like that in my code.

The zombie is a replacement for the zombieman, so my only guess is that it has something to do with the original definition being triggered somehow but Im' not sure. How can I fix thsi please?

Here is my zombie DECORATE code:

Code: Select all

ACTOR Zombie : Zombieman replaces Zombieman
{
//$Category Monsters
//$Title Zombie
//$Sprite ZOMBA1
  Game Doom
  obituary "%o was torn to pieces by a zombie."
  health 50
  mass 80
  speed 3
  Radius 20
  Height 52
  painchance 200
  scale 0.9
  seesound "zombie/sight"
  painsound "zombie/pain"
  deathsound "zombie/death"
  activesound "zombie/active"
  MONSTER
  +FLOORCLIP
  States
  {
   Spawn:
    ZOMB ABCD 4 A_Look
    loop
  See:
    ZOMB A 9 A_Chase
    TNT1 A 0 A_Playsound("zombie/step")
    ZOMB B 9 A_Chase
    ZOMB C 9 A_Chase
    TNT1 A 0 A_Playsound("zombie/step")
    ZOMB D 9 A_Chase
    loop
  Missile:
    goto See
  Melee:
    ZOMB E 9 A_FaceTarget
	ZOMB F 9 a_playsound("zombie/attack")
    ZOMB G 9 A_CustomMeleeAttack (random (1, 5) *5, "imp/melee", "skeleton/swing")
    goto See
  Pain:
    ZOMB H 3 A_Pain
    goto See
death:
    ZOMB I 5
    ZOMB J 4 A_Scream
    ZOMB K 4 A_NoBlocking
    ZOMB L 4
    ZOMB M -1
    stop
	XDeath:
		ZMBX N 0 a_setscale(1, 1)
		ZMBX N 5 A_XScream
		ZMBX O 5 A_NoBlocking
		ZMBX PQRST 5
		ZMBX U -1
		Stop
  Raise:
    ZOMB n 0 a_setscale(1.2, 1.2)
    ZOMB nmlkji 4
    goto See
  }
}
And here is a video of the problem in action:


Hope someone can help. Thanks in advance!
User avatar
RicardoLuis0
 
 
Posts: 57
Joined: Tue Aug 21, 2018 9:31 pm
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)
Location: Brazil
Contact:

Re: Zombie makes a gun sound??

Post by RicardoLuis0 »

try changing the "AttackSound" property
User avatar
Hidden Hands
Posts: 1053
Joined: Tue Sep 20, 2016 8:11 pm
Location: London, England
Contact:

Re: Zombie makes a gun sound??

Post by Hidden Hands »

How do you mean? You mean the

Code: Select all

ZOMB F 9 a_playsound("zombie/attack")
part? Because that sound is just the zombie grunting. Or is causing problems by being there?
User avatar
RicardoLuis0
 
 
Posts: 57
Joined: Tue Aug 21, 2018 9:31 pm
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)
Location: Brazil
Contact:

Re: Zombie makes a gun sound??

Post by RicardoLuis0 »

no, you are changing SeeSound, PainSound, DeathSound and ActiveSound from Zombieman, but AttackSound is still the original "grunt/attack"
User avatar
Hidden Hands
Posts: 1053
Joined: Tue Sep 20, 2016 8:11 pm
Location: London, England
Contact:

Re: Zombie makes a gun sound??

Post by Hidden Hands »

RicardoLuis0 wrote:no, you are changing SeeSound, PainSound, DeathSound and ActiveSound from Zombieman, but AttackSound is still the original "grunt/attack"
Oh I see what you mean. But where about is that issue in the code? Not to sound dumb but I'm not sure how to remove it.
User avatar
Enjay
 
 
Posts: 26533
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Zombie makes a gun sound??

Post by Enjay »

Your actor inherits from the original zombieman. So anything in your code that does not explicitly override something that the original zombieman has, will default to whatever is in the original actor. The original actor has an attack sound specified, you have not overriden it with your code so the original attack sound is used.

You can either override the attack sound in your code or simply not inherit from the zombieman at all. If you don't want to inherit from the original actor, but still want to replace the zombieman, you could use:

ACTOR Zombie replaces Zombieman

as your first line.

Also (as a minor tip) it's not a bad idea to ensure that your actors have names that are far more likely to be unique. e.g. "HHZombie" (or similar) is far less likely to clash with other code from other mods than just "zombie"
User avatar
Hidden Hands
Posts: 1053
Joined: Tue Sep 20, 2016 8:11 pm
Location: London, England
Contact:

Re: Zombie makes a gun sound??

Post by Hidden Hands »

Enjay wrote:
ACTOR Zombie replaces Zombieman
A perfect fix, thank you for all tips and advice. I actually never realised you could do that. I thought it always had to be the way I did it. Much more useful, thank you a ton.
Post Reply

Return to “Scripting”