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!
Scholar
Original Poster
#1 Old 19th Oct 2021 at 1:50 AM
Default Custom Moodlet Tutorial
My new tutorial on creating Custom moodlets is here check it out



For some reason processing is taking a lot of time. Maybe cause it's a long video. If there are problems let me know.

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
Advertisement
Inventor
#2 Old 26th Oct 2021 at 2:11 PM
Oh, wow! Your tutorials are amazing. I have spent a long time working from Nona Meena's custom moodlet tutorial, but there's just no substitute for seeing it in a video. (And I speak as someone who usually only wants text tutorials )

Echo Weaver's Simblr: http://echoweaver.tumblr.com/
A portrait in stubbornness - Playing the same legacy since 2009
Sample a Brave Legacy: http://sims3sample.illation.net
Scholar
Original Poster
#3 Old 26th Oct 2021 at 9:06 PM
Quote: Originally posted by echoweaver
Oh, wow! Your tutorials are amazing. I have spent a long time working from Nona Meena's custom moodlet tutorial, but there's just no substitute for seeing it in a video. (And I speak as someone who usually only wants text tutorials )


Thank you very much! Means a lot.

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
Scholar
Original Poster
#4 Old 27th Oct 2021 at 5:34 PM
Part 2 is here. Shows you how to create custom thumbnails for your moodlets. Check it out.


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
Scholar
Original Poster
#5 Old 23rd Nov 2021 at 8:51 AM
Part 3 is here. Shows you about 4 methods used in moodlet class. Check it out.


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
Forum Resident
#6 Old 27th Nov 2021 at 10:03 AM Last edited by olomaya : 27th Nov 2021 at 10:23 AM.
Would you be able to share the cs for the script and package file you used in the video? I'm trying to create custom moodlets for my mod and haven't had any success with any tutorial I've tried so far even when copying word for word. I'd love to just see a full basic template to better understand where I'm going wrong.
Scholar
Original Poster
#7 Old 28th Nov 2021 at 2:16 AM
Quote: Originally posted by olomaya
Would you be able to share the cs for the script and package file you used in the video? I'm trying to create custom moodlets for my mod and haven't had any success with any tutorial I've tried so far even when copying word for word. I'd love to just see a full basic template to better understand where I'm going wrong.


Yea sure.

Tips:- If you created separate namespace and class for moodlet then you will need a new kInstantiator or similar variable. Make sure all the numbers are correct in the xmldb code. The xml itself is correct. No missing </...> . xmls for other mods also can't have missing close tags.

Ask me for more help if you need. @ my name though or I won't get notification.
Attached files:
File Type: 7z  Class1.7z (2.7 KB, 31 downloads)

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
Forum Resident
#8 Old 28th Nov 2021 at 11:57 AM
Thank you! I think my issue is likely with the instantiator class. I'll do some more testing tomorrow.
Forum Resident
#9 Old 29th Nov 2021 at 11:23 AM Last edited by olomaya : 29th Nov 2021 at 12:37 PM.
@PuddingFace, Thanks again for sharing. Unfortunately, I'm still stumped in that none of my custom moodlets are showing up in the game. I've quadruple-checked at his point to make sure there are no issues with the XML, the Stbl entries, and I have social data in the same script that is loading fine, just not the buffs.

Code:
namespace olomaya.Religious.Buffs_Socials
{
	public class Main
	{
		[Tunable] static bool init;

		static Main()
		{
			LoadSaveManager.ObjectGroupsPreLoad += OnPreLoad;
			World.sOnWorldLoadFinishedEventHandler += OnWorldLoaded;
			World.sOnStartupAppEventHandler = (EventHandler)Delegate.Combine(World.sOnStartupAppEventHandler, new EventHandler(OnStartupApp));
		}

		public static void OnPreLoad()
		{
			new BuffBooter().LoadBuffData();
		}

		static void OnWorldLoaded(object sender, EventArgs e)
		{
			Initialize();
		}

		public static void OnStartupApp(object sender, EventArgs e)
		{
			try
			{
				LoadSocialData("Olomaya_Religion_SocialData");
				LoadSocializingActionAvailability("Olomaya_Religion_SocializingActionAvailability");
			}
			catch (Exception exception)
			{
				SimpleMessageDialog.Show("Socials not loaded", exception.Message);
			}
		}

