Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Quick Reply
Search this Thread
Lab Assistant
Original Poster
#1 Old 23rd Mar 2006 at 3:01 AM
Default Moving an Sim interaction/animation to a new object
I am working on a new object and there is one interaction I would like to add to it. After a search, I decided the 'warm hands' animation from the fireplace is just about perfect as all the Sim would need to do is walk over to this thing and hold their hands out like that. I imported as much as I thought I might need, the relevent ANIM, BHAV, TXT 81,85,87,88 and 100 etc, and so far so good. , each is recognizing the existence of the others although there is still no actual action by the Sim when the pie menu option is selected - (he just bolts upright from whatever he is doing and jumps one square). I thought the slot file might be needed as well for routing to and from but that simply refused to load the object at all in the game. Do we have a step by step tutorial on adding an existing Sim interaction to a new object? There has been a proliferation of objects with 'borrowed' animations/interactions lately so obviously it is possible..I am willing to kiss the goat and stand in cold porridge if that is the initiation that is required..

I live vicariously through my Sims. This is a sad reflection on my life and theirs.
Advertisement
Retired Duck
retired moderator
#2 Old 23rd Mar 2006 at 11:39 AM
First note - you don't need to import the anim file, the object will just reference the original.
Second note - Any chance you could post the object? There could be any number of things that are almost-but-not-quite-right, and it would be a lot easier to figure out which one if we have an object to look at.

Alas, there's no step-by-step tutorial, because the process can be so vastly different from one object to another. There's a bit of a discussion about it in this thread

In the meantime, turn on testing cheats and see if you get an error message when the sim is jumping. Error messages are a debugger's best friend. You might also want to check a few things that I've always found irritating to track down:
- Make sure you don't have any duplicate (two with the same instance number) text lists
- Make sure the correct BHAV is being called by the Pie Menu Functions file
- Make sure the "Animate Sim" command is pointing to the right line in the text lists.
Lab Assistant
Original Poster
#3 Old 23rd Mar 2006 at 11:54 PM
Echo - Thank you I hope you can make sense of it. The attached file contains two versions of the test object, one with animation and one without. I have also included the error log and you will see that it is failing on the first test (routing) and I'm lost right there. I got the slot files in without it crashing but that doesn't make any difference.

A couple of things

This is my first interaction test object - the mesh is just a box. It has two states, on or off, indicated by a texture change.

The TEST for the animation is not enabled because frankly, I haven't isolated whatever the flag is that indicates the ON or OFF state is true, so I by-passed it altogether to enable the pie menu option.

I took out the anim files as you suggested as well, and it resolved those references nicely.

I know it's a mess but you should have seen it before I cleaned it up

In case you are wondering why I didn't just use a fireplace as a base - I did at first, but I found no way to remove the parts I didn't want without it crashing or refusing to do anything at all. EG, the Fire ON and Fire OFF tie to the light fire animation in constants which i couldn't edit or remove - plus dem bones be everywhere...lol. It seemed simpler to me to have a blank object and import only what i wanted which is simply the warm hands part..nothing else was required.
Attached files:
File Type: zip  testobject.zip (80.9 KB, 34 downloads) - View custom content

I live vicariously through my Sims. This is a sad reflection on my life and theirs.
Retired Duck
retired moderator
#4 Old 24th Mar 2006 at 1:13 AM
Not that messy really, I've seen messy and that wasn't it. I've given both the explainations for what was causing the problems, as well as instructions for the fix. A fixed version is also attached. If you're not interested in the why of the situation, then just skip everything between the [Theory] and [/Theory] markers.

Your first instinct was correct, the fireplace has slots in it that the ficus (which I presume you cloned from) doesn't have.

[Theory]
Adding slots to a slot-free object is very complicated, because they actually connect through the OBJD, the SLOT and the CRES files (possibly more, I've never managed to pull it off myself). The good news is that there's a fairly simple work-around.

Slots provide very precise locations to objects - if you need a sim to walk to a very specific spot (eg - "go to coordinates (-0.25, -0.1532, 0) from the object"), then you have to use slots. However, if you just want the sim to be close to the object (eg - "go in front of the object and face it"), then primitive 0x1B: "Go To Relative Position" is a much easier alternative.
[/Theory]

[Instructions for fix]
To use "Go to Relative Position" instead of routing slots, just change the first command in the BHAV to use opcode 0x1b, with the operands:
00000004000000000000000000000000
[/Instructions for fix]

That will stop your first error, but you'll now get a shiny new error after the sim has walked over to the object saying "Attribute number out of range.". Fortunately this is also fixable, and should help explain how to track whether the fire is on or off.

[Theory]
Some of the details here I'm not 100% certain of, but I'll do my best to explain anyway.

When objects need to store information about their current states, they use attributes. These attributes are public, that is, any object in game can access them if they need to. Now, the fireplaces have the information about their attributes stored at the semi-globals level, so when local BHAVs try to edit these attributes, they refer to them as "Stack Object's [semi] attributes" (I think!).

When you imported the text list 0x100, you gave your object the list of attributes from the fireplace. However, because the text list was in your local package, they became local attributes rather than semi-global attributes. To make your interaction recognise the local attributes, you just need to change all references to "[semi] attributes" in the BHAVs to just plain "attributes".
[/Theory]

[Instructions for fix]
Find the two commands in the interaction that refer to "Stack Object's [semi] attributes", and change them so that they refer to "Stack Object's attribute". (Note: This should also fix the guard function)
[/Instructions for fix]

Now when your sims go over to the heater you won't get an error, but the interaction will end before anything happens. That's because the BHAV checks if the fire is on or not before it animates the sim. That means that you have to edit the "On" and "Off" functions so that they work correctly.

Basically, to turn on the heater you need to have a "Stack Object's attribute 0x1 := 1" called, and to turn it off again you need to have a "Stack Object's attribute 0x1 := 0".

I've attached a version of the object which should work so you can see the changes I've made. I also made a couple of other tweaks - mostly changing the names of your functions to be consistent with the Maxis naming style. (Simply speaking, CT functions are "Call Trees" which are called by other objects. Interactions are things sims can do to and with an object. )

You might want to think about writing a couple of guard functions for the turn on/turn off functions, so you can only turn on when it's off and vice versa, but I'll leave that up to you.

Hope that was helpful, and best of luck with your object!
Attached files:
File Type: zip  electricbarheater-new.zip (39.0 KB, 21 downloads) - View custom content
Lab Assistant
Original Poster
#5 Old 24th Mar 2006 at 1:42 AM Last edited by darylmarkloc : 24th Mar 2006 at 2:11 AM. Reason: update
Thank you so much Echo!! I was close but not quite close enough lol I certainly will go through what you did so I can learn from it I am thankful there is away around using the slot files for routing as I knew they were much more complicated and interlinked with other files in strange and mysterious ways. I think I can safely delete them now.

Brush the goat's teeth, I'm ready...

Once again..thank you

Added: It tested just great in the game

I live vicariously through my Sims. This is a sad reflection on my life and theirs.
Back to top