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!
Test Subject
Original Poster
#1 Old 3rd Sep 2018 at 11:57 PM Last edited by Aethral : 4th Sep 2018 at 9:52 AM.
Default Need help with modding XML and scripting information!
SO before I start any rant I feel I should say I am green on the modding scene. With that out I will get on with it. I have begun to dabble in a bit of modding and using XML to code. I am very new so there is not much I can do though following the countless tutorials really help with it. So when first playing the game I noticed that when a sim pees themselves, among other drawbacks will lose their entire hygiene meter. This causes them to become filthy and require a bath or shower. I have been dabbling in buffs and traits and my goal is to stop this from happening. I want to make it so the hygiene meter doesn't move when a sim has an "accident".

My first step was dabbling in buffs and traits. Thanks to Zerbu for his mod constructor. I have been able to override the hygiene meter drop by making it so the hygiene meter maxes out or is set to a specific value when a sim pees themselves however this is not what I want. I want to make it so when a sim does the deed, the hygiene meter is untouched and remains at the value it was before the deed is done. Regrettably for this I am lost.

Edit: In addition to this, I also want to know if there is a way to stop the sim from autonomously indicating that they need to pee (they stop everything and wave to you with a bubble above their head).
Advertisement
Theorist
#2 Old 5th Sep 2018 at 2:51 AM Last edited by PolarBearSims : 5th Sep 2018 at 3:05 AM.
Quote: Originally posted by Aethral
SO before I start any rant I feel I should say I am green on the modding scene. With that out I will get on with it. I have begun to dabble in a bit of modding and using XML to code. I am very new so there is not much I can do though following the countless tutorials really help with it. So when first playing the game I noticed that when a sim pees themselves, among other drawbacks will lose their entire hygiene meter. This causes them to become filthy and require a bath or shower. I have been dabbling in buffs and traits and my goal is to stop this from happening. I want to make it so the hygiene meter doesn't move when a sim has an "accident".

My first step was dabbling in buffs and traits. Thanks to Zerbu for his mod constructor. I have been able to override the hygiene meter drop by making it so the hygiene meter maxes out or is set to a specific value when a sim pees themselves however this is not what I want. I want to make it so when a sim does the deed, the hygiene meter is untouched and remains at the value it was before the deed is done. Regrettably for this I am lost.

Edit: In addition to this, I also want to know if there is a way to stop the sim from autonomously indicating that they need to pee (they stop everything and wave to you with a bubble above their head).


Not sure about stopping the sims from autonomously indicating that they have to pee but on the first question you had on changing the hygiene when they pee themselves. You will find that in the XML Loot_BladderFailure. The part of the code you want to look at and adjust is:

<V t="statistics">
<V n="statistics" t="statistic_set">
<U n="statistic_set">
<T n="advertise">False</T>
<T n="stat">16657<!--Commodity: motive_Hygiene--></T>
<L n="tests">
<L>
<V t="posture">
<U n="posture">
<L n="prohibited_postures">
<T>39398<!--MobilePosture: posture_Swim--></T>
</L>
</U>
</V>
</L>
</L>
<T n="value">-100</T>
</U>
</V>
</V>

the <T n="value">-100</T> is what you want to change. That number tells the game how to change the hygiene motive.

If you don't want the hygiene to change at all then you would remove that portion of the code.

Hope this helps!

For help with my mods please join my discord HERE

**********If you like my builds, mods or videos you can support me at Patreon! **********

*****Thank you for all of your support!*****
Test Subject
Original Poster
#3 Old 5th Sep 2018 at 11:58 AM
Quote: Originally posted by PolarBearSims
Not sure about stopping the sims from autonomously indicating that they have to pee but on the first question you had on changing the hygiene when they pee themselves. You will find that in the XML Loot_BladderFailure. The part of the code you want to look at and adjust is:

<V t="statistics">
<V n="statistics" t="statistic_set">
<U n="statistic_set">
<T n="advertise">False</T>
<T n="stat">16657<!--Commodity: motive_Hygiene--></T>
<L n="tests">
<L>
<V t="posture">
<U n="posture">
<L n="prohibited_postures">
<T>39398<!--MobilePosture: posture_Swim--></T>
</L>
</U>
</V>
</L>
</L>
<T n="value">-100</T>
</U>
</V>
</V>

