Build #140(x64): Guard hostility persists across play session [RESOLVED]

Locked
ifkopifko
Posts: 195
Joined: Thu Apr 02, 2015 9:03 am

Build #140(x64): Guard hostility persists across play session [RESOLVED]

Post by ifkopifko »

Messing around with guards I noticed that when I make guards hostile, after loading a save from before my vile actions, present guards are still hostile (they are not spawned in numbers though).

R.D.
Posts: 379
Joined: Fri Oct 07, 2016 10:41 am

Re: Build #140(x64): Guard hostility persists across play session

Post by R.D. »

I can't reproduce normally in towns, but I had a hunch, and I think I know what happened.

Probably you killed a townsperson with a ranged weapon while standing just outside of town to make the guards appear, right? It seems that in such a case the guards aren't cleared if you then load a game in the same location.

If guards spawn when you're not in a location (*You are entering --* appears), they aren't assigned a parent.
Interkarma, I copied existing code for the setting of parents when writing the guard spawning, so this same issue may affect other enemy spawns when they happen outside the bounds of a location.

ifkopifko
Posts: 195
Joined: Thu Apr 02, 2015 9:03 am

Re: Build #140(x64): Guard hostility persists across play session

Post by ifkopifko »

Sorry for not testing thoroughly. Yes, I killed a townsperson with a sword while standing outside of city walls.
Basically, went like this: I load a save (the one attached here: https://forums.dfworkshop.net/viewtopic.php?f=24&t=1618 ), kill a few citizens outside of city walls (but still "inside the location" as I understand it, because the automap is available), then I ran away from the horde of guards past the location border (no automap). Afterwards I reloaded the same savegame, so yes, the same location. Met a guard and he was hostile.

P.S.: It seems like it does not happen if I do not run away from the location, but reload right away.

EDIT: Hm, I can not reproduce it 100%. Will try to investigate a bit more...

EDIT2: Indeed it seems that the distance from "location" matters. If I kill people near the walls, the problem does not occur. If I do it further away (but still well within reach of "automap" - I hope you know what I'm talking about), then it does happen every time.

R.D.
Posts: 379
Joined: Fri Oct 07, 2016 10:41 am

Re: Build #140(x64): Guard hostility persists across play session

Post by R.D. »

Same thing happens with enemies that spawn while resting (and probably enemies that spawn under any circumstances) when you are outside a location.

Also these enemies (unlike ones that spawn in a location) will not be cleaned up when you enter a building. (You'll get the "enemies nearby" message if you try to rest.)

User avatar
Interkarma
Posts: 7242
Joined: Sun Mar 22, 2015 1:51 am

Re: Build #140(x64): Guard hostility persists across play session

Post by Interkarma »

Spawned enemies are now correctly parented and will be removed when reloading scene.

Locked