Enemy active sound not playing

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
JtoTheB
Posts: 32
Joined: Sat Aug 09, 2025 9:46 am
Operating System Version (Optional): Windows 11
Location: New Jersey

Enemy active sound not playing

Post by JtoTheB »

I'm not entirely sure on what i'm doing wrong, but i'm currently coding an NPC that goes off of the peasant's base if you get what I mean. Is there something I'm missing here, or is this just not possible?

Code: Select all

ACTOR Civillian : Peasant 7827
{
 Health 150
  PainChance 200
  Speed 8
  Radius 20
  Height 56
  Monster
  +NEVERTARGET
  -COUNTKILL
  +NOSPLASHALERT
  +FLOORCLIP
  +JUSTHIT
  MinMissileChance 150
  MaxStepHeight 16
  MaxDropoffHeight 32
  SeeSound "peasant/sight"
  AttackSound "peasant/attack"
  PainSound "peasant/pain"
  DeathSound "peasant/death"
  ActiveSound "peasant/act"
  HitObituary "%o somehow died to a civillian's weak ass punch."
  States
  {
  Spawn:
    PEAS A 10 A_Look2
    Loop
  See:
    PEAS AABBCCDD 5 A_Wander
    Goto Spawn
  Melee:
    PEAS E 10 A_FaceTarget
    PEAS F 8 A_CustomMeleeAttack(2*random[PeasantAttack](1, 5)+2)
    PEAS E 8
    Goto See
  Pain:
    PEAS O 3
    PEAS O 3 A_Pain
    Goto Melee
  Wound:
    PEAS G 5
    PEAS H 10 A_GetHurt
    PEAS I 6
    Goto Wound+1
  Death:
    PEAS G 5
    PEAS H 5 A_Scream
    PEAS I 6
    PEAS J 5 A_NoBlocking
    PEAS K 5
    PEAS L 6
    PEAS M 8
    PEAS N 1400
    GIBS U 5
    GIBS V 1400
    Stop
  XDeath:
    GIBS M 5 A_TossGib
    GIBS N 5 A_XScream
    GIBS O 5 A_NoBlocking
    GIBS PQRS 4 A_TossGib
    Goto Death+8
  }
}
User avatar
Enjay
 
 
Posts: 27074
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Enemy active sound not playing

Post by Enjay »

I could be wrong here but the active sound is usually played when an enemy is chasing its target using A_Chase. Your NPC uses A_Wander and I'm not sure if that supports playing the active sound. If it doesn't, you could change your code to include a chance of jumping to a state that plays the sound randomly using A_StartSound.
User avatar
JtoTheB
Posts: 32
Joined: Sat Aug 09, 2025 9:46 am
Operating System Version (Optional): Windows 11
Location: New Jersey

Re: Enemy active sound not playing

Post by JtoTheB »

I'll be sure to try that, and i'll give a follow up on the outcome.
User avatar
JtoTheB
Posts: 32
Joined: Sat Aug 09, 2025 9:46 am
Operating System Version (Optional): Windows 11
Location: New Jersey

Re: Enemy active sound not playing

Post by JtoTheB »

It ended up working just fine, thanks a lot enjay!
Post Reply

Return to “Scripting”