Home | Download | Discussion | Help | Site Map | New Posts | Sign in

Latest Site News

Guidelines/Rubrics Changes - posted on 16th Jun 2017 at 6:09 PM
Replies: 15 (Who?), Viewed: 2787 times.
Doing all the things, and *mostly* not failing.
staff: retired moderator
Original Poster
#1 Old 4th Jun 2017 at 6:11 AM
Default Maxis School Friend Code Broken?
I was asking people about what they'd change about the maxis private school, and a number of people mentioned wanting the school friends their kids to bring home to actually be from the same school. This code works for adults bringing home work friends, so did they break or not finish it for the schools?

I think I have isolated the correct BHAV, but as bhav'ing isn't my specialty, I can't tell if it isn't working or why. I'm also not entirely sure this bhav ever gets called. Could someone take a look at it and see what's going on? I haven't changed or done anything to the code yet, just attaching it for convenience sake.
Screenshots
Download - please read all instructions before downloading any files!
File Type: rar SchoolFriendCode.rar (621 Bytes, 10 downloads) - View custom content

Working on a set of Private Schools. Will you help me name them?

New! Hillside Terraced Cemetery!
Like my work? Help me make a difference!
Advertisement
Lab Assistant
#2 Old 4th Jun 2017 at 10:41 AM Last edited by clsve : 4th Jun 2017 at 10:59 AM.
The School things are handled by JobDataSchool Globals (Group 0x7FBE051B) in a Pie Menu Fuction Action BHAV: 201A Interaction - At School which call BHAV 201D Sub - Return to World which call BHAV 202A Sub - Return to World - Try Bring Friend which call BHAV 2029 Sub - Get in T[0] - School Friend

As far as I can see there is likely a Bug in node (line) 0x08 of BHAV 2029 Sub - Get in T[0] - School Friend

