Welcome to
Mod The Sims
Online: 2578
News:
Have an account? Sign in:
pass:
If you don't have an account, why not sign up now? It's free!
Other sites: SimsWiki
Reply  Replies: 11 (Who?), Viewed: 2080 times.
Search this Thread
Old 6th Aug 2012, 07:30 PM DefaultObject that has its own Inventory? #1
Phaenoh
Original Poster

Sprinkles and Streaks!



Join Date: Apr 2007
Posts: 4,248
Thanks: 94847 in 164 Posts
50 Achievements

View My Journal


I'm wanting to make a box that holds stuff. Literally. I want to make a moving/packing box, and be able to put sim objects inside it. Is there anything that does that besides the SSNs Juicer? I'd prefer this to be as base-game as possible. If that's the best way to go, should I just clone it and try to code it so it will accept objects instead of harvestables? Any other ideas about how to do this?
Old 7th Aug 2012, 12:20 AM #2
Echo
Duck



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

View My Journal


Ooh, I do like it when you come up with these interesting questions!

The tricky thing is that the inventory system didn't support storing and retrieving arbitrary objects in the base game. It was pretty much tokens only, which I'm guessing isn't what you're after?

To achieve it in a base game environment, I'd probably try something like this:
- Create an object with a bunch of container slots. Like... A *lot* of container slots. Give it a massive support strength, so you could put all kinds of things in it.
- In the "on enter live" function, have the container turn off rendering on its child and turn on rendering of the box. That'll make the objects effectively 'disappear' into the box.
- In the "on enter build/buy" functions, have the container turn on rendering for its children, and turn off rendering of the box. That'll make the contained objects visible, and ready to be 'unpacked'.

Other objects have their own inventory from seasons on, including the fridge (which can store leftovers), but they would absolutely require that EP.
Old 7th Aug 2012, 01:27 AM #3
Phaenoh
Original Poster

Sprinkles and Streaks!



Join Date: Apr 2007
Posts: 4,248
Thanks: 94847 in 164 Posts
50 Achievements

View My Journal


That's kinda a cool approach, I might even be able to pull that off myself with minimal help from you! I kinda like the render switching idea. Doing it with slots would also give a hard limit to the number of things I could put in each box, and I could add a few more as deco slots so you could put more small things in one box. You also wouldn't need a sim to interact with it by first putting things in their own inventory. The more I think about it this way, the more I like it instead. Is this how you would do it? Also, if you have it in your back pocket, what's the code for entering live and buy/build and for turning rendering on and off? XD
Old 7th Aug 2012, 02:58 AM #4
Echo
Duck



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

View My Journal


I never implemented it, way back when I actually still made things, I had an idea similar to this (a storage cupboard rather than boxes), and yes, that was the solution I settled on.

Entering/Exiting live mode function calls are set in the OBJF. Just point those lines to your BHAVs, and they'll be called when you enter or exit live mode respectively.

To turn off rendering... I'm not actually on a PC with TS2 or SimPE so I'm going from memory, but... Stack Object's Render Opacity = 0x00, maybe? Something like that, anyway.

The the direction changer in the Carnival set does almost exactly this - appears in build/buy, then disappears in live mode, so feel free to dismantle that as a starting point. If it doesn't use the render flags (I might have just switched the mesh out for null, which works as well but is a bit harder to undo when you want your object back), then the transparency potion in the Harry Potter project definitely messed with the render flags, by setting opacity on the sim to some low value.
Old 7th Aug 2012, 03:46 AM #5
Phaenoh
Original Poster

Sprinkles and Streaks!



Join Date: Apr 2007
Posts: 4,248
Thanks: 94847 in 164 Posts
50 Achievements

View My Journal


Perfect! I love having objects that work exactly like how I want so I can poke and pull and learn myself. What was your idea for a storage cupboard? Cuz I could totally do that one for you while I'm at the rest of this.

Edit: So, your carnival cart does it by: [prim 0x0002] Expression (My 0x0000 (graphic) := Literal 0x0002),
and the transparency potion does it by: [prim 0x0002] Expression (My 0x0047 (Render Flags) := Literal 0x0003),
and I found an end table that shows and hides on live and buy it and it does it by: [prim 0x006D] Change Material (Target: Stack Object ID 0x0000,
Material from: Me (material: "##0x1C050000!tablecofinv-[natalya-18.10.07]_glass_none" [MaterialName:0x00 (Private)]),
Mesh from: Me (over all model)).

Which do you think is the way I should be doing this? I do plan on recoloring my boxes and I don't want to loose which recolor it is when I'm in Buy Mode.
Last edited by Phaenoh : 7th Aug 2012 at 07:10 AM.
Old 8th Aug 2012, 08:44 AM #6
Phaenoh
Original Poster

Sprinkles and Streaks!



Join Date: Apr 2007
Posts: 4,248
Thanks: 94847 in 164 Posts
50 Achievements

View My Journal


I has a cute mesh now I'm making progress. (The simlish says 'Simoving Company') Next up is slots, then the live/buy object hiding stuff, though I don't want to start that until I've got a solid plan for the object hiding, in case I need to do something drastically different, like clone a sculpture instead of an end table.

This one was a bit too big:




This one has transparency issues:


Last edited by Phaenoh : 8th Aug 2012 at 09:28 AM.
Old 8th Aug 2012, 12:33 PM #7
Echo
Duck



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

View My Journal


Heh heh... Always at least a dozen ways to skin a cat!

The technique I was *actually* thinking of was:
Render Alpha = 0 (0 = invisible, 255 Fully opaque)

Which is quite close to the render flags one, but not *quite*... Sorry about that!

Changing the material is a bad fit. It's hard to revert back to the correct material afterwards, and dynamically swapped materials don't 'stick' between lot loads so everything would revert each time you restarted your game.

Changing the graphic (the cart technique) only works if the object actually has a second mesh attached to it, and that second mesh is a 'null' (empty) mesh. Most objects don't have that setup.

I'm pretty sure your transparency issue is just that you've got a blend mesh with a single overlapping subset. See > http://www.modthesims.info/showthread.php?t=303053

Old 8th Aug 2012, 06:17 PM #8
Phaenoh
Original Poster

Sprinkles and Streaks!



Join Date: Apr 2007
Posts: 4,248
Thanks: 94847 in 164 Posts
50 Achievements

View My Journal


I went with the blend=none, alpha=1, and now my text is a little crunchier, but I think I can fix that with a background for it.

I think the reason I picked this project up (wasn't even on my to-do list) is that tomorrow I'm moving out of my apartment. Usually I'm moving every three months (because of school), but I've only been here 2 since I graduated in June. I'm used to living out of suitcases. :/ I seriously should be packing up my apt, but I don't have any real boxes to use! I'd rather do this than do my own apt right now. >.< Ok, next up is sweep the floor, water the flowers, and then get this box's placement issues sorted out.

Edit: Placement, weight, and top slot issues sorted. I've even added in all my recolors. Need to look into making custom thumbnails for the recolors though...
Screenshots
Click image for larger version

Name:  Untitled-1.jpg
Views: 0
Size:  243.4 KB  
Last edited by Phaenoh : 8th Aug 2012 at 10:16 PM.
Old 11th Aug 2012, 09:18 PM #9
Phaenoh
Original Poster

Sprinkles and Streaks!



Join Date: Apr 2007
Posts: 4,248
Thanks: 94847 in 164 Posts
50 Achievements

View My Journal


How do I tell it to make all the inside slots invisible, but leaving the box stacking slot visible?

Edit: I've got most of the slots working, but the last 2 don't quite work right. I've changed their positions using the CRES, but its not working right. I added the new slots off a different node than the one that the box stacking uses, thinking that might help when it comes to making things disappear, but I really have no idea what I'm doing again.
Download - please read all instructions before downloading any files!
File Type: rar Phaenoh_MovingBox-Standard.rar (95.4 KB, 3 downloads) - View custom content
Last edited by Phaenoh : 12th Aug 2012 at 06:32 AM.
Old 13th Aug 2012, 10:14 AM #10
Echo
Duck



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

View My Journal


You need to loop through each of the container slots in turn, setting "Render Alpha = 0" on each one. If you use a loop which adds one to a temp variable, then you can use "Stack Object's Slot [temp]", something like so:

1: Temp 0 := 0
2: Local 0 := Stack Object ID 0
3: Stack Object ID 0 := Stack Object's Slot [temp] 0
4: Stack Object's Render Alpha := 0
5: Stack Object ID 0 := Local 0
6: Temp 0 > (however many slots you have) [true => 3]

That's just off the top of my head though, so it probably won't be quite perfect first time.
Old 5th Sep 2012, 06:32 AM #11
xiaoyun
Test Subject

Join Date: Oct 2011
Posts: 54
Thanks: 269 in 2 Posts
5 Achievements


Why not just make this box to have array.
When sim put item to box - (chose ttab interaction at box 'store item')
this BHAV will :
make sim come to box, make animation like he put it to box ect,
read guid from item which sim have in hand (slot 0)
then destroy this item (delete) and push this guid to box array
So now item is in box (we have its guid in box array)
We can store many items in this array.
(For more realism lets say array can store 10 values 'items'
if theres more then box is full and show dialog that its full)

When you want to pull object from box :
Call interaction on box (ttab) which make sim come, make animation like
he is pulling item from box then show dialog box to chose item he want
We can try to use magazine rack dialog 0x0D and give him our array with guids
Then 'sim' chose one guid from this dialog -
Then we create item from this guid and put to sim hand slot 0
and delete it from array.
No invisible items, no items in outworld, no laging - fiew numbers in array is not much.. And array is saved with object i think.

Btw, this idea about cardboard storing items is really cool idea

Although im not english native, it does not exempt me from caring about my grammar, which is usually main reason for editing my posts after submitting.
Last edited by xiaoyun : 5th Sep 2012 at 07:09 AM.
Old 7th Sep 2012, 05:19 PM #12
Phaenoh
Original Poster

Sprinkles and Streaks!



Join Date: Apr 2007
Posts: 4,248
Thanks: 94847 in 164 Posts
50 Achievements

View My Journal


Because then I can't store things with their original value, if I put a really old and devalued object into the box, when I pull it out it will be a brand new version, my box turns into a magically rejunvenating object. Also for things that are more personal, like a painting or a photobooth photo, I don't think I'll retain the image by respawning it.

The slots plan works fine because these boxes shouldn't hold that much anyways. I prefer to work within the bounds of physics, so its not possible to fit too many things in the specific confined space. Thank you for your suggestions though. I hadn't really thought about making the sim come and animate it, but that might be cooler.
Reply


Section jump:


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