Quick Reply
Search this Thread
Field Researcher
Original Poster
#1 Old 8th Dec 2024 at 1:13 AM
Default Solution for buff replacement bug
I've been looking for the cause of this for a long time and finally got somewhere, wanted to log it in case it's useful for others.

When a buff is replaced by editing its entry of BuffDictionary, it works but all the strings disappear, and I found while testing a mod recently that whatever is wrong there can become more than a cosmetic issue in some cases - it seemed like one of my replaced buffs wasn't getting removed properly on timeout, and was preventing the buff manager from updating any buffs' time remaining.

Turns out those problems only happen in cases where the new buff was added using the original buff's ID (so, if you replaced the Cold Shower buff, any code that adds BuffName.ColdShower to a sim would give you the string-less buff bug, but adding (BuffNames)ColdShower-Replacement-Hex would be fine), and it's because in those cases BuffManager.AddBuff tries to use the original buff's ID with the new buff and the mismatch messes up something.

I'm not sure where the problem is past that, but I've been able to solve it by core modding the last line of BuffManager.AddBuff from
Code:
return AddBuff(value, guid, moodValue, timeoutLength, timeoutPaused, axisEffected, origin, considerDelayTimer, travelReaddition: false);
to
Code:
return AddBuff(value, value.mBuffGuid, moodValue, timeoutLength, timeoutPaused, axisEffected, origin, considerDelayTimer, travelReaddition: false);
to ensure the correct ID is always used.
Back to top