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!
Quick Reply
Search this Thread
Instructor
Original Poster
#1 Old 3rd Jul 2021 at 9:05 PM
Default Sit for more than five seconds (script mod)
Hi everyone, I'm making a mod for sims to stay seated longer (you know, more than five sim seconds with high free will ^^)

I called the interaction "relax" and for now it's available on dining chairs, living chairs and sofas. It's working, sims will stay seated for 2 sim hours (it's tunable) and just as I wanted, if you ask other sims to join you they will chat, which I find very enjoyable.
- I've seen two problems so far. First, as you can see on the picture, the interaction appears three times. Does anyone know what could be the reason?
- Second, I notice a lot of errors when sims try to use dining chairs, living chairs and sofas for other interactions... They reset and I don't know why it does so.

As always, thank you for anyone willing to test the mod and give advices, it helps a lot
Screenshots
Attached files:
File Type: 7z  FloTheory_NapInAllChairsV2.7.package.7z (10.6 KB, 4 downloads)
Advertisement
Virtual gardener
staff: administrator
#2 Old 4th Jul 2021 at 12:35 PM
I think I might know what the first problem is, but I'll have to check the package first to see it (will do that soon!)

Regarding the resetting... does error trap or any try/catch exception tell you what it is? Or is it just resetting and then no errors?
Instructor
Original Poster
#3 Old 4th Jul 2021 at 4:34 PM
Quote: Originally posted by Lyralei
I think I might know what the first problem is, but I'll have to check the package first to see it (will do that soon!)

Regarding the resetting... does error trap or any try/catch exception tell you what it is? Or is it just resetting and then no errors?


Thank you for your help! About the reseting, error trap does report errors but I need to investigate more because it quotes a lot of things in the report. I'll look into it more.
Virtual gardener
staff: administrator
#4 Old 5th Jul 2021 at 4:15 PM
I think i found the reason why it's showing it 3 times, the relax that is

On your OnWorldLoadHandler you actually have ChairLiving twice:
Code:
	List<ChairLiving> list = new List<ChairLiving>(Queries.GetObjects<ChairLiving>());
	foreach (ChairLiving item in list)
	{
		AddInteractions(item);
	}
	EventTracker.AddListener(EventTypeId.kBoughtObject, OnNewObject);
	List<ChairDining> list2 = new List<ChairDining>(Queries.GetObjects<ChairDining>());
	foreach (ChairDining item2 in list2)
	{
		AddInteractions(item2);
	}


And then on your 'OnNewObject' you check if it's a ChairLiving type but not the others, meaning that chair gets the third interaction now :p

Regarding that second issue... What I tend to do is on each line I put a notification that counts up basically So:

Code:
blahblah
print(1);
blahblah
print(2);


It's tedious but you do easily track down then where the resetter is and it just makes it easier to check if particular variables do return something for you. Especially since your Run function is pretty huge
Instructor
Original Poster
#5 Old 6th Jul 2021 at 11:37 AM
Thank you very much, I will look at everything you said
Back to top