Replies: 3 (Who?), Viewed: 1797 times.
Test Subject
Original Poster
#1 Old 18th Jul 2018 at 2:57 PM Last edited by Renha : 18th Jul 2018 at 10:33 PM.
Default Detect moodlet in script
Hi. I want to make a mod where when certain moodlet appears, some scripted function runs once. Any idea how to set up this kind of trigger?
#2 Old 24th Jul 2018 at 5:36 AM
There is a _send_mood_changed_event as part of the buff component that calls the event manager to process events of type test_events.TestEvent.MoodChange - presumably you could register an event callback for this type and this would make that get a call when any mood changes. I haven't played with this myself, so no clue exactly how well that might work. You'd have to do some hunting around the game scripts, likely searching the sources for mentions of "TestEvent.MoodChange" as that should show you something which registers one of those events.

If that's too much of a pain to figure out perhaps it might be easier to append your own simple basic callback to the buff component's on_mood_changed list (that's what triggers the call the send mood changed event I mention above).

Not sure if registering that test event would be on a per-sim basis or not, but the latter one is definitely tied to a specific Sim's buff component so it would have to be set for each Sim.
Test Subject
Original Poster
#3 Old 23rd Aug 2018 at 6:51 AM
Thank you! I've successfully implemented second method, now I'm interested to try the first one, to find out if that would be per-sim or not, because I'm not sure how to trigger callback registration on new sim appearance on lot.
Test Subject
Original Poster
#4 Old 28th Aug 2018 at 6:36 AM
Well yeah, first method gives events for every sim. Actually, I'm more interested in buffs and actions - and these are working just the same way as mood changes.

Now I have to figure out how inbuilt state machine work and if I could use it for my mod or I should create my own state machine.
Back to top