PDA

View Full Version : Suntan script mod - Work in progress


Consort
9th Apr 2012, 09:20 PM
Hey I've been working on this suntan mod and thought I share it in case any one of you has any ideas or suggestions or sees mistakes.

This is just a debug version, I can not recommend using this for anything else but testing because it can potentially damage your sims or your savegame.

The mod adds the "Take Sunbath" interaction to all Lounge chairs that are outside. Sunbathing is only available between 8am and 7pm.

The Sim should walk up to the chair, change into swimclothes, sit down and start tanning (a bit every 30 sim minutes).
This also starts the untan timer which will fire after 12 sim hours and then again every 6 hours to make the tan slowly go away.

To Do:
-Newly bought lounge chairs don't get the interaction
-Kick sim out of chair after sunset
-Think about a tanning process that works without alarms

Known Glitches:
Uhm a few :)
-The alarms don't fire very punctual, so some delayed tanning can happen
-Tanning sims getting up from the chair and immediately changing clothes have the pre-sunbath tan for a while
-Every time a sim starts sunbathing a new untan alarm gets created leading to a faster untanning process. this is not intended but i'm not sure how to fix it.
-Pregnant sims lose their tan when giving birth
-Age transition seems to "burn in" the tan permanently?

I nicked several bits of code from velocitygrass who was kind enough to publish his usetoiletnaked mod here http://www.modthesims.info/showthread.php?t=470925
Other bits were stolen from CmarNYC's Penis morph script and ofcourse the pure script modding tutorial.


Here's the code: http://paste.ubuntu.com/922362/


VisualStudio2010 project folder attached
Mod package attached

Please note that it's compiled against de-protected Sims3GameplaySystems.dll and Sims3GameplayObjects.dll libraries. See this thread: http://www.modthesims.info/showthread.php?t=467578

Odistant
10th Apr 2012, 07:46 PM
To fix the tan from being "burned in" permanently, possibly a temporary fix depending on how long tans last, if the sim is set to become a new age, then they cannot use the chair until they have already aged up. I haven't checked to see how long your alarms are set for, but usually sims can age up 3 days prior to their actual birthdays. EAxian has a code that they use to check if a sim is ready to age up.

In namespace Sims3.Gamplay.Cas, class SimDescription...



public bool IsDueToAgeUp()
{
if (this.AgingState == null)
{
return false;
}
return AgingManager.Singleton.SimIsOldEnoughToTransition(this.AgingState);
}


So in the Run or definition just do a check on the Sim using IsDueToAgeUp and if it's true, then return false.
_____________________________

in your Sunbathe class i noticed....


public override bool Run()
{
if ((base.Actor.Posture != null) && (base.Actor.Posture.Container == base.Target))
{
return true;
}
if (this.StartSunbathing())
{
base.EndCommodityUpdates(true);
base.StandardExit(false, false);
//base.Actor.BuffManager.AddElement(BuffNames.Comfy, base.Target.Tuning.ComfyBuffStrength, (Origin)(-8359806666160896334L));
return true;
}
return false;
}


To fix -8359.....L stuff in Reflector select Tools>Options>Number Format>Hexadecimal. It will then be much easier to track what buff EA is talking about. I'm not sure if you know that, maybe you did, but if someone sees this then they can fix it.

______

I hope this helped you some, and excellent work so far :)

Consort
11th Apr 2012, 12:05 AM
Hmm untanning could take a long time. We're talking 10 days or more in the worst case, so a quickfix won't do I guess, especially since children can use it and -as we know- they always age up so fast...
I have to investigate if and why the game would grab the skintone from the outfits and overwrite the genetic skintone with that value. I was thinking about adding some gene to the sim to buffer the genetic skintone... we'll see.
A lost tan can be tolerated, but a genetically burned in tan would be a serious problem.

I commented out that buff thingy because I found it too distracting to fiddle with it at this point. It's easy to get lost in the playground of possibilities :) In VS you can just replace the parameter by typing Origin. and selecting a buff origin from a long list. But that tip with the hex format is great in case you want to research what origin EA were using.

misukisu
11th Apr 2012, 07:19 AM
I noticed you had a todo to add interactions to new items also, here is a thread to do that: http://www.modthesims.info/showthread.php?t=470925

Consort
11th Apr 2012, 10:37 PM
Uh yea I found that toilet mod extremely useful to learn from. I think there's even a commented out line in my code from there (the one that sets the listener)