View Full Version : Modding Infocenter - Simantics and BHAVs
Numenor
15th Dec 2005, 12:57 AM
>>> Modding InfoCenter <<<
A workshop about Simantics and BHAVs
By AdidasSG2
DISCLAIMER: The "Modding InfoCenter" threads are NOT tutorials: they are intended to help average-experienced object creators performing specific tasks, or to give users a deeper in-sight on specific modding-related subjects. So, don't expect to find step-by-step explanations, to be performed "blindly". Please DO NOT REPOST the following info, or part of them, on other sites.
All the "Modding InfoCenter" threads are created and mantained by Numenor and JWoods. Everyone is welcome to post his own questions or additional information about the specific thread subject.
CREDITS: Some of the following information can be found scattered on the various forums, but special credits go to ADIDASSG2 for having collected and organized them, and for having provided a lot of additional info, by experimenting on the various instructions. AdidasSG2 will mantain this thread, adding new information as he gathers them; and will answer to questions about the subject of this article.
-------------------------------------------------------------------------------------
SUMMARY
The BHAVs (Behaviour functions), are for sure the most complex known Sims2 filetype. Oll the functions of an objects, the sims' behaviour, the NPCs activities are coded into BHAVs.
AdidasSG2 has created, and still the work is in progress, an extremely valuable articles about BHAVs and BHAV editing. All of AdidasSG2's articles are posted below, on post #2. Please check beck to see the additions and changes that AdidasSG2 will make to post #2.
:deal: These InfoCenter articles are provided in PDF format. To view them, we strongly suggest to download the Foxisoft PFD Viewer (http://www.foxitsoftware.com/pdf/rd_intro.php): it's free and small, less than 1Mb!
-------------------------------------------------------------------------------------
OTHER USEFUL RESOURCES
Modding Infocenter Index (http://www.modthesims2.com/forumdisplay.php?f=333) - Comprehensive list of all the InfoCenter threads
Programmer's Guide to BHAVs (http://www.modthesims2.com/showthread.php?t=67365) - by Echo
Tutorial: Making Your First Custom BHAV (http://www.modthesims2.com/showthread.php?t=142907) - by Echo
-------------------------------------------------------------------------------------
.
AdidasSG2
16th Dec 2005, 11:10 PM
A series of documents that will cover SimAntics BHAV's.
What are they?/How do they work!?/ and much much more!
Learn to understand it's OpCodes and Operands
So get ready to sit down and learn!, and have some fun.
New Addition:
Set To Next
Hmmm...I wonder what I will set to next be? :deal:
AdidasSG2
24th Jan 2006, 10:44 PM
Check it out!
AdidasSG2
26th Jan 2006, 10:56 PM
Spread Sheet files listed for those references you cannot find! :-)
ZerkSim
18th Mar 2006, 01:18 AM
Hey Adidas, EXCELLENT work on these tutorials. I'm an experienced programmer so I was able to pick it up for the most part but thanks to your work in this community, modding sims2 is a joy now! I remember trying to mod the original sims and was fed up with the lack of information, tools and limited things you could do and lost interest being frustrated. Now with your awesome tuts and SimPE, I'm excited to do some cool stuff now!
I followed your burglar alarm tut verbatim but mine never creates the glass of water. The pie is there and I can activate it but it doesnt do anything. I can see the sims twitch though like something happened. Oh well. The part where you hurry through the "- TEST" BHAV part was a bit confusing so I bet I messed up there.
exnem
7th Apr 2006, 04:04 PM
Thanks Numenor and Adidas for these, they are really, really helpful! :nod:
Morague
13th May 2006, 01:15 PM
AdidasSG2,
Thank you - these really are excellent. Will you be doing more? I know, tutorials take so long to write up! These have helped me so much. I really appreciate the time & effort you put into this.
Morague
KusanagiKei
16th May 2006, 09:59 PM
Great Tutorials AdidasSG2,
I'm sort of new at this modding thing and I'm having troubles creating a phone book service dialog on a T.V. My method of doing it is just by adding a simple behavior with the 0x0024 primative function:
0000000000050B000000140000170000
[prim 0x0024] Dialog (Scope: Private,
Type: Phone Book - Services: "Call %s",
Yes: [none],
No: [none],
Title: "Service Phonebook",
Cancel: [none],
icon: automatic,
wait for user,
block Sim. (Display the phone book dialog for services - uses private string table 147 to get service choices in. Returns index selected in array0 at position 0.))
I'm using a Text Lists to display the strings, like they do with all dialogs, however when I try to run the behavior in the game it just stops the sims and disappears (kind of like a sleep call (0x0000).
Has anybody had any progress in creating their own Phone book - service dialog? Does the Service dialog only specifically work for the phone? Do i need another function to call it up? I'm confused :P Thanks for any help u guys could give me :D
Numenor
17th May 2006, 08:40 AM
When you test new BHAVs, you should play with the testingcheats active, so that when an error occurs, a message will be shown, and a log file will be created.
The log files are located in the document folder, in EA Games\The Sims 2\Logs; they are quite useful because they tell you (more or less) what happened when the sims disappeared.
That said, I'm not expert with this dialog, so I can't help you. But I thought to tell you about the logs, because the error might not be caused by the dialog, but rather by another problem.
KusanagiKei
17th May 2006, 05:29 PM
Thanks for the advice Numenor,
Although I haven't got the dialog to work yet, I have some idea as to what is going on :D
Numenor
5th Jun 2006, 10:21 PM
Woot! Woot! Woot! :)
Echo
6th Jun 2006, 12:23 PM
Part 6 Is comming....LUA - LUA Scripts and of course Lua Primitive (0x7E)...
I'm certainly looking forward to this! LUA scripts are something I've yet to venture into in the sims... I'm very curious!
Numenor
8th Jun 2006, 11:00 PM
41-45 pages?! Oh, my... I didn't expected it any shorter, but I guess I have to take a vacation (from work *and* from modding!) to read it all! :lol:
Thanks for the time you spend for these extremely useful guides! :up:
AdidasSG2
9th Jun 2006, 09:35 PM
Lua Is Up and Running! :-)
Sorry All, Had to repost the zip file, you will notice in the original PDF
there is some info missing in the LT. Green shaded section. Sorry about that!
Here is the new one, Full and Uncut! :up: :new: :!:
kaisilverwolf
14th Jun 2006, 06:00 PM
I've been following your tutorials, they are excellent, but i have a small question...?
In tutorial two (sleep and expression) on the bottom of pg 7 you have us test out "translating" the Operands. I tried, and i got 08 0000 05 0B 000B
You said that the correct translation should be "Temporary Storage 0x0000 AssignTo: My Object ID" but on the excel spreadsheet (OpCode Expressions) with the data owners it says that 0x0B is "Temporary Storage [temp]"... I follow the rest of it but i don't know where you got "my object id" from. are there more lists than what you have provided? or is that entry wrong? or am i just insane/stupid?
AdidasSG2
14th Jun 2006, 08:54 PM
Kais.
I don't think that you are the first one to spot this, I think I may have a typo in there! I am not for sure, I will have to check it out!
I try to catch as many of the mistakes as possible, so I am sure a couple slip thorugh the cracks.
But indeed, the Translation should read:
Temporary Storage 0x0000 := My Object ID
If I have it correct in my mind, which I am not sure,
The operands would then translate to
Temporary Storage (0x08) 0x0000 (0x0000)
:= (0x05) (Assign)
My (0x03) object Id (0x0B)
This is the Actual translation, I checked it out and made sure it's right!
I hope this helps you!
AdidasSG2
20th Jun 2006, 09:14 PM
Problem solved
AdidasSG2
27th Jun 2006, 09:14 PM
Manage Inventory (0x33) Is Comming Soon to a forum near you! :-)
Numenor
27th Jun 2006, 10:49 PM
You always concentrate on the most obscure and less documented instructions... Lucky us! :)
AdidasSG2
30th Jun 2006, 10:03 PM
I try to hit the one's that are used the most, but documented least to cover those first, also as to help modders get an understanding from the ground up! :-)
AdidasSG2
6th Jul 2006, 09:44 PM
Manage Inventory Now up for Grabs!
Numenor
6th Jul 2006, 11:44 PM
Grabbed!!! :) Thanks a million, this is a really valuable library where to gather information...
Ehm... I have a question, not related to the already issued guides... It's a quickie (or at least I guess it is) and it doesn't need a guide, actually...
In order to "move" the stack object to a specific object or sim, there are several Global BHAVs like "Verify - Object ID", "Verify - Stack Object ID" etc...; all these BHAVs use the Set to next primitive in a way that I really don't understand...
Well, I must confess that I don't understand most of the possible usages of the Set to Next primitive...
Cane you briefly explain the Set to Next primitive? Or do you think it's a subject that worths a guide?
AdidasSG2
12th Jul 2006, 09:46 PM
Numenor,
Well, well, well...let's just say you already guessed my next topic! :-) Yes! I am going to cover the "Set To Next" primitive in a guide :-}
If I can remember correctly, I think I have approx 10 pgs done so far....still working though! The reason I am covering it next is because I noticed the same thing too, when I was working on a couple of the previous guides already written... You know I have to make sure my sources are correct :) So when I ran across them, I decided I am going to cover that one after Inventory, becasue I also found a few (Inventories) that use that primitive as well.
So if you think you can wait a little while longer, you will get your answer.
(Now I am getting your curiousity up huh?? :~) )
So I hope this answers your question! And I hope you, and everyone else can hold on to their seats and get ready when it's released!
Thanx soooo much EVERYBODY for the comments! I enjoy them! And yes, you too Numenor ;-)
Numenor
12th Jul 2006, 10:00 PM
I will quietly await until your next release...
Set to Next (Adidas' guide) - True target: Return YEAH!!! :giggler: - False target: Return BOOOOOHHH! :(
:lol:
cokenasmile
29th Jul 2006, 11:42 PM
Numenor, you crack me up. :D
Adidas, Thank you soooooo much for the guides. I have been devouring them, but I am not a programmer per se. I wonder if you might include in a future tutorial a short list of definitions into layperson? As simple when you see "stack object" it means X, or stack object's attribute means Y, as a quick example though I know I'm forgetting the ones that really throw me. LOL Just a quick clue-in for the non-programmer. Thanks so much, and it's cool if you haven't the time... I may end up learning programmer speak by the end of your series anyway ! hehe
Numenor
30th Jul 2006, 09:58 PM
If I have understood correctly your question, you need to know what the Stack Object is, and how it is affected by the BHAV.
The problem is that the Stack Object (let's call it "StObj" for brevity) is dynamically updated quite often, and therefore it's highly unpredictable what the StObj is when a particular line of the BHAV is executed.
The only certain (well... almost! :lol:) thing is that, in the first BHAV executed when you click on an object, the StObj is the object that you have clicked on (the one that popped up the pie menu, letting you to choose an interaction).
But as soon as the BHAV is executed, the StObj might be changed by the instructions contained in the BHAV itself.
Let's make an example, to better understand.
You click on the indoor trashcan and select "Take out trash"; in this moment, the StObj is the indoor trashcan. Then, the internal BHAVs are executed, the sim approaches to the trashcan and takes the trash... And in this moment the StObj becomes the trash itself. Then the sim searches for an outdoor trashcan, and the StObj is now the outdoor trashcan; the sims approaches it, opens the lid and put the trash in it: now the StObj is the trash again...
I stop here, but the process goes on, with the StObj changing quite often.
I hope to have been clear enough in my explanation... But in brief, this means that it's not possible to create a guide that can tell you what is the Stack Object...
cokenasmile
31st Jul 2006, 02:49 AM
Thank you Numenor! I had a bit of an idea, and I know you can't give a guide on what it is for all objects at all moments, but just getting a non-programmer idea about it is very welcomed! It is easy to get lost in all the programmer-speak. Thank you. As always, your explanation is very clear.
Numenor
31st Jul 2006, 09:24 AM
There is an interesting article by Dizzy2 over at *cough* Varioussimmers; I would never thought I would post a link to there :D , but Dizzy has my fullest consideration and respect as a modder, and her articles were enlighting for me.
The article I'm talking about can be found HERE (http://www.variousimmers.net/vsimforum/showthread.php?t=1618); I'm sure you will find useful also the other "Just the basics" installments, that can be found in the same forum.
cokenasmile
31st Jul 2006, 06:58 PM
:beer: Thanks once again Numenor! *going incognito to check it out* ;)
trezero
2nd Aug 2006, 12:40 AM
*read the Dizzy2 thing*
Very useful. I've been wondering about the scope of variable for quite a while.
I still have a question, though. When it says globals can be accessed anywhere, does that mean anywhere for the specific action that's going on, or anywhere as in literally, in any action that's going on anywhere on the lot?
I think it's the first, but I figure it's a big enough distinction to ask about. And if so, what happens to them when sims switch between objects? Are the temps cleared?
trezero
2nd Aug 2006, 12:42 AM
*scrolls down*
...oh. Dizzy answers.
I still want to know, though, what happens when an interaction ends? Are the temps cleared?
Numenor
2nd Aug 2006, 01:50 AM
Frankly, I don't know; I never rely on the temps values, unless a temp is set (even in a sub) and read immediately afterwards.
Inge Jones
2nd Aug 2006, 08:36 AM
I agree Numenor, the temp must be transferred into a local variable ASAP after being set, and certainly before any other function or BHAV is called, in case the temp is reused there.
If it's not convenient to return and store a temp for any reason, you can consider using an attribute on the object to store the value, where it will remain safely to be read not only by any other BHAV on the object, but also by any other object.
Numenor
2nd Aug 2006, 09:30 AM
Talking about what Dizzy's articles say and don't say...
I have a question about parameters, and I hope that someone will clear up this for me.
When an interaction is called called via the TTAB, or a functional tree is invoked by the OBJF, are there any parameters passed to the BHAV? Sometimes, the first BHAV executed expects a parameter, and I don't know how to set it, or where the BHAV gets the value for that parameter...
Inge Jones
2nd Aug 2006, 09:47 AM
I know Param 0 passed to the *test* BHAV is the flag for whether the sim is choosing it autonomously. Param 0 passed to the action BHAV contains whatever was the stack object when the menu line was generated. That's how things like the teleporter let you choose a sim to teleport.
But there are bound to be others, and it would be highly useful to know them!
AdidasSG2
4th Aug 2006, 11:29 PM
Ahhh...Params...didn't I cover those? *<puzzled look on face>*
I will see about getting you an example! sorry for not being around,...Heat- computer etc...
Echo
5th Aug 2006, 07:04 AM
For cross referencing purposes about parameters in BHAVs - here's the MTS2 discussions I have bookmarked for specifically those questions:
http://www.modthesims2.com/showthread.php?t=128350 (which leads on to)
http://www.modthesims2.com/showthread.php?p=874413#post874413
Jasana_BugBreeder
6th Aug 2006, 06:49 AM
I hope this is the right place to ask :-<
I noticed that when you pass parameters to a BHAV, it can be done in (at least) 2 different ways - depending on something in BHAV. The question is, what is that 'something' and what else it affects?
Say, I cloned a BHAV, set it to have 1 argument, and passing parameters to it from another BHAV. In both cases, I'm passing 'Literal Value 1' - just to point which opcodes affected - so, i.e. replacing 07 to 19 in opcode string will pass Local Variable instead of Literal Value, as usual.
Example 1: a BHAV cloned in the 'fruitbowl' decorative object, sorry, forgot which BHAV. OpCode string is:
070100FFFFFFFFFFFFFFFFFFFFFFFFFF
3 first bytes correspond to first argument, whatever goes next is not important - I could put 00s instead of FFs and it would accept it.
Example 2: a BHAV cloned in the birthday cake, AFAIR - source was semiglobal 'Grab Plate - Remove Slice'. OpCode string is:
0701000A00000A00000A000001000000
Same way, 3 first bytes correspond to first argument, but what goes next is important - not sure if all of those 0As, but at least some.
1st question is: what in BHAV makes it accept arguments in a certain way? It's not Format, Tree Type or Tree Format from the top row - tried to copy them from one BHAV to another, way of acepting parameters didn't changed. (By the way, any links where to read what those 3 values are, please)?
2nd question is: is there any other difference besides way of passing parameters?
If anyone knows something, please share it :-<
Echo
6th Aug 2006, 09:06 AM
Well I'm not 100% sure what the "different way" is, but assuming you're talking about non-primitives, there are two ways to pass parameters:
Option 1: Operand 13 == 0. Each parameter takes two operand boxes, and all values are treated as literals.
Option 2: Operand 13 == 1. Each parameter takes three operand boxes. The first specifies the data owner and the second two are the data value.
If you have to pass a lot of values to a function, the former is obviously better. However, if you need to be able to pass non-literal values then you have to go with the latter.
As for the Format, Tree Type, Tree Version etc, I only know the superficial details. The format specifies how the file is decoded - some formats will allow things that others don't. In most cases, your choice of format doesn't matter, although if you're making objects for the original game you shouldn't use anything in 8008 or 8009 (unfortunately). There's a bit more info on it here: http://www.sims2wiki.info/BHAV
Tree type is deprecated - it isn't used any more.
Tree version is, I believe, a mechanism used by the game to choose which function two run if there are two that conflict (ie - have the same instance) in case you include multiple versions of code. However, I've never tested this, nor heard from anyone who has, so I'm just speculating.
Numenor
6th Aug 2006, 07:03 PM
Inge, Echo, thanks for the info and the links!
Adidas, I might have overlooked this subject when reading your guides; if so, forgive me for having asked again :P
AdidasSG2
7th Aug 2006, 10:13 PM
I think I'll forgive you this time :-P, but just remember!...I'm always lurking somewhere...
Yes that somewhere should be home typing on the tutorial....
/me swooshes back to work *swoooooooooosh*
AdidasSG2
9th Aug 2006, 09:37 PM
News Flash!
Set To Next (0x1F) Tutorial will be up tomorrow!
Get Ready for the next in the series!
Numenor
9th Aug 2006, 10:23 PM
Countdown started!
23:59:59...58...57... :bunny: :)
AdidasSG2
23rd Aug 2006, 09:51 PM
Sorry All, The Internet here has been down for a couple of weeks. I will try to get it up tomorrow or so...I apologize for the Totally Lateness of the download....don't worry, it will be up soon!
Again, I apologize!
cokenasmile
24th Aug 2006, 04:53 AM
Thank you for writing these, and no worries if it is late; it is still very much appreciated. :)
AdidasSG2
7th Sep 2006, 11:11 PM
Hello All!
Set to Next Is now up!
Next one comming soon...
AdidasSG2
11th Sep 2006, 10:30 PM
Hey all,
Tutorials will be on hold until TS2 has an update for Vista, as that is the sys I am running, but I will still continue on the intermitten tut comming up.
Sorry for the delay all, I will try to do what I can, with what I have.
Numenor
12th Sep 2006, 10:06 AM
You mean that The Sims 2 doesn't run on Vista? Hope that Maxis will fix this soon...
AdidasSG2
13th Sep 2006, 10:27 PM
I am not sure if TS2 will/won't run on Vista, I have read that one site says yes, another says no.
Plus Latley, my OFB Disc has gone bad! :-( I cannot install it, it throws up an error that it cannot copy file B001_Lot116.package, "Error Reading Source Media", and yes I tried to copy the file over to HD, then extract.
Anyway, sorry for the delays comming up!
Zach
14th Sep 2006, 12:43 AM
Well, in all fairness to Maxis, you guys tend to forget that Vista is still only a beta OS, and it is unreasonable to expect Maxis to dedicate time and resources to support it at the moment. ;)
AdidasSG2
14th Sep 2006, 10:07 PM
Actually, I ran TS2 last night on Vista, ran just fine! :-) Hip Hip Horray!
So in reality, Maxis already had support built in, just kept it quite! Them sneaky little devils :cool: :!:
Now if I can just get my OFB CD to work I will up and running! :up:
youcmecruzin13
23rd Sep 2006, 05:17 PM
Is BHAVs What you need for animation?
Numenor
23rd Sep 2006, 07:40 PM
The BHAVs are routines that control everything in an object: the animations, the interactions, what they do to the sims, what they do by themselves...
Each BHAV is a little program (written in Simantics), and it may contain one or more specific instructions whose purpose is animating the object.
But it's not a simple job, anyway, I warn you... :)
AdidasSG2
26th Sep 2006, 09:30 PM
Hey there, got my OFB cd working...
Starting to work on a new Tut...and BTW- TS2 does run on Vista, but the sound is sticky!...don't know if that's becasue of Vista or DX10 (Properitery for Vista, not XP)
Anyway, will have some new ones comming soon, so keep your eyes open!
AdidasSG2
6th Nov 2006, 10:17 PM
Sorry all, been working on new tuts, but now that TS2P (the Sims 2 Pets) has come out and soon to be expansion pack (Holiday Stuff, plus another after that, plus the one in January to be released, much more info has come up (such as Maxis® getting the Weather system finally finised! ).. So in trying to keep up with what's going on, I have decided to change my direction and go towards TS2Pets instructions! I hope this will help many people in the new era to come of TS2
Numenor
7th Nov 2006, 12:29 AM
...and soon to be expansion pack (Holiday Stuff...
Don't worry about the Holiday pack: it will be a copy of the one released last year :lol:
...Maxis® getting the Weather system finally finised!
If they "finish" the weather like they did with body layers (i.e. resuming an old unfinished and malfunctioning project started by the first Maxoid team and releasing as is) we'll have really bad time :P -
TS2Pets instructions!
I still didn't look at the new instruction set. Are there new primitives? Something interesting to delve into? :)
Many thanks for your continuous efforts :up:
Inge Jones
7th Nov 2006, 08:58 AM
If they "finish" the weather like they did with body layers (i.e. resuming an old unfinished and malfunctioning project started by the first Maxoid team and releasing as is) we'll have really bad time :P -
Numenor! How terribly off-message of you!! <stifles a giggle :D >
Numenor
7th Nov 2006, 09:59 AM
OK, I admit it: I miss MaxoidTom... :P -
AdidasSG2
17th Nov 2006, 10:33 PM
So far into my delving, I have found a couple new Instructions, but mostly they are data types, for my and stack obj. plus other attribs.
I am getting close to finishing the tut, but still looking to find some missing info. those pkgs take a long time to look through! :-)
Inge Jones
17th Nov 2006, 11:45 PM
Well, are you going to let us know what they are so they can be added to PJSE and Disasim etc? :)
AdidasSG2
8th Dec 2006, 10:59 PM
Sorry for the long over waited delay....My computer got fried over the past weekend, so I am waiting for my new one to come, then I will have to get everything back up and running, before I can get anything out. I apologize for the wait.
Sorry Again!
Numenor
9th Dec 2006, 12:55 AM
Take your time, slavery has been abolished here at MTS2 :lol:
I'm sorry for your PC, and I hope that you will soon be back in business ;)
KevinsHope
11th Dec 2006, 03:40 AM
Hey great job with this post. I will read over the files when I can.
AdidasSG2
2nd Jan 2007, 10:28 PM
Hey Everyone! I got my computer up and running again! :-)
I purchased a new Motherboard/Processor! (Intel Proc 3.20 Ghz, 1Gb mem)
(I didn't like the one I purchased from Dell)
So It will be a bit longer before anything gets out! - Plus I am also waiting on Vista.
So First and formost, THANX to all for being very very patient. I appreciate your
enthusisiam.
AdidasSG2
10th Jan 2007, 10:28 PM
Inge:
So far I have only been through 0x00 -> 0x90. I have only noticed 2 so far, which are both OLD ones, but are still used, there are only 2 instances (one in one instruction and a few in another) They were like looking for a needle in a haystack.
I will try to get the info posted up here As soon as I get finished to make sure it's correct and no others have been found. So I still have to go through 0x91 -> 0xFF.
Numenor
11th Jan 2007, 10:09 PM
I'm always here, hovering this thread like a condor in search of a pray... :lol:
I'm curious... What are the two opcodes so rarely used? and in which BHAVs have you found them? I think that in the objects.package there are some discontinued (and incomplete) semiglobals; perhaps those BHAVs are no more used in the game.
WesHowe
13th Jan 2007, 04:55 AM
I have been 'round and 'round looking for any prior research on the BHAV primitive 'AnimateObject' (0x69). For AnimateSim I found a writeup on the sims2wiki.
If anyone knows where any prior work on the parameters or other info, I'd appreciate a pointer to it.
<* Wes *>
Jasana_BugBreeder
13th Jan 2007, 08:31 AM
wes_h, I suppose you don't have the Sims2Differences.doc? Attached it, since the site it was located is down for a long while. The file contains info on meanings of parameters, and not only for AnimateObject, so it's extremely useful :)
Or, if you want a brief summary of what to type in opcode boxes, here's my list - obtained by simply typing various values and seeing what's changed :)
Op00,01 = animation number (in reverse order, as usual)
Op02 - flag, built from bits:
01= Flip Flag: True
02= Anim Speed: Temporary Storage 0x0002
04= animation from Parameters
08= Interruptible: True
10= Start at tag: Temporary Storage 0x0000
20= Loop Count: Temporary Storage 0x0001
40= Blend out: False
80= Blend in: False
Op03 - flag, meaning is mostly unknown:
20= no idea what it changes, but it's present in all animations
80= play backward, thanks to Echo for info :)
Op04,05 = event tree number
Op06 = object dataowner (i.e. 0A - Stack object)
Op07,08 = object number
Op09 - event tree from:
01= private
02= semiglobal
03= global
Op10 - flag:
01= ?
02= ?
04= Sync to calling object: True
08= Align blend out with calling object: True
10= ?
20= ? could it be - take anims from adult/child separately
40= ?
80= Not hurryable: True
Echo
13th Jan 2007, 08:54 AM
Jasana - Op3 is the speed field, not a flag field - its use is described in the wiki under "Animate Sim", operand 4.
http://www.sims2wiki.info/0x006A#Operand_4
It's a fixed point float field, 0x20 = 1.0 (normal speed), 0x80 = -1.0 (normal speed, but in the opposite direction). ;)
WesHowe
13th Jan 2007, 06:15 PM
I thank both Echo and Jasana for the help.
I had gathered some of the stuff jasana posted, but her list, with echo's additions, is far more complete than what I had gathered.
If I learn anything new, y'all will learn about it.
<* Wes *>
Numenor
13th Jan 2007, 09:56 PM
Jasana, thanks a million for the valuable document you posted: I didn't even know about its existence; btw, it seems one of those "underground" documents escaped from Maxis' laboratories: this "David P. Miller" (author of the document) is credited in The Sims1, The Sims2 and Nightlife. He must be a guru in programming this game! :)
linolino
19th Jan 2007, 08:34 PM
Can i ask something please.
First, I'm thrilled about this documentation. Thx so much AdidasSG2. Im finnaly understanding how to use SimPe to mod some things i wanted for so long now!
So i wanted to ask 2 things i did not quite understand very well:
1) Stack Object:
- What's Stack Object? Is it a variable? What does it stores? How does it work?
- Does it always reference to the object that is beeing used?
- I've tried out the follownig instruction:
prim[ 0x0002] Expression (Local 0x0000 > Stack Object ID)
if i change the Op7 it changes the Stack Object ID to Stack Object's Attribute, Stack Object's graphic, Stack Object's Slot, Stack Object's Temp 0x0000, even a Stack Object's motive Shopping...
How are these different from each other?
2) Still in the Expression instruction, i can select Temp 0x0000 and Temp[Temp 0x0000]. What's the difference?
AdidasSG2
19th Jan 2007, 10:44 PM
Linolino:
Thanx for the comments! :-) Yes I am still breathing, but alive in my little corner.
As per your questions:
1.) Stack object.
A Stack Object is not just one item, but it can be many items, depending on which BHAV you are looking at. So in a sense it's a variable, but you can only check on that variable, you cannot make any modificiations to that item in the variable, that must be done in other instructions such as Expression(0x02) and the likes where you modify that "attributes" of that item be it a Sim/Object/ Now including Pets.
It will only reference that object that's in it for that current set of Instructions you are working with.
part 3: Trying out instuctions-you have noticed that you can change the op7 to the stacks object attrib/graphic etc...but you can only change those, you CANNOT change the id (that is ingame fixed).
Each change is different in it's own way. Each modifys someother info that may/maynot be releated to a certain function.
Question 2.) The difference is the Temp 0x0000 is a base variable where as Temp[Temp 0x0000] is refering to a value in the Temp Array located at the Temp 0x0000.
I hope this helps you out. If there is anything else I can help you with please feel free!
Numenor
19th Jan 2007, 11:16 PM
Whoa! A lot of "huge" questions! :)
The Stack Object.... I will simplify a little, so to better explain.
In the very moment you click on an object (or a sim, or a pet), that object (sim, pet) becomes the Stack Object; at the same time, the selected sim, i.e. the one that performs the interaction, is referred as "Me".
Like any other object in the game, the Stack Object is identified by a number: the ID; therefore, "Stack Object ID" means the unique number that identifies the currentStack Object.
Once the stack object has been identified, the BHAV can do a lot of things with it: query its attributes, deleting it, snapping something in its slots...
But the "Stack Object" is not always the same: it changes quite often, because every instruction in the BHAV needs to be referred to an object; therefore, the various BHAVs often point to a different object, selecting it as the Stack Object, and then perform an action on it.
An example: your sim wants to bring the newspaper inside. This is what happens (let's call the Stack Object "SO", for brevity's sake...)
1) You click on the newspaper and select the menu "Bring in"; in this moment, the SO is the newspaper
2) The sim picks it and searches for a table where to put it; in order to do so, the BHAV scans all the objects in the lot; for every object found, the game changes the SO to that object, checks its category (is it a table? a bed? a stove?), if it's a table then checks if it has free slots, and finally finds a suitable table where to put the newspaper. In all this "scan" process, the SO has changed continuously, and is lastly set to the table.
3) The sim is instructed to reach the table (currently, the stack object), perform the "put down" animation and the newspaper (which in the meantime is not the SO any more) is finally snapped into the table's slot.
Now that we have briefly explained what is the SO, let's talk about its properties: there are a lot, and I can't explain them all. For example, the SO's Graphic is the mesh of the SO; the SO's attributes are variable stored into the object itself (for example, a cake stores how many slices are left), SO's motives (hunger, energy etc) are the hunger, energy etc of the sim currently selected as SO (I said that the SO can be not only an object, but also a sim or a pet). I'm sorry, but I can't be more detailed, the list of the SO properties is very very long...
Lastly, your question #2 means this:
Temp 0x0000 is a temporary storage, where the game stores a value; and then this value can be read for further elaborations. There are numerous "Temp" storages: Temp 0x0000, Temp 0x0001 etc.
Temp[Temp 0x0000] is the "Temp" storage whose number is stored in Temp 0x0000; if Temp 0x0000 = 3 then the expression
Temp[Temp 0x0000] = Temp[3] = Temp 0x0003.
In other words, in this example, the Temp 0x0000 is just a pointer to another Temp.
linolino
19th Jan 2007, 11:17 PM
wow, you're really fast ain't you guys? thany for answering me, i'm just getting better at simantics!
so for what i undertood, stack object is kind of a variable. Stack ID is the ID of the object/sim, and so I can change the stack object's attributes, like if it is a Sim i can change the stack object's motives?
ok.. but how will i know what object is the Stack Object ID in my instruction?
I mean, In a behavior of a sim interacting with a object, Stack Object ID will be referring to the Sim or the Object?
Echo
19th Jan 2007, 11:38 PM
so for what i undertood, stack object is kind of a variable. Stack ID is the ID of the object/sim, and so I can change the stack object's attributes, like if it is a Sim i can change the stack object's motives?
Yes, stack object is a variable. It can store the "object ID" of any object in game, including both sims and more traditional objects. When your function first starts, the stack object value is copied from the function which called it. The upside of that is that for an interaction, the stack object will be the object you clicked on to run the interaction. (Note that this is not necessarily the case for all functions - for example, a Function - Init is called directly by the game engine and not from another function, so the Stack Object defaults to 0). As you noted, if the Stack Object is pointing to a Sim, then changing the Stack Object's Motives will change the Sim's motives. If the stack object is a table, then changing Stack Object's Motives will probably result in an error (tables have no motives!).
ok.. but how will i know what object is the Stack Object ID in my instruction?
I mean, In a behavior of a sim interacting with a object, Stack Object ID will be referring to the Sim or the Object?
Like any variable, the stack object will stay the same unless you specifically do something to change it. The most common way to do that is "Stack Object ID 0x0000 := [some other object ID]", although other commands can change it too (in Numenor's example of scanning for a table, "Set To Next" changes the stack object to a different object). If you're writing a BHAV from scratch, you can generally rely on the Stack Object to remain the same unless you specifically try to change something.
<self promotion alert>A lot of this stuff is covered in the sections "Understanding the call stack" and "'Me' and the 'Stack Object'" here: http://www.modthesims2.com/showthread.php?t=212101</self promotion alert>
linolino
19th Jan 2007, 11:58 PM
:anime: First, let me thank a LOT, i mean really a LOT you guys. I wasn't expecting to get my doubts answered by you 3 masters of SimAntics, AdidasSG2, Numenor and Echo! i mean, just cool..!! :) :) :)
Yey! That really explained SO!! I wasn't getting it at all. :D
<self promotion alert>A lot of this stuff is covered in the sections "Understanding the call stack" and "'Me' and the 'Stack Object'" here: http://www.modthesims2.com/showthread.php?t=212101</self promotion alert>
I really thought if that. That maybe there was already a tutorial explaining that, and that i would be making you answer things twice. I'm sorry for that.
I just posted because I'm following the AdidasSG2 tutorials, and i coudn't understand SO entirely from the tutorials, but i understood everything else, so i thought asking just that...
well, i think i got it now.
Imagine I want to creat a set of instructions that will do the following, when the mouse click the action on the pie menu:
1) check if the selected sim's comfort is higher than 50%
2) store a value in a variable in the object that the sim is interacting with.
In the case, the SO is the object, and the sim is the My?
So a sim will only be considered a SO in a social Interaction with another sim, where on of them is the My and the other the SO?
right?
Echo
20th Jan 2007, 02:35 AM
In the case, the SO is the object, and the sim is the My?Yes, exactly! :)
So a sim will only be considered a SO in a social Interaction with another sim, where on of them is the My and the other the SO?
right?Not really sure about socials, I don't play much with them... But that seems a good possibililty.
As a small side note on sims as stack objects though, you can explicitly set the stack object to be the "My" Sim if you want, by running something like:
Stack Object Id := My Object ID ;)
Smonaff
20th Jan 2007, 03:55 AM
In the case, the SO is the object, and the sim is the My?So a sim will only be considered a SO in a social Interaction with another sim, where on of them is the My and the other the SO?
right?
I believe the Stack Object will be the controller for the social interaction and both sims will by My, but each running in a seperate stack.
Numenor
20th Jan 2007, 12:18 PM
Yes, the social interactions often use a Controller (which is in most cases the SO), but in the very moment you click on a sim and choose an interaction, the SO is the clicked sim, and "Me" is the currently selected sim. Then, a Controller might be spawned to manage the social interaction, and it becomes the SO, but not necessarily.
An example: in Nightlife, when a sim is idle, he frequently scans the room (or the lot) for an attractive sim; in this case, a "Set to next" loop is performed, and every sim that is found becomes temporarily the SO; then the game checks the attraction between "Me" (the idle sim) and the SO (the sim currently pointed by the Set to Next loop). No controllers are involved in this example.
linolino
20th Jan 2007, 08:20 PM
with all this info from you guys, I think I now can make a object i had in mind.. the socials might be a problem though, but i'll try to leave that for last, if it is really needed... I'll try to upload it when i get it done and working!
By the way, wouldn't anyone know how to put in my object a pie menu like the "influence to" menu? I want that effect that disables it and turns it gray if the sim does not have the appropriate requirements..
Smonaff
21st Jan 2007, 10:01 PM
You would use the "Add/Change the Action String" primitive to gray the Pie Menu option out.
Numenor
22nd Jan 2007, 03:05 PM
This is interesting, I've never examined carefully the "Add/Change" primitive... Which operand(s) make the menu entry grayed out?
Inge Jones
22nd Jan 2007, 03:15 PM
I would simply return false or skip to the next iteration of the loop if the test was not met.
Numenor
22nd Jan 2007, 04:20 PM
But Linolino seems to want that gray-out effect; and anyway I've answered my own question: SimPE offers a handy wizard for the Add/Change primitive, thanks to PJSE :P -
linolino
22nd Jan 2007, 04:39 PM
yes, that's right. i want that effect because I want the player to see the disabled options, so he will try to met the conditions to activate it.
I love when SimPe has a specific wizzard for the operands of a function! that's a good news then!
Inge Jones
22nd Jan 2007, 05:53 PM
Well while we are talking about wizards, what are the next three wizards you would most like to be implemented?
Numenor
22nd Jan 2007, 07:26 PM
Well while we are talking about wizards, what are the next three wizards you would most like to be implemented?
"Animate Sim" and "Animate Object" :)
As for the third wish (we are talking about Wizards, so three wishes are the canonical number :P ) I'll think about it before asking :D
Inge Jones
22nd Jan 2007, 08:25 PM
"Animate Sim" and "Animate Object"
I have added those to Peter's todo list. He had been waiting for Quaxi to do that core redesign work on SimPe which but now it won't be done before Seasons so he will be able to work on some wizards.
linolino
26th Jan 2007, 02:50 AM
It would really help a wizard for the prim 0x0033 Manage Inventory
It is really confusing!
Inge Jones
26th Jan 2007, 10:01 AM
Noted. Sorry Numenor you lost your chance of the 3rd wish :P
linolino
26th Jan 2007, 01:52 PM
I hope Numenor won't get mad at me for suggesting the manage inventory.. i really need help from you guys...
and while on the manage inventory subject... I have read the attached documentation of AdidasSG2 for this primitive, and I got this doubt:
:help: 1) "Neighbor Counted inventory with ID in Local Varaible 0x0001 Find Token with GUID 0xEE8E8647 , Put count into Temporary Storage 0x0000"
For what I understood, if the function FINDS a specific TOKEN, it will it will ADD a count to Temp 0x0000. And for "ADD", i understand that its going to sum Literal 0x00001 to what ever value is already in Temp 0x00000.
Example: if Temp 0x0000 = 5, then the function will add 1 + 5, and Temp 0x0000 will be = 6.
But then, in another part, I got the impression that the COUNT that is PUT into Temp 0x0000 is actually the position of the SLOT where the TOKEN was found.
Example: Whatever is the value in Temp 0x0000, if a TOKEN is found in slot 2 of the inventory, the function will do Temp 0x0000 := 2
So, wich one is right?
:wtf: 2) Also, what's the deal with:
"Neighbor Counted inventory with ID of My Person Data 0x001F (neighbor id), Add Token with GUID of 0xCC58DF85 Pull count from Literal 0x0001"
Whats "Pull count from Literal 0x0001"????
How can you pull a count from a Literal? It's not a variable...
:giggler: 3) Why all these things about put/pull count are relevant anyway? I never saw the Temp, in wich the count was put, beeing used later in the function...
:!!: 4) and last... If Neighbor Counted is the backpack, what is the Neighbor Singular ?
Numenor
26th Jan 2007, 02:08 PM
The "Manage Inventory" is perfect for me either :) Thanks Linolino for suggesting it and thanks to the Jones' for making them! :D
Echo
26th Jan 2007, 11:54 PM
I think you've just got a minor misunderstanding of terminology. ;)
There are two types of token you can have - "Counted Tokens" and "Instance Tokens" (aka "Singular Tokens").
Counted Tokens - a sim can have at most one of these in their inventory at any time. These tokens contain a count variable in them, so instead of adding the same token 5 times, you can add the token once then set the count in it to 5.
Instance Tokens - Sims can have multiple tokens of the same sort in their inventory, and can have any number of properties associated to them. :)
When a command says "put count into x", it means get the value of the count in the currently selected counteded token, and store that in x variable.
As for the "Pull Count from literal 1", that command is adding a new counted token. The count for that token needs to be given an initial value (because I believe that counted tokens that reach 0 get automatically deleted?) and in this case it should "pull" its count value from literal 1, in other words, set the count to 1. If you'd put a variable in there, say a local, then it would have pulled its initial value from that variable instead.
linolino
27th Jan 2007, 01:01 AM
Ooohhh, so basically I got it all wrong! :faceslap: Well even so i think it's good that I asked this because other people may have the same doubts (or not, maybe i'm just slooow.. :turtle: )
Then if i'm not wrong again, when it says Neighbor Counted it's referring to a Count Token in a Sim's Inventory?
Can regular object be a Singular Token then?
Echo
27th Jan 2007, 06:17 AM
The "Neighbour" part is telling you that it's an item in a sim's inventory. There are also (I believe,) global, house and family inventories which can also contain tokens. Don't know much about them except that they exist though. :)
Inge Jones
28th Jan 2007, 02:23 PM
Numenor, please would you test the animate(thisthatandtheother) in this build: http://www.simlogical.com/externally_accessible/pjse.coder.plugin-Release-20070128-1359.zip
I have never used them so I am not the best person to test. He did all three of the animate wizards, as well as the random primitive wizard.
I don't advise anyone else downloading this test release unless you really want to be a guinea pig.
Numenor
29th Jan 2007, 12:57 AM
Thanks Inge, I've downloaded the "guinea pig" version of the PJSE :) I think I'd better report my findings (if any) to Simlogical, so not to clog this thread.
AdidasSG2
29th Jan 2007, 10:23 PM
Ooops! My Simlogic went haywire---I missed everything from #75 on.
Hehehe! I guess I better read better. :blink:
BTW-I have been working on something new for SimAntics Tutorials-
I am trying to include all the tutorials plus any new ones to come in a
Windows Vista Sidebar Gadget! :cool:
So between going through the BHAVs and learning JavaScript and CSS (which I am almost getting down pat) I am a bit behind! :turtle:
linolino
30th Jan 2007, 01:30 AM
linolino:
That depends on the instuction set. If you are modifying the object you would use something similar to:
StackObjId = object id;
If it's a sim:
StackObjID = my object id;
(I hope I got this correct)...I've been doing toooo much digging in BHAV's I am kind of screwing my mind up
AAARRRRRHHHHH!
Anyway, I hope this help you out.I appreciate your answer AdidasSG2, but I'm not undertanding to what question it is the answer to...
Oh... I think i know now. it's the post #75 isn't it?
AdidasSG2
31st Jan 2007, 10:15 PM
Please Read Post #99 in regards to post #100 :-0
Inge Jones
5th Feb 2007, 08:30 PM
I just wanted to say that the inventory wizard is finished and Peter wants someone to test it please. latest file in http://www.simlogical.com/PJSE/PJSEbuilds/
Linolino, that would be you - or maybe Numenor has time to test this too?
linolino
10th Feb 2007, 11:11 PM
I just wanted to say that the inventory wizard is finished and Peter wants someone to test it please. latest file in http://www.simlogical.com/PJSE/PJSEbuilds/
Linolino, that would be you - or maybe Numenor has time to test this too?Hello Inge! I'm sorry for the long wait, I meant to test it as soon as i could. But i really couldn't until friday night.
Well first let me thank you and Peter, :D very much, for the great job. it definitely makes working with inventories much easier, this is so necessary! :bunny:
I'll send you a PM with notes from my testing!
Jasana_BugBreeder
25th Feb 2007, 05:47 AM
About AnimateObject - wonder if everyone except me knows it already - in opcode 10 (numbering starts from 0), flag 0x02 means 'use age of person in Temp5'.
Numenor
25th Feb 2007, 11:30 AM
Thanks Jasana! So, the flag 0x02 of op10 should mean:
bit2 = 1 -> use age of person in Temp5
bit2 = 0 -> use age of Me (default)
Right?
Inge My brief examinations confirm Jasana's finding.
I've examined, for example, the BHAV 0x2006 from the ShoppingRackGlobals, used to open the dressers (the object animation is different if the sim is a child or an adult).
Just before the Animate Object instruction, the Temp5 is set to "My Object ID"; and the flag 0x02 of Op10 IS set (in my experience, the most frequent value for Op10 is 0x22, which includes a set bit2). Undoubtedly, the game reads the right TextList: STR# 0x192 for children, STR# 0x86 in all the other cases (if there isn't a TextList for the age of the sim, the game defaults to Object-Adult, 0x86).
Of course, this means that PJSE can't actually translate the animation to be performed: it can only read the "default" text list 0x86, but there is no way to actually check the age of the sim in Me or in Temp5...
Inge Jones
25th Feb 2007, 12:45 PM
So, presumably there is no useful way to change PJSE for this without breaking other things?
Numenor
25th Feb 2007, 02:20 PM
Well, Peter could at least include the bit2 in the (already existing) parsing for the Op10...
As for displaying the name of the Anim, I'd leave it as is (putting a warning that it's just the default animation, and not necessarily the actual one would be too long to read)
pljones
25th Feb 2007, 04:46 PM
Yes, there are precedents for this - other wizards have flags like that (Dialog being a prime example).
1) Does this only apply for certain Node Values? (i.e. does the game ignore it if the node value isn't, say, 2.)
2) Anyone want to experiment with the other bits in that byte..? :up:
Jasana_BugBreeder
25th Feb 2007, 09:12 PM
bit2 = 0 -> use age of Me (default)
Right?
I'm afraid no, bit2=0 means 'use adult animation regardless of my age'. At least until I changed that bit from 0 in tea set (cloned from coffee maker which was only for adults), any changes to animation from child list were ignored.
I'd say it's OK to just add to translation that the bit is set or not, with adult animation name anyway :)
2) Anyone want to experiment with the other bits in that byte..?
Which ones? So far I know:
02= use age of person in Temp5
04= Sync to calling object: True
08= Align blend out with calling object: True
80= Not hurryable: True
Of the remaining four, looks like none of them is 'Use Tree Owners Anims' flag (mentioned in Sims2Differences). Or perhaps it required something else to be set.
Are there other flags which corresponding bits are unknown? I feel like I'm going to use AnimateObject more :) so I'll try to pay attention.
ahmird2
15th Apr 2007, 11:02 PM
Thank you so much Adidas. I am sure I will find these very useful when I finally get around to working with them.
AdidasSG2
24th May 2007, 11:45 PM
Hey there everybody! I am not dead, but just hiding around...been busy working on other main projs that had to be finised first.
Thanx to everyone who made a comment that I did not have a chance to read since my last post! I appreciate any comments you may have. Also thanx for the others,
Numenor, pljones, and Jasana and any others for you info, I will have to add this to one of the upcomming tutorials.
I would like a vote!? If you would please, on weather to keep the PDF format or change to chm (compiled help) file? I am not sure how many of the users here are using Macs or are mainly the users here PC? Please let me know! As I have a couple new tuts ready to get started and a few to finish, but wanting to know on what format you all would like!?
Or wold you like both?
Thanx
AdidasSg2
Numenor
25th May 2007, 08:17 AM
I vote for both: even if the majority of users of this thread have a PC, would be too bad if even few Mac users would be excluded from reading the guides.
As an alternative to the CHM (which is useful mainly for the ability to have a clickable summary that gives instant access to the various ), I can suggest a PDF with a properly configured summary in the sidebar.
AdidasSG2
1st Jun 2007, 11:23 PM
Ok, that's one vote for both! Now if I can figure out how to do a sidebar in a PDF file, I will be in business.
Also, I do see your point on the "few" users whom may be using a Mac, I guess the PDF would be good for them and with the choice for users on PC since using chm (compiled help) they would not need to download any other programs to view the document.
This was my choice as to ask the question for voting!
Thanx Numenor! :-)
Numenor
2nd Jun 2007, 01:21 AM
Adidas, while you are here :P can you explain me briefly (if you know) what is the purpose of the "Verify" opcode? Just to determine if something exists or not? I really don't get it...
AdidasSG2
13th Jun 2007, 11:15 PM
Numenor, sorry It took me soo long to reply...been working @ setting up 4 new computers and networking them here at the library. I apologize...
As for the Verify opcode, it's to verify that either
1.) A value is where it should be with in a Temp or Local, Stack, you can also think of this as being an "If" clause.
2.) Also it is to verify if something exists that deals with that guid of that object/sim. this creates a better routine so that you cannot deal with dead people....on a daily basis, except them haunting. (This is just an example...and yes I did find a way to play as a dead person....quite interesting. Though a bit buggy becasue of being able to go thru walls and such...but none the less...VERY FUNNY!
I hope this answers your question if you need more please just ask as always
Dr. Macabre
20th Jun 2007, 02:10 PM
I want to take a moument and thank you AdiadsSG2 and Numenor for these. I am trying to learn to do a little thing called edit, and hopefully I will find my answers in your tutorials.
sabrown100
1st Sep 2007, 08:12 PM
The link for datagen won't work.
Echo
2nd Sep 2007, 02:12 AM
The datgen project got discontinued in 2005, most people are using SimPE now. You can still get copies of datgen from TSR if you want them, but there's very, very little support for it and virtually no tutorials, so you probably wouldn't benefit much from it.
wndy26
6th Oct 2007, 10:10 AM
Wow....reading these comments to Adidas's documents has been helpful in itself. I have a huge project ahead of me and can't wait to delve into these pdf tutorials along with all the links I gathered while reading the comments. Can anyone tell me - the PJSE wizard beta version for the Inventory that was listed in the comments - is it working and in use yet? I have the latest version of SimPE and am not sure what wizards I have installed. How can I tell?
I finally was able to get my ticket booth window meshed - need to mesh my gold ticket and finish my npc then attach them both to the ticket booth window.
I have been looking at the Init and Main Bhav of Echo's clown but am not exactly sure what each of the lines in those do. Some of them I understand but there are many that have me stumped. Can someone put the jist of what happens within the Init Bhav of an NPC into laymans terms for me? What things are initialized when the NPC is created?
Numenor
6th Oct 2007, 11:21 AM
Interesting question :)
I opened the NPC that is most similar to the one you nee, the register clerk from the base game. You can follow my explanation better if you open it yourself:
start Object Workshop, wait for the list to load, click the "Catalog" button in the upper-right corner and search for "NPC - Template - Register Clerk";
then select "clone" and uncheck all the options, then proceed.
When done, select the Init BHAV and - first off - click "Sort", so that we can read better the bhav and you'll be able to follow my explanations.
Line 0x00: Person Data 0x009B set to "Register Clerk".
The bhav declares this NPC as a "Register Clerk"; this is needed in various parts of the game: for example, whenever you delete a register cash in a lot and go to live mode, the cash will look for the clerk associated to it in order to delete it. This is done by looking for an NPC with his "Person Data 0x009B" (NPC Type) set to "Register Clerk".
Line 0x01: Call to the Semiglobal INIT.
This line calls the general INIT for all the NPCs, that in turn does the following things:
- Sets the Outfit reading the two "CT - Special1" bhavs from the package itself
- Checks if the NPC is in a real family and if he is on the job or not; and sets some parameters accordingly (for instance, an NPC in a real family out of the job is a "visitor" with dynamic motives, while the same NPC, in a community lot on the job is a "NPC" with static motives).
Line 0x02: This sets whether the NPC can accept social interactions (usually set to 1 = yes; very few NPCs don't accept interactions, like Mrs. Crumplebottom).
Line 0x03 / 0x04: If the NPC is on the job, his outfit is put on (line 0x04).
Line 0x05 /0x06: If the sim has never been "initialized", it does now in line 0x06, then the BHAV ends. The "initialization" means setting the standard parameter of any object and sim:. weight, walk style, age etc. No need to change these values.
Line 0x07 / 0x08: These lines are execute only if the sin has never been initialized. They set the initial skills for the NPC (being it an NPC, his skills are not that relevant; the assignment is made on a random basis, anyway), and his personality.
Line 0x09: Adds the "Sim was initialized" memory into the NPC's inventory.
That's all, there's not much to change here. Remember that the NPCs are spawned by the object that require them, and therefore, if your ticket booth needs a special NPC, you have to check the BHAVs of the booth, so to instruct it to spawn the right NPC.
As for the Main BHAV of the NPC, it's the real "heart" of the NPC itself. In the case of the clerk, the Main simply instructs him to look for his register cash, go in front of it and wait (accepting social interactions, while waiting). When a purchase is made, it will be the cash itself to "order" the clerk to perform some actions.
Echo
6th Oct 2007, 11:59 AM
For clarification, that clown is a "Person/Unique NPC", which means his code is somewhat different to the register clerk which is a "Templated NPC". I don't particularly recommend trying to create new Templated NPCs, because so much of their code accesses global BCONs (or at least it used to, back when I was looking at these things), and those BCONs need to be changed to allow for things like new uniforms, genetic traits etc...
The clown was based on the hula zombie, and basically just sets a bunch of attributes, except at one point where it calls the generic semiglobal 0x206A "Init - NPC", which I am very careful not to touch. :)
wndy26
6th Oct 2007, 12:05 PM
First, thank you for replying to my post! I have a few more questions that will help me figure this whole thing out. Is it possible to create an object that will call a default NPC yet set a different outfit than the Maxis default for that NPC?
Line 0x01: Call to the Semiglobal INIT.
This line calls the general INIT for all the NPCs, that in turn does the following things:
- Sets the Outfit reading the two "CT - Special1" bhavs from the package itself
- Checks if the NPC is in a real family and if he is on the job or not; and sets some parameters accordingly (for instance, an NPC in a real family out of the job is a "visitor" with dynamic motives, while the same NPC, in a community lot on the job is a "NPC" with static motives).
Would it be possible to set a different outfit after this semiglobal is called -specifically after Line 0x04 where he puts on the outfit or change that line 0x04 to point to a different outfit?
That's all, there's not much to change here. Remember that the NPCs are spawned by the object that require them, and therefore, if your ticket booth needs a special NPC, you have to check the BHAVs of the booth, so to instruct it to spawn the right NPC.
I had figured this much but wasn't sure where the animations would come from? Can the template NPC's animations and interactions be over ridden and adjusted through the item itself? Or am I better off sticking with creating my "clown makeover"? I would prefer that there not be an actual money transaction animation - I like the way the bartender sells the drinks quickly with no register - some NPC cashiers take forever to work a register - I want the gold ticket to appear in their inventory - then disappear after they walk into one of the four theaters - my thought is by adding a test for ticket to an archway preventing non-ticket holders from entering (think that is possible?)
As for the Main BHAV of the NPC, it's the real "heart" of the NPC itself. In the case of the clerk, the Main simply instructs him to look for his register cash, go in front of it and wait (accepting social interactions, while waiting). When a purchase is made, it will be the cash itself to "order" the clerk to perform some actions.
Using my clone from Echo's clown - this would be where I would add my animations and interactions - I would suppose. Many of these I could probably take directly from the bartender and cashier etc to match the animations.
I think I may be able to figure most of this out - Echo's clown has an expression (Myfamilynumber:=Constant 0x013A:0x00) what does this do? As well, it has another expression (My NPC Type := Literal 0x0000) - when I checked the literal 0x0000 against an NPC Type list it was blank. Does this just tell the game to consider the character an NPC but not set it to a specific template?
OK...I think that is enough questions for now. LOL. I am sure I will have more so thanks in advance for sharing all of your wisdom.
wndy26
6th Oct 2007, 12:10 PM
For clarification, that clown is a "Person/Unique NPC", which means his code is somewhat different to the register clerk which is a "Templated NPC". I don't particularly recommend trying to create new Templated NPCs, because so much of their code accesses global BCONs (or at least it used to, back when I was looking at these things), and those BCONs need to be changed to allow for things like new uniforms, genetic traits etc...
The clown was based on the hula zombie, and basically just sets a bunch of attributes, except at one point where it calls the generic semiglobal 0x206A "Init - NPC", which I am very careful not to touch. :)
I understand completely Echo. Those template NPC's look like a real pain the arse! So being that it is a person/unique NPC - this means then that the "clown" that spawns will forever be the same sim - is this correct? So when using your clown as my clone - I should basically leave the Init Bhav just the way it is and only change the Main - adding the interactions etc that I need - is this correct? (By the way - I never did figure out where that male voice came from since the clown I downloaded said it was female)
Thanks for your help!
Oh yes...one more question - your clown has no need to leave his post - correct? He does not need to attend to his basic needs - food, sleep, etc.
Echo
6th Oct 2007, 12:28 PM
Echo's clown has an expression (Myfamilynumber:=Constant 0x013A:0x00) what does this do? Family -1 (which is what that BCON points to) is just a standard NPC family. Stops the sim from appearing in a regular player-created family.
As well, it has another expression (My NPC Type := Literal 0x0000) - when I checked the literal 0x0000 against an NPC Type list it was blank. Does this just tell the game to consider the character an NPC but not set it to a specific template? The NPC type is used in some objects to identify particular types of NPCs (eg, all the maids have a particular NPC type, etc). Anything which doesn't fit into one of those groups is in 0x00. I think this includes the hula zombie, santa and the RC car amongst others.
So being that it is a person/unique NPC - this means then that the "clown" that spawns will forever be the same sim - is this correct?Yep.
So when using your clown as my clone - I should basically leave the Init Bhav just the way it is and only change the Main - adding the interactions etc that I need - is this correct?That's what I'd suggest, just because there's not much in there worth changing.
(By the way - I never did figure out where that male voice came from since the clown I downloaded said it was female). Hmm... Have you tried changing the gender flags in the property sets and Age Data files? Adding a call to Expression (My person data 0x0041 (Gender(0=male/1=female)) := Literal 0x0001 before the "Init - NPC"?
Oh yes...one more question - your clown has no need to leave his post - correct? He does not need to attend to his basic needs - food, sleep, etc.Good question. He probably technically does have his needs drop, but at no point in the main function am I allowing him to check for needs, so even if everything's red he'll never realise it. If you want to freeze needs for the sim properly though, you should be able to just add this call to the init:
Expression (My person data 0x001D (Motives Static?) := Literal 0x0001)
wndy26
6th Oct 2007, 12:34 PM
Thank you soooo much Echo! You answered almost everything I was curious about when it comes to the clown NPC! I am pretty sure I am about ready to start coding this monster. :) The only part that really worries me is that I may not be able to add certain things to the ticket booth - since it was cloned from a window. I have a couple of other things to look at as well. Can pie menu's be added to just about any item - including windows?
By the way, I did check the gender in both places you suggested. I will just add the code - that should fix it.
Grapholina
25th Feb 2008, 06:07 PM
Hi!
Edited: Nevermind. I found the problem and was able to correct it on my own. Woo Hoo!!
ethyrdude
8th Mar 2008, 01:34 PM
I have a question and if it's been answered elsewhere, please feel free to toss me in the right direction.
I am trying to add either a thought or talk bubble to a custom interaction with a woohoo icon in it. I know how to add either bubble but have no clue when it comes to the bhav parameters.
adamSpline
26th May 2008, 08:53 PM
Hi,
I am new to Sims2 and modding the game, but have a question I hope some of you could help me with.
I have a lot with two sims: Father and Son. I to create a BHAV in which, if the Son invokes the BHAV, the fun motive of the Father increases and then the Father does an animation (whatever animation it is).
In other words, when the Son does something (click on a pie menu), it effects the Father sim, and not the Son.
I was able to accomplish most of the above BHAV, but not all of it. I was able to get the Father’s fun motive to increase, but I was not able to have an animation run on the Father (instead, the animation always runs on the Son).
I am able to get the motive of the Father to increase by switching the Stack Object to that of the father (which makes sense)
However, when I go into the SimPE wizzard for sim animation, it seems like it should be pretty easy to have the Father sim be animated (since he is already on the Stack Object). But, every combination I attempt still results in the Son being animated (remember the Son was the sim who originally invoked the BHAV).
Any ideas? Thanks,
-Adam
Numenor
26th May 2008, 11:23 PM
It seems that you have done everything correctly...
However, the "Animate Sim" function operates on the sim currently selected as Stack Object only if in the wizard the "IK Target" is set to Stack Object ID 0x0000.
Also, be sure that nothing changes the stack object between the moment the Father's motives are increased and the moment when you try to animate the Father.
If you want me to take a look at the code, post the package here.
adamSpline
27th May 2008, 03:49 PM
Numenor,
Thanks for your quick reply. I just got sims2 a few weeks ago, and I am a programmer, so I thought I would take a stab at some modding.
I have uploaded my package file. The BHAV is called, "Make Elder Happy."
Perhaps you could suggest some commands for the arguments of the AnimateSim (Line 0B) primitive to make it accomplish its goal of animating the Father.
Here are some of my major lines of code and what I want them to do. Everything works as I expect until Line0B (which currently is just set to my last test, not anything particular).
Line 03 - loop through each person, place on stack object
Line 05 - print each persons Object Id for debugging purposes
Line 06 - if the persons age is greater than 50 (thus he is the Father)
Line 07 - print yep! - another debug command
Line 08 - max that person’s fun motive
Line09 - store some variables (deprecated line)
Line0A- Have the Son walk to the Father (this works)
Line0B- Father whooping in thanksgiving for the Son increasing his fun value (does not work)
Suggestions are welcome!
Thanks,
-Adam
Numenor
28th May 2008, 12:19 AM
Uhm... I think I've told you some inaccurate info...
The "IK Target" is the object (and I mean really "object", not sim) that the animated sim needs interacting with. For example, when a sim opens the oven lid, the oven is the IK target. In case you are curious, IK stands for Inverse Kinematics, and is an invisible point contained in an object mesh that the sim needs to reach in order to perform the animation. In this example, the IK point is the oven handle: if you move the mesh of the oven vertically or horizontally, the hand of the sim will always try to reach the IK point before performing the "open lid" animation.
Apart from the theoretical facts :P I was wrong when I said that setting the IK target to the Stack Object (the Elder) forces the Elder to be animated: the truth is that the only sim affected by the "Animate Sim" is the one that is currently performing the interaction. And after all it can't be different! In this case, we can't know what is doing the Elder when the young sim "operates" the picture: the Elder may be swimming, or sleeping, or making a shower... Performing a happy animation means checking the current interaction of the elder, stop it (if possible), make him face the youngster and lastly perform the animation.
Therefore, the simplest solution I can think of is a "Push Interaction".
It works this way:
1) the youngster selects the "Make Elder Happy" from the picture, the BHAV searches for an elder, boosts his fun and forces the youngster to move in front of the elder.
2) the BHAV is concluded by a line that forces (pushes) the elder to choose a different interaction from the painting: a hidden interaction (something like "Interaction - Animate Elder") that contains an "Animate Sim" line.
The "Push Interaction" function requires you to pass some values:
- who is the sim pushed to run the interaction
- what is the object whose TTAB contains the interaction
- the line in the TTAB that contains the interaction to be performed.
Pushing a sim to choose an interaction from an object has the very same effects of selecting the sim and clicking on the object manually: only, the user doesn't need to do anything, it's everything automatic.
I hope to have given you enough information to let you explore how the "Push Interaction" works: the lesson would be very long if I had to tell you every single bit of info about this :lol: but you seem to be a modder that can walk with his own legs, so to speak ;)
PS: there are many BHAVs in the game that use the Push Interaction; but if you want a simpler exaple, look into my "ZX Spectrum": when a sim deletes the program created by another sim, this action causes a reaction obtained by a Push Interaction.
adamSpline
28th May 2008, 03:11 PM
Numenor and all,
Cool, that makes sense about the push command. I had not heard of that command, but that seems like it should work. I will look into that. We will see if I can walk yet!
Perhaps you could give me another conceptual answer (I am not looking for the exact details, but just a conceptual response would be great)…
Is there any way to have a behavior automatically invoked based on a timer?
For example, lets say that there is a bottle of pills in the room. Every three hours (lets say), a behavior of the pills is automatically invoked that lowers the motives of the Elder. However, if the Elder “takes” a pill, it restarts the three hour clock.
Wow there is a lot here. And I know this is probably way complicated (I like challenges).
But, I guess the first question is simply: can behaviors be automatically “pushed” on a sort of timer? Any ideas?
Anyway, I am just getting into to Sims2 and find it to be a lot of fun, and a cool way to do some AI type scripting.
Thanks again!
-Adam
Numenor
28th May 2008, 04:11 PM
Yes, pushed interactions can be automated on a timed basis.
Of course if you embed a timer into an object (the pills), the timed "push interaction" will occur only if the pills are on the lot: if you delete them, no more interactions :P -
That said, there are at least two methods to simulate a timed action.
A) The first method is exactly what you ask for: a timer; but if I remember well the timer functions have been implemented in the game with some EP, they were not included in the base game; therefore, the object will not be compatible with all the games, but it will require that EP. At the moment I can't be more precise, because I can't check the game files, so I'll write about it later on.
B) This second method is simpler and it's perfectly compatible with the base game.
The "Function - Main" of the pills should include a check (performed via a "0x0002 Expression" opcode) for the hour of the day, that is a Global Variable.
It should look like this:
1 - Global (Hour) == 0? If true, goto 9; if false goto 2
2 - Global (Hour) == 3? If true, goto 9; if false goto 3
3 - Global (Hour) == 6? If true, goto 9; if false goto 4
4 - Global (Hour) == 9? If true, goto 9; if false goto 5
5 - Global (Hour) == 12? If true, goto 9; if false goto 6
6 - Global (Hour) == 15? If true, goto 9; if false goto 7
7 - Global (Hour) == 18? If true, goto 9; if false goto 8
8 - Global (Hour) == 21? If true, goto 9; if false goto 1 (thus restarting the loop)
9 - (search for elder, lower his motives and then idle for 1 hour to prevent multiple executions in the same hour)
adamSpline
29th May 2008, 08:55 PM
Numenor,
I checked out your ZX Spectrum, and it was very helpful in figuring out the Push Interaction. BTW, great object, I hope to study it more.
Also, I was able to figure out how to use the main() function to make the Elder sick if he does not take a pill by a certain time (thanks for the pointers).
I was trying to think of a way to determine if the Elder had already taken the pill or not (because I do not want to make him sick if he did take the pill). To accomplish this, I used manage inventory to place an item in the Elder’s inventory (in this case a water bottle)… and if this item is found in the inventory, then he will not get sick a the appointed time. I am sure there is a better way to do this, but I have a limited bag of tricks right now.
Thanks again.
-Adam
Numenor
30th May 2008, 01:40 PM
Usually the game uses the "tokens" instead of a real object, but the method used is the same: putting something (the token) in the inventory. Therefore, "bravo!" for having found by yourself the right solution :)
adamSpline
9th Jun 2008, 08:31 PM
Numenor and all,
Thanks again for all your help. I have a couple more conceptual questions you might be able to help me with.
[1] In the game, the sims automatically gravitate towards certain things when a motive reaches a level. For example, they go to the bed when they are tired, or they eat when they are hungry. I assume we can do something similar with our own objects? When they reach a threshold of a motive, they automatically gravitate towards a behavior of an object. I know I could probably handle this with a main() timer loop that checks motives, but is there any way to add that functionality at a higher level within the object: say link it up with a particular motive (or a combination of motives)?
[2] I see in the game that there are services like housekeeping. A person comes over and does a particular task. Is it possible to do a new type of service? I’ll just make something up here: a sim that shows up, does a particular behavior, and then leaves?
Thanks,
-Adam
Numenor
9th Jun 2008, 09:50 PM
[1] This is simple: in the TTAB, you can set the motives that will "attract" the sim toward a specific interaction. I mean, this is not a "per object" setting, but a "per interaction" one.
For example, let's say that your object has two interactions: "View" (supposed to give fun) and "Use" (supposed to give social); for the first interaction, you should set the "Fun" motive in the TTAB to a non-zero value; for the "Use" interaction, set a non-zero value for the "Social" motive.
As a result, the sims in need of fun will "View" the object and the sims in need of Social will "Use" it. You only have to tweak carefully the level of Motives set in the TTAB, so to avoid sims to become "addicted" to the object, or ignore it.
[2]Custom NPC's are definitely possible. Echo has created some of them, if I remember well (for sure, she created a Easter Bunny): I suggest you to download and examine it to understand how custom NPC work; in few words, the "magic" is performed by the "Function - Main" BHAV the you write for that NPC: this BHAV will instruct the NPC to perform what you want.
Echo
10th Jun 2008, 05:35 AM
As an interesting side note...
[1] The 'attraction' you're talking about is called 'advertising'. The object 'advertises' all the motives that it thinks it's good at filling, and the sim makes a judgement based on all the available advertisements. The TTAB lets you specify a fixed attraction for different age groups etc, but if you want to do something a bit clever you can actually change the advertising on the fly in the guard function. For example, if you look at the guard code on a bed, it checks if the sim's sleep need is less than a certain threshold (25% or something). If it isn't, then the sleep advertising level is really low. If it is, its sleep advertising level is quite high. That's why sims won't autonomously sleep in a bed until they're really quite tired - if the code wasn't there to adjust the advertising on a per-sim basis, the sims would want to go to sleep every time their sleep need dipped below all their other needs. :)
[2] There are two types of NPCs in the game - Unique NPCs and Templated NPCs.
The kind you mention, the maids and the gardeners and the repairmen and the like are templated. That means that the game has a template for these sims - what they wear, how old they are, what gender they should be - and when you need one in the game it generates a sim according to that template. Templated NPCs can be moved in, married, made controllable, all of the above, because they're basically just regular sims with some special code added in. If a templated NPC moves in and becomes controllable, the game can just generate a new NPC according to the template to take their place. Templated NPCs are, essentially, unclonable. (That's not strictly true of course, anything is clonable with enough determination, but doing so here would either require extensive global hacks which would need to be different for every EP, or an enormous amount of global file importing and changing. It's a pretty spectacularly nasty hack to try and do).
The other kind is unique NPCs. These include the Grim Reaper, Mrs Crumplebottom and the Hula Zombie girls, amongst others. These are definitely cloneable, and I have done so several times now. They are mostly self-contained as packages, so if you want a cloneable base package you're welcome to hack apart the Easter Bunny or the Carnival clowns under my profile. They're not *simple* by any means, and you have to do a fair amount of homework regarding the structure of bodyshop files as well as the obvious object knowledge, but they're definitely possible.
To get them to show up on the lot though, you need to place an object on the lot which will create them (although it can be an out-of-world controller object if you want it to happen more spontaneously). You won't be able to make them controllable, they won't be marryable, and they will always look, sound, and be named exactly the same thing, since they are unique. But they are still NPCs. :)
adamSpline
10th Jun 2008, 06:45 PM
Numenor, Echo and Everyone,
Thanks again for your suggestions. I loaded up the Bunny and the clown. Cool stuff. I was able to make the bunny do some different things by editing the behaviors. This will be a great starting place for me.
But, I want to make the Bunny look different. As I said, I am trying to make a new service NPC, and it would be cool if I could make her dress the role (in this case a nurse). So, I saw that I could change the outfit of the Bunny with some of the Sims2 preset outfits (this worked fine), and then of course without any outfit she just looks like Hula Girl. But, how do I put different clothes on her?
For example, I have a Sim that I dressed up, and I want to make the Bunny have that outfit (or import the Bunny’s behavior data into my Sim, whichever is easier).
I thought I could just load up Echo’s Bunny into Body Shop, and change the base clothes (so she would not be hula). However, Body shop was not finding echo’s bunny NPC package when I put it in my “SavedSims” directory (perhaps Body shop is not able to load such a package, or maybe this is the wrong way to load it into Body Shop). -- My idea was to load her into body shop, clone her, change clothes, and then re-link the crest to the clone’s new guid.
I also saw that there are some tutorials on how we can change the clothes of the NPC townies, maids and such. However, I am not trying to change any archetypes, instead I am just trying to change the clothes on this unique NPC Sim (or will the method in those tutorials work for me also?)
So, again, if you have any conceptual answers on how I can change the base clothes of the Bunny so she is no longer wearing a Hula outfit, that would be great.
Thanks,
-Adam
Echo
10th Jun 2008, 11:48 PM
That's... er.... because when I made the bunny I did it wrong. ;) Actually, I just didn't know how I was supposed to do it with the bunny, and I only figured it out when I was making the clown. :)
Basically, what you have to do is pull out all of the bodyshop files from the existing NPC package, export a sim from bodyshop who looks like what you want, then import those files from that exported sim into the NPC package. You have to tweak a couple of the group and instance numbers so that they match the originals though - the ones at the top of the bodyshop scenegraph. I can't remember exactly which ones they were that I had to change, although I could probably figure it out again looking at the clowns. (They're exactly the same object, just different GUIDs and different bodyshop files). My memory says it was the ones which had really low instance IDs - 0 or 1 or 2...
The clowns are actually better templates than the bunny, because the bunny was an early NPC prototype whereas I actually had some idea of what I was doing by the time I made the clowns. The only thing they don't have is a default locomotion (since they don't walk around!) but you can copy that line from the bunny's init. :)
adamSpline
11th Jun 2008, 02:46 AM
Hi,
Echo, I followed your instructions. Like magic, I now have my own Sim juggling and making a fool of herself on the podium. I just imported everything from the body shop clone into your male clown, and it worked. I did not need to change anything in the scene graph (actually I really don’t know what the scene graph is in this context, but I am fine with that because it worked, well at least my Sim is acting like your clown, which is all I wanted for a start).
Now comes the fun! - adding behaviors to my new NPC.
Thanks again!!
-Adam
Echo
11th Jun 2008, 02:57 AM
Yay! Excellent news, and very fast too! :)
adamSpline
19th Jun 2008, 08:52 PM
Hi all,
Some more questions. I am working on an object in which I want to change custom states attached to any sim. By custom state, I mean that I want to add a new “motive like” state to a Sim that can go up and down depending on how the sim interacts with objects. For example, there could a be new state called “silly” attached to a sim - interactions with objects could move the value of silly up or down (and I could use this “silly” state to effect how the sim interacts with other objects).
So, I am trying to create the custom “silly” stat by simply adding items to the inventory. If an item is in the inventory, then the person is “silly”, else the person is not. I currently know how to do this, by hiding tokens in the inventory.
However, I am not looking for an on/off value, but it would be nice to have a range of possible values of the state. In other words, a silly value of 100 would be higher than a silly value of 20.
I could accomplish this by just changing the count of the token in the inventory. If I have a count of 100 silly objects, then this would be more silly than a count of 10.
Unfortunately, I can not get the counting to work correctly. I am using the wizard, but it is not giving me the results I expect. I am trying to increment the count by a literal, subtract the count by a literal, and save the count into a local.
So, I have posted a test object which is a cloned sunflower, which attempts to add/subtract/count tokens of sunflowers in the inventory (after many tries the behavior functions might be a bit mangled and they do have some test dialogs that pop up with variable values... but you should get the idea). If you have any suggestions, please let me know.
Thanks,
-Adam
Echo
20th Jun 2008, 12:12 AM
What you're after is a "counting token", not a way of counting multiple tokens. Confusing, nay? A counting token is one that actually has a stack (in the push/pull sense) of numbers in it which you can read or update as you wish.
One of the best examples of counting tokens in-game is the toddler skill token. It's assigned to toddlers, and stores three values in it - walking, talking and potty training skill. They start at zero, then count up to 100 as the toddlers do the learning activities.
If you don't fancy trying to track down the relevant code for that in all the in-game objects, you can check out the magic skill and cauldron/spell books here:
http://www.modthesims2.com/showthread.php?t=145882
and the wand which shares the skill code here:
http://www.modthesims2.com/showthread.php?t=258224
The code in these basically took all the relevant parts of the toddler skill token, and extracted them to be mostly generic. You can pretty much copy all the "Magic - *" BHAVs from the wand files, update the GUIDs to refer to a new token of your creation, then use them as-is for any other custom-skill (or custom motive in this case) object.
adamSpline
20th Jun 2008, 11:48 PM
Hi,
Echo thanks again. Your suggestion worked like a charm, quite literaly. I was able to create a new counting token and GUID, and keep track of custom states. :)
adamSpline
17th Jul 2008, 10:05 PM
Hi,
Quick question regarding the overhead meter. I currently have a meter that hovers over a sim, that is tracking a custom state (this works fine). But then if the sim goes and does something like working out, then my meter will disappear after the work out (which is not entirely unexpected).
I want to find a way to always keep my little meter above my sim, or to have it pop back up after working out (and similar actions).
I was thinking that I could insert into an object's main loop to just pop up the meter if it has disappeared. But, how do I check if a meter is already up? I could not find a command for that. Because, with the command I am using (Global 186 - OverheadMeter track Custom), it seems to toggle to meter on and off (so this would not be very useful, because it would be appearing, and then disappearing).
So, is there an overhead meter command that will make the overhead meter appear (but not disappear if it is already up?)... or is there simply a way to check if a meter is already up?
Thanks,
-Adam
adamSpline
24th Jul 2008, 06:16 PM
hi,
I did find a solution to my previous post. In a loop, run the update meter function, if it launches a false, then the meter is not up, and it can be placed back up with a track custom meter function. Else, the meter is already up and there are no worries. -Adam
joex2k8xx
10th Sep 2008, 10:48 AM
Just a quick question i have read the above information and am still struggling. I want to make a mod that when a visitor, npc ect decides to leave family sims can stall them and even make thhem spend the night.
I have noticed when they are leaving you cant interact with them and i am unsure of how to change this can anyone help.
Thanks
Joe :)
Echo
10th Sep 2008, 11:21 AM
I'm pretty sure that's in the core sim BHAVs - they become unselectable and pretty close to unstoppable so that they don't get stuck on the lot accidentally. Take a look in (I think it's called) the Person object.
You'd have to make it as a global hack if you want this to work, and that's code which gets changed pretty much every EP so it's not a simple thing to maintain. Just as a heads up. ;)
Inge Jones
10th Sep 2008, 11:26 AM
Oh yes, once that empty box comes up in their queue you've had it. I think it's something to do with their brain slot - it's gets an "I am imprisoned" flag or token in it, and once that is there even if you manage to distract them briefly by making them selectable and directing them to do something else, the game just keeps making them start again wandering round looking for a way out. In fact as EPs have come out, they have added more things to help the sim leave, including simply zapping him after a while.
joex2k8xx
10th Sep 2008, 11:31 AM
Thanks For quick reply, I have found the BHAV for the leave command. Browsed through it a lot of things like Pick up carry sim, Age sim and etc... Cant find the command in it that would make them selectable and stopable. Any ideas?
Thanks again echo:)
Joe :)
Inge Jones
10th Sep 2008, 11:50 AM
Well I think several of us have tried it before without luck, so if you find out how to do it, you can let us all know :)
joex2k8xx
12th Sep 2008, 04:03 PM
Hi guyz
been at this for 2 days now and still strugglin lol, runnin out of ideas, found the Bhav for leave just cant work it out lol ideas welcome and needed lol
Joe :)
joex2k8xx
20th Sep 2008, 07:58 AM
Hi found away to get my sims to stay in wihout disabling leave, used the prison bhavs as a guide for it. Guess what i have hit another problem lol. I am tryin to make an option so that when u click on a bed it will come up with the option
"Send "sim" to bed
i have been tryin this myself for a while and cant get it to make other sims go to bed just keeps sending the selected sim to bed or the sim initiating the command.
Does anyone have any ideas
Thanks
Joe:)
Inge Jones
20th Sep 2008, 09:13 AM
You want to ask TwoJeffs at Simbology. Maybe he could add an "all sims" option to his Smart Beds?
joex2k8xx
20th Sep 2008, 09:31 AM
Hi Inge what i mean is say Sim A Clicks the bed it would come up with a menu that has default options and Send sim to bed-
so say we had sim b and sim c it would have send sim be to bed, and send sim c to bed.
Its hard explaining what i want does that give you a better idea?:)
Joe
Echo
21st Sep 2008, 03:38 AM
You want a plugin social which pushes the "go to bed" interaction of the bed onto Sim B (The target of the interaction).
joex2k8xx
21st Sep 2008, 09:28 AM
Hi cheers echo, do u know any good tutorials for making these never done that before ?
Just done bhav editing with objects.
Thanks
Joe :)
Echo
21st Sep 2008, 12:15 PM
No tutorials per se, but some notes in various forms:
http://www.modthesims2.com/showthread.php?t=208885
http://www.modthesims2.com/showthread.php?t=254413
http://www.modthesims2.com/showthread.php?t=256958
joex2k8xx
22nd Sep 2008, 04:08 PM
OMG lol i think im out of my comfort zone lol.
Ive cloned the socialdownloadtest dont no where to go from here lol
sorry for being a nuissance but can you offer anymore help thanks
Joes:)
Echo
23rd Sep 2008, 01:20 AM
Okay, best thing I can suggest is to download an existing social plugin. There's a nice simple one by Marvine attached to her dancing animation, or if you're worried about cloning someone else's stuff without express permission then you're welcome to grab the wand social object from my Sourcery download (but it's not as bare-bones). Read through those and see if you can figure out how they work, then post any questions. Unfortunately I can't really write a full end-to-end tutorial on socials at the moment, but I'm always happy to answer specific questions. ;)
joex2k8xx
23rd Sep 2008, 06:09 AM
Thanks echo i certainly will have a look at ur social object i do really appreciate this thanks and ill let u know how i get on or if im stuck lol
Thanks :)
joex2k8xx
24th Sep 2008, 12:54 PM
hi echo i have attached a package can u have a look it is a clone ofur wand social package. I dont know what ive done wrong no pie options in game. Also do u have any info on the push interaction (how to code opcodes) thanks Joe :)
Echo
24th Sep 2008, 01:08 PM
Wrong object to clone for pie menus. ;) The pie menus come from the social plugins (spellset) rather than the social object (socialobject). The former generates the pie menu options which, when selected, push interactions from the latter onto the sim's queue.
Regarding "Push Interaction", the main important parameters are "Object" (which should be the object ID of the social object) and "Interaction" (which should be the line in the TTAB of the social object which you want to push onto the sim). The others you can just copy from a sample object without too much fuss. :)
joex2k8xx
25th Sep 2008, 12:08 AM
Hi echo, I was thinkin these social interactions are puzzlin me soo much do u think i could add a "send (a sim on lot) to bed" and "send all sims to bed" using the push interaction (add these to a bed) or will i have to figure these social interactions.
Regarding push interaction -
does the GUID(object ID) go in opcode boxes 0-4 backwards like others
and for interation what is the opcode boxes and where can i locate the numbers to go in them.
I must be really dumb lol cant seem to get this at all. :(
Thanks :)
Joe
Echo
25th Sep 2008, 12:48 AM
Object ID != GUID. ;) Object ID is the identifier for the *specific instance* of an object. If you want to find the object ID for an object with a particular GUID which is on your lot at the time, you'd need to run a "set to next" to find the object, then run whatever checks you need to on it (eg, is it currently unoccupied?), then push the interaction onto the relevant sim.
Have you done much complex object modding before? Social plugins are a little bit mind bending if you're not too familiar with BHAVs.
joex2k8xx
25th Sep 2008, 07:39 AM
Hi echo,
wouldnt say complex nodding lol just basics like trying things out read the articles at the beginning of this thread as well as doin a few tutorials most things i have done is object based. Iam tryin to make a functional psychiatric hospital lots of advanced mods needing done and i am strugllin but i am withit. but iam dedicated lol. I am able to do all other like recolouring, object meshing and adding some basic bhavs.
Joe:)
Echo
25th Sep 2008, 08:48 AM
Ah, okay. :) Since you have done the standard tutorials, then what I would suggest a bit of experimental learning. ;) Take a working object, change a few things, then test in game and see if that's achieved anything. Don't try and make the full hack in one go. Take a working social plugin, and try to change the text of the pie menus while keeping the same behaviour. Then change the behaviour slowly until it matches what you're trying to achieve.
For some social interactions, the easiest option is to build the interaction into a regular object, then just migrate that code into a social afterwards. That way you don't have the overhead of actually getting your code to run to start with. :)
joex2k8xx
25th Sep 2008, 08:18 PM
Hi echo, I got my pie menus workin, dont ask me how lol:) NExt part the interaction wish me luck lol any tips or advice :) i think im pushin it lol
Thanks Joe :)
Skwifey
15th Oct 2008, 09:19 PM
ty this is helpful
GeneralOperationsDirector
17th Dec 2008, 08:15 PM
AdidasSG2:
Last Activity: 13th Jul 2007
Does anyone know if he is still working on this?
Echo
18th Dec 2008, 12:08 AM
As far as I know, he is no longer updating these documents. However, the information presented is still accurate, and any questions posted will still be read by people who have a good chance of being able to answer them. ;)
GeneralOperationsDirector
18th Dec 2008, 01:34 AM
Yeah, I`d noticed that questions were still being answered, but ShoeGuy seems to have dropped off the radar rather abruptly, judging by this thread, and I was wondering if anyone knew anything. I`d like to be able to thank him for making the results of his work available to learn from. :)
J. M. Pescado
20th Dec 2008, 04:51 PM
He hasn't been seen in over a year, so based on the fact that he talked too much, he probably suffered a common fate typical of those who delve too deeply in this field without taking precautions to protect their privacy: Assassinated by EA.
If you don't believe me, recall that BHAV editing didn't open for at least 3 expansions in TS1, because at that time, EAxis was able to move faster and had the people who made inconvenient discoveries in this field "disappeared".
Let this be a lesson to you: Always treat the Internet like it is made of antimatter. Never, ever, touch it with any physical object you don't want to see annihilated. Never be standing near anyone who does touch it with a physical meatspace object.
AdidasSG2
13th Mar 2009, 01:53 PM
Hey all, I return, but with some baaaad news....
I have not been on in a very very very long time as I do not really play TS2 anymore, since a national disaster happed where I lived, so in effect I lost all that I had (computer, files on the computer and all my TS2's. But my memory still works good though but I do not know what has been updated/added to the new expansion packs. But when I get everthing going, I would most likley to be a part of the new TS3. (Due out some time this year!), but will just have to see and wait!
So this is just a basic update as to what has happened to me.
Also I want to say thanx for all those who took over in my place when I was no longer able to be there, Numenor, Echo, Shoeguy and a few others I might have missed. You help and knowledge were/is/are appreciated!
Thanx VERY MUCH guys!
vBulletin v3.0.14, Copyright ©2000-2013, Jelsoft Enterprises Ltd.