the <T n="value">-100</T> is what you want to change. That number tells the game how to change the hygiene motive.

If you don't want the hygiene to change at all then you would remove that portion of the code.

Hope this helps!


Thank you very much @PolarBearSims! I feel this has got me on the right track. However when I use this code, the game logs a LastException.txt and insists that the mod is outdated or broken now. I have confirmed it is from changing this line of text in the XML that I import into my mod. I can assume it is because I am exporting the tuning for this XML into my mod and changing it from there because I don't want to change this feature for the entire game, I just want to make an exception for my custom trait. I have uploaded the txt file if that is any help.
Attached files:
File Type: txt  lastException.txt (4.6 KB, 13 downloads)
Theorist
#4 Old 5th Sep 2018 at 7:03 PM
Quote: Originally posted by Aethral
Thank you very much @PolarBearSims! I feel this has got me on the right track. However when I use this code, the game logs a LastException.txt and insists that the mod is outdated or broken now. I have confirmed it is from changing this line of text in the XML that I import into my mod. I can assume it is because I am exporting the tuning for this XML into my mod and changing it from there because I don't want to change this feature for the entire game, I just want to make an exception for my custom trait. I have uploaded the txt file if that is any help.


The code I posted was just part of the XML. You need to find the full XML code called Loot_BladderFailure. If you were to put just the code I posted into your game it would be a broken XML and could cause a number of things to break or happen in your game.

In order to have it work for specific traits you would need to write in the traits it works for or doesn't work for in that code I posted above.

Once you find the full XML code then open it in your text editor and make the changes I posted in the above post. Then save it in a new folder NEVER override the original file. Then turn it into a package file, this is where you can add any other XML's that you have either changed or created new. Then save the new package and put it into your game.

I hope this is more clear, I apologize if I was a little confusing in the above post.

For help with my mods please join my discord HERE

**********If you like my builds, mods or videos you can support me at Patreon! **********

*****Thank you for all of your support!*****
Deceased
#5 Old 6th Sep 2018 at 10:58 AM
The exception you posted is due to an invalid subtraction, and I think I know where things got confused. When Polarbearsims said to remove "that portion" of the code, she means the entire section from the <V t="statistics"> all the way to the corresponding </V> tags.

If you just remove the <T n="value">-100</T> line then what you have created is a request to set the hygiene motive to "None" which is not a valid number. Since one of the things setting the value of a commidity attempts to do is to determine what the delta value is (the amount of change from what it is now to what you want to set it to) using a subtraction like this
Code:
change = value - self.get_value()

Since no value was specified to set the statistic to if just that value line is removed, it attempts to subtract the current value, a floating point number, from that "None" value thus triggering the exception "TypeError: unsupported operand type(s) for -: 'NoneType' and 'float'".

If you completely remove that statistic operation section she noted from the loot action, then the attempt to set the hygiene to a new value never occurs.
Theorist
#6 Old 6th Sep 2018 at 12:11 PM Last edited by PolarBearSims : 6th Sep 2018 at 4:00 PM.
Quote: Originally posted by scumbumbo
The exception you posted is due to an invalid subtraction, and I think I know where things got confused. When Polarbearsims said to remove "that portion" of the code, she means the entire section from the <V t="statistics"> all the way to the corresponding </V> tags.

If you just remove the <T n="value">-100</T> line then what you have created is a request to set the hygiene motive to "None" which is not a valid number. Since one of the things setting the value of a commidity attempts to do is to determine what the delta value is (the amount of change from what it is now to what you want to set it to) using a subtraction like this
Code:
change = value - self.get_value()

Since no value was specified to set the statistic to if just that value line is removed, it attempts to subtract the current value, a floating point number, from that "None" value thus triggering the exception "TypeError: unsupported operand type(s) for -: 'NoneType' and 'float'".

If you completely remove that statistic operation section she noted from the loot action, then the attempt to set the hygiene to a new value never occurs.


Thank you, I can't read LE's so I wasn't sure what had happened to cause it.

For help with my mods please join my discord HERE

**********If you like my builds, mods or videos you can support me at Patreon! **********

*****Thank you for all of your support!*****
Back to top