Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Script & Texture for Fire

Priscilla Sautereau
Registered User
Join date: 3 Apr 2007
Posts: 9
06-19-2007 08:36
I want to build a fire bowl. The bowl is no problem, but I do not know where to buy the textures and scripts needed for the fire. I went to a scripting store and paid L$99 for what I thought was what I needed, but it was a particle script for fire; what I want is something that looks more like fire, not a particle fire script. :)

From looking in the contents tabs of other creators' fire bowls and fireplaces, it looks to be a combination of a couple of textures and a couple of scripts.

Would appreciate being pointed in the right direction. Am willing to pay for these items w/full perms (or at least copy & transfer) so I can legitimately sell my fire bowls.

Thanks!
_____________________
PS Yard Sale & Flea Market
SLURL: http://slurl.com/secondlife/Vitersonus/55/198/40
Learjeff Innis
musician & coder
Join date: 27 Nov 2006
Posts: 817
06-19-2007 09:15
Post again in the textures forum, and also try "products wanted" for fire textures. If you find any good freebies please let us know.

When I get a chance I'll post a script here to turn the fire on and off in multiple prims, and one to animate the texture (though, you'll need to adjust the parameters to suit the particular texture).
Shadow Subagja
Registered User
Join date: 29 Apr 2007
Posts: 354
06-19-2007 10:33
http://www.kan-ed.org/second-life/using-LSL.html#texture
Priscilla Sautereau
Registered User
Join date: 3 Apr 2007
Posts: 9
Fire Script
06-19-2007 10:56


Thank you so much!!
_____________________
PS Yard Sale & Flea Market
SLURL: http://slurl.com/secondlife/Vitersonus/55/198/40
Shadow Subagja
Registered User
Join date: 29 Apr 2007
Posts: 354
06-19-2007 11:04
Don't thank me thank the guy hosting that great tutorial!
Learjeff Innis
musician & coder
Join date: 27 Nov 2006
Posts: 817
06-19-2007 12:55
Here's a script to turn the flames on and off when you touch the fire. (ouch?)

To use it, name all the prims that are textured with the flame texture with the same name, and do NOT use that prim name for the rest of the prims.

Put the script in one of the flame prims. In that same prim, adjust the "features -> light" (in edit popup) to give the glow you want all the flame prims to have when the fire is on.

When the script is initialized, it assumes the fire is on. After that, when you touch it, if it's on it will do two things to each prim named "flames" (using the naming convention embedded below -- you can change that):

1) Changes the texture to 100% transparent, making the flames invisible.
2) Turns the "light" feature off, killing the glow.

Click again to turn on, which does this to each prim named "flames":

1) Changes the texture to 0% transparent. Note that the transparency mask (alpha channel) in the texture will still be honored.

2) Turns the "light" feature on, and sets the color to match whatever the containing prim was when the script reset.

It would be nice if it could leave the color alone in each prim, but there is no "llGetLinkPrimitiveParameters()", and you can't throw the "light" switch without setting the color using "llSetLinkPrimitiveParams()".

This script assumes there are at least 2 prims. It's inappropriate for use in a single-prim object.

CODE


// Set this variable to the name of the prims that are textured with the flame texture.

string FLAME_PRIM_NAME = "flames";

float Alpha = 1.0;
integer Glow = 1;
list light;

default
{
state_entry()
{
light = llGetPrimitiveParams([PRIM_POINT_LIGHT]);
}

touch_start(integer total_number)
{
if (Glow == 0) {
Alpha = 1.0;
Glow = 1;
llWhisper(0, "Fire on");
} else {
Alpha = 0.0;
Glow = 0;
llWhisper(0, "Fire off");
}

light = llListReplaceList(light, [Glow], 0, 0);

integer link;
for (link = 1; link <= llGetNumberOfPrims(); link++) {
if (llGetLinkName(link) == FLAME_PRIM_NAME) {
llSetLinkAlpha(link, Alpha, ALL_SIDES);
llSetLinkPrimitiveParams(link, [PRIM_POINT_LIGHT] + light);
}
}
}
}


There's also a trick if you want the script in a non-flame prim for some reason. Set that prim's light to what you want the flames to have, start the script, and then change the light for the prim contaning the script back to what it should be. This works fine until you have to reset the script for some reason.
Learjeff Innis
musician & coder
Join date: 27 Nov 2006
Posts: 817
06-19-2007 13:01
BTW, the script in the tutorial SHOULD be:

CODE

default
{
state_entry()
{
llSetStatus(STATUS_PHANTOM,TRUE);
// llSetTexture("lit_texture", ALL_SIDES);
llSetTextureAnim (ANIM_ON | LOOP, ALL_SIDES, 4, 4, 0, 0, 15.0);
llRemoveInventory(llGetScriptName());
}
}


Once the animation is going, there is no need for the script to remain in the object and contribute (a tiny bit) to sim lag. So, this script deletes itself after doing its work.

Also, I commented out the "llSetTexture" call. It's better to apply the texture yourself, and make the ends of a thin wavy flame prim totally clear.

Dont' bother putting the texture in the object's inventory, as the tutorial seems to imply. Just apply the texture to the faces you want.
Priscilla Sautereau
Registered User
Join date: 3 Apr 2007
Posts: 9
Fire Script
06-19-2007 13:23
Awesome! Thanks so much, Learjeff! I need to come here more often--lots of knowledge here. :)

PS. lol@ouch
_____________________
PS Yard Sale & Flea Market
SLURL: http://slurl.com/secondlife/Vitersonus/55/198/40