PDA

View Full Version : Adding an "Effect" to an object


atavera
3rd Apr 2006, 12:29 PM
http://static.modthesims2.com/customavatars/avatar793875_3.gif
EDIT (by Numenor): Atavera has retired from modding; all his creations and tutorials are therefore NO LONGER SUPPORTED by the author. We'll do our best to answer to the questions, if possible; but the entire production of objects/hacks/tutorials by Atavera is nevertheless to be considered DISCONTINUED.

--------------------------------------------------------------------------

Adding an "Effect" to a custom object

I suggest reading the following tutorials before trying this:
Modding Infocenter - An Introduction to Slots (http://www.modthesims2.com/showthread.php?t=146440)
Modding InfoCenter - The Resource Node(CRES) (http://www.modthesims2.com/showthread.php?t=84487)
and be familiar with adding and changing behaviour functions.

Overview:
Effects are started and stopped via BHAV. The effects are called by name defined in text lists, and are started in slots. Lots of effects will stop on their own once the animation is finished, but others are looped and must be manually stopped by the BHAVs again. There seems to be no limit on how many effects can be on one slot at a time, and they can be created in any type of slot(usually target slots though). In this tutorial, I add the zZz sleeping effects to a re-meshed garden gnome that I made. I have the gnome(before I added the FX) for you to use so you don't have to clone your own and make a mesh.

Finding Effects:
Well there seems to be some kind of list in Effects.package, but the filetype isn't yet recognised by any package editors. What I do, is open an object from the game in Objects.package, and read it's text list 0x8F to get names of effects. For my object I will use the "sleeping" effect.

The Resource Node:
First thing to do is to go to my object's Resource Node, and add a node for the slot. Add a transform node, and attach as a child node of 0x9(the Shape reference node). Now name the node "slot_fx_0". Now we need to edit the position of the node. Load the mesh in your 3d editor, and set the units so that 1 unit is equal to 1 sims tile(the shadow mesh is 1 tile). Now create a small cube, and position it right above the gnomes head and record the position from the origin. The coordinates that I use for this object are (0.016,0.118,0.177), enter these into the Translation part of your new block.
http://thumbs.modthesims2.com/getimage.php?file=464733

The Text Lists:
This object does not come with an effect text list, so clone another text list and change the instance to 0x8F. Delete any un-needed strings, and add to the first string, your effect name. The effect that I'm using is called "sleeping".
http://thumbs.modthesims2.com/getimage.php?file=464734
Now go to list 0x90 and add your the name of the effect slot node that you added to the resource node. Note that it is index 0x3 that we will need in the next part.
http://thumbs.modthesims2.com/getimage.php?file=464735

The Slot:
Now open the Slot file and add an entry. Set the type to Target, and set S2 to 2(to tell the game to get the position from the CRES). Because the index in text list 0x90 was 0x3, put 3 into I9. I10 seems to just be the entry number in the slot but doesn't seem to effect anything, anyway set it to 4 since it is the fourth slot entry.
http://thumbs.modthesims2.com/getimage.php?file=464736

The Behaviours:
Now the object needs instructions to use the effect. Depending upon the object, you may want to put this in different places, but in this object I want the effect to start when I buy the gnome and stay forever. First thoughts may be to add this to the init, but that will not work for effects. The effects can only be started in Live Mode, so we need to put it in the Main function right before the main idle loop.

From looking at how the fountain handles its effects, there is a 3 tick Idle before starting the effect, I believe this is necessary for similar reasons that it won't start in Buy Mode. So add a 3 tick Idle, followed by the primitive Start/Stop Effect(0x70). For the 0x70, the first operand leave 00 because we are starting an effect(you would put 01 to stop this effect). The next 3 are the data owner that of the object we start it on, since this is the main, it will be the My ObjectID(03 0B 00). The fourth operand is the index of string 0x8F to use, which will remain 00 because the "sleeping" effect is in 0x0 index. The seventh operand is the slot number which we will change to 01. There was already an existing Target slot in the slot file(0x0), so the one we added was 0x1. The tenth operand will remain zero because it is a target slot. The eleventh operand will also remain zero because it uses the private string 0x8F rather than Global or SemiGlobal. Now link the effect line to go to the main loop, and you are done.
http://thumbs.modthesims2.com/getimage.php?file=464737

End Result:
http://thumbs.modthesims2.com/getimage.php?file=268478

Feel free to ask questions if you have any, and I'll try to help.

Fat D
3rd Apr 2006, 12:59 PM
Just as I suspected. Thanks!

niol
7th Apr 2006, 11:54 AM
For probably more infos on FX effects, may check out the material.package at the material folder right at the "res" folder, not the one in the catalogue folder. I don't really know much, so it's just a suggestion...

Thanks for showing how to add the FX efects... Now, I've realised it takes really more things to set to have them work...

Karybdis
12th Apr 2006, 09:17 PM
yea... I'm afraid we havent come up with a way to read the .fx files in effects.package...

I was designing an editor for them, but I got stalled and had to stop because of real life stuff.

They're listed on the wiki though for whoever wants to try and decode more of them.

atavera
15th Apr 2006, 07:53 AM
Thanks Kary, I'll check the Wiki for that :)

Edootjuh
19th Apr 2006, 02:54 PM
could you make it PDF, it kinda hard to read in my resolution

atavera
19th Apr 2006, 07:04 PM
:skull: Probably the problem was my resolution :lol: I was on 1280x800 when I made this. Sorry, but I don't have any utility to create PDF files though.

Cylais
12th Jul 2006, 07:41 PM
I would love to see a tutorial on how you make the neon lettering. I want to do a sign for a strip club called "The Foxy Flamingo." I want to do the sign before posting it on MTS2.

Max3D
22nd Jul 2006, 11:24 AM
if u need to apply the effect to the object without control the starting point of the effect you can use Object in Stack Objects's ... on this way independently by the cres the effect will be applied to the object in the stack.
I'm not shure if it's important but on the Sloth i've assigned #i9 = 0
Effect Stop/Start (Hard start effect on object in Target slot 0x00 of object in Stack Object's 0x000B (object id),
"coolglassesafterglow"
01040B00030000C40B0000000A000000


this note is for me too ^^

databanks
18th Oct 2006, 01:59 AM
:skull: Probably the problem was my resolution :lol: I was on 1280x800 when I made this. Sorry, but I don't have any utility to create PDF files though.

Umm, what if someone had copied the article to an RTF file for their own use? Could you use that (nothing edited, just copied & pasted) with pages set to landscape to minimise image degradation from shrinking

If it's okay, I'm sure I could email it to you for proof reading. Or something? Still learning this site but loving what I find.

atavera
13th Nov 2006, 08:15 AM
databanks: Sorry for the late response, I haven't checked this thread in some time now. I have no problem with anyone re-organising this information, re-posting it, re-wording it, or anything really.

Numenor
10th Feb 2007, 09:47 PM
10 Feb 2007 - The tutorial has been restored (after having been deleted by Atavera). Please remember that Atavera has retired from modding; all his creations and tutorials are therefore NO LONGER SUPPORTED by the author. We'll do our best to answer to the questions, if possible; but the entire production of objects/hacks/tutorials by Atavera is nevertheless to be considered DISCONTINUED.

buggybooz
12th Feb 2007, 08:40 AM
I would like to use only part of the waterSpoutupFX, ie take away the big spouts but keep the water falling.

Karybdis wrote in April 2006:

"I'm afraid we havent come up with a way to read the .fx files in effects.package"

Am I to understand by this that there is no way to edit the actual effect?

Echo
12th Feb 2007, 08:57 AM
buggybooz - Yes, that is correct.

kaydabear101
7th Apr 2007, 09:12 PM
I don't understand any of that... lol

xanathon
18th Apr 2007, 01:46 PM
I'm having a little problem with the behaviours:

If I try to link to the FX via 0x0070 the effect is not taken from the text list 0x008f (Effects) but from 0x0100 (attrribute labels).

Why?

Any help appreciated, see attached image.

http://thumbs2.modthesims2.com/images17/MTS2_508945_xanathon_fx_bhav.jpg

Numenor
18th Apr 2007, 03:33 PM
Xan, I think that it's only a "visual" problem, i.e. the BHAV wrapper displays the name from the wrong text list, but then the game acts correctly.
Are you experiencing problems in game, with this effect?

xanathon
18th Apr 2007, 06:13 PM
I have not yet tried it ingame, since this my first try at SFX and I wanted to make sure I made no error. :)

Thanks, I will experiment and then come back with my findings.

xanathon
18th Apr 2007, 06:54 PM
The game crashes, but that could be due to other errors I've made. Does the Main BHAV really loop to itself?

tish85
19th Apr 2007, 10:31 AM
this is so cool!love it!thanx

Echo
19th Apr 2007, 12:16 PM
xanathon - At what point does the game crash though? When it's booting, or when you're using the object? It's pretty much impossible for a bad BHAV to fully crash the game as long as you play with testing cheats. If you're actually crashing the game, it's more likely a problem in the way you've set up the CRES. :)

(And yes, the main function must loop. As long as it has a decent idle or a sleep somewhere in there then it's working fine.)

xanathon
19th Apr 2007, 05:42 PM
It crashes at the moment I click on the one lamp category, where my new object resides. I hear some regular ticks for a second or two and then the game crashes.

It is abolutely possible that I made errors in the process before writing the new BHAVs, since I'm trying this for the first time. I guess I will start over from scratch.

Hm. Just had the idea to have a look at the games log, mybe in there is something helpful.

For now: Thanks folks!

I'll report back if I manage to make an ever greater mess... ;o)

Numenor
19th Apr 2007, 09:54 PM
Then it might be something in the scenegraph chain; most probable causes are an improperly added block to the CRES (I had a lot of problems with CRES having "IK" blocks at the end; but IK blocks exist only in animated objects); or something in the GMND: the "DataList Extension Reference" might have an exceeding line, compared to the actual number of DataList Extension blocks in the GMND.

Echo
20th Apr 2007, 11:18 AM
You can always post the object here, see if anyone here can spot what's not right. :)

xanathon
20th Apr 2007, 12:33 PM
I gladly do this, thanks for the offer, Echo. :)

Be warned: This is a highly experimental object, expect everything... ;)

