CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.54k stars 4.16k forks source link

Killing one character in a world with multiple characters breaks followers for the other character #67750

Closed Karol1223 closed 1 month ago

Karol1223 commented 1 year ago

Describe the bug

I had a world where, months ago, I accidentally created a random character. Today, after all these months, I gathered up the courage to have that character killed off because what could it break, right? Well it was wise to make a save backup.

When I killed that character off, I got the "stories" (or whatever they were called, truth be told I didn't read them since the character was a throwaway regardless) for factions I never met as that character... including an NPC follower of my second character of that world. I then chose NOT to continue as one of my NPC followers because... well, that character that died didn't have any.

Upon loading back as my normal other character, I checked and... the NPC follower is broken. She has the dialogue menu of a follower from my faction, I can give her commands... she just won't listen because she is Neutral, not part of my faction. Debug mind controlling her didn't work either. I believe she is performing the last task assigned to her which was guarding position, but I can't verify that.

Attach save file

Two this time! I'll throw in the backup save as well, just in case it's important.

Mainsave-trimmed.tar.gz - this is the savefile after the events described above

Mainsave-trimmed.tar.gz - this is the backup save prior to killing off the spare character (Ed Dobson)

Steps to reproduce

IF TRYING TO ONLY CHECK NPC BEHAVIOUR

  1. Load up the first attached save, hop on in and look at Darlena Hong
  2. Play around with what's going on there all you want. The world's your oyster. I personally would try talking with her and debug mind controlling. Didn't work for me.

IF TRYING TO CHECK THE ENTIRE PROCESS

  1. Load up the second attached save, hop on in as Ed Dobson
  2. Debug damage the head or torso past 90 damage, walk around a little for it to set in
  3. Watch as it says the "faction stories", or whatever. Note: none of those were met as this character in the first place
  4. Choose "no" when prompted to continue as one of your followers
  5. Load back in as Karol1223, repeat the first set of instructions to check NPC behaviour

Expected behavior

NPCs should not be shared across multiple characters. Neither should faction knowledge.

Screenshots

No response

Versions and configuration

Additional context

No response

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not bump or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.

Inglonias commented 9 months ago

I take it that rendering this bug irrelevant by disallowing multiple characters in the same world at the same time is a bad idea? I recall reading somewhere that we wanted to discourage that in the past, but I may be misremembering.

I-am-Erk commented 6 months ago

I'd be open to fixing it by disallowing, or at least giving a warning about, multiple characters in the same world, now that we have switch to follower on death.

I-am-Erk commented 6 months ago

Reviewed with Kevin on discord. I think the answer here is to disable creation of characters in a world that has living characters.

if desired, it would be OK to have an external option to allow this function, but it's not necessary to add that (and I'm not sure it's better). This should be a very easy fix if someone is feeling motivated

github-actions[bot] commented 5 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not bump or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.

XygenSS commented 5 months ago

/confirmed

Downloaded second save, load the other character, QQ, load Karol, observed follower is broken.

Steps taken to independantly reproduce:

  1. Teleport to specific overmap coordinates 0,0
  2. Quick setup, spawn NPC, make them obey.
  3. Save and quit. Create new character on the same world
  4. Repeat step 1
  5. Move around to break lines of sight until the NPC you spawned on step 2 becomes visible
  6. Observe that the NPC is incorrectly allied to your new character and responds to commands.
  7. QQ and return to your original character.
  8. Observe that the NPC is marked as neutral and does not obey commands and steals your items. Exchanging items with them will ask for currency. They are unresponsive until you tell them that you're leaving, then recruit them once again. In addition, they have a new random quest available.

If you follow the steps 1~6, but kill the original character instead, the NPC correctly becomes neutral to your new character.

In addition, dying and then savescumming (by closing the game before you tab through all of your post-death screens) will also neutralize your followers.

RenechCDDA commented 4 months ago

So it seems it only breaks followers sometimes. It appears that it's wiping data about "your followers" for some reason, maybe some dead-faction cleanup function that's aimed wrong.

Here's save data from a test I ran where I wasn't able to get this bug to occur. (I believe this data is from the dead avatar's half of the world, so I rolled 50/50 basically)

Notice that all references to "your followers" have been wiped out. All the items have reverted ownership.

image

...and if we keep looking we can see the NPC's faction has been reverted to no_faction. Hm!

image

But part of the reason we're here is that it's storing the data together, instead of separately.

image

This isn't necessarily a problem, as data that is used for both characters can be shared... but if not properly delineated, this sort of mistake can happen. I don't think it's in scope to separate these, but just pointing it out for the benefit of other readers/future contributors.

RenechCDDA commented 4 months ago

hm yep right there in do_turn(), it calls cleanup_at_end() which calls game::reset_npc_dispositions() and specifically does this, to your followers and only your followers.

The commit is located here but I'm not finding an associated PR.

RenechCDDA commented 4 months ago

OK so the problem is that ed dobson is loading both avatar's followers list.

Here's Ed Dobson (yes I wrote a new window for this don't @ me): image

If I teleport all the way over to Darlena Hong, she acts as if she's a follower of Ed! This is not right, and Ed's save file has an empty follower list: "followers": [ ],