Actor not making sounds

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
AshHouswares
Posts: 145
Joined: Fri Jun 03, 2022 11:31 am
Graphics Processor: Not Listed

Actor not making sounds

Post by AshHouswares »

I have coded an NPC that has all sounds imported and defined in SNDINFO and they all match up perfectly. However, the NPC makes no sounds in game.

The idea is that they are wandering around minding their own business, but occasionally say something. Is something wrong here?

Code: Select all

class Angel : Actor
{
	Default
	{
		Speed 10;
		Radius 30;
		Height 56;
		Mass 400;
		Renderstyle "Normal";
		Bloodcolor "none";
		SeeSound "friend/angel";
        ActiveSound "friend/angel";
	}
	States
	{
	Spawn:
        LPLC A 8 A_Wander;
		loop;
	}
}
To confirm, the SNFINFO has "FRIEND/ANGEL" listed as a random select and all of that is set up correctly. Why would this not work? Is it because it's not a monster? Or is there a flag I've missed?
Jarewill
 
 
Posts: 1853
Joined: Sun Jul 21, 2019 8:54 am

Re: Actor not making sounds

Post by Jarewill »

ActiveSound only plays when the monster is active and chasing the player, I would guess that's the reason they don't play.
Try using A_StartSound in your state to play the sound manually.

If it still doesn't play, try this console command: playsound friend/angel
User avatar
AshHouswares
Posts: 145
Joined: Fri Jun 03, 2022 11:31 am
Graphics Processor: Not Listed

Re: Actor not making sounds

Post by AshHouswares »

New error has occurred since doing this?

Code: Select all

Spawn:
        LPLC A 8 A_Wander; A_StartSound ("friend/angel");
		LPLC A 8 A_Wander;
		LPLC A 8 A_Wander;
		LPLC A 8 A_Wander;
		LPLC A 8 A_Wander;
		LPLC A 0 A_LookEx (LOF_NOSOUNDCHECK, 32, 0, 0, 30, "See");
		LPLC A 0 A_LookEx;
		LPLC A 8 A_Wander;
		LPLC A 8 A_Wander; A_StartSound ("friend/angel");
		LPLC A 8 A_Wander;
		LPLC A 0 A_LookEx (LOF_NOSOUNDCHECK, 32, 0, 0, 30, "See");
		LPLC A 0 A_LookEx (LOF_NOSOUNDCHECK, 32, 0, 0, 30, "See");
		loop;

Code: Select all

ParseTeamInfo: Load team definitions.
LoadActors: Load actor definitions.
Script error, "hfgame.ipk3:zscript/angel" line 21:
Unexpected ')'
Expecting ';'

Script error, "hfgame.ipk3:zscript/angel" line 29:
Unexpected ')'
Expecting ';'


Execution could not continue.

2 errors while parsing hfgame.ipk3:zscript.zc
Is this clashing with the A_WANDER? I'm so stuck it's unreal.
Jarewill
 
 
Posts: 1853
Joined: Sun Jul 21, 2019 8:54 am

Re: Actor not making sounds

Post by Jarewill »

That's because you are trying to use two functions in a single frame without using anonymous functions.
Change it to this instead:
LPLC A 8 {A_Wander(); A_StartSound ("friend/angel");}
User avatar
AshHouswares
Posts: 145
Joined: Fri Jun 03, 2022 11:31 am
Graphics Processor: Not Listed

Re: Actor not making sounds

Post by AshHouswares »

Jarewill wrote: Sun Sep 03, 2023 10:58 am That's because you are trying to use two functions in a single frame without using anonymous functions.
Change it to this instead:
LPLC A 8 {A_Wander(); A_StartSound ("friend/angel");}
I think that fixed the sounds. I have one more tiny issue that I simply cannot figure out whatsoever regarding this. Now the character makes a sound when the game starts, then completely disappears from the map entirely. ???? What did I do wrong?
Jarewill
 
 
Posts: 1853
Joined: Sun Jul 21, 2019 8:54 am

Re: Actor not making sounds

Post by Jarewill »

Please show the entire monster code.
User avatar
AshHouswares
Posts: 145
Joined: Fri Jun 03, 2022 11:31 am
Graphics Processor: Not Listed

Re: Actor not making sounds

Post by AshHouswares »

Code: Select all

class Angel : Actor
{
//$Category npcs
//$Title Angel
//$Sprite LPLCA0
	Default
	{
		Speed 10;
		Radius 30;
		Height 56;
		Mass 400;
		Renderstyle "Normal";
		Bloodcolor "none";
		SeeSound "friend/angel";
        ActiveSound "friend/angel";
	}
	States
	{
	Spawn:
        LPLC A 8 {A_Wander(); A_StartSound ("friend/angel");}
		LPLC AAAAAAAAAAAAA 8 A_Wander;
		LPLC AAAA 0 A_LookEx (LOF_NOSOUNDCHECK, 32, 0, 0, 30, "See");
		LPLC AAAAAAAAAAAAA 8 A_Wander;
		LPLC A 8 {A_Wander(); A_StartSound ("friend/angel");}
		LPLC AAAAAAAAAAAAA 8 A_Wander;
		LPLC A 0 A_LookEx (LOF_NOSOUNDCHECK, 32, 0, 0, 30, "See");
		loop;
	}
}
Jarewill
 
 
Posts: 1853
Joined: Sun Jul 21, 2019 8:54 am

Re: Actor not making sounds

Post by Jarewill »

Your monster doesn't have a See state, so the jump in A_LookEx causes it to disappear instead.
User avatar
AshHouswares
Posts: 145
Joined: Fri Jun 03, 2022 11:31 am
Graphics Processor: Not Listed

Re: Actor not making sounds

Post by AshHouswares »

Ahhhhhh can't believe i made this mistake twice. I had a similar issue with a monster a few months back. Thank you!
Post Reply

Return to “Scripting”