Page 1 of 1

Faction Member Changes "randomly"

Posted: Sun Sep 01, 2024 9:32 pm
by cptscrimshaw
Hi Tony!

I have an odd one for you. The faction member for a specific NPC (Bartholomew) changes when I change scenes - specifically from "Bartholomew" to "Sairyn." This does not happen with any other character from what I can tell. I think this has been a bug for a while, and I just didn't notice it because it doesn't really affect gameplay that much.

YT video:

I tried the following:
  • Deleting the FactionMember component on Bartholomew's prefab and in each scene and recreating them
  • Restoring the faction database from an old version from 4 months ago
  • Pounding my head against the desk after 3 hours (j/k)
Any ideas?

Thanks as always for your awesome support.

LH: 1.10.47

-Rick

Re: Faction Member Changes "randomly"

Posted: Sun Sep 01, 2024 10:06 pm
by Tony Li
Hi Rick,

The fact that it changes to Sairyn, who is faction member #0, suggests to me that maybe the Bartholomew FactionMember component's internal faction ID isn't set or isn't transferring over properly, and so the ID is defaulting to a non-initialized value of 0.

When you change scenes, are the other NPCs' factions correct?

Are there any errors or warnings in the Console window?

Are you using the save system to change scenes? If so, are you using a FactionMemberSaver component and/or FactionManagerSaver, or something else?

Re: Faction Member Changes "randomly"

Posted: Sun Sep 01, 2024 10:45 pm
by cptscrimshaw
Hey!

I was thinking something similar regarding the internal faction numbers, but couldn't figure it out.

To answer your questions:
  • When you change scenes, are the other NPCs' factions correct? Yes
  • Are there any errors or warnings in the Console window? No
  • Are you using the save system to change scenes? If so, are you using a FactionMemberSaver component and/or FactionManagerSaver, or something else? Yes, yes, yes.
Happy to look at additional things if you have more ideas; I imagine it's some weird nonsense that I've created. That said, there is no where in my code that changes someone's faction.

Thanks again!

Re: Faction Member Changes "randomly"

Posted: Mon Sep 02, 2024 8:35 am
by Tony Li
Hi,

At any time, please feel free to send another repro project to reproduction project to tony (at) pixelcrushers.com.

Does Bartholomew's faction go wrong when you save and load a game?

If you tick the SaveSystem and SavedGameDataStorer component's Debug checkboxes and then play and save in the Unity editor's play mode, it will log the save data to the Console window. Here's an example of the save data from Love/Hate's example scene:
Save System: Storing in PlayerPrefs key Save1: {"m_version":0,"m_sceneName":"LH Example with Save System","m_list":[
{"key":"factionManager","sceneIndex":-1,"data":"7,0,Player,0,0,0,0,0,1,Citizens,50,0,20,0,2,2,1,-50,1,1,100,2,Bandits,-50,20,-10,0,2,1,1,-50,2,1,100,3,Princess,80,-30,20,1,1,3,2,1,-70,5,1,-80,6,1,20,4,Cat Girl,10,20,30,1,1,0,5,Horn Girl,-80,50,0,1,2,1,3,1,-80,6,Pink Girl,-40,0,40,1,2,2,5,1,80,3,1,50,"},
{"key":"pink","sceneIndex":-1,"data":"6,0,0,0,0,0,"},
{"key":"princess","sceneIndex":-1,"data":"3,0,0,0,0,0,"},
{"key":"player","sceneIndex":-1,"data":"0,0,0,0,0,0,"},
{"key":"cat","sceneIndex":-1,"data":"4,0,0,0,0,0,"},
{"key":"horn","sceneIndex":-1,"data":"5,0,0,0,0,0,"}]}
I bolded the faction IDs in the save data above.

In the Faction Manager data, each character's faction ID appears before the faction name. For example, the Princess's faction ID is 3.

In the Faction Member data for each character, the ID is the first number in the "data" string. Above again the Princess's faction ID is 3.

Re: Faction Member Changes "randomly"

Posted: Mon Sep 02, 2024 10:49 am
by cptscrimshaw
Weird - I'm not seeing that info in the console window - do I have something wrong here?

https://ibb.co/BwZ9FQz

Re: Faction Member Changes "randomly"

Posted: Mon Sep 02, 2024 11:13 am
by Tony Li
It'll only log that info when you save a game, not when you change scenes.

Since you're using DiskSavedGameDataStorer, the line will start like this:

Save System: DiskSavedGameDataStorer - Saving (file path): {(data)}

Re: Faction Member Changes "randomly"

Posted: Mon Sep 02, 2024 2:22 pm
by cptscrimshaw
Here's the save data for the faction database:

FactionDatabaseData=\"44,0,Sairyn,10,10,10,10,10,10,10,10,0,6,1,1,0,35,4,1,0,5,6,1,0,0,5,1,0,40,2,1,0,60,8,1,0,60,10,Inn,0,0,0,0,0,0,0,0,0,10,11,1,0,0,26,1,0,0,25,1,0,0,24,1,0,0,27,1,0,0,13,1,0,0,23,1,0,0,5,1,0,0,6,1,0,0,4,1,0,0,11,Bards,0,0,0,0,0,0,0,0,0,10,26,1,-75,0,25,1,25,0,24,1,50,0,27,1,50,0,13,1,-50,0,23,1,-25,0,5,1,50,0,6,1,50,0,4,1,25,0,32,1,25,0,26,Clerics,0,0,0,0,0,0,0,0,0,10,11,1,-25,0,25,1,0,0,24,1,-75,0,27,1,-25,0,13,1,-75,0,23,1,50,0,5,1,50,0,6,1,50,0,4,1,-25,0,32,1,-75,0,25,Druids,0,0,0,0,0,0,0,0,0,10,11,1,25,0,26,1,-75,0,24,1,25,0,27,1,25,0,13,1,-75,0,23,1,-25,0,5,1,-50,0,6,1,-50,0,4,1,75,0,32,1,-25,0,24,Fighters,0,0,0,0,0,0,0,0,0,10,11,1,50,0,26,1,-25,0,25,1,25,0,27,1,25,0,13,1,-50,0,23,1,0,0,5,1,25,0,6,1,-25,0,4,1,0,0,32,1,0,0,27,Rogues,0,0,0,0,0,0,0,0,0,10,11,1,25,0,26,1,-50,0,25,1,0,0,24,1,25,0,13,1,-25,0,23,1,-75,0,5,1,50,0,6,1,-50,0,4,1,25,0,32,1,25,0,13,Wizards,0,0,0,0,0,0,0,0,0,10,11,1,-25,0,26,1,-75,0,25,1,-75,0,24,1,-25,0,27,1,-25,0,23,1,25,0,5,1,50,0,6,1,25,0,4,1,0,0,32,1,25,0,23,Guards,0,0,0,0,0,0,0,0,0,10,11,1,50,0,26,1,0,0,25,1,0,0,24,1,50,0,27,1,-75,0,13,1,-50,0,5,1,0,0,6,1,50,0,4,1,-25,0,32,1,0,0,5,Merchant Guild,50.1,45.4,49,50,50,50,50,50,0,10,11,1,50,0,26,1,0,0,25,1,-50,0,24,1,0,0,27,1,-75,0,13,1,50,0,23,1,0,0,6,1,75,0,4,1,-50,0,32,1,25,0,6,Royalty,0,0,0,0,0,0,0,0,0,10,11,1,50,0,26,1,50,0,25,1,0,0,24,1,0,0,27,1,-75,0,13,1,25,0,23,1,0,0,5,1,75,0,4,1,-50,0,32,1,25,0,4,Swamp Hermits,-43.6,-33,0,-14.5,17.8,19.1,-70,-44.2,0,11,0,1,11,33,11,1,75,33,26,1,-25,33,25,1,50,33,24,1,0,33,27,1,50,33,13,1,-25,33,23,1,-50,33,5,1,-50,33,6,1,-75,33,32,1,0,33,32,Scholars,0,0,0,0,0,0,0,0,0,11,0,1,0,0,11,1,25,0,26,1,-75,0,25,1,-25,0,24,1,0,0,27,1,25,0,13,1,25,0,23,1,0,0,5,1,50,0,6,1,25,0,4,1,-25,0,15,Bartholomew,0,0,0,0,0,0,0,0,2,5,10,1,0,1,0,0,40,Chives,0,0,0,0,0,0,0,0,1,10,1,0,1,0,0,9,Foimoisha,0,0,0,0,0,0,0,0,1,10,1,0,1,0,0,1,Hans,0,0,0,0,0,0,0,0,1,4,1,0,1,5,0,2,Kendall,0,0,0,0,0,0,0,0,1,4,1,0,1,0,0,7,Artemis,0,0,0,0,0,0,0,0,1,25,1,0,1,0,0,8,Arthur,75,75,75,75,75,75,75,75,1,5,1,0,1,0,0,14,Peggy,0,0,0,0,0,0,0,0,1,27,1,0,1,0,0,16,Eric,0,0,0,0,0,0,0,0,1,4,1,0,1,0,0,17,Anna,0,0,0,0,0,0,0,0,1,32,1,0,1,0,0,18,Dave,0,0,0,0,0,0,0,0,1,13,1,0,1,0,0,19,Forfud,0,0,0,0,0,0,0,0,1,24,1,0,1,0,0,20,Jane,0,0,0,0,0,0,0,0,1,24,1,0,1,0,0,12,Ysabella,0,-25,25,0,50,-25,75,0,1,11,1,0,1,0,0,21,Porcupine,0,0,0,0,0,0,0,0,1,27,0,28,Etzel,0,0,0,0,0,0,0,0,1,5,0,29,Callidora,0,0,0,0,0,0,0,0,1,27,1,0,1,0,0,30,Hayrettin,60,30,20,80,80,20,80,50,1,27,1,0,1,0,0,31,Xazisvyar,75,50,50,25,50,50,50,0,1,24,1,0,1,0,0,33,Grendel,0,0,0,0,0,0,0,0,1,5,1,0,1,0,0,34,Taylor,0,0,0,0,0,0,0,0,1,5,1,0,1,0,0,35,Kristen,0,0,0,0,0,0,0,0,1,5,1,0,1,0,0,36,Tobias,0,0,0,0,0,0,0,0,1,25,1,0,1,0,0,37,Ferdinand,0,0,0,0,0,0,0,0,1,5,1,0,1,0,0,38,Daria,0,0,0,0,0,0,0,0,1,24,1,0,1,0,0,39,CardKids,0,0,0,0,0,0,0,0,1,27,1,0,1,0,0,41,DreamSairyn,0,0,0,0,0,0,0,0,1,10,1,0,1,0,0,42,Makena,0,0,0,0,0,0,0,0,0,1,0,1,0,0,43,Nomad,0,0,0,0,0,0,0,0,0,1,0,1,0,0,44,Tome,0,0,0,0,0,0,0,0,1,32,0,45,Glitz,0,0,0,0,0,0,0,0,1,27,0,\"

Re: Faction Member Changes "randomly"

Posted: Mon Sep 02, 2024 2:35 pm
by Tony Li
Hi,

I see "...,15,Bartholomew,0,0,...", so it should be setting Bartholomew's faction to 15, which I presume is his faction. At the least, it's not faction 0 (Sairyn). Strange that it's only Bartholomew. Is there anything unique about his GameObject? Any unique scripts?