Replies: 40 (Who?), Viewed: 43725 times.
Page 1 of 2
Retired Duck
retired moderator
Original Poster
#1 Old 5th Jun 2005 at 1:08 PM Last edited by Echo : 8th Jun 2005 at 2:18 PM.
Default Programmer's Guide to BHAVs
Been seeing a lot of questions about recently asking about hacking and changing behaviors. This is a really slippery topic to write tutorials about, because the standard walkthrough style tutorial can only teach how to do one specific hack, and can be very hard to generalize beyond that particular example. So I had a go at writing a guide to BHAV theory, the bits and pieces that make it easier to edit BHAV files intelligently.

I am NOT an expert on BHAVs. Not even close! Absolute amateur compared to many people on this forum. This document just combines a lot of bits and pieces of information I garnered from this and similar forums over the last several months. So a word of warning - there may be mistakes in this document, but I promise I've done my best to discuss only things I was reasonably certain about.

Specific questions are welcome, (that is, "what did you mean by...?" and "could you explain this part in more detail?"). Generic questions are less welcomed ("how do I make an object?" or "where can I get SimPE?",) and are more likely to result in a polite redirection to a more relevant forum. Corrections, suggestions and criticisms are also entirely welcome.

This document is subject to future modification (in case I fouled something up!)

Thanks for listening, hope you all enjoy!

A Programmer's Guide to Behavior Editing
Download - please read all instructions before downloading any files!
File Type: zip BhavGuide.zip (85.9 KB, 6179 downloads) - View custom content
Advertisement
Instructor
#2 Old 5th Jun 2005 at 1:25 PM
well i for one will be the first to post and read your guide. Perhaps if i get the theory down, i will have a better understanding of why i do this, or why when i do this, this doesn't work sorta stuff. thanks so much
Firestarter
#3 Old 5th Jun 2005 at 1:25 PM
You did a good job on it. It is hard to help people to understand Simantics. What I usually tell everyone is, Simantics is a language. It's a language that is made up of numbers, but it is still a language, and it can be learned if you are persistant.
Retired Duck
retired moderator
Original Poster
#4 Old 7th Jun 2005 at 4:43 AM
Thanks for the feedback Especially Carrigon - it was your basic tutorials on BHAV editing in SimPE that got me started on the whole behaviour editing business!
Lab Assistant
#5 Old 8th Jun 2005 at 9:23 PM
Dear Echo

I am just now reading your file now. WOW you did a both fantastic and a user friendly manual. I CAN’T THANK you enough, This made so many things fit into place (in my head).
Thank you

WindBlower
Forum Resident
#6 Old 13th Jun 2005 at 11:04 AM
Thanks a lot, Echo, I was looking forward to something like this a long time! It is somewhat difficult to find a source of information about this that is a basic overview and does not only rely on one specific topic. Great work!
Test Subject
#7 Old 22nd Jun 2005 at 12:10 PM
Really good thing. I used many basic tutorials but still could not get into details: "why this thing has to be modified that way" and "will it still work if i try to change this BHAV code". With Echo's tutorial it is easier to figure out how to get desired results. Thanks.
Test Subject
#8 Old 26th Jul 2005 at 1:52 AM
Don't know much about programming (or modding yet), but this was very, very useful. Thanks to the bit about opcodes numeration, and where to extract (from objects), was able to edit the bhav's for the whole game. (Was making new package in SimPE and importing semiglobals, but those were'nt of the 2000's instance, and so nothing changed despite changing those bhavs.) The t-f thing was fairly evident, but i wasn't completely understanding until reading this guide that those lines are (some of them anyway) calls to other globals. Thanks for this guide, was looking for something to explain it in this way instead of the basic lets change an objects bhav tutorial. I think now I can do just about anything with the bhav's. thankya thank ya thank ya
Retired Duck
retired moderator
Original Poster
#9 Old 26th Jul 2005 at 7:50 AM
I'm delighted you found it useful! I'm looking forward to seeing what mods you come up with.
Test Subject
#10 Old 2nd Feb 2006 at 2:31 PM
thankyou! i am not smart enough yet to understand all of it. But it helps me a bit.
Test Subject
#11 Old 2nd Apr 2006 at 3:14 AM
Promblem with downloading the file. Tried to download BhavGuide.zip and I got a pdf file with 14 pages of garble.
Retired Duck
retired moderator
Original Poster
#12 Old 2nd Apr 2006 at 4:20 AM
Downloads fine for me... Have you tried downloading it again? Perhaps something went wrong in transmission? If all else fails, I can email it to you as a word document.
Instructor
#13 Old 21st Apr 2006 at 5:18 PM
Yay. Good stuff.
Okay, I made it to page 7 by now, and so far it's great - I love that finally I'm getting explanations for the terms which I find all over the forums: what is SimAntics, what is BHAV, what in all heck is a global, what do the numbers mean...

