- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- Custom Moodlet Tutorial
- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- Custom Moodlet Tutorial
Replies: 13 (Who?), Viewed: 2710 times.
#1
19th Oct 2021 at 1:50 AM
Posts: 1,500
Thanks: 4287 in 41 Posts
Custom Moodlet Tutorial
My new tutorial on creating Custom moodlets is here check it outFor some reason processing is taking a lot of time. Maybe cause it's a long video. If there are problems let me know.
Advertisement
#2
26th Oct 2021 at 2:11 PM
Posts: 978
Thanks: 1929 in 13 Posts
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
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
#3
26th Oct 2021 at 9:06 PM
Posts: 1,500
Thanks: 4287 in 41 Posts
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.
#4
27th Oct 2021 at 5:34 PM
Posts: 1,500
Thanks: 4287 in 41 Posts
Part 2 is here. Shows you how to create custom thumbnails for your moodlets. Check it out.
#5
23rd Nov 2021 at 8:51 AM
Posts: 1,500
Thanks: 4287 in 41 Posts
Part 3 is here. Shows you about 4 methods used in moodlet class. Check it out.
#6
27th Nov 2021 at 10:03 AM
Last edited by olomaya : 27th Nov 2021 at 10:23 AM.
Posts: 732
Thanks: 291 in 5 Posts
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.
#7
28th Nov 2021 at 2:16 AM
Posts: 1,500
Thanks: 4287 in 41 Posts
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:
Class1.7z (2.7 KB, 31 downloads) |
#8
28th Nov 2021 at 11:57 AM
Posts: 732
Thanks: 291 in 5 Posts
Thank you! I think my issue is likely with the instantiator class. I'll do some more testing tomorrow.
#9
29th Nov 2021 at 11:23 AM
Last edited by olomaya : 29th Nov 2021 at 12:37 PM.
Posts: 732
Thanks: 291 in 5 Posts
@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.
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?
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?
#10
30th Nov 2021 at 6:28 AM
Posts: 1,500
Thanks: 4287 in 41 Posts
@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.
#11
30th Nov 2021 at 7:59 AM
Posts: 732
Thanks: 291 in 5 Posts
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!
#12
30th Nov 2021 at 8:35 AM
Posts: 1,500
Thanks: 4287 in 41 Posts
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!
#13
24th Dec 2021 at 2:01 AM
Posts: 1,500
Thanks: 4287 in 41 Posts
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.
#14
23rd Jan 2022 at 5:21 PM
Posts: 1,500
Thanks: 4287 in 41 Posts
Part 5 is here. Shows you how to add Event Listener to a Sim via a moodlet.
Who Posted
|