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!
Former Hamster
retired moderator
Original Poster
#1 Old 1st Aug 2014 at 9:18 AM Last edited by mustluvcatz : 7th Aug 2014 at 8:23 AM.
Default Turning effects on/off depending on time of day when placed, then on/off at a specific time of day after placement.
Is it possible to turn effects on and off? Say- on during the day and off at night? (I sure it is but I'll be danged if I can find anything about it!)

I've got an object with an effect that starts once you go in live mode and stays on. It's neat but I think it would be neater if the effect was turned off at night.
Advertisement
Me? Sarcastic? Never.
staff: administrator
Former Hamster
retired moderator
Original Poster
#3 Old 1st Aug 2014 at 5:17 PM
I did, right before I asked this question, lol. This playing around with BHAVs all started because someone asked me if the interactions from one object could be added to another. I figured it wouldn't hurt to try and actually ended up adding more to it and it all worked! It's addictive and now I want to learn more, lol.

So, in looking at a bazillion objects I did look at them and I can see how Inge's curtains work. I just can't figure out how to apply that to the effect in my object. The idles followed by expressions in the main BHAV are a big clue, of course. But her curtains use material changes for the open/close states and I see that 'Update by attribute' in there along with 'Update wrapper'.. and yeah, understanding all of that isn't helping me figure out how to apply any of that to my object. If it helps any, I used a Function - Start Run Mode for my effect instead of adding it the way it's done in Atavera's tutorial. (Nix had helped me add effects to a stove ages ago and that's how she had me do it. ) I'm thinking that anything I'd add would need to be added to that? Then again, I'm fairly new to this part of creating so I'm probably wrong.
*shrugs*
retired moderator
#4 Old 2nd Aug 2014 at 2:37 AM
Basically in your Main, you would have an Idle node that idles for an hour ([global 0x016E] Idle - Hours (1 arg: Hours=0x0001)) and then checks the time. If the Global 0x0000 (Hour) is equal to Literal 0x007, use the [prim 0x0070] Effect Stop/Start primitive to turn on the effect. You can use [global 0x0459] Time - Night Time? and the [prim 0x0070] Effect Stop/Start primitive to turn off the effect at night. The first operand box for 0x0070 controls hard/soft on/off.

The reason I suggest checking against the hour of daybreak instead of using [global 0x0458] Time - Daytime? would be so that it doesn't keep turning the effect on. Off hand, I'm not sure if the effect would stack...but it shouldn't be an issue this way.

I don't mind if you call me "MSD" or something for short.
Tumblr
Perhaps someday I'll have leisure time back...
Former Hamster
retired moderator
Original Poster
#5 Old 2nd Aug 2014 at 6:31 AM
Thanks MSD. I would be awesome if I understood that well enough to actually do it properly. I can add all of that just fine, it's the true and false targets that are messing me up. ALSO, you say the Main. Since I added a Function - Start Run Mode for the effect would I get rid of that or add to it instead of the Main?
*shrugs*
retired moderator
#6 Old 3rd Aug 2014 at 2:50 AM
Depends upon how you want the object to behave. Do it in whatever BHAV controls turning the effect on/off.

I'm not entirely certain what you mean when you say you have a "Function - Start Run Mode." Is this a BHAV for when the game enters/leaves Live mode? If so, is there a reason to turn the effect off when not in Live mode? Or is this a BHAV that is used as part of an interaction (e.g. the Sims starts to use the object and you call it to turn on the effect)?

I don't mind if you call me "MSD" or something for short.
Tumblr
Perhaps someday I'll have leisure time back...
Former Hamster
retired moderator
Original Poster
#7 Old 3rd Aug 2014 at 6:01 AM Last edited by mustluvcatz : 4th Aug 2014 at 12:07 AM.
When I added the effect I added it the way I was taught to- which is with the Function - Start Run Mode. The effect doesn't start until live mode is entered. (And to be honest, I've never paid attention to whether or not it stops when you change to buy/build.) Nix is the one who taught me to do it that way. So I'd add everything to that then, correct? That's how I did it the first time and it didn't work right. That said, I've gotten a lot more comfortable playing with the BHAVs in the last couple of days. So I'll try it again!

Edit: trying this again with a version of the object that has the effect controlled by the Main BHAV! *crosses fingers*

Further edit: Well, it didn't work for me. However, I DID get it to work by studying Inge's Main BHAV (auto curtains) and adapting what I "learned" to fit what I wanted my object to do!! On sim day 4 and it works perfectly.
Former Hamster
retired moderator
Original Poster
#8 Old 7th Aug 2014 at 8:18 AM
Double posting to say: I thought the effects were turning on and off the way I wanted them to but they weren't. I had := where there should be == and it was causing the game time to change when the effect went on/off. Fixed that but the effect still wasn't working right because the time the effect turned on/off depended on what time the object was initially placed, so the it was turning on/off at the wrong time of day. The screenshot below shows how I finally got it to work. It might not be perfect, but it works and doesn't error in any way. So if someone ever wants to make an object with an effect that is on/off when placed (depending on the time of day when placed) and then goes on/off at a specific time of day, feel free to copy.



NOTE: As far as I know, my object requires NL due to the Time - Daytime? and Time - Night Time?.
Back to top