Quick Reply
Search this Thread
Instructor
#26 Old 28th Jul 2022 at 11:15 AM
If you want sims to be able to talk with other sims around them while performing an interaction, place Actor.TryGroupTalk(true); or Actor.WaitAndGroupTalk(); in the loop.
Advertisement
Scholar
#27 Old 2nd Jan 2023 at 11:02 PM
You can change the color of visual effects. Here on my Grave Wound moodlet for Pet Fighting, I'm using the dripping effect from getting soak in a tomb in World Adventures and changing the color to red.

One thing to keep in mind that took me a while to figure out -- the color code is in RGB, but the scale is 0-1, not 0-255, which is what I was expecting. Any number higher than 1 will be treated as one.

Code:
Vector3 fxColor = new Vector3(1f, 0f, 0f); // RGB for red
mHeadFx = VisualEffect.Create("ep1SoakedDripsHead");
mHeadFx.ParentTo(owner, Sim.FXJoints.Head);
mHeadFx.SetEffectColorScale(fxColor);
mHeadFx.Start();


(This is just the head effect. There are also dripping effects for arms and thighs. I'm pretty sure there's an actual dripping pet effect for dogs that go swimming in the pool. I don't know why I didn't use that one; I'll assume my past self knew what she was doing.)

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
#28 Old 4th Jan 2023 at 5:14 AM
I also thought I'd put this here from a different thread, since I just had to dig that thread up to check this information. This is about the order that the world events fire.

Quote: Originally posted by Lyralei
I should probably add this to the Code snippets thread, but gamefreak said this on the discord ages ago:

Quote:
OnStartupApp -> First loading screen -> Main Menu -> Second loading screen -> PreLoad -> Load world file (including loading & setting persistable script values) -> PostLoad -> InWorldState/OnWorldLoadFinished


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
Field Researcher
#29 Old 17th Apr 2023 at 4:54 AM
Code snippet to freeze/unfreeze a sims motive.
Virtual gardener
staff: administrator
Original Poster
#30 Old 29th Apr 2023 at 6:02 PM Last edited by Lyralei : 30th Apr 2023 at 12:19 PM. Reason: forgot about spoiler
You need for science-y reasons get the item that has been placed down just now by a handtool, then this is the way to do it:

Virtual gardener
staff: administrator
Original Poster
#31 Old 6th May 2023 at 12:54 PM Last edited by Lyralei : 7th May 2023 at 11:42 AM.
If you've worked with something like Unity before, you definitely understand how important it is to make your manager classes a Singleton (or, one instance per save). Though, for explanation:

Why should I use a singleton
When you have a class that generally takes care of everything in the world/save (called, a manager), you don't want 5 or even a thousand of those managers taking care of everything! One is, simply enough.

When to use a singleton
If you are thinking of making your class take care of the following things:
  • Handles and curates everything that all sims/objects in the world should do (For example, for my Interest And Hobbies mod, it collects all sims in the world and figures out when to attach a new Interest to the sim depending on what they're doing)
  • Handles world events.
  • Handles any variables that count,

Generally speaking, you should see it sort of like this:
Quote:
Let's say, we have a GameObject (let's say, a chair), which is its own instance many times because we may have 200 chairs in the world. If we wanted to figure out per chair, how many times it's been sat on, then we want to do that per instance (aka, per chair). As one chair may be used more than the other.

However, where a manager would be preferred, would be for something like gathering from all chairs, how often they've been sat on (or just a global count altogether).


If you want a more in-depth talk, then this article helps (it's unity, but make sure to check my snippets of what's the sims equivelant of things): https://gamedevbeginner.com/singlet...-the-right-way/




NOTE: Shutdown, and Startup WILL work, despite not having derived the GameObject class.


EDIT: if "Startup()"doesn't 'start up' by itself, you can always call the function inside your "Onworldloadfinished"
Field Researcher
#32 Old 1st Jun 2023 at 7:44 AM
Code Snippet to check whether a sim is currently wearing a specific type of clothing. Can be CC or vanilla clothing
Code Snippet to retrieve the relationship number value between two sims and then compare it to a value
Trainee Moderator
staff: trainee moderator
#33 Old 6th Aug 2023 at 1:50 PM
Checking whether a (script) mod is installed (regardless of it being instantiated):

This is a signature.
Virtual gardener
staff: administrator
Original Poster
#34 Old 6th Aug 2023 at 5:11 PM
That's not a terrible way of doing it Eca! For Zoe's knitting mod, I did this instead in case you want to make it less exception dependant (And have multiple mods to check) which can be used OnAppStartup or OnWorldFinished:

Virtual gardener
staff: administrator
Original Poster
#35 Old 23rd May 2024 at 3:18 PM
Want to know how to randomize a list per day? For this we use the good ol' Random seed Because the random seed will always be the same for that day, you'll always get the same random item!



Note: If you rather want it to be different per hour, weeks, etc. Just change the TimeUnit part!
Virtual gardener
staff: administrator
Original Poster
#36 Old 23rd Jul 2024 at 10:36 PM
I've been really busy with scripting again, so I got some pretty "brutal" scripts that should have sims do what you want them to do.

Here are my helper functions!

1. Force Sims to do interaction, no matter what.




1. Get sim to visit lot without ringing doorbell.
Quick note on this trick, if your sim also should see the inside of that residential house, use sim.GreetSimOnLot(lot);




1. Make sim not do anything autonomously for a bit.
Page 2 of 2
Back to top