Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Field Researcher
Original Poster
#1 Old 21st Jun 2020 at 8:32 PM
Default Replace default moodlet with custom version - what will happen?
Now that I know how to make basic custom moodlets I'm about to go wild, I have so many ideas. The first one, extending on the mixed-feelings-about-pregnancy thing I was working on in my last thread: if I make a custom version of the pregnant buff that has no mood effect, and a write a function that detects the application of EA's pregnant buff and then immediately removes that buff and applies my neutral version, in what ways (if any) is that likely break things, if anyone knows? I'm planning to try this today if it doesn't take too long to set up, and some googling suggests it might be totally fine but I'm wondering if anyone knows of any specific bugs I should look for while testing. It seems like most if not all times that the pregnancy manager checks if a sim is pregnant, it does so by checking Sims3.Gameplay.CAS.SimDescription.IsPregnant, not by looking for the Pregnant buff; so I don't think removing that buff will confuse the manager, but I'm about to find out!

There's a mod by Arithmancer that changes the mood effect of the EA pregnant moodlet already, but I plan to change the durations of several other buffs as well and want to minimize the potential for conflicts, so I'm looking for another way to get the same effect.
Advertisement
Scholar
#2 Old 21st Jun 2020 at 9:24 PM
I have done a moodlet swap before. There are two ways that I know of.

First of all create your own moodlet with a script mod. Like you do for custom moodlets.

Method 1:
Go to Buffs.xml in gameplaydata.package copy the file to your .package file. Open it > Go to the Pregnancy moodlet. Replace what's inside <CustomClassName> </CustomClassName> with your mod's CustomClassName. This will replace the moodlet and there won't be any conflicts as far as I know. This is basically EA's moodlet but will use your code now.

Method 2:
Replace by a script. I will have to look at my mod again to see exactly how this is done. One side effect is that the moodlet that you replaced won't have any description or name. The image will be there. But because of this side effect I am guessing this is not the method for you. In my case the moodlet was regarding vampires burning in the sun and people already knew what it was doing so the lack of description or name wasn't bothering people.

If you like my mods. Consider supporting me on Patreon
Check out my website for updates on my mods and other work PuddingFace.wixsite.com
Check out my Youtube channel for tutorials(modding tutorials) and other content Youtube

Follow me on Twitter Instagram Pinterest Tumblr
Field Researcher
Original Poster
#3 Old 21st Jun 2020 at 9:53 PM
I don't know much about XML conflicts, but my interpretation of Arithmancer's description of potential conflicts for their mod was that any mod involving any kind of edit to Buffs.xml would conflict with any other mod that also edits anything about Buffs.xml. Is that correct? If so it seems like method 2 would be more stable; I've been trying to remember the mod I'd seen that did this so I could find an example and just couldn't recall, but it turns out it was indeed your vampire mod, so thanks!

As for the name and description problem, I had never even noticed that was missing from the burning vampire buff It shouldn't matter much for most of the buffs I'm thinking of replacing either, since they're also extremely self-explanatory and have pretty distinctive icons (pregnant, abducted, heart of gold, frozen solid, a couple others).

My first attempt at method 2 is ready to test; if it doesn't work I'll open up your mod and see if I can see why mine is busted
Field Researcher
Original Poster
#4 Old 21st Jun 2020 at 11:24 PM Last edited by lizcandor : 22nd Jun 2020 at 12:38 AM.
[EDIT: It works!]

Okay, first attempt confirmed to be a failure! Looking at your code (wow there is a lot in here, this is cool), I think the parts I need to understand are just the ReplaceBuffHeatingUp()/ReplaceBuffTooMuchSun() functions in the DemoClass class, is that right?

If I'm understanding correctly, the variable "value" is the buff to be replaced and "value2" is the custom buff. Is the ulong key input to BuffManager.BuffDictionary.TryGetValue() (when it's called to generate "value") and to BuffManager.BuffDictionary[] actually just the ulong copied from BuffNames, or is it supposed to be BuffNames.HeatingUp or something and ILSpy just decompiled it weirdly? And does my custom buff need to have a CreateBuffInstance method for this to work?
Scholar
#5 Old 22nd Jun 2020 at 8:11 PM
I don't think there needs to be a CreateBuffInstance.

If you like my mods. Consider supporting me on Patreon
Check out my website for updates on my mods and other work PuddingFace.wixsite.com
Check out my Youtube channel for tutorials(modding tutorials) and other content Youtube

Follow me on Twitter Instagram Pinterest Tumblr
Back to top