PDA

View Full Version : making a box with open/closed states?


aelflaed
18th Aug 2009, 04:31 AM
I'd like to make a floor chest that opens, but can't find out how. I've been all over MTS for days and can't find anything, which probably means I'm using the wrong search terms.

I don't care about animating the movement particularly, but I'd like the box to have an open state. I presume this means two meshes? And then I need to know how to connect them in the interaction.

Can someone point me to a tutorial? Thanks.

HugeLunatic
18th Aug 2009, 08:23 PM
I don't know of a tutorial, but an object you can look at is the open/close drapes by Inge at Simlogical. I think the original object she used was lights, since they have the two states.

aelflaed
19th Aug 2009, 12:54 AM
That's an idea. Of course, looking at another object usually confuses me, but it's worth a try. ;)

Thanks, HL.

leesester
25th Aug 2009, 01:10 AM
another excellent item would be the dolls house if you want something already on the floor - it has two meshes. I also made a small window that does EXACTLY this trick and feel free to take look at the BHAVs in that. You can find my little window in the thread below.

http://www.modthesims.info/download.php?t=341918

aelflaed
25th Aug 2009, 02:39 AM
Thanks, Leesester. I'll have a look at your window.

I'm working on the mesh, which is taking a while, but then I'll have to discover how to make the package work. Still haven't found any instructions, so I hope I can figure it out from looking at these other objects.

Echo
25th Aug 2009, 05:41 AM
http://www.modthesims.info/showthread.php?t=220742
describes what you are trying to do. For linking the new GMDC into your package, you'll probably find this one useful:
http://www.modthesims.info/wiki.php?title=Tutorials:Understanding%20the%20Scenegraph

aelflaed
25th Aug 2009, 05:42 AM
Thanks, I'll check out those links when I get back.

Oooh, after a quick glance, the Scenegraph one looks scary, but I probably have to dive in and work it out. Thankyou.

aelflaed
27th Aug 2009, 09:17 AM
'm working on connecting the 2nd mesh and referencing it in the BHAV. It seems to need a temp file...or is that because I have My graphic instead of My Stack object? I have to do that next, missed that post before.

EDIT - okay, I've been messing about with it but I just don't understand enough. I've tried to add the open box mesh, and I've also tried to spawn roaches when the coinflip fails. Neither is working, not very surprisingly.

Must look again at the scenegraph info, and the Data Types thread. I've been reading all sorts of stuff on stacks and things, but not following very well. I may understand more after some sleep!

In the meantime, here's the current package, and some error logs...perhaps some kind soul can help me on my way.

There are lots of things wrong with it at this stage - no proper texture, too-small footprint, just to name a few. You can probably ignore it for the moment.

One more thing which I would like a pointer on - I've tried to put a view menu onto it, but it isn't showing. Mustn't be connected right or something. I imported the BHAVs for view and view test from another object, was that the wrong way?

I hope the files are attached properly, they aren't showing up for me at present.Trying a Mediafire link just in case:
http://www.mediafire.com/?sharekey=3d3e3bdffdf6560f95af63b7d44918aa16262b50c543740e

aelflaed
28th Aug 2009, 04:17 AM
I now have roaches! Hooray...I think.

But the mesh is still vanishing instead of changing state. The anims and motive changes coded are happening as far as I can judge, but without an object. Hmmm.

Also, the roaches have a visual lag - the sims react to them immediately and begin stomping, but the visible bugs take a while longer to show. Not sure if this can be tweaked?

Thanks for reading! Asistance also appreciated. :)

EDIT again:

I've been trying to fix the scenegraph, and some of it is better thanks to Echo's tutorial. However, I can't repair the second mesh - the -open' state of the chest. I have two orphans and one false TXMT (which should be pointing to one of the orphans). I can't make them reference each other properly, and am probably making it worse by more fiddling! Hope someone can help.

aelflaed
31st Aug 2009, 03:14 AM
Well, I've finally got the scengraph working. Don't know what was wrong with it before, but I now have everything linked and the open/closed states of the box are working. Yay me!

Question - do I need to add an extra shadow for the open state? At present the closed state still has a dollhouse shadow. Can I link both states to the one?

Next I am working on the footprint issue.

HugeLunatic
31st Aug 2009, 04:04 AM
Good job! Based on how repository works and that shadows can be linked then, I would guess that yes you only need to create one shadow.