So, thanks a bunch!

One thought:

"There are many resources online that are excellent at explaining these concepts."

Okay....

But: Where? Because at that point, and later on, I have a dim idea at best of what concepts those are. The best I can do is wait for the first unknown expression and then google "tutorial *expression*" and wade through the first dozen of links.

If you have any recommendation, it would be great if you added them, and it would save a lot of time-consuming searching.

It's worth repeating myself on this: getting an understanding of all the terms is great, it means that I don't have to follow walk-throughs blindly but know what I'm doing. Many many thanks!
Retired Duck
retired moderator
Original Poster
#14 Old 22nd Apr 2006 at 3:58 AM
You mean basic programming concepts? Just type "introduction to programming" into google and you'll get hundreds of thousands.

If you're looking for a basic concepts that are BHAV specific, then you'd be better reading this:
http://www.modthesims2.com/showthread.php?t=142907
first. It's much more practical and hands on, and assumes no previous programming knowledge.

Or you can keep going with this one, it's a great resource, but like it says in the intro, it's designed for programmers to learn the simantics specifics and does assume programming knowledge.
Lab Assistant
#15 Old 7th May 2006 at 11:22 AM
Thank you so much! I realy have enjoyed seeing my sim dancing in front of the painting! The tutorial was exelent and I was able to understand it without having any programing experience whatsoever.

However when I started try to make the object interactions for the toddler instead I got stucked. When I make the same changes for the object as in the tutorial but for toddlers only the object turn to be unplacable at the lot.

I have tried with different objects, the painting and toddler object. Do you know why this happeneds or can you tell me wich object will be good to start with to make a toddler object. To start with I only want them to crawl to the object and then sit down.
Retired Duck
retired moderator
Original Poster
#16 Old 7th May 2006 at 12:25 PM
Are you able to post a copy of the object here (or on the tutorial thread)? Toddler interactions are slightly different to adult interactions, but most of the stuff in the tutorial ought to work just fine for toddlers (assuming you want hula dancing toddlers, of course!). Being unplaceable makes me think it's not related to the interactions, but to some other change. Placeability is determined before any of the interaction code is accessed normally.
Lab Assistant
#17 Old 7th May 2006 at 5:21 PM Last edited by solfal : 7th May 2006 at 6:26 PM.
I remade the package for the fifth time to have for posting and suddenly it worked!

I have no I dea why because I thought I made it thesame all times, but apparently not.
One thing I know I didn´t do is rename the behavior function to interaction. Could this cause the problem?

I would like to have some animation but since the paintig don´t have any toddler animation I cant import it from the painting globals, do I have to clone an object that already have toddler animation?
Retired Duck
retired moderator
Original Poster
#18 Old 8th May 2006 at 10:59 AM
The name given to a BHAV is just for human reader benefit, it doesn't actually do anything to the system. If you still have the earlier drafts, I'm still happy to take a look and see if I can figure out what you did differently, but it's your call.

