Replies: 54 (Who?), Viewed: 9792 times.
Page 1 of 3
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#1 Old 16th Dec 2008 at 11:13 PM
Default Add Interest and Skills and Different Fun Levels
I've created some custom schools for children and I'd like to make going to them add interest, both the regular interest and the FreeTime Hobby interests. Anyone know how to go about this?

Some of them I'd also like to build skills, again how?

Secondly I'd like to make these different schools give a different amount of fun to the children based on their personality. How would this be accomplished?

Thanks!
Advertisement
Sesquipedalian Pisciform
retired moderator
#2 Old 16th Dec 2008 at 11:22 PM
You could try taking a look at Inges custom school mods over at simlogical.

More downloads by Leesester, BoilingOil and others at Leefish.nl | My Stuff at Leefish.nl | LeeFish RSS | Sims4 News Blog | TumblinLeefish
One horse disagreer of the Apocalypse
#3 Old 17th Dec 2008 at 10:04 AM
No, Phaenoh is asking about something that schools do not have at this time, so mine won't help. The currect effect BCONs only affect motives.

Probably the easiest way without having to hack the school semiglobals and therefore begin to clash with all sorts of other work is to add it to one of the CTs in the school package - so they get an instant hit to the interests and enthusiasm for the day rather than an amount per hour.

"You can do refraction by raymarching through the depth buffer" (c. Reddeyfish 2017)
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#4 Old 17th Dec 2008 at 6:29 PM
Sounds good, how do I go about that? BHAVs are NOT my strong suit.
One horse disagreer of the Apocalypse
#5 Old 18th Dec 2008 at 9:49 AM Last edited by Inge Jones : 18th Dec 2008 at 12:38 PM.
Each school has "CT - dress for school" which runs each time they get ready to go to school. That is the one you can count on running every time, so that seems a good place to add it.

Interests and enthusiasms are stored in Persondata, and you can use the BHAV wizard to help you find those - it will be an Opcode 0x02 you need, if as I suggest you are going to do a direct incrementation.

Echo has a tutorial for beginners for editing BHAVs, so that might help you if you are not confident with those. Here: http://nene.modthesims2.com/showthread.php?t=142907

"You can do refraction by raymarching through the depth buffer" (c. Reddeyfish 2017)
Slippery When Wet
#6 Old 20th Dec 2008 at 5:22 AM
I would advise against editing the enthusiasm bars directly.
Instead use global 0x0621 Enthusiasm - Boost (Absolute).

The reason for this is that there are triggers as sims pass certain levels that enable the rewards (hobby mag, club card, plaque, LTA).
There are also 10+ tokens that you would have to deal with correctly.

I've documented the enthusiasm system here, including the params you need to pass to the global.

You can edit the interest values directly without causing any problems so long as you also check the limits. They may not stick for long though in an unmodded FT game.
My Enthusiasm Overhaul mod (see sig) will help with the random interest loss.
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#7 Old 4th Sep 2011 at 5:39 AM
Default Fun based on Personality and Adding Hobby Enthusiasm
I'm looking at making different schools for kids. I want the different schools to be more or less fun for the kids based on their personality. How do I do that? A test for personality and adjusting the Fun BCON? I don't really know what/how. I do know that serious sims prefer reading a book than they do watching tv, but I don't know what to do with that info.

The other thing I'd like to do is if the user has FreeTime installed I'd like these schools to add Hobby Enthusiasm. Is it possible to stick this all in a BG compatible package; ignore it all if no FT and run the hobby stuff if it is installed? How do you make stuff effect Hobby Enthusiasm?
Field Researcher
#8 Old 14th Sep 2011 at 7:12 AM
For adjustments to Fun, look in JobDataSchoolGlobals at "Sub - Start Motive Deltas". Rather than just directly assigning the value from the constant to My Decay Fun per Day, read it and multiply it by whatever factor you come up with and assign the result to Decay Fun Per Day. For example a really easy way would be to multiply by Playful/500 which gives 0% fun decay for super serious sims and 200% fun decay for super playful sims. Note that personality ranges 0-1000, not 0-10 like we see in the game. Make sure when you are multiplying and dividing no value ever goes over 65535 because that's the largest value these variables can hold.

For enthusiasm, use global BHAVs "Enthusiasm - Start" and "Enthusiasm - End", just be sure to set the rate very low since school lasts so long. A better option might be to use "Enthusiasm - Boost (Absolute)" to just give a one-time boost, say when the kid leaves or comes home, rather than an ongoing boost all day.