aelflaed
1st Sep 2009, 01:25 AM
Thanks. Still wrestling with the footprint at the moment.

Echo
1st Sep 2009, 11:09 AM
Just a quick note regarding the "View" option, unfortunately you can't just import a "view" option from a painting or sculpture object into a different kind of object like the dollhouse, because they belong to different object "families" and have different semi-globals. That's why, if you open the "view" bhav inside a painting and find a line with an ID greater than 0x2000, it'll have one description, but if you move it into another type of object it gets a different description.

From the looks of the rest of your code, you've definitely got the hang of getting sims to move around and animate when you tell them to, so I'd suggest that rather than trying to import the view behaviours (which are all unnecessarily complicated) you just make a simplified version of the view which just chooses some good standard viewing animations and plays them. :)

aelflaed
1st Sep 2009, 01:04 PM
rather than trying to import the view behaviours (which are all unnecessarily complicated) you just make a simplified version of the view which just chooses some good standard viewing animations and plays themI was thinking that might be the way to go. Thanks. And I'm glad you think my code looks okay - it's far more linear than anything else I've looked at.

I really need an animation that has the sim reach towards the object. Obviously enough, trying the a2o anims keeps giving me an IK error, but are there some that will work? Or can I make one of those animations work somehow? I'm not sure I'm ready to leap into animating anything just yet, but I can't find an animation that looks reasonable.

Assuming I get the footprint fixed and finish coding this box, the next project is a basketry station. For that, I want to spawn a partial project in front of the sim, have them work on it for a while, and then get a finished object at the end - a bit like painting on the easel, I suppose. Any tips on where to find out how that is achieved?

I want them to sit on the ground while doing it, and I'd like other sims to be able to join the activity and be social, like they do with fishing..., all of which might be easier said than done. :blink:

It's a steep learning curve!

Echo
2nd Sep 2009, 12:47 PM
For reaching... I can't remember what it's called, but there's a sort of pick up type animation which doesn't require a2o... I used it in the Easter Bunny code when he swipes the "crest of bunny", if that helps? :)

The easiest way to create a "work-in-progress" object style object is actually, oddly enough, very similar to what you've made here - mesh switching. :) What you want to do is run a "Create New Object Instance" command with the GUID of the object you want to create, but have multiple mesh versions for different states of completion. When the object is in it's final state, you're done and can move it away at will. :)

Multiple sims joining in is sometimes a bit trickier, but it depends on how synchronized the activity needs to be. If they can just all run animations at roughly the same time as each other, that's fine. If you actually want sims coordinated with one another, passing stuff around or taking turns with something, it's a fair deal harder to do!

aelflaed
2nd Sep 2009, 02:53 PM
I thought mesh-switching would be the way; thanks for confirming it. (My progress isn't precisely "oddly enough" - there is a level of planning in my modding career :) I'm a late bloomer, but hoping to get there in manageable stages.)

I've been looking at Nadira's Ceramics Workstation, which is VERY complex but does show me a number of things I need to do. Hopefully less complicatedly!

It looks as though the ceramics station is doing most of the work in little bits, all in separate BHAVs, instead of putting them together. Maybe it's easier to keep track of that way. There are an awful lot of BHAVs calling each other all over the place, and a lot of other commands I don't understand, many of them without helpful wizards. Sigh.

I've got a budget transaction coded for the Bugbox, but haven't time to test it this evening. Hope I got it right; then I can use that for the basketry too.

I'll keep looking for the reaching animation - saw a thread where you had suggested bookcase anims, will have to look for those. I can look up the bunny one as well. I'm using a text list of basegame animations, but I suspect it is rather incomplete - haven't seen any book anims on it at all, and I was looking for the diary one particularly. I'll have to seach the game files myself.

The joining doesn't need to be synchronised. I would like the activity to be social - one sim making a basket can be joined by others ('ask to join' maybe?). Each sim would need their own project spawned, I think, and then they'd work on it in their own time-frame. Hopefully that's the less tricky option! And I do want them to talk with each other while working.

I got the sim to sit on the ground properly in front of the basketry station, but I'm not sure if I can keep going that way - there might not be any animations to use for the rest of the interaction. Looks good sitting down and standing up again, though, so I hope I can continue - it won't be as good if I have to put it all onto a table.

Is it better to spawn the project in their hands, or on the ground in front of them? Does it mattter? Presumably the finished version will have to go on the ground so it can be kept or sold.

