Value saved in Resource File Overwriting Value Added in Init

Godot Version



I’m working on an inventory system for an RPM. I currently have an armor class that provides a bonus to AC, as well as an array of status effects it can add to the user. The idea is most armor will increase AC, but it might also want to do something custom, like increase strength or give a bonus against fire damage, and that stuff would go into status effects.

While thinking about this I thought it might be easier if I added the bonus to AC to status effects as well, because it would give me more room to tinker with armor properties without having to touch other classes. The problem I’m having is when I added the status effect in _init it get overwritten when reading from the resource file where the status effect array is empty.

Is there a way to add code that will fire just after the value in the file is read? Or is there another way to do this? I prefer to add the status effect via code, if at all possible.

I don’t really know what you are trying to do and you didn’t provide any code, but can’t you just check if the status effect array is empty and not overwrite the status effect in _init?