- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- Buff not loading into game
- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- Buff not loading into game
Replies: 13 (Who?), Viewed: 480 times.
#1
26th May 2024 at 3:22 AM
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 31
![Default](/images/icons/icon1.gif)
Code:
namespace Sims3.game.est_MoodletLoader { 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) { XmlDbData xmldbdata = XmlDbData.ReadData(new ResourceKey(ResourceUtils.HashString64("BuffList_BuffTestMoodlet"), 53690476u, 0u), false); if(xmldbdata!=null) { BuffManager.ParseBuffData(xmldbdata, true); } } } public static class Instantiator { [Tunable] internal static bool kinstantiator2 = false; static Instantiator() { LoadSaveManager.ObjectGroupsPreLoad += OnPreLoad; } public static void OnPreLoad() { new BuffBooter().LoadBuffData(); } } } namespace Sims3.game.est_Moodlet { public class BuffTestMoodlet : Buff { private const ulong kTestMoodletBuff = 0x16E200B42A4DBF48; public static ulong staticGuid { get { return 0x16E200B42A4DBF48; } } public BuffTestMoodlet(BuffData info) : base(info) { } } }
and then the xml-
Code:
<?xml version="1.0"?> <buffs_BuffTest> <BuffList> <BuffName></BuffName> <BuffDescription></BuffDescription> <BuffHelpText></BuffHelpText> <FirstPersonDescription></FirstPersonDescription> <Category></Category> <PermaMoodlet>False</PermaMoodlet> <PermaMoodletColor></PermaMoodletColor> <AxisEffected></AxisEffected> <PolarityOverride>NoOverride</PolarityOverride> <EffectValue></EffectValue> <DelayTimer>0</DelayTimer> <TimeoutLength></TimeoutLength> <SKU>BaseGame</SKU> <SolveCommodity></SolveCommodity> <AttemptAutoSolve>False</AttemptAutoSolve> <SolveTime></SolveTime> <Stackable></Stackable> <IsExtreme>False</IsExtreme> <FacialIdle></FacialIdle> <IncreasedEffectiveness></IncreasedEffectiveness> <ReducedEffectiveness></ReducedEffectiveness> <Hex></Hex> <CustomClassName></CustomClassName> <ThumbFilename></ThumbFilename> <Topic></Topic> <ShowBallon>True</ShowBallon> <Travel>False</Travel> <DisallowedOccults></DisallowedOccults> <JazzStateSuffix></JazzStateSuffix> <Version>0.1</Version> <SpeciesAvailability>All</SpeciesAvailability> </BuffList> <BuffList> <Hex>TestMoodletBuff=0x16E200B42A4DBF48</Hex> <BuffName>BuffTestMoodlet</BuffName> <BuffDescription>BuffTestMoodlet_BuffDescription</BuffDescription> <SKU>EP6</SKU> <ThumbFilename>moodlet_ensorcelled</ThumbFilename> <AxisEffected>None</AxisEffected> <EffectValue>0</EffectValue> <TimeoutLength>180</TimeoutLength> <CustomClassName>Sims3.game.est_Moodlet.BuffTestMoodlet, Sims3.game.est</CustomClassName> </BuffList> </buffs_BuffTest>
Advertisement
#2
28th May 2024 at 2:53 PM
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 291
Thanks: 494 in 7 Posts
I looked in some old code and it was like this,
Hope it can help.
Code:
using Sims3.Gameplay.ActorSystems; using Sims3.Gameplay.Utilities; using Sims3.SimIFace; ResourceKey key = new ResourceKey(ResourceUtils.HashString64("MyBuffs"), 0x0333406C, 0x00000000); XmlDbData xmlDbData = XmlDbData.ReadData(key, false); if (xmlDbData != null) { BuffManager.ParseBuffData(xmlDbData, true); }
Hope it can help.
#3
28th May 2024 at 8:24 PM
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 31
Quote: Originally posted by denton47
I looked in some old code and it was like this,
Code:
using Sims3.Gameplay.ActorSystems; using Sims3.Gameplay.Utilities; using Sims3.SimIFace; ResourceKey key = new ResourceKey(ResourceUtils.HashString64("MyBuffs"), 0x0333406C, 0x00000000); XmlDbData xmlDbData = XmlDbData.ReadData(key, false); if (xmlDbData != null) { BuffManager.ParseBuffData(xmlDbData, true); } Hope it can help. |
@denton47 Thank you so much for responding, I gave it a try and I was getting errors in visual studio. I try every buff code I could find I'm not sure if I had made an error with a spelling or anything. I am not sure if you would like to look at it, Thank you in advance again.
Attached files:
![]() |
TestingBuff.zip (3.8 KB, 5 downloads) |
#4
31st May 2024 at 12:13 PM
Last edited by Eca : 31st May 2024 at 12:48 PM.
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 164
Thanks: 1308 in 12 Posts
It's probably because in the assembly, the variable is named "kinstantiator2", whereas in the XML, it's named "kInstantiator2"; case-sensitive.
So it's not that the buff is not loading, but the script isn't running at all.
So it's not that the buff is not loading, but the script isn't running at all.
#5
3rd Jun 2024 at 8:54 PM
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 31
Quote: Originally posted by Eca
It's probably because in the assembly, the variable is named "kinstantiator2", whereas in the XML, it's named "kInstantiator2"; case-sensitive. So it's not that the buff is not loading, but the script isn't running at all. |
Thank you @Eca, Though I tried and it seems as if nothing is working. I'm not sure if it is because of the namespace, but nothing will show up.
#6
6th Jun 2024 at 8:47 AM
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 164
Thanks: 1308 in 12 Posts
Quote: Originally posted by SimShady19
Thank you @Eca, Though I tried and it seems as if nothing is working. I'm not sure if it is because of the namespace, but nothing will show up. |
I don't think so. It seems OK to me.
Perhaps you can add "SimpleMessageDialog.Show()" to produce a popup message as a reporter to many places in your code to see where it gets fired and where it does not. You may start with your constructor "static Instantiator()".
#7
9th Jun 2024 at 6:56 PM
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 31
Quote: Originally posted by Eca
I don't think so. It seems OK to me. Perhaps you can add "SimpleMessageDialog.Show()" to produce a popup message as a reporter to many places in your code to see where it gets fired and where it does not. You may start with your constructor "static Instantiator()". |
Thanks @Eca, I put debug messages and it seems like the only place that it seems not to work in is the Instantiator. I am not sure If I should use an OnWorldLoad, since it seems as if the Instantiator is not going through.
Code:
public static class Instantiator { [Tunable] internal static bool kInstantiator = false; static Instantiator() { try { SimpleMessageDialog.Show("Debug", "Instantiator Constructor Called"); LoadSaveManager.ObjectGroupsPreLoad += OnPreLoad; SimpleMessageDialog.Show("Debug", "Event Handler Registered"); } catch (Exception ex) { SimpleMessageDialog.Show("Error", "Error in Instantiator constructor: " + ex.Message); } } public static void OnPreLoad() { try { SimpleMessageDialog.Show("Debug", "OnPreLoad Called"); (new BuffBooter()).LoadBuffData(); SimpleMessageDialog.Show("Debug", "Buff Data Loaded in OnPreLoad"); } catch (Exception ex) { SimpleMessageDialog.Show("Error", "Error in OnPreLoad: " + ex.Message); } } } }
#8
9th Jun 2024 at 9:58 PM
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 164
Thanks: 1308 in 12 Posts
That means your script is not being run at all. So, "static Instantiator()" is also not being run.
Your XML should be like this:
"OnPreLoad" should be enough.
Your XML should be like this:
Code:
The variable is case-sensitive and its value must be either "True" or "False".<?xml version="1.0" encoding="utf-8"?> <base> <Current_Tuning> <kInstantiator value="True" /> </Current_Tuning> </base>
"OnPreLoad" should be enough.
#9
11th Jun 2024 at 5:17 PM
Last edited by SimShady19 : 11th Jun 2024 at 5:58 PM.
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 31
Quote: Originally posted by Eca
That means your script is not being run at all. So, "static Instantiator()" is also not being run. Your XML should be like this:
Code:
The variable is case-sensitive and its value must be either "True" or "False".<?xml version="1.0" encoding="utf-8"?> <base> <Current_Tuning> <kInstantiator value="True" /> </Current_Tuning> </base> "OnPreLoad" should be enough. |
@Eca that doesnt seem to be the problem, because I got my debug to produce what might be the issue, I'm not sure how to fix it though. It said "Error in Instantiator constructor: Attempting to yield in a non-yielding context!".
#10
12th Jun 2024 at 1:02 PM
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 164
Thanks: 1308 in 12 Posts
May I test your file?
#11
12th Jun 2024 at 6:18 PM
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 31
Quote: Originally posted by SimShady19
@Eca that doesnt seem to be the problem, because I got my debug to produce what might be the issue, I'm not sure how to fix it though. It said "Error in Instantiator constructor: Attempting to yield in a non-yielding context!". |
@Eca, Thank you.
Attached files:
![]() |
TestingBuff2.zip (4.5 KB, 2 downloads) |
#12
14th Jun 2024 at 9:33 AM
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 164
Thanks: 1308 in 12 Posts
It throws the exception when trying to subscribe to ObjectGroupsPreLoad. This shouldn't happen. Maybe you used assemblies from older versions, targeted the wrong framework, or forgot to reference the game's mscorlib.dll... Can you send the project folder as well?
#13
14th Jun 2024 at 2:36 PM
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 31
Quote: Originally posted by Eca
It throws the exception when trying to subscribe to ObjectGroupsPreLoad. This shouldn't happen. Maybe you used assemblies from older versions, targeted the wrong framework, or forgot to reference the game's mscorlib.dll... Can you send the project folder as well? |
@Eca now that I think about it that could definitely be the case.
Attached files:
![]() |
Sims3.game.est.zip (171.0 KB, 4 downloads) |
#14
20th Jun 2024 at 11:00 PM
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 164
Thanks: 1308 in 12 Posts
Sorry I couldn't respond sooner. Turns out removing "SimpleMessageDialog"s from the constructor solves the yielding error. But your buff is still not loaded and that gives another error. I don't know why. I think you need to go through the custom moodlet tutorial and compare it to your work again.
Who Posted
|