| Search this Thread |
|
|
Modding InfoCenter - Changing the object Placement #1 |
|
Numenor
Original Poster
The ModFather
|
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. -------------------------------------------------------------------------------------
SUMMARY In this article, we'll discuss about changing the objects placement, i.e. the ability of the object to be placed on tables, counters, walls, ground, etc...
-------------------------------------------------------------------------------------
PART 1 - FINDING WHERE THE PLACEMENT INFO ARE STORED You may have noticed that in the OBJD there are many fields that hold information about the object placement. For instance, field 0x0006 is "Default allowed Heigh flags", field 0x0005 is "Default Wall placement flags". Defining the object placement using those OBJD fields would have been easy... Too easy! So, Maxis decided to define the object placement using the "Init" BHAVs, just to make things harder ![]()
Almost every object contains a private Init BHAV (called "Function - Init") that usually calls one or more semiglobal Init BHAV. Either in the private or in the semiglobal BHAVs, the placement flags for the object are set.
PART 2 - EDITING THE PLACEMENT FLAGS Now, you could search the BHAVs and spot the all the lines that adjust the object placement, but the easiest thing to do is to add some lines at the end of the private BHAV, and use them to change the placement flags at will: all the previous settings will be overridden.
As said, we have to add a line at the end of the private Init BHAV, set the function (Op-Code) to 0x0002 (="Expression") and set the operands in the form: My 0x00NN Set Flag Literal Value 0x00MM In the Expression above, 0x00NN is the type of placement (horizontal or wall placement), and 0x00MM is the flag that we want to "set" (= activate). You can set the following values: My 0x0004 Set Flag Literal Value 0x0001 ---> Placeable on floor If you want your object to be placeable on different surfaces, you have to add (and edit) multiple lines to the private Init BHAV. sometimes you may need to prevent an object to be placed on specific surfaces; in this case, use as reference the table above, but use the "Clear Flag" operand instead of the "Set Flag".
EXAMPLE If you want your object to be placed on all the surfaces (tables, counters, mantles), you have to add 5 lines: My 0x0004 Set Flag Literal Value 0x0002
-------------------------------------------------------------------------------------
OTHER USEFUL RESOURCES Modding InfoCenter Index - Comprehensive list of all the InfoCenter threads Object Creation Workshop and Repair Center - If your object doesn't work, no matter what you try Colour Options for "EP-ready" packages - About the texture linking tecniques Sims 2 start to finish Object Creation Tutorial - Learn how to create your own object -------------------------------------------------------------------------------------
|
|
I've finally started my Journal. Information only, no questions. My latest activity: CEP 9.2.0! - AnyGameStarter 2.1.1 (UPD) - Scriptorium v.2.2f - Photo & Plaques hide with walls - Magazine Rack (UPD) - Animated Windows Hack (UPD) - Custom Instrument Hack (UPD) - Drivable Cars Without Nightlife (UPD) - Courtesy Lights (FIX) - Custom Fence-Arches - Painting-TV - Smarter Lights (UPD) I *DON'T* accept requests, sorry.
|
|
|
|
Last edited by Numenor : 9th Feb 2008 at 10:53 AM.
Reason: Slightly updated Placement flag #12 (on Driveways)
|
|
49 users say thanks for this.
[ Click here to view a longer list ] |
|
|
|
#2 |
|
Khaibit
|
Thank you, Numenor! :bow: Another useful information from you
|
|
Yes, I am serious though I'm not serious at all. I'm serious about this! Even the joker can be deadly serious... Wichtig ist, was hinten raus kommt!
Entscheidend daran ist, wie? |
|
|
|
|
|
|
#3 |
|
windkeeper
|
Great to have all that info put together and explained! Thanks! I had the list of placement and intersection codes for a while. My problem is, just adding extra lines of code in BHAV doesn't always work. I was successful with stopping painting from going down with the wall and setting few decorative objects to allow other object or person intersection, thats about it. For example, right now I'm trying to change "on a pedestal" statue to allow person and object intersection by adding modified 0x0008 code - no luck. Oh, and here is the codes for 0x0008, got them at this forum: 1: can be stepped over 2: allow object intersection 3: allow object and person intersection 4: can walk 5: allow person intersection 6: in use 7: notified by idle for input 8: Do NOT Use Maya Model Footprint 9: chair facing A: burning B: hide for cutaway C: unused -was fireproof D: Remove Floor E: Add Floor if Required F: Hide Floor *Edit* got my object working by importing BHAV from another object. Needs more testing but so far it works. |
|
|
Last edited by windkeeper : 10th Aug 2005 at 07:21 AM.
|
|
|
#4 |
|
Numenor
Original Poster
The ModFather
|
I've read somewhere (probably Dizzy2 said that) that after the Init BHAV has been executed, some parameters can't be modified any more. this means that when changing the BHAV and restarting the game, you have to sell and rebuy the object. Thanks for letting me know, though... I hate when things don't work like they logically should!
|
|
|
|
|
|
#5 |
|
Inge Jones
|
If you set something in an init, that *should* only run once - when the object is instantiated. Ie you'd have to rebuy the object if you want to run its init again. An init will also normally run if an object errors, it resets and reruns init. All the attributes and other settings that can be set in an init can be set at any time during gameplay, for example as a result of choosing a menu option. There is a way to have an already-purchased object re-initialised after you have updated its code. That is to specify a BHAV to run in the "load" object function. Usually just give the number of the init BHAV! Load runs when the game detects the file on disk has changed. However, if you specified things like placement flags in the init, that will not affect already-placed objects. Those are only used at the time of placing the object, they will not suddenly cause an object to leap up from a coffee table and hang itself from the wall. |
|
|
|
|
|
#6 |
|
Numenor
Original Poster
The ModFather
|
That's what I thought. But why WindKeeper says that this procedure not always works? I'd like to know from her if re-buying the object fixes the placement. I can't see any reason why a flag set in the last line of the init BHAV shouldn't override the previous settings. |
|
I've finally started my Journal. Information only, no questions. My latest activity: CEP 9.2.0! - AnyGameStarter 2.1.1 (UPD) - Scriptorium v.2.2f - Photo & Plaques hide with walls - Magazine Rack (UPD) - Animated Windows Hack (UPD) - Custom Instrument Hack (UPD) - Drivable Cars Without Nightlife (UPD) - Courtesy Lights (FIX) - Custom Fence-Arches - Painting-TV - Smarter Lights (UPD) I *DON'T* accept requests, sorry.
|
|
|
|
|
|
|
#7 |
|
Inge Jones
|
Well I don't know what exactly is "not working" for them. An already-bought object will not reinitialise itself when you change the file. That is logical and to be expected, given the knowledge that Init only runs at purchase time and when the object errors. If you buy an object whose init says "place on coffee tables" then you leave the game, change the init to say "don't place on coffee tables" then go back into the game, the object will still want to go on coffee tables, because nothing has happened to make it run Init again. This is completely logical in my opinion. If they want already-purchased objects to pick up such changes, they need to set a "load" function in the object functions table, pointing to the Init function, so that the object will run Init when they return to the game after changing the file. This is the documented purpose of the Load function. |
|
|
|
|
|
#8 |
|
dizzy2
|
That's nice to know. I always assumed Load was strictly for when you loaded a lot. Now, if only we could run behaviors in simless build mode... |
|
|
|
|
|
#9 |
|
Inge Jones
|
Windkeeper, to allow intersection, you may also need to add an "allow intersection" function. At its simplest you can just put in a meaningless line that returns true. |
|
|
|
|
|
#10 |
|
Inge Jones
|
Dizzy, it is for when you load a lot. It won't run at other times. You close your game, edit your object, load the game, load the lot, and then the object's "load" function runs. But only if it's been changed on disk. |
|
|
|
|
|
#11 |
|
windkeeper
|
Um, I didn't say "it stops working", I was trying to say that for some objects it just plain doesn't work. For example, that venus statue. I added the extra line of code to allow intersection, but sims still cannot walk through it. The reason is probably because the Init calls "sculptures" bhav and I guess that resets everything I try to change. But when I removed all the bhav functions and replaced them with the others taken from a simple decor object that do not have calls to external functions, I was able to add the code I needed and finally make it work. |
|
|
|
|
|
#12 |
|
Inge Jones
|
The global init can only reset something you changed if it runs after your settings. If one BHAV says Set Flag and the other says Clear Flag, it will be the instruction that happens last of all that will win. I don't think you have understood what I meant about the Allow Intersection function. It's not a line of code in an init, it's a BHAV of its own that is referenced from the Object Functions table. You can put various conditions in there like it can intersect with particular objects but not others. Nowadays if I want to allow intersection I do use that function, even if I don't want to run conditions. |
|
|
|
|
|
#13 |
|
windkeeper
|
I did understand, I just wouldn't know how to create that function and how to call it . I would love to see an example, or a mini-tut, as that is the behavior that I need to change the most.
|
|
|
|
|
|
#14 |
|
Inge Jones
|
Well I don't think we should hi-jack this thread any more, but I'd be happy to start a new one about Object Functions. |
|
|
|
|
|
#15 |
|
windkeeper
|
Yes, please!!! And sorry, Numenor for the off-top! |
|
|
|
|
|
#16 |
|
Numenor
Original Poster
The ModFather
|
Never mind, it's interesting (but please Inge don't post a tutorial here )I'd like to take a look at the Venus Statue init BHAVs, though... Maybe the "Allow intersection" flag works differetly than the placement flags, or maybe it's just useless if the "Allow intersection" BHAV isn't called somwhere... |
|
I've finally started my Journal. Information only, no questions. My latest activity: CEP 9.2.0! - AnyGameStarter 2.1.1 (UPD) - Scriptorium v.2.2f - Photo & Plaques hide with walls - Magazine Rack (UPD) - Animated Windows Hack (UPD) - Custom Instrument Hack (UPD) - Drivable Cars Without Nightlife (UPD) - Courtesy Lights (FIX) - Custom Fence-Arches - Painting-TV - Smarter Lights (UPD) I *DON'T* accept requests, sorry.
|
|
|
|
|
|
|
#17 |
|
windkeeper
|
The venus statue ("on a pedestal") has three bhav functions: init, init common, and main. Init function calls "[semiglobal] Function - Init - Sculptures". Init Common function has the placement codes, including My 0x0008 which is set to remove the flag. I tried changing that line to "set" the flag, tried adding a new My 0x0008 line at the bottom - both didn't work. |
|
|
|
|
|
#18 |
|
Inge Jones
|
Windkeeper, your line 1 that you added isn't being run. See the grey line with an arrow pointing to it? That means it's not linked into anything - none of the other lines Goto it. You'll know it's going to run when you see a green or a red line going to it. Also you'd find it useful to use the Sort button, it helps you to see more clearly what order the lines will be executed in. |
|
|
Last edited by Inge Jones : 10th Aug 2005 at 06:51 PM.
|
|
|
#19 |
|
windkeeper
|
That was the original file without my changes. But I didn't realise that line was not linked when I tried to use it. I was also adding a new line at the bottom and connecting it to the last executable line. Here is what it looked like (see pic). Thanks for the "sorting", I wasn't sure it that affects the actual functions. |
|
|
|
| |
| Inge Jones |
| This message has been deleted by Inge Jones. |
|
|
#20 |
|
Inge Jones
|
What's in the individual inits? Might they be setting the flag wrong? Presumably they do their stuff after calling Init Common. Also have you followed through all the way from the OJBF table that all the parts of your object are running that Init Common? I wrote the thing about OBJFs I promised you, do try using the Allow Intersection function I mentioned. Hmm and just in case there is something wrong with flag 3 (ISTR I've had trouble with that one too) use 2 and 5 instead |
|
|
|
|
|
#21 |
|
windkeeper
|
Thanks, Inge! I'm moving my questions there then :D Numenor, just for your information. After reading Inge post I found whats wrong, the Init Common function is not even listed in OBJF, so there was very little point trying to change it as it looks like it is not even used! |
|
|
Last edited by windkeeper : 10th Aug 2005 at 09:21 PM.
|
|
|
#22 |
|
Numenor
Original Poster
The ModFather
|
You're right: the Init Common is probably a remaining of an old version, that Maxis discontinued... It's not used at all. I think I'll add a "Hint" in the main post, explaining that the "Private Init BHAV" I refer to, is the one called in the OBJF. So far, I only pointed out that the BHAV name is always "Function - Init" (and that's true also for the Venus statue). |
|
I've finally started my Journal. Information only, no questions. My latest activity: CEP 9.2.0! - AnyGameStarter 2.1.1 (UPD) - Scriptorium v.2.2f - Photo & Plaques hide with walls - Magazine Rack (UPD) - Animated Windows Hack (UPD) - Custom Instrument Hack (UPD) - Drivable Cars Without Nightlife (UPD) - Courtesy Lights (FIX) - Custom Fence-Arches - Painting-TV - Smarter Lights (UPD) I *DON'T* accept requests, sorry.
|
|
|
|
|
|
|
#23 |
|
Numenor
Original Poster
The ModFather
|
Notice: The question by Lethe_s about indoor use of barbecues has been moved here: http://www.modthesims2.com/showthread.php?t=83770 |
|
I've finally started my Journal. Information only, no questions. My latest activity: CEP 9.2.0! - AnyGameStarter 2.1.1 (UPD) - Scriptorium v.2.2f - Photo & Plaques hide with walls - Magazine Rack (UPD) - Animated Windows Hack (UPD) - Custom Instrument Hack (UPD) - Drivable Cars Without Nightlife (UPD) - Courtesy Lights (FIX) - Custom Fence-Arches - Painting-TV - Smarter Lights (UPD) I *DON'T* accept requests, sorry.
|
|
|
|
|
|
|
#24 |
|
dizzy2
|
Looks like there's a new "allowed height" flag (used specifically for ownable cars): My allowed height flags (0x4) Set Flag Const 0x101:0xC(12) I suppose this means placeable on driveways. See: # Group = 0x7F4EA230, Instance = 0x2071 # Title = Functional - Init - Ownable |
|
|
|
|
|
#25 |
|
Numenor
Original Poster
The ModFather
|
Dizzy - Thank you for your input and valuable info (and not only in this thread! )Zalo_m - I've moved (and answered) your question into the Object Creation forum (http://www.modthesims2.com/showthread.php?t=93369) |
|
I've finally started my Journal. Information only, no questions. My latest activity: CEP 9.2.0! - AnyGameStarter 2.1.1 (UPD) - Scriptorium v.2.2f - Photo & Plaques hide with walls - Magazine Rack (UPD) - Animated Windows Hack (UPD) - Custom Instrument Hack (UPD) - Drivable Cars Without Nightlife (UPD) - Courtesy Lights (FIX) - Custom Fence-Arches - Painting-TV - Smarter Lights (UPD) I *DON'T* accept requests, sorry.
|
|
|
|
|
![]() |

Have you made some custom content?


This 
Twitter
del.icio.us
StumbleUpon
Google