The animation lists are the same for all objects, so you don't need to clone a different object. (Just about everything I make is based on sculptures or paintings these days.) If your object doesn't have a table for toddler animations, just make one for it. All you need is a text list with the instance number of 0x89.
Fat Obstreperous Jerk
#19 Old 8th May 2006 at 11:03 AM
Quote:
Originally Posted by Echo
The name given to a BHAV is just for human reader benefit, it doesn't actually do anything to the system.

This is not true. The name of a BHAV *USUALLY* doesn't matter, but BHAVs can be invoked by Run Tree By Name, which DOES use the name. So arbitrarily changing the names of BHAVs on cloned objects can caused them to behave strangely.

Grant me the serenity to accept the things I cannot change, the courage to change the things I cannot accept, and the wisdom to hide the bodies of those I had to kill because they pissed me off.
Retired Duck
retired moderator
Original Poster
#20 Old 8th May 2006 at 12:34 PM
Oh yeah, my error, allow me to rephrase.

The name given to an Interaction is just for human reader benefit, it doesn't actually do anything to the system. The same is true for object functions, events, and most other BHAVs, with the exception of those that get run using a "Run Tree By Name" call. These often (although not always,) have names that begin with "CT", to help differentiate them to the reader.
Lab Assistant
#21 Old 8th May 2006 at 9:05 PM
I did overwrite the bad package, but here is the new one and it workes!

I have tried to make the toddler stop playing when it is tiered, but I couldn´t figure it out. How do I tell the toddler to quit?
Download - please read all instructions before downloading any files!
File Type: rar SolfalGardenToddlerPlay0605.rar (81.0 KB, 48 downloads)
Retired Duck
retired moderator
Original Poster
#22 Old 9th May 2006 at 12:03 PM
Well done! Congrats on a working object.

As far as telling a toddler to quit when it's tired... Let me rephrase your question, as it may make the answer a little more obvious:

If "My motive (Energy) < -60" is true, then finish the interaction. Otherwise, keep going in the loop.

The tutorial should show you how to manage If statements like that, but if you're still stuck PM me and I'll send you the code.

As an extra note, if your object is only ever going to be used by toddlers, then it's good practice to specify the toddler list in the "Animate Sim" commands, rather than the adult list. If you look at your Animate Sim commands, you'll see one of the operands is "81". Change that to "89". That box is just saying which text list to look at first. In your case, it'll make the Animate Sim commands actually display the correct description for the animation you're running.

Of course, since toddlers that run the animation will automatically look to that table anyway it's not strictly necessary, it just makes the code a bit clearer.
Lab Assistant
#23 Old 9th May 2006 at 11:23 PM
I made two misstakes, I tried to finished the operation with true and I didn´t use a minus (stupid, I didn´t read the walues the game use properly).

When you rephrased the question it all come clear. You have a great way of explaining things in a simple way.

I couldnt understand why the adult animation commands still showed when I used toddler commands and the toddler commandes worked. Using "89" made it so much easier to work with.

Thank you so much. I am a proud creator of a new toy. Here it is
Download - please read all instructions before downloading any files!
File Type: rar SolfalGardenToddlerPlay0605.rar (23.2 KB, 40 downloads)
Lab Assistant
#24 Old 26th May 2006 at 5:26 PM
Hi!

I have been playing around with the potty animation, I thought I would like to make a little chair for the toddler.
I have two problems. I think I need to tell the toddler to go to a routing slot, but I dont know where to set that value.
It looks like I have to snap the toddler to the object to get the animations to work but I dont know where to set that either.

Perhaps this is way over my head.
Download - please read all instructions before downloading any files!
File Type: rar SolfalToddlerCair0605.rar (18.6 KB, 31 downloads)
Lab Assistant
#25 Old 28th May 2006 at 2:01 PM
I have done some reading about routing slots and it seems to be rather complicated. I made it the other way around instead. I cloned a potty and deleted the BHAV that have to do with training and bladder and set it only awalible for toddlers to use. It actuelly worked!
Page 1 of 2
Back to top