		public static void LoadSocialData(string resourceName)
		{
			XmlDocument xmlDocument = Simulator.LoadXML(resourceName);
			bool isEp5Installed = GameUtils.IsInstalled(ProductVersion.EP5);
			if (xmlDocument == null)
			{
				return;
			}
			XmlElementLookup xmlElementLookup = new XmlElementLookup(xmlDocument);
			List<XmlElement> list = xmlElementLookup["Action"];
			foreach (XmlElement item in list)
			{
				XmlElementLookup table = new XmlElementLookup(item);
				ParserFunctions.TryParseEnum(item.GetAttribute("com"), out var value, CommodityTypes.Undefined);
				ActionData data = new ActionData(item.GetAttribute("key"), value, ProductVersion.BaseGame, table, isEp5Installed);
				ActionData.Add(data);
			}
		}

		public static void LoadSocializingActionAvailability(string resourceName)
		{
			XmlDbData xmlDbData = XmlDbData.ReadData(resourceName);
			if (xmlDbData == null)
			{
				return;
			}
			try
			{
				if (xmlDbData.Tables.ContainsKey("SAA"))
				{
					SocialManager.ParseStcActionAvailability(xmlDbData);
				}
				if (xmlDbData.Tables.ContainsKey("TAA"))
				{
					SocialManager.ParseActiveTopicActionAvailability(xmlDbData);
				}
				if (xmlDbData.Tables.ContainsKey("ActionNames"))
				{
					SocialManager.ParseActionNames(xmlDbData);
				}
				if (xmlDbData.Tables.ContainsKey("ActionTopics"))
				{
					SocialManager.ParseActiveTopic(xmlDbData);
				}
			}
			catch (Exception)
			{
			}
		}

		public static void Initialize()
		{
			
		}
	}
	internal class BuffBooter
	{
		public void LoadBuffData()
		{
			AddBuffs(null);
			UIManager.NewHotInstallStoreBuffData = (UIManager.NewHotInstallStoreBuffCallback)Delegate.Combine(UIManager.NewHotInstallStoreBuffData, new UIManager.NewHotInstallStoreBuffCallback(AddBuffs));
		}

		public void AddBuffs(ResourceKey[] resourcekey)
		{
			ResourceKey key = new ResourceKey(ResourceUtils.HashString64("olomaya_Religion_Buffs"), 53690476u, 0u);
			XmlDbData xmlDbData = XmlDbData.ReadData(key, bSuppressLogs: false); 
			if (xmlDbData != null)
			{
				BuffManager.ParseBuffData(xmlDbData, true);
			}
		}
	}
}


I added in an exception catch and keep getting the message upon startup "A null value was found where an object instance, etc". Does that mean the issue is with the XML not being read?
Scholar
Original Poster
#10 Old 30th Nov 2021 at 6:28 AM
@Olomaya Ok I suggest creating separate namespaces like in my mod. Separate it out. Remove the moodlet code from your project and start fresh. Copy paste my code into your project and change the names to fit your mod. And then try.

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
Forum Resident
#11 Old 30th Nov 2021 at 7:59 AM
Quote: Originally posted by PuddingFace
@Olomaya Ok I suggest creating separate namespaces like in my mod. Separate it out. Remove the moodlet code from your project and start fresh. Copy paste my code into your project and change the names to fit your mod. And then try.


@PuddingFace Ah, yay, that worked! Separating it out into new namespaces did the trick. I was even able to keep it in the same project. I have it working though not all of my moodlet images are showing up. So I'll guess I'll be watching your third video today to deal with that.
Thanks so much for your help!
Scholar
Original Poster
#12 Old 30th Nov 2021 at 8:35 AM
Quote: Originally posted by olomaya
@PuddingFace Ah, yay, that worked! Separating it out into new namespaces did the trick. I was even able to keep it in the same project. I have it working though not all of my moodlet images are showing up. So I'll guess I'll be watching your third video today to deal with that.
Thanks so much for your help!

Yay! That's awesome!

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
Scholar
Original Poster
#13 Old 24th Dec 2021 at 2:01 AM
Forgot to post here but part 4 is here. Shows you how to make Instance class and through that add vfx via moodlet and change the value of a variable inside the moodlet after it has already been added through external means.


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
Scholar
Original Poster
#14 Old 23rd Jan 2022 at 5:21 PM
Part 5 is here. Shows you how to add Event Listener to a Sim via a moodlet.


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