Lost soul target amnesia
From DoomWiki.org
A lost soul that targets a monster will do so only until it makes an attack against the monster. After that, the target is apparently forgotten. Since the lost soul always goes into its pain state when damaged, it will target its opponent again once said opponent retaliates successfully, although it can easily be distracted by other attackers.
When attacking a player, lost souls retain it as their target as long as the player makes at least one attack that alerts them in their area. If the player does not make such an attack, lost souls that lose sight of their target will stop chasing it. This is easy to test in Doom's E2M8: Tower of Babel by going to the outside area without attacking at all, and letting the lost souls charge at the player, but dodging them. These will strike the walls and stop chasing the player until they see or hear them. Using a weapon will awaken them, and from then on they will continue active, pursuing and attacking the player normally.
The following code in P_XYMovement sets the lost soul to its spawnstate after it hit a wall. A simple fix is to set it back to its seestate so it continues to hunt for its target. The spawnstate is when a monster waits in place until it gets a target (sees or hear the player). The seestate is when the monster has seen a target so it proceeds to hunt it.
if (!mo->momx && !mo->momy) { if (mo->flags & MF_SKULLFLY) { // the skull slammed into something mo->flags &= ~MF_SKULLFLY; mo->momx = mo->momy = mo->momz = 0; P_SetMobjState (mo, mo->info->spawnstate); } return; }
Of note is the fact that this code does not actually clear the lost soul's target: the lost soul continues to have its target set, but that in itself does not make it resume the chase. However, it does lead to a phenomenon whereby the lost soul will adjust its altitude closer to that of its target as the latter approaches it.