Npc turret ceiling/fixes: Difference between revisions
(A whole page dedicated to npc_turret_ceiling fixes) |
|||
(4 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
npc_turret_ceiling contains various bugs. This is a list of many of these bugs and how to fix them. | {{ent|npc_turret_ceiling}} contains various bugs. This is a list of many of these bugs and how to fix them. | ||
Line 8: | Line 8: | ||
== No shooting sound == | == No shooting sound == | ||
This is caused by a missing soundscript called <code>NPC_CeilingTurret.ShotSounds</code>. Just place | This is caused by a missing soundscript called <code>NPC_CeilingTurret.ShotSounds</code>, and <code>NPC_CeilingTurret.Shoot</code> (leftover during development/beta) is present instead. Just place the following text in a soundscript file (e.g. "npc_sounds_turret.txt") to make ceiling turrets use the shooting sounds used by all other turrets: | ||
<pre> | <pre> | ||
Line 29: | Line 29: | ||
== Muzzle flash only plays once / no shot recoil == | == Muzzle flash only plays once / no shot recoil == | ||
This is caused by the fact ceiling turrets don't reset their activity after playing their "shoot" animation. This means the turret is stuck at the end of its shooting activity while it's firing, which is also why the muzzle flash plays only once. | |||
There's two ways of fixing this. Thea easy fix is to just add <code>Loop</code> to the firing sequence.<br> | |||
[https://www.youtube.com/watch?v=SgA2VFIY9OA Here's] a video discussing how this thing happens to work, and also showcases even more seemingly unfixable issues related to how the model is being used by the game. | |||
The second way of fixing it is via the game code, in which you should navigate to where the shooting activities, which are set in this part of <code>CNPC_CeilingTurret::ActiveThink()</code>: | |||
<source lang=cpp> | <source lang=cpp> | ||
Line 43: | Line 47: | ||
</source> | </source> | ||
Place <code>ResetActivity()</code> right above the spawnflag check and the | Place <code>ResetActivity()</code> right above the spawnflag check and the reset should allow the activity to play for each shot, therefore firing the muzzle flashes on each shot. The turret's barrel will also recoil when firing. | ||
== Not firing at enemies directly underneath turret == | == Not firing at enemies directly underneath turret == | ||
This is caused by the ceiling turret's | This is caused by the ceiling turret's <code>m_flFieldOfView</code> being set to <code>0.0f</code>, equivalent to 90 degrees. Actually, the turret's model is fully capable of rotating 360 degrees and lowering <code>m_flFieldOfView</code>, or at least making it mapper-modifiable through [[Data Descriptions|DEFINE_KEYFIELD]], should expand the turret's vision to the point in which it could shoot downwards. Keep in mind this expands its horizontal FOV as well. | ||
== | == Health is too high == | ||
In CNPC_CeilingTurret::Spawn(), you can find this: | In CNPC_CeilingTurret::Spawn(), you can find this: | ||
Line 63: | Line 67: | ||
m_iHealth = 1000; | m_iHealth = 1000; | ||
</source> | </source> | ||
[[Category:Bug fixes]] |
Latest revision as of 07:08, 3 June 2025
npc_turret_ceiling contains various bugs. This is a list of many of these bugs and how to fix them.
Looping engine sound lingering after death/removal

StopSound()
by overriding StopLoopingSounds()
. Haven't fully looked into this yet.No shooting sound
This is caused by a missing soundscript called NPC_CeilingTurret.ShotSounds
, and NPC_CeilingTurret.Shoot
(leftover during development/beta) is present instead. Just place the following text in a soundscript file (e.g. "npc_sounds_turret.txt") to make ceiling turrets use the shooting sounds used by all other turrets:
"NPC_CeilingTurret.ShotSounds" { "channel" "CHAN_WEAPON" "volume" "VOL_NORM" "pitch" "PITCH_NORM" "soundlevel" "SNDLVL_GUNFIRE" "rndwave" { "wave" "^npc/turret_floor/shoot1.wav" "wave" "^npc/turret_floor/shoot2.wav" "wave" "^npc/turret_floor/shoot3.wav" } }
Muzzle flash only plays once / no shot recoil
This is caused by the fact ceiling turrets don't reset their activity after playing their "shoot" animation. This means the turret is stuck at the end of its shooting activity while it's firing, which is also why the muzzle flash plays only once.
There's two ways of fixing this. Thea easy fix is to just add Loop
to the firing sequence.
Here's a video discussing how this thing happens to work, and also showcases even more seemingly unfixable issues related to how the model is being used by the game.
The second way of fixing it is via the game code, in which you should navigate to where the shooting activities, which are set in this part of CNPC_CeilingTurret::ActiveThink()
:
if ( m_spawnflags & SF_CEILING_TURRET_OUT_OF_AMMO )
{
SetActivity( (Activity) ACT_CEILING_TURRET_DRYFIRE );
}
else
{
SetActivity( (Activity) ACT_CEILING_TURRET_FIRE );
}
Place ResetActivity()
right above the spawnflag check and the reset should allow the activity to play for each shot, therefore firing the muzzle flashes on each shot. The turret's barrel will also recoil when firing.
Not firing at enemies directly underneath turret
This is caused by the ceiling turret's m_flFieldOfView
being set to 0.0f
, equivalent to 90 degrees. Actually, the turret's model is fully capable of rotating 360 degrees and lowering m_flFieldOfView
, or at least making it mapper-modifiable through DEFINE_KEYFIELD, should expand the turret's vision to the point in which it could shoot downwards. Keep in mind this expands its horizontal FOV as well.
Health is too high
In CNPC_CeilingTurret::Spawn(), you can find this:
m_iHealth = 1000;
You can either adjust it to your own liking or change it to this to make the health modifiable by the "health" keyvalue in Hammer:
if (m_iHealth == 0)
m_iHealth = 1000;