Edit: Object removed

Echo
20th Apr 2007, 01:18 PM
Well I can't say if it will fix the problem because I'm not on the right computer to test anything at the moment, but you've got a lot of zeroes in your new SLOT line which I don't think ought to be zeroes.

If you look at Atavera's original screen shot, you can see that there are values filled in which aren't specifically identified. Copy all the values he's listed for those into your item (particularly i5 through f6, f7 and f8).

Your i10 value can be set to 1, since it's a sequence number. I don't think setting it to 4 will cause any breakages, it just looks a little odd. ;)

xanathon
20th Apr 2007, 04:26 PM
Okay, I did that, still the same behaviour: a few ticks and then a game crash without any errors in the console window.

xanathon
21st Apr 2007, 09:29 AM
Stop searching. I was using the latest QA-version of SimPE by mistake instead of 0.60b and it seems that this error is caused by it. I cloned a simple chair and had the same ticking-and-crashing-behaviour when clicking on its category.

Sorry for bothering you, I'll try again with 0.60b and report what happens.

xanathon
21st Apr 2007, 04:25 PM
Here's a new experiment I did with 0.60B.

This time the game crashes when entering the neighborhood.

The BHAV looks good now, the correct effect is shown in the BHAV editor. I changed the Slot according to Echos hints and the CRES also looks good to me.

