StateLabel variables change their value sometimes.

Thu Oct 08, 2020 7:26 am

Tested and reproduced on g4.5pre-205-gda4e791a3, but it doesn't seem to be unique to that version. No idea when exactly it got "broken".
This is one of those bugs that I cannot easily reproduce and it only happens after reloading a save game. It happens with the companion mod for Hideous Destructor (yeah, I know, the chances of this getting fixed just dropped down to practically none, but I'm reporting it anyway).

More details:
- The variables are assigned only once, here, so accidental assignment is completely out of the question.
- FollowerWeapon.Create() is called here and only once when the follower is created for the very first time when you start a new game, here.
- The last and only time this happened (to me), FireState somehow managed to get the value of ReloadState. I don't know how, I don't know why.
- Other people have reported the follower straight up disappearing, which I assume is because FireState's value is a non-existent state label in the actor. This is where it happens.

Sadly I am unable to give more information at the time, much less make a contained example. I'm still trying to reproduce this. I suspect it's because I changed the code a little between save games (in a completely unrelated part of the follower, mind you), but never before have I had something like this happen with any other variables. I don't know if the people who originally reported this to me have added/removed mods or changed the code between saving and loading their games.

Re: StateLabel variables change their value sometimes.

Sat Oct 10, 2020 5:37 am

It seems like this happens on saving and stays broken permanently. I still haven't found a way to reliably reproduce it, but it would appear that it's not necessarily affected by code changes. I suspect some sort of serialization issue.

Re: StateLabel variables change their value sometimes.

Sat Oct 17, 2020 2:17 am

At the moment StateLabels are not safely serializable, they are meant for transiently pass around a state name, so that some target actor can retrieve a real state from it (which can be stored persistently), but not for actually keeping it around.

Re: StateLabel variables change their value sometimes.

Sat Oct 17, 2020 2:50 am

Figured as much. Well I rewrote most of the code to avoid this issue so it's no longer a problem.