Then all you have to do is add a check of global variable x14 (Game Flags) to see if flag xE is set (that's FreeTime). You can look in global "Expansion Pack - EP(param) Installed?" to see how that works. However don't use that BHAV if you want to be BG-compatible because EA was apparently surprised by the fact Sims 2 had expansion packs and didn't include an EP check in base game (insert eye-rolling here). Just check the flag directly. If it's set, do the hobby stuff. If not, skip over it.

On my site I have dozens more Sims 2 mods. These mods come with no support so use them at your own risk.
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#9 Old 15th Sep 2011 at 3:26 AM
How would I multiply it by Playful? Is there a BHAV that does that? That sounds exactly like what I need. Do you know of any examples I can look at?

I was reading up on something about Enthusiasm by Tunaisfish over on MATY and it sounds like the Boost Absolute doesn't do things like add Hobby Lot cards appropriately, and that the Start and Stop ones are the better option. Do you know anything about that?

As for the EP check, is there anything that asks not if a certain EP is installed, but asks instead if its the original version? If I ran a check for that first and found out there was an EP installed, I could then check for FT, and wouldn't that technically work in Base because it wouldn't get to the EP check code if its just Base.
Field Researcher
#10 Old 15th Sep 2011 at 5:08 AM
You just multiply it. Since "me" is the sim in this context, then playful is my person data Personality Playful (x05). So instead of what's there now (My Decay Fun per Day := Const 0x1014:[Temp 0x0000]") you'd do something like:

Local 0 := My Personality Playful (which is "my person data x05" and will be in the range 0-1000)
Local 0 /= x0A (divide by 10 to reduce the range 0-100 which will prevent overflow in the next step)
Local 0 *= Const 0x1014:[Temp 0x0000] (the normal fun decay, which is 300 for public school and 200 for private)
Local 0 /= x32 (divide by 50 to give a final range of 0-600 for public school or 0-400 for private)
My Decay Fun Per Day := Local 0

Note that rather than dividing by 500 I divided by 10 and then 50. If I'd divided by 500 right away, you'd multiply fun by 0, 1 or 2 which isn't much variation. If I hadn't divided at all, Local 0 would have overflowed during multiplication and given nonsensical information.

I was going to refer you to Tunaisafish's hobby enthusiasm thread but I didn't have the address right offhand. I hadn't realized that about boost. As I said, the only concern with continuous enthusiasm is if you set the hobby rate too high, the kids max out hobbies on the first day of school, so you'll need to set it very low.

As for the EP check, yes and no. Technically the correct way to check for EPs is to first see if global variable x14 is equal to x7D0. If it is, that's base game. If not, you check flags or use the crappy built-in EP check which just checks flags so isn't really any better than checking them yourself.

The reason you check for x7D0 first is that falsely indicates the presence of FFS, Pets, Seasons, Celebrations, H&M and Bon Voyage. However since it doesn't falsely indicate FT, and you care whether the user specifically has FT and not "FT or later", you can just bypass the 7D0 check and look at the flag itself. The point is you can bypass the built-in EP check.

If you want to see a convoluted EP check you can go to my site and look at Smarter EP Check. That shows all the annoying manipulation to check for SPs, plus the unique problems introduced by IKEA and Apartment Life. But that's overkill for what you are trying to do here.

On my site I have dozens more Sims 2 mods. These mods come with no support so use them at your own risk.
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#11 Old 15th Sep 2011 at 5:29 AM
Thank you! This all looks pretty much doable to me now! Still confusing, but I imagine all that will sort itself out once I'm actually look in the packages. Thanks!
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#12 Old 16th Sep 2011 at 6:50 AM
Lol, I basically asked the exact same question 3 years ago. At least now I can make more sense of it. http://www.modthesims.info/showthre...obby+enthusiasm And this is useful as well. http://www.snootysims.com/infoindex.php?id=hobbies
Field Researcher
#13 Old 17th Sep 2011 at 5:33 AM
Well, at least you admit when you do something silly

Incidentally, I like your "make a difference" link. I have something similar on the donate page on my site.

On my site I have dozens more Sims 2 mods. These mods come with no support so use them at your own risk.
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#14 Old 18th Sep 2011 at 10:14 PM
Well, 'admitting it' was the easiest way to link the two help threads together, each gives slightly different perspectives on it.

Glad you like my link So far no one has done anything with it, but being able to track that as well is nice.
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#15 Old 21st Sep 2011 at 7:33 PM
Woohoo! That worked perfectly, except now I've run into a problem. There are only opcode options for the positive versions of the personalities. How do I make something fun for them the meaner or sloppier they are?
Site Helper
#16 Old 21st Sep 2011 at 7:38 PM
Can't you pass a negative parameter?
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#17 Old 21st Sep 2011 at 7:47 PM
I'm not seeing a way of doing that... ?
Site Helper
#18 Old 21st Sep 2011 at 8:11 PM Last edited by Mootilda : 21st Sep 2011 at 10:50 PM. Reason: Fix typo
I'd have to know the exact BHAV, but if you pass a parameter with the first bit set to 1 (ie 0x8xxx to 0xFxxx), then the game may interpret it as a negative number, depending upon whether the game believes that it is a signed or unsigned value.

Possibly the easiest way to see this is in SimPE. You can choose to have numbers displayed as signed or unsigned decimal, or hex. Take a look at the signed decimal for a hex value with the top bit set.

If you want to change a WORD from positive to negative, you could multiply by -1 (0xFFFF). For example:
Local 0 *= 0xFFFF
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#19 Old 21st Sep 2011 at 11:36 PM Last edited by Phaenoh : 22nd Sep 2011 at 1:08 AM.
Its not that I want a negative number, rather, Grouchy <--> Nice is on a 1 <-->10 type scale. So, having something that is better for grouchy has a number like 1 or 2, not a negative number. Maybe instead, for the bad end I can just subtract the number from 10 and multiply by that... Like 10 (full) - 2 (grouchy) = 8 and multiply by that... Cyjon showed me that I can multiply by a constant number, so I suppose I can subtract as well.

x3e8 -= Local 0 is what I tried to do, and it didn't work...
Site Helper
#20 Old 22nd Sep 2011 at 1:58 AM Last edited by Mootilda : 22nd Sep 2011 at 2:11 AM.
The thing on the left side of an assignment must be a variable. The right side can be either a variable or a value. Yes, you can subtract a constant value:
Local 0 -= whatever...

Subtracting personality from 10 sounds very reasonable. That will give you an inverse value that you can use to increase fun with decreased niceness. However, isn't the personality actually 0 - 1000? In which case, you want to subtract from 1000 to invert the value.

Perhaps we could see that bit of your code and comments about what you're trying to accomplish? Or, is that code from Cyjon your finished code?
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#21 Old 22nd Sep 2011 at 2:44 AM
I think I'm actually going to multiply and divide instead of subtracting. According to the Snooty Sim graph, Hobby traits are based on two personality traits, one good and one 'bad'. I'll multiply by the positive one and then divide that by the less desirable one, then multiply by a constant to get back into the right range.

I'm pretty much just using Cyjon's code straight up.

Local 0 := My Personality Playful (which is "my person data x05" and will be in the range 0-1000)
Local 0 /= My Personality Nice (for a grouchy sim, gets us into the range between .1 and 10)
Local 0 *= x0A (multiply by 10 to get us back to the range 1-100)
Local 0 *= Const 0x1014:[Temp 0x0000] (the normal fun decay, which is 300 for public school and 200 for private)
Local 0 /= x32 (divide by 50 to give a final range of 0-600 for public school or 0-400 for private)
My Decay Fun Per Day := Local 0

I'll also need to put in a check to make sure that the down personality is not zero, and if it is, to use 100 instead.
Two of them don't use negative personalities, so for those I'll multiply the two personalities and then divide by 1000

Local 0 := My Personality Playful (which is "my person data x05" and will be in the range 0-1000)
Local 0 *= My Personality Nice (for a grouchy sim, gets us into the range between 0-1000000)
Local 0 /= x3e8 (divide by 1000 to get us back to the range 0-100)
Local 0 *= Const 0x1014:[Temp 0x0000] (the normal fun decay, which is 300 for public school and 200 for private)
Local 0 /= x32 (divide by 50 to give a final range of 0-600 for public school or 0-400 for private)
My Decay Fun Per Day := Local 0

/= 3e8 does translate into /1000, right?
Site Helper
DELETED POST
22nd Sep 2011 at 4:42 AM Last edited by Mootilda : 22nd Sep 2011 at 4:54 AM.
This message has been deleted by Mootilda.
Field Researcher
#22 Old 22nd Sep 2011 at 5:11 AM
The thing is, Grouchy is not (1/Nice). It's (1000 - Nice). So rather than dividing by Nice and worrying about dividing by 0, roundoff errors and such, you should use (1000 - Nice) just like you'd use Playful.

Local 0 := literal x3e8
Local 0 -= My Personality Nice (so now you have my Grouchiness 0-1000)
Local 0 += My Personality Playful (Grouchy + Playful which is in the range 0-2000)
Local 0 /= x0A (bring it to the range 0-200)
Local 0 *= Const 0x1014:[Temp 0x0000] (the normal 200 or 300 point fun decay, so our ranges are 0-40,000 or 0-60,000)
Local 0 /= x64 (divide by 100 to give a final range of 0-600 for public school or 0-400 for private)
My Decay Fun Per Day := Local 0

On my site I have dozens more Sims 2 mods. These mods come with no support so use them at your own risk.
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#23 Old 22nd Sep 2011 at 5:59 AM Last edited by Phaenoh : 22nd Sep 2011 at 6:32 AM.
Wow. I think I need to be sent back to basic Algebra... cuz I totally got schooled... on my afterschool activities... :facepalm:

Ok, that works well, but the values all move too quickly. How do I tone it all down some? I keep trying to /= 0x0002 at the end and it doesn't seem to change the rate at all.

And just to clarify, on the ones where I'm multiplying or dividing, I'm supposed to use the drop down item 'Unused' right before it right?
Site Helper
#24 Old 22nd Sep 2011 at 6:21 PM Last edited by Mootilda : 22nd Sep 2011 at 10:36 PM.
Exactly where are you trying to divide Local 0 by 2? Before or after you've added in the normal decay rate? I would suggest that you reduce Local 0 before you add in the normal decay rate, which should change the decay rate by less.

Something that I noticed about your code in post #15. More general programming information than anything specific to your problem. I hope that I can explain this adequately. Please ask questions if I'm not making sense.

You need to be much more careful about ranges. Local 0 is a WORD (two bytes) and can only store whole values between 0 and 0xFFFF (= 65535 unsigned decimal). Specifically, it can't store the value .1 (fractional) and it can't store the value 1000000 (too large). What happens in those cases is that the data is truncated and you basically lose your data.

You need to rearrange your calculations so that the beginning and ending values are always in the valid range, and are always whole numbers.

But there's more. If you arrange your calculations so that you take a range of 0-1000, reduce it to 0-10, and then multiply by 10 to get it back into the 0-100 range (as shown in your first example), you've lost a lot of variety in your values. You started with 1001 values and reduced that to only 11 distinct values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, and 10. When you multiply by 10, you still have only 11 distinct values: 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, and 100. This is rarely what you want.

Therefore, you probably want to arrange your calculations to maintain value diversity. This is usually accomplished by trying to keep the maximum possible range of values while still ensuring that all beginning and ending values are still in the valid range.

I really hope that makes sense. Computer math isn't like real math, because you always have to consider how the value is being stored.
Field Researcher
#25 Old 23rd Sep 2011 at 2:06 AM
I thought that range might be a bit high, but often that's how programming works. You do it quick and dirty just to get it working and then tweak on the numbers.

By coincidence, when Local 0 is in the range 0-200 that turns out to be 0-200%. So if you wanted a range of, say, 50-150% you can convert 0-200 to that range by dividing by 2 and then adding 50 (which is x32 in hex). Just remember that you need to look at the ends of the range, but also the center because that's going to be the average fun rate. If you just divide by 2, you get 0-100% which means you'll always get the same or lower fun drain, never higher, and the average student will have half the fun drain.

Then again, that might not be a bad thing. The problem with raising fun drain at school is the kids still have to do homework once they get home so you need to be careful about raising it too much. You might want to say the default drain is the high end and most kids will have lower fun drains.

I'm slightly confused by your last question, but I think I understand. You're using the wizard and telling it you want a local variable, and then it has you choose which local variable you want. Since you haven't named the variables you just get "unused" labels. So yes, that's what you do. Since you have only 1 variable there should be only 1 on the list.

On my site I have dozens more Sims 2 mods. These mods come with no support so use them at your own risk.
Page 1 of 3
Back to top