ParsimoniousKate
2nd May 2007, 02:22 AM
Can someone please help me - I've read the associated modding info but understood precisely nothing. I'm stuck on the first part which is adding a transform node, how and where? I've spent an age gazing at the different panes in the Resource Node of my object and can't see anywhere to input anything that creates another entry in the hierarchy - let alone one that looks meaningful? Am I supposed to use the Edit Blocks to add a new ... er thing and then go from there? I'm hoping (beyond all reasonable hope and evidence) to make a plumbob sculpture that uses the plumbob lighting effect but I fear I am probably considerably out of my depth here :(

Numenor
10th May 2007, 04:59 PM
The button to add blocks is in the "Edit Blocks" tab, not in the hyerarchy. Open the drop-down list and choose the "cObjectGraphNode" type, the one with the very long name

xanathon
11th Jun 2007, 08:01 AM
Some time ago, but: Did someone had a look at my object?

Numenor
11th Jun 2007, 10:11 AM
Sorry Xan, I've downloaded your object, but I couldn't spot anything wrong, that's why I didn't reply... My knowledge about slots and effects is not as wide as I would like :P

Echo
11th Jun 2007, 12:48 PM
I downloaded it too, changed dozens of things and it still crashed my game... I was planning on trying to remake it from scratch and import your mesh over the top, but then I completely ran out of time... Otherwise I would certainly have responded before now. :(

xanathon
12th Jun 2007, 12:15 PM
Okay, fellows, absolutely no need to apologize! Your tries are appreciated.

I'll also try to recreate an object with added effects from scratch.

macarossi
2nd Jul 2007, 06:49 PM
Hi Xanathon,
I downloaded your object and fixed the CRES and the Main Bhav, so now it should work fine. The child node in the cTransform node of the Practical cShapeRedNode was not quite OK:
- I changed 0x0000 0x00000005 to 0x0001 0x00000005
- the [semi 0x2006] main () line in the Main BHAV was not linked
http://i101.photobucket.com/albums/m76/macarossi/lightstele_xanathon.jpg
Here's the rar file with the original package and the modified one. Look for the modified file in Decorative>Sculptures.
Have fun!

ParsimoniousKate
8th Dec 2007, 01:35 AM
Ok dumb question time! If I've got an object which already supports an effect but the effect is in the wrong place relative to the mesh because there isn't an actual effects slot in the package to start with - must I address that by
adding a new effects slot, set the transform coordinates to be where the center of the mesh etc? The object in question does do its effect thing fine, but Sims interact with it in a way that requires the mesh to be off-centered within the tile, the effect is being generated natively from the center and it doesn't look quite as peachy as I want it to! I don't really understand slots in general I must admit, the tutorials on them are either very specifically geared towards doing something that isn't applicable to what I'm trying to do (lacking the understanding to apply it) or assume prior knowledge when it comes to which numbers go where!

Numenor
8th Dec 2007, 02:21 AM
Well, most of us, where it comes to slots, don't know exactly what numbers go where :P :lol:
I didn't think possible that an effect could be created without a slot to "contain" it. Either you are right, and the game provides a sort of "default" position in the center of the mesh, or the effects is created in a slot whose name doesn't contain the keyword "fx", but nevertheless is a "container" slot, usable for the effect.
Doesn't your object haveany slot at all? Have you discovered if the effect is triggered via BHAV (Effect Start/Stop) or via an animation?

By now, I can suggest to look at the SLOT file, in search of "Container" slots (ignore the routing ones). For each line related to a container slot, look in the second last column ("I9"): if the I9 is >=0, then the slot should have a name, that you can read in the Text List 0x90 (in the line number I9). Once discovered the name, go to the CRES and search for a node with that name. By trial and errors you migh locate the "missing" slot.

But of course you may be right, and there might be no "missing" slot to discover...

PS: this object that has an effect "without a slot", is a Maxis object?

Echo
8th Dec 2007, 03:21 AM
There is a "default" way to run effects on some objects. In the BHAV "Start/Stop effect" it would say "default 3/4 height", and the effect just gets played sort of in the middle of the lead tile (I think, never tried with multi-tile objects). If this is the case and you want to move the effect, then you'd need to add an effect slot, put it in the right position, then change that BHAV to use the slot you created instead. :)

niol
8th Dec 2007, 05:13 PM
The plugin view presentation of F7 "0,1875" seems to have "." replaced by "," in the screenshot.
So, the value should actually be "0.1875" or 3/16 .
Note a standard full level is "16-click-high" or "16-step-high", and namely a value of "3"

This can be a numeric value for the "1-click-high" in terms of the elevation-tool or "1-step-high" in terms of modular stairs (vertical span length) for a given grid

So, what I suspect it may mean how different the effect is from the grid vertically in terms of the 3D graphics.

Numenor
8th Dec 2007, 09:41 PM
The screenshot has no "errors": the use of the comma or the point as decimal separator depends on the language that.NET was installed with, and the language of the operating system of course.

From my limited experience, the F7 value is almost always 0,1875; this is mostly true for the container slots, while few particular routing slots have different values.
In my notes, I read that an "unknown routing slot" connected to the sim's right hand bone has a F7 value of 0,01171875 (= 3/256).
For some other routing slots, such as one from the Pancake TV, F7 is 0,25 or 0,35.
I don't know the meaning of these values...

niol
9th Dec 2007, 05:00 AM
Then, maybe , it can be just a relative vertical difference to something?

So, what will happen when a custom value is used? any crash or visible difference?
Omg, "3" doesn't seem to work.

BTW, is the FX effect in the tutorial object already activated? I for some reasons, I see no FX effect or I just don't know how to get it show the FX effect in live mode?

Numenor
9th Dec 2007, 07:17 PM
The package contained in the RAR attached to the tutorial is yet to be modified: the "Function - Main" BHAV still lacks the two lines described in the last step of the tutorial (one of the two lines is the "Start/Stop Effect" operator, which is responsible of starting the effect).

As for the "3" not accepted as an F7 value, I think that all the known values reveal that the range must be somewhat between 0 and 1. Perhaps, using two copies (with different GUIDs) of the tutorial gnome, one with F7=0 and the other with F7=1 will reveal a visible difference...

ParsimoniousKate
13th Dec 2007, 05:58 PM
Well, most of us, where it comes to slots, don't know exactly what numbers go where :P :lol:
I didn't think possible that an effect could be created without a slot to "contain" it. Either you are right, and the game provides a sort of "default" position in the center of the mesh, or the effects is created in a slot whose name doesn't contain the keyword "fx", but nevertheless is a "container" slot, usable for the effect.
Doesn't your object haveany slot at all? Have you discovered if the effect is triggered via BHAV (Effect Start/Stop) or via an animation?

By now, I can suggest to look at the SLOT file, in search of "Container" slots (ignore the routing ones). For each line related to a container slot, look in the second last column ("I9"): if the I9 is >=0, then the slot should have a name, that you can read in the Text List 0x90 (in the line number I9). Once discovered the name, go to the CRES and search for a node with that name. By trial and errors you migh locate the "missing" slot.

But of course you may be right, and there might be no "missing" slot to discover...

PS: this object that has an effect "without a slot", is a Maxis object?

I think to suggest I may be right about anything, ever is probably contrary to all evidence :lol:

It is a clone of a Maxis object, it does have 1 target slot so I presume that must be it - I had predictably misunderstood this tutorial and the slots tutorial and assumed it *had* to be a container slot. That all said, it still leaves me with the problem that having changed the X & Y values in each cTransform node in turn to see what happened, the only thing that seems to move is the mesh which means the Sims end up holding it wrongly. The effect is set to permanently appear in live mode so its not triggered by anything as such.

I must admit I don't understand what the slots *do* in this particular instance esp when the start/stop effect is set to 'default 3/4 height' rather than targeting slot or container slot? I did try setting that to use the targeting slot as there was one there, but that just crashed my game so I guess it wasn't happy.

Numenor
13th Dec 2007, 07:04 PM
Exactly, what Maxis object are you cloning? And what effect you are trying to apply to it?
Perhaps, talking of a specific subject will help solving the problem.

ParsimoniousKate
13th Dec 2007, 08:40 PM
It was the base game bag of cookies - it has a stink and flies effect natively. I think the basic problem is that because I've not understood the tutorial and been able to interpret it for a different object. I've followed it literally and run into problems as a result.

My first attempt with the cookies, I didn't spot the fact that the bones list is pointing to the 3rd node in the Cres, the Slot editor shows the target slot to be the 1st node in the cres and when the bones list doesn't match up, or its missing, the effect does work, but its position defaults to absolute zero relative to the object. With my second attempt based on the ceiling base game hosta plant, this shows up clearly because the object can only be placed at ceiling height so without the bones list the effect works, but its displayed on the floor regardless of the transform values in the target slot. It didn't show up with the cookies because the mesh is nearly at absolute zero and the effect seems to vary in height because the object can be placed at multiple heights! :giggler:

The 3/4 height thing threw me because it didn't seem to relate to the slots in any way - default implies that height is fixed and it didn't make any sense. I didn't realize because its not stated that SimPE's labels there are wrong. 3/4 height refers to the targeting slot specified in op. 7, target slot refers to the specified container slot, container slot refers to the specified routing slot etc. I'm guessing that my game complained when I tried to refer it to a targeting slot because there was no container slot which is what it was actually looking for. :rolleyes:

Anyway, I think I've answered my own question about the cookies, yes they do need an additional slot specified in order to correct the position of the effects although its academic since I've decided they really don't need an effect but I do feel somewhat happier that I've realized some of these basics and can therefore apply them to other things even if I do feel rather stupid for missing these blindingly obvious issues!

I also accidentally returned true and closed off the function -main which I think tells you everything! :rofl:

Grannygoose
23rd Oct 2008, 04:35 AM
Look'in forward to letting you help me figure my way through this mesh, thnx EUJIK

Manga_Moon
27th Oct 2008, 06:33 PM
I'm completely stuck here. I've followed this tutorial several times on different objects but it just doesn't seem to work.
Some objects I want to add effects to don't have an 'Idle' at all in behaviours so I add the top one and the one underneath and then the other Idle below that. It all links up because I checked but it doesn't seem to want to work.

The file's attached if anybody wants to look.. :)

Edit: Did ge the effects working after a fair bit of tinkering and here's the product. Poisened Apple of Doom for halloween which emits black fog (need to fix slot XYZ placement) but you get the main idea.

http://www.modyourpanties.com/images/081029092718-PAODoom.jpg

Echo
2nd Nov 2008, 01:43 AM
Well done on figuring it out! :)