Nadira has umpteen different vase types, colours and stages - it''ll reduce the coding if I keep it to three (or so) styles of basket. And maybe a super-duper master-level object to finish off with.

Anyway, must go to bed now. Thanks for your continuing advice.

Echo
3rd Sep 2009, 01:06 PM
If you're happy with just having sims sit near each other doing their own thing but talking to each other, then you should be able to get away with using the global "Conversation - Enter (Area)" code. It's global 0x034C, and handles people's conversation topics, taking turns to speak, reacting to different topics, and all the other inter-sim dynamics. You can find examples in a bunch of objects, but chairs are a nice example.

For objects which I want sims to move around and pick up and put down again, what I normally do is clone a "pick-up-able" object like a cup. That way I can spawn it on the ground or on a table, have the sim pick it up and interact with it, then put it down again. That's just my technique though, there are many others. It really depends on what effect you're going for.

aelflaed
3rd Sep 2009, 02:38 PM
That sounds like a good method for the basketry work, and for the joining. I'll give it a go.

(Found a good reaching animation, BTW - a20-videogameRackFloor-browse-crouch-getVideogame. Works well. The rabbit one you suggested was probably a-daydream-grabstuff, but that has the sim reach out at chest-height, which doesn't suit my current objects at all.)

Now, various Bugbox issues:

I've hit a snag with the Bugbox and can't figure it out. At present, the interaction fails after the videogame anim, accusing my expression of calling a non-3D object. I suspect this is because I have now altered the footrpint. I notice the sim is lining up at the front-left of the object, rather than in the middle of the two tiles, so perhaps I have missed something in the footprint stuff.

Did some searching but couldn't find out how to fix whatever it is. Found something suggesting a change in the 3D object type, but that setting seems to be correct for my OBJDs. I'll post the latest package in case someone (not pointing any fingers) can tell me what to alter next.

Also, I've lost the Close Lid menu option somehow. Maybe it's the same problem as the mesh swap, since I'm trying to make the option dependent on the lid needing to be closed.

I did make a guard for the Investigate BHAV, which is currently disabled. I wanted to prevent the option if the lid was already open, and push the sim to close the lid if so. My attempt at that last bit failed completely, so I mustn't be doing it right.

General query - I'm using Literals to check/alter motives, but I see others using constants - is one better? How would I know which constant to pick if I wanted to?

That's about enough for the moment. If I can't get any further with the bugbox on my own, I can start working on the basketry solutions you've offered. Nice to have a fallback plan. :)

aelflaed
4th Sep 2009, 06:26 AM
global "Conversation - Enter (Area)" I cloned the tea party chair and had a look, but it doesn't have anything in the BHAVs but main and init, and precious few commands in those. I assume all chairs are accessing BHAVs globally or something, but it didn't help me much. Maybe it's attached to the food rather than the chairs?

However, I did find it in the globals list, so I suppose I can mess about with it anyway.

Echo
4th Sep 2009, 06:47 AM
They're used from the "Function - Sit" commands (semiglobals), called from the objf's "Sit" target. Definitely not in the food. ;)

aelflaed
4th Sep 2009, 11:08 AM
Then it must be in the water.... :)

I'm working on the accessory meshes for the baskets just now, while waiting for either inspiration, or a tip, on my next move with the bugbox 3D error.

Echo
4th Sep 2009, 11:42 AM
A suggestion more than a definitive answer, but I suspect you've not got the right OBJD in the Stack Object. Right after the first line, add a line which says "Stack Object ID 0x00 := Stack Object's Lead Tile Object ID. :)

aelflaed
4th Sep 2009, 02:19 PM
I think you're right. Putting that line in got rid of the 3D error, allowing me to continue on to a Tree Break one instead. Oh well. The new error seems to indicate I'm not doing the budget transaction correctly. Must need another command or something.

What do I need to do to get the text notification to put the sim's name in properly? They all say "Me$" currently. I've searched for that also, without success so far.

The custom view menu seems to be working as planned, and the mesh swapped when it should. Close menu didn't appear after the Tree Break error (on a 'true' coinflip), but did appear after the failure result. With its own animation speed error. :rofl:
***********
I tried to create a new object with the basketry station, but nothing showed, and no error. I cloned the coffee mug, which seems to have no TXTR file, and I haven't yet added one, so that might be part of the problem. Have to investigate that some more too.

