Welcome to
Mod The Sims
Online: 2220
News:
Have an account? Sign in:
pass:
If you don't have an account, why not sign up now? It's free!
Other sites: SimsWiki
Reply  Replies: 37 (Who?), Viewed: 35717 times.
Search this Thread
Old 5th Jun 2005, 1:08 PM DefaultProgrammer's Guide to BHAVs #1
Echo
Original Poster

Duck



Join Date: Dec 2004
Posts: 3,918
Thanks: 48197 in 48 Posts
26 Achievements

View My Journal


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, 5074 downloads) - View custom content
Last edited by Echo : 8th Jun 2005 at 2:18 PM.
93 users say thanks for this.
[ Click here to view a longer list ]
Old 5th Jun 2005, 1:25 PM #2
thefuzmixman
Instructor

Join Date: Feb 2005
Posts: 522
Thanks: 5415 in 17 Posts
13 Achievements


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
Old 5th Jun 2005, 1:25 PM #3
Carrigon
Firestarter

Join Date: Sep 2004
Posts: 331
Thanks: 27 in 4 Posts
2 Achievements


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.
Old 7th Jun 2005, 4:43 AM #4
Echo
Original Poster

Duck



Join Date: Dec 2004
Posts: 3,918
Thanks: 48197 in 48 Posts
26 Achievements

View My Journal


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!
Old 8th Jun 2005, 9:23 PM #5
WindBlower
Lab Assistant

Join Date: Mar 2005
Posts: 154
Thanks: 1584 in 10 Posts
10 Achievements


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
Old 13th Jun 2005, 11:04 AM #6
xanathon
Forum Resident

Join Date: Oct 2004
Posts: 701
Thanks: 25870 in 74 Posts
20 Achievements


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!
Old 22nd Jun 2005, 12:10 PM #7
sirams
Test Subject

Join Date: May 2005
Posts: 15


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.
Old 26th Jul 2005, 1:52 AM #8
simsonite
Test Subject

Join Date: Oct 2004
Posts: 6


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
Old 26th Jul 2005, 7:50 AM #9
Echo
Original Poster

Duck



Join Date: Dec 2004
Posts: 3,918
Thanks: 48197 in 48 Posts
26 Achievements

View My Journal


I'm delighted you found it useful! I'm looking forward to seeing what mods you come up with.
Old 2nd Feb 2006, 2:31 PM #10
rebecca17
Test Subject

Join Date: Jan 2006
Posts: 34


thankyou! i am not smart enough yet to understand all of it. But it helps me a bit.
Old 2nd Apr 2006, 3:14 AM #11
lgiese
Test Subject

Join Date: Mar 2006
Posts: 24


Promblem with downloading the file. Tried to download BhavGuide.zip and I got a pdf file with 14 pages of garble.
Old 2nd Apr 2006, 4:20 AM #12
Echo
Original Poster

Duck



Join Date: Dec 2004
Posts: 3,918
Thanks: 48197 in 48 Posts
26 Achievements

View My Journal


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.
Old 21st Apr 2006, 5:18 PM Yay. Good stuff. #13
alchemist
Instructor

Join Date: Sep 2005
Posts: 536


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!
Old 22nd Apr 2006, 3:58 AM #14
Echo
Original Poster

Duck



Join Date: Dec 2004
Posts: 3,918
Thanks: 48197 in 48 Posts
26 Achievements

View My Journal


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.
Old 7th May 2006, 11:22 AM #15
solfal
Lab Assistant

Join Date: Sep 2004
Posts: 152
Thanks: 1139 in 4 Posts
7 Achievements


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.
Old 7th May 2006, 12:25 PM #16
Echo
Original Poster

Duck



Join Date: Dec 2004
Posts: 3,918
Thanks: 48197 in 48 Posts
26 Achievements

View My Journal


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.
Old 7th May 2006, 5:21 PM #17
solfal
Lab Assistant

Join Date: Sep 2004
Posts: 152
Thanks: 1139 in 4 Posts
7 Achievements


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?
Last edited by solfal : 7th May 2006 at 6:26 PM.
Old 8th May 2006, 10:59 AM #18
Echo
Original Poster

Duck



Join Date: Dec 2004
Posts: 3,918
Thanks: 48197 in 48 Posts
26 Achievements

View My Journal


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.
Old 8th May 2006, 11:03 AM #19
J. M. Pescado
Fat Obstreperous Jerk

Join Date: Oct 2004
Posts: 3,153
Thanks: 8623 in 39 Posts
14 Achievements


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.
Old 8th May 2006, 12:34 PM #20
Echo
Original Poster

Duck



Join Date: Dec 2004
Posts: 3,918
Thanks: 48197 in 48 Posts
26 Achievements

View My Journal


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.
Old 8th May 2006, 9:05 PM #21
solfal
Lab Assistant

Join Date: Sep 2004
Posts: 152
Thanks: 1139 in 4 Posts
7 Achievements


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, 34 downloads)
Old 9th May 2006, 12:03 PM #22
Echo
Original Poster

Duck



Join Date: Dec 2004
Posts: 3,918
Thanks: 48197 in 48 Posts
26 Achievements

View My Journal


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.
Old 9th May 2006, 11:23 PM #23
solfal
Lab Assistant

Join Date: Sep 2004
Posts: 152
Thanks: 1139 in 4 Posts
7 Achievements


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, 30 downloads)
Old 26th May 2006, 5:26 PM #24
solfal
Lab Assistant

Join Date: Sep 2004
Posts: 152
Thanks: 1139 in 4 Posts
7 Achievements


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, 24 downloads)
Old 28th May 2006, 2:01 PM #25
solfal
Lab Assistant

Join Date: Sep 2004
Posts: 152
Thanks: 1139 in 4 Posts
7 Achievements


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!
Reply


Section jump:


Powered by MariaDB Some icons by http://dryicons.com.