liwen0209
11th Feb 2009, 09:17 AM
It's very useful. Thanks a lot.

eletrodj
27th Apr 2009, 12:16 AM
I was working all the day and i have one tips

I've notice that some objects is *more propitious* to have effects. This doesn't mean that the other objects are "uneffect". I explain:

Some of them (taking the gnome, for exemple, works even if i don't attach the "slot node" in the Shape reference node, in the CRES. I mean, they don't appear in the Hierarchie, but in the Content tab it was there! Why? I don't know. /)

Some objects have to change the atttach of 0x0000 0x0000000* to 0x0001 0x0000000*. If don't, the game crashes.

Some don't accept the Text List 8F in the BHAV (they don't recognize), but if it's linked correctly, it will work.

And, if you put the efffect in the Target slot isn't necessary to have a Container slot. The effect will work even there's no container slot in the SLOT file.

joninmobile
23rd Sep 2009, 07:50 AM
I'm having some problems with this if anyone can help me out.

First thing, I don't understand the part where it says:

"and attach as a child node of 0x9(the Shape reference node)" how do you attach as a child node, and should I be adding a child node, or editing the one that's already there? or somehow attaching it as the article suggests. also should I add the child node in the shape reference node, or the transform node?

Another thing:

Where it says:

"Now go to list 0x90 and add your the name of the effect slot node that you added to the resource node."

I don't have a list 0x90 (Bone Names) in my package in my text lists anywhere. I'm making a decorative sculpture cloned from the Seasons "An Odd Fortelling" sculpture.

wndy26
18th Dec 2009, 09:45 AM
I am working on a set of Christmas decorations to share here. I have a fairly good start - as you can see with the example photo. What I would ideally like to do is to add a lighting effect - similar to the christmas lights that came with the holiday pack - so that my candy cane lights up when the sun goes down. Right now when its dark its not nearly as lit up as I would prefer - its actually pretty dark. I tried to add the lighting effect from the holiday white lights garland string but I am not sure how to view the effects.
A. Do I have to be in live mode to view the lighting effect?
B. It shows that the lighting effect should be 3/4 (default) but its not showing up at all like the light string - so I am wondering if someone can take a look and help me figure out where to go from here.