0x08 [prim 0x0002] Expression (Local 0x0003 := Stack Object's Job Object GUID2)
which has to be changed to
[prim 0x0002] Expression (Local 0x0004 := Stack Object's Job Object GUID2)
Doing all the things, and *mostly* not failing.
staff: retired moderator
Original Poster
#3 Old 4th Jun 2017 at 3:16 PM
So it does in fact get called, that's good. I'll try your suggestion and see if that takes care of the issue. Thanks for having a look!

Working on a set of Private Schools. Will you help me name them?

New! Hillside Terraced Cemetery!
Like my work? Help me make a difference!
Lab Assistant
#4 Old 4th Jun 2017 at 4:18 PM
Line 9 of the same op-code has a bug of exactly the same nature "BHAV 2029 Sub - Get in T[0] - School Friend"
It should be 'Neighbour's person data 0x005A (Job Object GUID2) == Local 0x0004'
Doing all the things, and *mostly* not failing.
staff: retired moderator
Original Poster
#5 Old 4th Jun 2017 at 10:11 PM
So I think I made the two changes you both suggested, then I tested it out. My public school kid eventually brought home 2 private school playable kids - rather than bring home public school townie kids (I checked, I have 4 public school townie kids in my test hood).

I've attached the package I was testing and screen shots of the whole thing so you don't have to download if you don't want. Is there something in the code that puts playable kids with the wrong school before townies with the right, or was that just luck? Maybe I messed up something somewhere?
Screenshots
Download - please read all instructions before downloading any files!
File Type: rar SchoolFriendFix.rar (626 Bytes, 4 downloads) - View custom content

Working on a set of Private Schools. Will you help me name them?

New! Hillside Terraced Cemetery!
Like my work? Help me make a difference!
Lab Assistant
#6 Old 5th Jun 2017 at 11:46 AM
After a more careful look at it there's a lot more wrong than that.
In lines 6,7,8 and 9 it should be testing for 'person data 0x006B (School Object GUID 1)' and 'person data 0x006C (School Object GUID 2)' instead of 'person data 0x0059 (Job Object GUID1)' and 'person data 0x005A (Job Object GUID2)'.

As the default code is if the sim does not have a job then the locals would default to zero, only then will other sims test true if they don't have a job. If either have a job then it will never test true which may not be a bad thing. After fixing the faults it may be a good idea to add a line or two at the beginning to prevent bringing a friend home if the sim does have to go to work after school.
Doing all the things, and *mostly* not failing.
staff: retired moderator
Original Poster
#7 Old 5th Jun 2017 at 4:00 PM
After some more digging, I've found that twoJeff's school bus dialog code is WAY better written, so I'm starting from there instead now, but upon testing, it still lets kids from the wrong schools come home. I've tweaked it a tad, but that wasn't sufficient. I have no idea what is going on.
Download - please read all instructions before downloading any files!
File Type: rar School bus - bring friend dialog-edit.rar (20.4 KB, 9 downloads) - View custom content

Working on a set of Private Schools. Will you help me name them?

New! Hillside Terraced Cemetery!
Like my work? Help me make a difference!
Lab Assistant
#8 Old 6th Jun 2017 at 5:55 PM
This is from A&N, I haven't tested it in M&G but I'm quite sure I've made it compatible to M&G.
https://app.box.com/s/rk5xk2p6fzk6awcuvj8ni3x7h6zoa3hb (BringFriendFix.zip)
The first line ensures teens wont bring a friend home if they go to work after school that day. The second line just prevents friends from bringing more friends, in A&N if children/teens invite a friend for a sleepover on a school night then that friend will go to school with them the next morning.
Doing all the things, and *mostly* not failing.
staff: retired moderator
Original Poster
#9 Old 7th Jun 2017 at 6:23 AM
Oooh! That does work! After initially wondering why on earth this one sim wasn't getting suggested to come home from school, I realized he had a job. After telling him to quit, yours works as expected. (I have M&G so I can also confirm compatibility.) This is really exciting now!

I've taken your BHAVs and spliced them into TwoJeff's dialog version, so now not only do just the right kids come home, but I also have the option to say no, and all the good fixes are included, like walking away from the bus before looking at your report card so your sister can get off the bus already.

The only two things left I have found that I'd like to change are having the school friend come home dressed in whatever school uniform they are supposed to be wearing - like the adult work friends do. I tried using the adult job code but that wasn't working at all, then I tried writing it in myself and that didn't work at all either. I don't want to hardcode it to the school uniform's GUID, because I have a few different private schools that use different uniforms, I just need it to pull whatever the school's official uniform is.

My second problem cropped up from your code, Chris, and I don't know how to put it back, but all the school friends think they are being invited over as house guests, and they get mad when I don't let them sleep. It is handy that friends can't invite extra friends over, but is that where that problem came from, or is it slightly different?
Download - please read all instructions before downloading any files!
File Type: rar BringCorrectSchoolFriendsDialog.rar (20.7 KB, 5 downloads) - View custom content

Working on a set of Private Schools. Will you help me name them?

New! Hillside Terraced Cemetery!
Like my work? Help me make a difference!
Lab Assistant
#10 Old 7th Jun 2017 at 1:57 PM
The problem of friends being invited to stay must be something separate, after the friend has been chosen they are pushed to perform 'Interaction - Friend - Come Home' (instance 0x00002028). Line 0xB(11) (Line 3 in the file below) of that op-code clears any invited to stay flags so it must be something that's occurring later.

The following should dress private school students friends in the private school uniform, it uses the default GUID so any default replacement would be used but I don't understand that you have more than 1 private school. The default school doesn't have the outfit GUIDs in constants the way jobs do so you won't be able to have multiple outfits and retain compatibility with the default code. If you are adding the outfit GUIDs into the constants then replace the literal values in line 1 with those constants but your mod will have to include those constants for the default school.
https://app.box.com/s/3mdiszp0nyuh1oyptzbl54h7k1bzdiye (FreindDressCorrect.zip)
Doing all the things, and *mostly* not failing.
staff: retired moderator
Original Poster
#11 Old 7th Jun 2017 at 4:55 PM
This is so frustrating that I'm not better at BHAVs. I've spent the entire morning trying to swap it over to using constants and I can't get it to work. What am I doing wrong?!?

Attached are pics of before and after using custom uniforms. The way that works is hard coding the GUID into it, but that won't work with the friend code we've been working on. I looked up how jobs handle it and tried to copy from there but it's not working. (uniform guids are in BCON 102E, lines 2 and 3 - just like adult job uniforms)

When I try it in game I get a jump bug, then testing cheats tells me Stack Number Out of Range.
Screenshots

Working on a set of Private Schools. Will you help me name them?

New! Hillside Terraced Cemetery!
Like my work? Help me make a difference!
Instructor
#12 Old 7th Jun 2017 at 6:14 PM
Quote:
Originally Posted by Phaenoh
When I try it in game I get a jump bug, then testing cheats tells me Stack Number Out of Range.


You are using two locals (0 and 1) but the Local Var Count box (over on the right) is set to zero, it needs to be 2

Just call me William, definitely not Who-Ward
Doing all the things, and *mostly* not failing.
staff: retired moderator
Original Poster
#13 Old 7th Jun 2017 at 8:44 PM Last edited by Phaenoh : 7th Jun 2017 at 9:01 PM.
William, Thank You! That was the missing piece. I fixed that, then diligently copied over the adult dress for work code, tested it out and it worked! My kids all spun into their red school uniforms! Then when they came home, their friends were wearing the same red uniforms! YAY.

Now my last bit of weirdness is that house guest sleepover issue...
Download - please read all instructions before downloading any files!
File Type: rar Phaenoh_CorrectSchoolBringFriendsDialog.rar (21.0 KB, 6 downloads) - View custom content

Working on a set of Private Schools. Will you help me name them?

New! Hillside Terraced Cemetery!
Like my work? Help me make a difference!
Doing all the things, and *mostly* not failing.
staff: retired moderator
Original Poster
#14 Old 8th Jun 2017 at 10:49 PM
After further testing, I figured out what the problem was. Nothing was wrong with the code, but instead, how I was testing. Originally I was using sethour to advance to whenever the bus was coming next, usually resulting in an overnight skip, and that's when the friends got mad. If I instead just fast forwarded to the next day, the kids left in the evenings like normal.

Now I just need to get all my ducks in order and it's ready for upload! Thank you again, bunches, Chris and William. You two are invaluable. <3

Working on a set of Private Schools. Will you help me name them?

New! Hillside Terraced Cemetery!
Like my work? Help me make a difference!
Doing all the things, and *mostly* not failing.
staff: retired moderator
Original Poster
#15 Old 14th Jun 2017 at 4:32 PM
So I got bold after getting the outfits to use BCON values instead of being hard coded into the BHAVs, and I thought I'd give that a try with the school bus. The idea being that a military school could send the humvee instead of the bus or some such.

Buuuut, I've broken it in a really interesting way. Now for every student, an individual vehicle shows up (it does happen to be whatever GUID I put in the BCON, so that part works), and only the first student gets Go to School pushed on them, but then it falls out of their queue as they can't get on the bus/in the car. TestingCheats revealed no errors. This leads me to believe that I'm missing a BHAV somewhere that is still using the school bus GUID, but I've combed through the full list of JobSchoolGlobals three times now, and I think I've gotten all the ones that listed the school bus by GUID. My other idea is that I've screwed up a Set to Next somewhere. Any thoughts?
Download - please read all instructions before downloading any files!
File Type: rar Phaenoh_SchoolBusTweaks.rar (21.3 KB, 4 downloads) - View custom content

Working on a set of Private Schools. Will you help me name them?

New! Hillside Terraced Cemetery!
Like my work? Help me make a difference!
Lab Assistant
#16 Old 15th Jun 2017 at 5:11 PM
Without looking at it (I will look at it) I can tell you that the school bus is recognised by only it's GUID so many times I considered it not viable to have alternatives. However to have different colour buses for different schools is very, very simple. The following has six different colours, it will use the default colour for the public school and any schools that have not been set to use an alternative colour. It uses a white bus for the default private school. The bus colour is set in the constant 0x102C:0x00 which is an otherwise unused gardening skill constant so it will exist in every school to avoid invalid constant errors and is in the range of 1 to 7.
https://app.box.com/s/4ryop53iqmuc0uugjr06rn846hkalqet (MoreSchoolBuses.zip 5kb)
Note the file is tiny because the yellow colour on the school bus is a straight colour so we don't need to use a texture, just define a colour in the material definition.
Back to top