A bug in the animation event system that prevented NPC variant sounds from playing
Star Wars Jedi Knight: Jedi Academy released in September 2003. The game includes an animation event system that triggers sounds at specific animation frames - things like stormtrooper armor sounds on death, or protocol droid footsteps.
For certain NPC variants, these animation sounds weren't playing. The audio files existed in the game data, and the configuration files were set up correctly, but the sounds would be skipped at runtime for most NPC variants.
The animation event system loads sound definitions from config files like models/players/stormtrooper/animevents.cfg. When loaded, these events are tagged with a modelOnly identifier set to the model name (e.g., "stormtrooper").
At runtime, when deciding whether to play a sound, the code compared this tag against the NPC's NPC_type value. Here's the problem:
NPC variants share the same model but have different type names.
A "stcommander" uses the stormtrooper model, but its NPC_type is "stcommander" - not "stormtrooper". The comparison fails, and the sound is skipped.
The bug affected 15 NPC variants across 4 model types: stormtrooper commanders and officers, imperial protocol droids, dark jedi cultist variants, and reborn duelists.
| Model | Affected Variants | Missing Sounds |
|---|---|---|
| stormtrooper | stcommander, stofficer, stofficeralt, rockettrooper, rockettrooper_w | Death sounds (armor clatter) |
| protocol | protocol_imp | Walking sounds, death sounds |
| cultist | 7 variants (destroyer, drain, grip, lightning, saber, etc.) | Victory gesture |
| reborn_new | reborn_dual, reborn_staff | Victory gesture |
Click the buttons below to see (and hear) the difference. The OLD method shows the buggy behavior - variants are silent. The NEW method shows the fix - all NPCs play their sounds correctly.
Compares modelOnly="stormtrooper" against NPC_type
Compares modelOnly="stormtrooper" against filename="stormtrooper"
Compares modelOnly="protocol" against NPC_type
Compares modelOnly="protocol" against filename="protocol"
Compares modelOnly="cultist" against NPC_type
Compares modelOnly="cultist" against filename="cultist"
Compares modelOnly="reborn_new" against NPC_type
Compares modelOnly="reborn_new" against filename="reborn_new"
The fix changes the comparison to use the animation file set's filename instead of the NPC's type name. Since the filename is always the base model name (e.g., "stormtrooper"), it matches correctly regardless of which variant NPC is using that model.
View the fix: OpenJK Pull Request #1310
Jedi Knight: Jedi Academy releases with the bug present in the original code
Raven Software releases the source code. The OpenJK project begins maintaining an open-source version
Bug discovered and fix submitted to OpenJK