I am slowly getting there.

I need to know how to fix the budget properly, get the sim's name into the text notification, and create a new object instance successfully. That ought to fill up my time for the next little while!

aelflaed
5th Sep 2009, 03:41 AM
Echo, I just found your "Better Interactions" tutorial. Don't know how I missed it before, but it looks like it will answer a number of my current questions. You're a marvel, and I'm off to study up.

Echo
5th Sep 2009, 04:23 AM
Well on the "Budget" thing, check out this thread:
http://www.modthesims.info/showthread.php?t=149812

It's old, but it's accurate. :)

aelflaed
5th Sep 2009, 05:23 AM
I saw that thread. I don't mind old if it shows me what I need ( and I can follow it!)

My current budget command might work - don't know yet. I realised there were four args mentioned in the command, but the box of arg numbers said 3 - I'm hoping that's all that was wrong with it.

I think I need to know more about stack objects. I'm sure I saw an info thread around here somewhere, but first I want to see if the budget thing works now.

EDIT - nope, tree break remains. I'll work on it some more.

EDIT AGAIN: Hooray, the budget is working now. I had to work out the parameters better than I had yet done, so I understood what to enter where. Next, figure out the Me$ problem.

...I was thinking I needed to use an array for this, but I see where you have commented that they are rarely required. Hmmm.

aelflaed
5th Sep 2009, 10:08 AM
solved the dialogue problem - had the syntax wrong, that's all. $Me works fine, no stacks or arrays needed. :rofl:

I'm posting the current version of the Bugbox. It's working, mostly. Problems I'd like advice on if possible...

The guard function for the main 'investigate' interaction won't work at all - or rather, works too well. If I use it, the menu option never appears. If I disable it, all is well.

I want it to check the open/closed state of the box, and push the sim to close it, if it isn't already, or be able to 'investigate' if it is.

I have a view BHAV, set in a loop and using the skill exit test to help them stop viewing before too long. They seem to be ignoring the painting critique anims, and just looping on the bookcase browsing one. Their hands go on and off their chins endlessly, fun fills up, and they continue like that until almost dead from other needs. Obviously I've got something set up wrong there.

I also need to find a better animation for lifting the lid to close it, but that will just mean trawling through the list until I find something. Or living with the sell painting anim, which is good but too high for this object.

Thanks for your help.

Echo
6th Sep 2009, 07:42 AM
The problem with your guard function is that it's trying to run the interaction itself. The guard function is run almost continuously, any time you run your mouse over the object (even without clicking) or any time your sim is evaluating it as an autonomous action he or she might like to try. You can only put commands in there which are "immediate", that is, they don't cause any animations or changes in behaviour. Try the attached.

aelflaed
6th Sep 2009, 10:58 AM
Thanks, I'll try it out.

......

Yes, that works perfectly! Thanks.

Now I can work on the hilarious loop happening in the view interaction.

You have a black arrow pointing to the Close lid command, and I don't know what that means or how it gets there, but presumably that's why it works now. I had the guard function pared down to just the mesh check at one stage, but it still wouldn't work. Even though the same check was made (and worked) for the close lid guard, with only the graphic number different.

I'll re-read your post above and see if I can figure it out...Oh, it looks like you have orphaned the close lid command? Does that mean the game isn't going to try to run that, since it isn't connected to the rest of the command chain? But if that's it, why didn't it work when I only had the graphic check? Puzzling.

More Waffle: I altered my package, orphaning the close lid command in the guard function as it appears you've done....and now mine works too! WHY didn't it work when I had only the mesh check in there? My only thought is that it might have needed the lead tile ID command added, which I only did last night on the off-chance that would fix the problem. Otherwise I'm completely at sea.

I believe that 'close lid' command line is doing nothing now, so I should delete it, yes?

(And find some better anims and fix the view loop.)

Echo
6th Sep 2009, 11:44 AM
Yes. (To all of those things) :)

aelflaed
6th Sep 2009, 12:17 PM
Thanks. ;)

aelflaed
9th Sep 2009, 09:17 AM
I'm having trouble with the View and Close Lid animations.

I've currently got a dresser anim for the lid - "close-drawer". The interaction works, and there are no errors, but instead of 'closing the drawer', the sim falls to the ground! Then they get up, and go about their business. Why is that happening? It might be resetting, as I think there should be another animation happening afterwards.

The View interaction seems to be ignoring most of the animations I put in - all the painting-critique ones, in fact. Sims do the video browsing anim, then loop that one repeatedly without seeming to do the others at all. Before that, they looped the chin-rubbing one and did nothing else.

Presumably I've got it set up wrong, or those anims aren't any good to use. There are start and stop versions of some animations, should I be using them in sets of three if there are?

Latest package attached for general amusement.

aelflaed
11th Sep 2009, 02:31 PM
While waiting for the next inspiration on the bugbox, I'm working on the basketry station. There are plenty of things wrong with it still, but I have got successfull skilling, the basket stub appearing in the hand, and have defeated three separate errors. Also, it is joinable, but there's no conversation yet.

It's very funny seeing a sim come along and take the project stub out of the working sim's hand, and then wash up the 'mug' they believe it to be. Must fix that, but it's amusing at present.

All in all, going reasonably well so far - mainly thanks to your tutorials, Echo, and your many replies in answer to others' questions. :lovestruc

Considering the conversation thing, how does the object know if there is someone to converse with? Do I need to tell it to check for that?

Numenor
11th Sep 2009, 05:44 PM
I noticed that in the "Interaction - Close Lid", at line 0x03, the code is:
Animate Sim (animation: "o2a-dresserDrawers-close").
The animation is related to the object, so the opcode should be Animate Object (0x0069), and not Animate Sim (0x006A).

As for the viewing animatino not playing, I can see nothing wrong in the BHAV; maybe you could point both the targets of the animation lines to the next line, instead of exiting to false (or, if you want to understand what's going on, you could point the false targets to Error, so that the game will stop and complain, if an animation can't be played...).

aelflaed
12th Sep 2009, 01:25 AM
That's a good hint about getting an error for the viewing animations. Hadn't thought to try that.

And I didn't notice the drawers anim was an o2a instead of a2o. Since my object isn't a dresser and doesn't have drawers, will it work? Try it and see, I suppose. Thanks!

EDIT- Sadly, making it an object animation only raised an error ("could not find object reference"), as I suspected. I don't really know how to set up an object anim, so I don't know if that's fixable.

However, I have an oven anim in there now (not sure if that's in the last posted copy) which might have to do - unless I want them to fall on the ground, which was really quite amusing.

The view interaction seems to be working - there was no result when I pointed the last anim to return error on false. So it seems to be getting through the interaction, I just can't see the painting critique anims. I can try putting in the stop/start ones that match.

Numenor
12th Sep 2009, 03:02 AM
Oh, then I misunderstood: the inconstency is the "o2a" animation, not the "Animate Sim" opcode :) as a matter of fact, applying an objectanimation to an object thatit wasnot designed for will hardly work, so you'd better change the reference to the "o2a" animation to a suitable a2o one (but keep in mind that sometimes the a2o animations require the object mesh to be compatible; for example the "close oven" animation looks for the oven lid handle, and won't probably run if the handle is not found).

aelflaed
12th Sep 2009, 07:36 AM
On the contrary, the 'close-oven' anim seems to be working. :)

Closing the oven isn't really the right action of course, but unless I find something better, it will have to do. The sim is trying to lift a heavy stone lid, so I need something with both hands. Haven't found a lifting one other than the easel sell, which is far too high for my object. I've taken the dresser animation out.

Haven't yet tried adding the painting crit add-ons to the view interaction. I'm hoping that might make them work properly.

EDIT - the view interaction is working better now, with painting-serious-crit-start put in. Still a bit jerky at the end of the loop, but I'm not sure if that can be fixed.

Next for this object is texture tweaking - shadows, edge definition etc.

aelflaed
13th Sep 2009, 04:40 AM
Bugbox:
Here's the latest bugbox package; perhaps it's good enough as far as the modding goes. Any suggestions?

Basketry:
I know it's dark (happens to be night on the test-lot, must fix that!) but here's a picture to show the basketry station in use.

I'm currently trying to figure out how to get conversation to happen while skilling. I've looked at a few objects such as chairs, but they all seem to be using a number of different commands, similar to, but not, the 'conversation enter area' one Echo pointed me at.

I've stopped sim cleaning up the 'coffee mugs' by making the interaction non-autonomous, but there are lots of mug BHAVs in the package that I probably don't need - is it safe to just get rid of them?

Package attached.