Quest - Proving Allegiance (409) - Lillith Nefara despawning
Describe the bug When doing the quest Proving Allegiance, Lillith Nefara despawns after 5-10 seconds and the player character gets stuck in combat until relog.
Steps to reproduce
- Start the quest
- Pick up a candle from the box
- Spawn Lillith Nefara, get in combat with her but don't kill her. She should respawn within 5-10 seconds.
Expected behavior She shouldn't respawn and players should be able to kill her.
I also experienced this bug. If you kill her within the window she's spawned you do get quest completion it's just that if you take too long she will despawn.
Experimented with this a bit on my server. The script that summons her sets her to despawn after 18 seconds with the despawn type being "Timer OOC or Disappear". I changed this to "Timer OOC" to be absolutely sure whether it was an issue with the SQL command or not, since under this command her despawn timer should only start when she's out of combat, resetting when she enters combat. Sure enough, she despawned despite being in combat, so this appears to be an issue with the command itself rather than the quest script.
This appears to be an issue with the SQL command itself, tested with NPCs created through the Summon Creature command and they all despawn after a few seconds, although it seems to happen while they're in combat. I'll open a bug report about this.
This appears to be an issue with the SQL command itself, tested with NPCs created through the Summon Creature command and they all despawn after a few seconds, although it seems to happen while they're in combat. I'll open a bug report about this.
This vanishing act also happens with the snakes created by snakebloom, snakebloom snakes 6195. I wouldn't be surprised if fixing the underlying SQL/spawn mechanics would fix their half-life. (They vanish nearly instantly but should last around 30 seconds or so)
I may have found a solution, just needs further testing.
Okay, I think I found the root of the issue. Script-summoned creatures have a despawn delay (in ms) which, when exceeded, causes them to despawn, with the NPC staying up forever if the despawn delay is set to 0. However, this timer is supposed to work in unison with the other conditions (Timer, Timer OOC, Timer after Death, etc) and is not meant to run independently. However, an issue with its code causes it to run independently of these conditions, making it so that it will always despawn after the set time threshold which starts as soon as it spawns. This issue seems to apply to the other conditions as well, as newly spawned NPCs will never target anything even if the proper parameters for them to target a player/NPC are set. What this means for Lillith is, she has a Timer OOC of 18000 ms, i.e. a despawn delay of 18000 ms with the condition of Timer OOC. Because the Timer OOC condition is set, this timer is supposed to stop when she enters combat and restart when she leaves combat. However, because the despawn delay is ignoring the Timer OOC condition's presence and running as soon as she spawns, this causes her to despawn shortly after spawning.
SCRIPT_COMMAND_TEMP_SUMMON_CREATURE does not handle despawn type atm, as seen in code:
For a full list of the different despawn types that should be implemented: 1 = Timer OOC or Disappear. Despawn timer plays when the creature is out-of-combat, or if the creature disappears (which I assume is despawn but can still respawn, or if the NPC is unloaded.) Despawn timer pauses when the creature is in combat and restarts at 0 when the creature leaves combat. 2 = Timer OOC or Death. Despawn timer plays when the creature is out-of-combat, or if the creature dies. Despawn timer pauses when the creature is in combat and restarts at 0 when the creature leaves combat. 3 = Timer. Despawn timer plays regardless of the creature's state. 4 = Timer OOC. Despawn timer plays when the creature is out-of-combat. Despawn timer pauses when the creature is in combat and restarts at 0 when the creature leaves combat. 5 = On Death. Despawn timer plays when the creature dies. 6 = Timer after Death. Despawn timer plays after the creature dies. 7 = On Corpse Despawn. Despawn timer plays when the creature's body despawns. 8 = Manual. Not entirely sure what this one means, and no NPC scripts use it. It may be related to the NPC's inherit despawn timer, not entirely sure. 9 = Timer or Disappear. Despawn timer plays immediately when the creature is spawned in, or if the creature disappears (which I assume is despawn but can still respawn, or if the NPC is unloaded.) 10 = Timer OOC or Death. Despawn timer plays immediately when the creature is spawned in, or if the creature dies.
Names were taken from ScriptEditor, which also refers to the despawn timer as "despawn delay". We should open an offiical bug report about this, as to bring more awareness to the situation.