mcmonkeyprojects / Sentinel

Combat NPCs for Spigot!
MIT License
165 stars 85 forks source link

Unstable spawnpoint #260

Closed Ferocimo closed 6 years ago

Ferocimo commented 6 years ago

Versions : http://www.noelshack.com/2018-35-7-1535879690-2018-09-02-11-14-21.png

Hello,

Currently, it seems that when a Sentinel dies somewhere, it will respawn where it died. The /sentinel spawnpoint therefore seems to only has an effet when restarting (not tested though). Because of that, on our server many guards and various sentinels are scattered through the dungeons after a player has killed them. It's really messy.

It would be nice to be able to really control the exact respawn location of a Sentinel, so that, in the way of every RPG, once a mob respawns it respawns where it should be (for instance, for a guard, in front of the door it defends). For that goal it is also important that such a command saves not only the exact respawn location where the NPC is when you type it, but also the way in which the NPC's head is orientated when you perform the command.

Thank you.

mcmonkey4eva commented 6 years ago

The spawnpoint system works fine.

If it respawns where it died, it's likely you have a different respawn system affecting its own respawn prior to Sentinel doing it. Examples of other systems that tend to overlap are the health trait in Denizen conrolled by /npc health (use /npc health -s to disable), and the /npc respawn command in base Citizens (should be set to -1 to disable).

Ferocimo commented 6 years ago

We don't have Denizen and npc respawn is set to -1 for every NPC. We'll have a look at what can cause this then. We'll keep you updated.

mcmonkey4eva commented 6 years ago

If you can't figure out a cause, feel free to copy/paste the Citizens/saves.yml section for an NPC that is respawning improperly, I might be able to spot something that would cause it.

Ferocimo commented 6 years ago

Ok so, after extensive testing, it appears I was partly wrong.

First of all, respawn after death DOES work properly. But I suspect that, if some Sentinels die away from their respawn location, and the server is restarted BEFORE they respawn, they will spawn at their death location after restart. But if they are killed again after that, they will respawn at their correct respawn location.

It's still an issue though, because the first person to enter a dungeon after a restart occured while the sentinels were still dead, will find the NPCs scattered everywhere.

mcmonkey4eva commented 6 years ago

uh... can you kill an NPC, stop the server, then open the saves file mentioned above and pastebin that NPC's data?

Ferocimo commented 6 years ago

Here : https://pastebin.com/dHaDaYNR

mcmonkey4eva commented 6 years ago

It says: spawned: true so it will spawn it immediately on join wherever it's at. I guess it's not properly tracking that it was no longer spawned? 0.o

Ferocimo commented 6 years ago

You're right actually, it seems to be exactly that. I switched every "spawned:" to false and it now works correctly. Do you know what is this option for ?

mcmonkey4eva commented 6 years ago

That indicates whether the NPC was spawned (or dead) at time of save. My guess is that's not being appropriately updated. That's likely a Citizens issue though I'll have to look through how that's normally updated.

Ferocimo commented 6 years ago

Okay. Well as far as we are concerned the issue is fixed, so I'm closing. Thank you for your help !

mcmonkey4eva commented 6 years ago

I looked through how it works a bit, and changed it so it should respawn at the correct location even if respawned by something other than Sentinel, which should make this much less of an issue in general.