Removing or Despawning (by killing them) NPCs cause remaining NPC to glitch while they walk #998

GomaTerzu opened this Issue Dec 1, 2016 · 7 comments


None yet

3 participants


I have this simple denizen script. Every NPC with the flag "Soldat" walks randomly around with the "walk" command.

But, if I kill one NPC and it despawns or if I select one NPC and remove it completely remaining NPC that are currently walking, glitch together to a norht-west positon.

This causes some of them even dropping through the ground. I recorded a small gif for that:

There are no errors in the denizen debug. I talked with mcmonkey about it and he told me to post it here.

This also causes errors like this when citizens tries to save. Relaoding or restarting fixxes it.

It sometimes even visually duplicates the glitched out NPC with no armor and movement. They also can't be damaged.

I can select those "ghosts" but when I try to remove them I get this

This alltogether sometimes fucks up permanently (beyond repair through restarting) and I have to stop the server and remove the NPCs manually in the config


Last part is fixed by #996

fullwall commented Dec 2, 2016

The error portion should be fixed in latest build.

fullwall commented Dec 2, 2016

Finding it hard to reproduce the bugged pathing part.


Hey fullwall. First thing I noticed is that the errors in my log are gone. No matter if the NPC glitched out, they don't procude errors on /citizens save.

But now a new behaviour appeared. Once the NPC glitches out I check for their coordinates with a simple denizen command <npc.location> and it says the correct coordinates the NPC should normally be. But if I teleport to the NPC with /npc tp I get in a spot where all my coordinates say NaN.

If I teleport to the location the denizen tag tells me I can briefly see the npc and then it disappears.

But I can just teleport him with /npc tphere and he works fine again (at best he should actually be at the position it tells mehe is without having to "rescue" him 😄 )

Ok now the part with reproducing my problem that got me in this whole situation. I actually forgot to just add the script after the first sentence. Sorry about that.

Just build a wall (so they don't run away), start the loop, create some of them (command in the paste) and kill them with a sword for example). Now you should see them glitching together. after one or two kills

fullwall commented Dec 4, 2016 edited

Can you try disabling gravity (/npc gravity)? Also what's your Citizens config?


This is my config

If I disable Gravity the denizen walk command does not work anymore and the NPC won't move anymore.


fullwall, mcmonkey - after days of trying I finally found a way to deal with this issue via script and it was kind of simple all along. I somehow may have a clue why it happens. Your suggestion fullwall to use the gravity command brought me to this

When I made /npc gravity I noticed that some NPC still walked a few steps and even made turns. This should definitly not happen so I noticed that the walk command for evey NPC is probbaly not finished and they kind of build up a queue of not finished walk commands and this may cause the issue. I have no idea why it affects other NPC on their death or why they fall through the ground but now I made a script where I use walk more carefully and stop it even everytime before I start it again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment