|Search this Thread|
|14th Jun 2007, 03:11 AM||Change object via pie menu, where do I start? #1|
Join Date: Jul 2005
I'm looking at trying to create a fairly simple effect--click an object, select a menu option, and it changes to another object. I have a pretty good beginner's grasp of SimPE, cloning and changing the properties of various items, GUID's and so on, but I'm not sure how to go about setting up the pie menu and switching the objects out. Could someone point me at a tutorial(s) that would help? Thanks!
|14th Jun 2007, 06:07 AM||#2|
Depending on what you mean by 'change to another object', the way to do it may be different; anyway, you need to modify BHAVs.
'Another object' means really another object, with different GUID and functionality? Then create new object with [prim 0x002A] Create New Object Instance, delete old one with [prim 0x0012] Remove Object Instance; both object menus can be tweaked.
'Another object' is a sub-mesh or another state of current object (you can see it in food code)? Then either show/hide sub-meshes via [prim 0x006D] Change Material, or simply assign another graphic state via [prim 0x0002] Expression (Stack Object's 0x0000 (graphic) := Literal <number from #STR 0x85>).
Of tutorials, start from reading Echo's. For more details about particular primitives, check AdidasSG2's tutorials in Modding thread. I'm afraid there's no tutorial which explains exactly what you want to do (common situation with BHAVs), so you have to compile the available information to produce your code - Simantics and BHAVs
|16th Jun 2007, 09:45 PM||#3|
Join Date: Jul 2005
Wow! Thanks, now I have to go see if I can figure out what you just said. LOL! XD ('Another object' is an entirely different one with a different GUID, yes. The tips are appreciated. :) )
|17th Jun 2007, 07:15 AM||#4|
If you did nothing with BHAVs, you absolutely must follow all Echo's tutorial. The task you've chosen isn't for beginners so you have to get more understanding of BHAVs before starting.
Actually, I had never tried the first way (create and delete), so I can only guess how to do it :-<
An example of CreateNewInstance call:
[prim 0x002A] Create New Object Instance (GUID 0x4C7EF534,
place: out of world (put new object id in Stack Object),
Create object normally,
fail if tile is non-empty: False,
pass Temp 0 to main: False,
move in a new Sim: False,
copying design mode materials from object in Temp 5: False)
opcodes for this: 34F57E4C060000000000000000000000
As always, guids are entered by byte in reversed order (34F57E4C for guid 0x4C7EF534), make sure you replaced it with yours.
If you change opcode 0x10 (numeration start from 0) to 02, the last line will change to
copying design mode materials from object in Temp 5: True
(Naturally, you should put some object ID to Temp5 before that.)
It is useful if your new and old object share the same recolors, and you want to make new object have exactly the same recolor as currently used on old object. I used it in my tea set - you can check it to see what I mean
The most hardest in your task, in my opinion, would be to place your new object exactly where the old one was. It's hard because objects likely don't allow intersection. So you have to create object out of world, then probaly delete old object, then in new object's code check when old object is gone and then take its place. Maybe someone will suggest a better logic