Posts: 226
Thanks: 2637 in 8 Posts
7 Achievements
Replacing a moodlet
Hi there!
What i'm trying to do is replacing a moodlet with one of my own. I tested my moodlet and it works in game. Now i want to replace an existing moodlet with my custom moodlet. I looked at the code for Puddingface's Enhanced Vampires mod and it is done there. However, when I try, it doesn't work.
Like in the vampires mod, I created a method to replace the buff and right now I am testing with the Strained moodlet:
Code:
private static void ReplaceBuffTest()
{
BuffManager.BuffDictionary.TryGetValue(0x4924F8700C4ED9E5, out BuffInstance buffInstance); //Moodlet Hex: Strained FNV64 = 0x4924F8700C4ED9E5
ulong key = Convert.ToUInt64("0x864E029DB24CCDC4", 16); //Hex of my custom moodlet
BuffManager.BuffDictionary.TryGetValue(key, out BuffInstance buffInstance2);
if (buffInstance != null && buffInstance2 != null)
{
BuffManager.BuffDictionary[0x4924F8700C4ED9E5] = buffInstance2.mBuff.CreateBuffInstance();
}
}
I am then calling the method in the OnWorldLoadFinishedHandler method:
Code:
public static void OnWorldLoadFinishedHandler(object sender, EventArgs e)
{
try
{
ReplaceBuffTest();
//More code........
I am not sure what I'm doing wrong, so if someone knows, please let me know.