A_KlaxonBlare woes - coders needed

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
Skippy
Posts: 695
Joined: Sun Nov 20, 2005 9:57 am
Location: Belfast, NI

A_KlaxonBlare woes - coders needed

Post by Skippy »

I've been trying to figure out this function for ages now and I have no real idea how to use it properly. The Wiki page is no real help, so hopefully one of the devs or a friendly code monkey can assist me.

Form the (very) little I've gleaned from the source code, A_KlaxonBlare checks the ReactionTime of the calling actor and reduces it by one.
  • If the resulting value is over 50, it plays the sound 'misc/alarm'.
  • If it's equal to 2, it fires a 'null' noise alert that theoretically clears the sound target of any actors in the vicinity (I'm not quite sure how this is calculated, but it's not just same-sector).
  • If it's less than zero, it listens (once?) for a noisy player (A_TurretLook), resets the calling actor's reaction time to the default, clears the calling actor's target, and puts the calling actor into its Spawn state.
Assuming my reading of it is right (and there's a high chance it isn't), the function doesn't appear to work correctly. I set up a test level in Strife with a single Acolyte in a room with a KlaxonWarningLight. I went into the adjacent room and fired my gun. The klaxon went off, the Acolyte was alerted - so far, so predictable. I let the warning light run down (it has an initial ReactionTime of 60 so the klaxon only sounds ten times at the start) until it reset itself. The Acolyte, however, stayed alert, and fired on me whenever I entered his line of sight.

Is this a bug, or have I completely misinterpreted the function?
User avatar
XutaWoo
Posts: 4005
Joined: Sat Dec 30, 2006 4:25 pm
Location: beautiful hills of those who are friends
Contact:

Post by XutaWoo »

I think it's the Acolyte's behavior, not the alarm, because it still sees you a target. Infact, I think Acolytes are only alerted by the alarm, and unaffected by the target wipe.
User avatar
Skippy
Posts: 695
Joined: Sun Nov 20, 2005 9:57 am
Location: Belfast, NI

Post by Skippy »

Thanks for replying XutaWoo. I've since tried the test with a standard pistol Trooper in Doom. Exactly the same procedure - I have the klaxon and the enemy in one room, myself in an adjacent room with a small tunnel between them so the sound carries (there's no line of sight between myself and the enemy at any point). I have a camera set up so I can observe the enemy from my room. I fire the gun, the kalxon goes off, the enemy is alerted, but the kalxon counts right down to zero and shuts off again, leaving the Trooper still on alert and A_Chaseing around.

Somethign struck me as odd in the A_KlaxonBlare source code, though - the 'null alert' it fires as it shuts down clears an actor field called 'LastHeard'. I wonder if this means that the actor has two 'target' properties - one for the last actor it heard make a noise, and one for the last target it had LOS with. That doesn't make sense, though, as the Trooper in my test has never seen the player.

Interestingly, I tried exactly the same thing with a new Decorate actor in place of the klaxon, that called A_ClearSoundTarget in its Spawn state (and used A_KlaxonBlare to count down the ReactionTime as before). But it makes no difference. I'm thinking these are both bugs, or at least unintended behaviour, and I shall report them as such.
Locked

Return to “Editing (Archive)”