Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Help Needed with Custom Sound Issue

Recommended Posts

Sorry this is a bit long, I figured I'd help YOU help me by adequately describing my issue and supplying my code. I've read article after article, and have learned a lot recently, I've done my homework and this is my last resort.


I'm currently working on a chainsaw zombie. I know one exists on Realm667, but I've taken the liberty to make a 'better one'. I have figured out how to do this, and got it working in-game. It plays my new chainsaw sounds, but I'm having some issues with looping, stopping, and switching sounds.

I have a chainsaw 'idle' sound, chainsaw 'revved up' sound, and chainsaw 'hit' sound. The 'hit' sound has no problems.


chainsawzombie/idle      idle_1
chainsawzombie/rev       rev_1
chainsawzombie/hit       sawing_1
chainsawzombie/death     shutoff
ACTOR ChainsawZombie 3204

    Health 30 
    Radius 20 
    Height 56 
    Speed 25 
    MeleeDamage 1 
    PainChance 200 
    Obituary "%o was sliced by a madman zombie with a chainsaw!" 
    SeeSound "grunt/sight"
    MeleeSound "chainsawzombie/hit" 
    PainSound "grunt/pain" 
    DeathSound "grunt/death" 
    ActiveSound "grunt/active"
    DropItem Chainsaw 
        CHAN A 4 A_Look 
        CHAN A 4  
        CHAN A 4 A_Look 
        CHAN B 4  
        CHAN B 4 A_Look 
        CHAN B 4  
        CHAN A 4 A_Chase 
        CHAN A 4 A_Chase 
        CHAN B 0 A_PlaySound("chainsawzombie/rev",0,1,ATTN_IDLE) 
        CHAN B 4 A_Chase 
        CHAN B 4 A_Chase 
        CHAN C 0  
        CHAN C 4 A_Chase 
        CHAN C 4 A_Chase 
        CHAN D 0  
        CHAN D 4 A_Chase 
        CHAN D 4 A_Chase 
        CHAN A 0  
        CHAN E 1 A_FaceTarget 
        CHAN F 3 A_MeleeAttack
      CHAN F 4 
        Goto See 
        CHAN G 5 
        CHAN G 3 A_Pain 
        Goto See 
        CHAN H 5 A_StopSound(0)
        CHAN I 5 A_Scream
        CHAN J 5 A_Fall 
        CHAN KLM 5 A_PlaySound("chainsawzombie/death",1,0,ATTN_IDLE)
        CHAN N -1 
        CHAN O 5 A_StopSound
        CHAN P 5 A_XScream
        CHAN Q 5 A_Fall
        CHAN RSTUV 5
        CHAN W -1
        CHAN NMLKJIH 5 
        Goto See 
I have a few questions. I'll admit upfront that I don't exactly understand everything perfectly, so go easy on me. Clearly I'm trying to learn.

1) My chainsaw 'rev' sound loops, yes, but it is overlapping itself and creates a droning sound. It just loops over itself. I want it to play through once, and loop once it finishes. Is this just a timing issue?
2) Because of the looping, if I kill the zombie the first instance of 'rev' sound stops, but the subsequent instances of 'rev' sound keeps playing even after he's dead laying on the ground.
3) When he attacks me, or if I damage him (not kill him), his 'rev' sound begins again each time and once again, starts playing over itself multiple times. This is because his MELEE and PAIN properties have "Goto See" at the bottom of them right? Which starts the sound again? Is Goto See necessary?
4) The chainsaw "shutoff" sound, or death sound, doesn't play when he dies. Why is this? I set it to play in his DEATH state. I'm confused.

Here is my goal. I have looked into A_CheckSight but don't know if I could implement this.

>Zombie spawns with no sound playing
>When zombie sees you, he starts playing the chainsaw 'rev' sound and obviously starts to pursue you.
>If you leave his line of sight, the 'rev' sound will play out until its finished, but only the chainsaw 'idle' sound will play. (He can't see you, so he isn't throttling the chainsaw..that's the logic)
>Once he sees you again, you come back in his line of sight, he revs up the chainsaw again.

It seems like I need a second kind of "See" actor STATE to use. I need two STATES, one that plays a certain sound when you're in his line of sight, and a second STATE that plays a different sound when you're out of line of sight. I have researched quite a bit. I haven't come across anything that indicates that I could do this.

If its not possible, then my second best alternative is simple. I would simply want the 'rev' sound to play out completely (its about 7 seconds) and loop indefinitely until he is killed. If I can't have a second idle sound when youre not in his line of sight, so be it.

I apologize for the length. I appreciate your time.

Share this post

Link to post

The problem I can see with your code is that you are using the parameters of A_PlaySound in a nonsensical way that you clearly didn't intend. The sensible way would be to write just A_PlaySound("somesoundname"). It would solve both the problem of some sounds looping over themselves and some sounds not playing at all.

I can also imagine a solution for the 2 See states depending on whether there is line of sight between the monster and the player, involving calling A_CheckSight after each step / every other step / some fixed number of steps.

I'd like you to clarify the intended looping period of the "rev" and "idle" sounds. Is it 8 tics (the duration of a single walking animation frame) or 32 tics (the duration of the entire walking animation)? If the former, you'd need to call A_PlaySound after every 8 tics, in each of the frames with duration 0.

Share this post

Link to post

Thank you for your response.

Well, the rev sound is about 7seconds long. So the looping period SHOULD be the full animation, right?

The idle, however, is a short 0.5second clip that was made to repeat but sound seamless. But, I can easily revert to a longer idle sound clip if need be.

If I understand you correctly, then I believe the rev sound should play over the entire animation frame, 32 tics. But, I must admit I'm still wrapping my head around this subject.

Do you have a suggestion? Again, the rev sound is 7 second long, and the idle sound can be whatever length I want. I have experience with sound editing so the idle is easy to make loop seamlessly any length. Currently, it's a 0.5 second long clip.

Don't the sound clip lengths play an important role in how many tics I play then in the animation frame?

Thank you.

Share this post

Link to post

I finished to chainsaw zombie. Couldn't pull of what I wanted exactly, but I'm happy nonetheless.

+New custom chainsaw engine start sound, he pauses as he starts the engine then starts to chase you
+New custom chainsaw engine running sound
+New custom engine die sound when he is killed.


Share this post

Link to post

A_MeleeAttack has been deprecated and should not be used unless you're aiming for backward-compatibility with older mods. You should consider using A_CustomMeleeAttack instead.

Here's what the melee state should look like:

	CHAN E 1 A_FaceTarget 
	CHAN F 3 A_CustomMeleeAttack(1,"chainsawzombie/hit")
	CHAN F 4 
	Goto See

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now