Jump to content

Recommended Posts

Hello! Is it possible to make such a script so that if you put it, for example, in an element of clothing (or even full mesh avatar), so that when shooting and hitting bullets on clothes, blood particles will fly out of it? as a spray. Advise me please, thanks a lot!

Edited by MIVIMEX

Share this post


Link to post
Share on other sites

Use particles.  There's no L.I. overhead, it's much easier than dealing with objects, and it looks "realistic."  :)

  • Thanks 1

Share this post


Link to post
Share on other sites
6 minutes ago, Rolig Loon said:

Use particles.  There's no L.I. overhead, it's much easier than dealing with objects, and it looks "realistic."  :)

I understand that I need to use the script of particles, the same as for rezzed objects, right? will it work? if the object is attached on avatar (as mesh clothes)?

Share this post


Link to post
Share on other sites

I managed to create such a system of particles.

default
{
state_entry()
{
llParticleSystem([PSYS_PART_MAX_AGE,1.00,
PSYS_PART_FLAGS, 303,
PSYS_PART_START_COLOR, <1.00000, 1.00000, 1.00000>,
PSYS_PART_END_COLOR, <1.00000, 1.00000, 1.00000>,
PSYS_PART_START_SCALE,<0.15531, 0.15531, 0.00000>,
PSYS_PART_END_SCALE,<1.00744, 1.00675, 0.00000>,
PSYS_SRC_PATTERN, 1,
PSYS_SRC_BURST_RATE,0.30,
PSYS_SRC_BURST_PART_COUNT,10,
PSYS_SRC_BURST_RADIUS,0.00,
PSYS_SRC_BURST_SPEED_MIN,30.00,
PSYS_SRC_BURST_SPEED_MAX,30.00,
PSYS_SRC_ANGLE_BEGIN, 0.00,
PSYS_SRC_ANGLE_END, 3.14,
PSYS_SRC_MAX_AGE, 0.0,
PSYS_SRC_TEXTURE, "18284696-0566-2376-fa5f-21fae84547da",
PSYS_PART_START_ALPHA, 1.00,
PSYS_PART_END_ALPHA, 0.25]);
}
}

And I'm thinking of using this script, but there's so much extra! I need only to squirt the blood endlessly. Please tell me what can I remove? In fact, I only need a sensor and a particle system. THANKS!!!

float health = 100;
// Particle Script 0.3
// Created by Ama Omega
// 10-10-2003

// Mask Flags - set to TRUE to enable
integer glow = FALSE;            // Make the particles glow
integer bounce = FALSE;          // Make particles bounce on Z plan of object
integer interpColor = TRUE;     // Go from start to end color
integer interpSize = TRUE;      // Go from start to end size
integer wind = TRUE;           // Particles effected by wind
integer followSource = FALSE;    // Particles follow the source
integer followVel = TRUE;       // Particles turn to velocity direction

// Choose a pattern from the following:
// PSYS_SRC_PATTERN_EXPLODE
// PSYS_SRC_PATTERN_DROP
// PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY
// PSYS_SRC_PATTERN_ANGLE_CONE
// PSYS_SRC_PATTERN_ANGLE
integer pattern = PSYS_SRC_PATTERN_EXPLODE;

// Select a target for particles to go towards
// "" for no target, "owner" will follow object owner 
//    and "self" will target this object
//    or put the key of an object for particles to go to
key target = "";

// Particle paramaters
float age = 1;                  // Life of each particle
float maxSpeed = 10;        // Max speed each particle is spit out at
float minSpeed = 2;            // Min speed each particle is spit out at
string texture;                 // Texture used for particles, default used if blank
float startAlpha = 1;           // Start alpha (transparency) value
float endAlpha = 1;           // End alpha (transparency) value
vector startColor = <.5,0,0>;    // Start color of particles <R,G,B>
vector endColor = <.3,0,0>;      // End color of particles <R,G,B> (if interpColor == TRUE)
vector startSize = <4,4,4>;     // Start size of particles 
vector endSize = <.035,.035,.035>;       // End size of particles (if interpSize == TRUE)
vector push = <0.0,0.0,-5>;          // Force pushed on particles

// System paramaters
float rate = .1;            // How fast (rate) to emit particles
float radius = .5;          // Radius to emit particles for BURST pattern
integer count = 30;        // How many particles to emit per BURST 
float outerAngle = 7.0;    // Outer angle for all ANGLE patterns
float innerAngle = 2.5;    // Inner angle for all ANGLE patterns
vector omega = <14,14,14>;    // Rotation of ANGLE patterns around the source
float life = 0;             // Life in seconds for the system to make particles

// Script variables
integer flags;

updateParticles()
{
    flags = 0;
    if (target == "owner") target = llGetOwner();
    if (target == "self") target = llGetKey();
    if (glow) flags = flags | PSYS_PART_EMISSIVE_MASK;
    if (bounce) flags = flags | PSYS_PART_BOUNCE_MASK;
    if (interpColor) flags = flags | PSYS_PART_INTERP_COLOR_MASK;
    if (interpSize) flags = flags | PSYS_PART_INTERP_SCALE_MASK;
    if (wind) flags = flags | PSYS_PART_WIND_MASK;
    if (followSource) flags = flags | PSYS_PART_FOLLOW_SRC_MASK;
    if (followVel) flags = flags | PSYS_PART_FOLLOW_VELOCITY_MASK;
    if (target != "") flags = flags | PSYS_PART_TARGET_POS_MASK;

    llParticleSystem([  PSYS_PART_MAX_AGE,age,
                        PSYS_PART_FLAGS,flags,
                        PSYS_PART_START_COLOR, startColor,
                        PSYS_PART_END_COLOR, endColor,
                        PSYS_PART_START_SCALE,startSize,
                        PSYS_PART_END_SCALE,endSize, 
                        PSYS_SRC_PATTERN, pattern,
                        PSYS_SRC_BURST_RATE,rate,
                        PSYS_SRC_ACCEL, push,
                        PSYS_SRC_BURST_PART_COUNT,count,
                        PSYS_SRC_BURST_RADIUS,radius,
                        PSYS_SRC_BURST_SPEED_MIN,minSpeed,
                        PSYS_SRC_BURST_SPEED_MAX,maxSpeed,
                        PSYS_SRC_TARGET_KEY,target,
                        PSYS_SRC_INNERANGLE,innerAngle, 
                        PSYS_SRC_OUTERANGLE,outerAngle,
                        PSYS_SRC_OMEGA, omega,
                        PSYS_SRC_MAX_AGE, life,
                        PSYS_SRC_TEXTURE, texture,
                        PSYS_PART_START_ALPHA, startAlpha,
                        PSYS_PART_END_ALPHA, endAlpha
                            ]);
}
default
{
    state_entry()
    {
        llParticleSystem([]);
        llSetTimerEvent(1);
        llSetStatus(STATUS_DIE_AT_EDGE,TRUE);
    }
    timer()
    {
        llSetText((string)((integer)health) + " Health",<1,1,1>,1);
    }
    collision_start(integer times)
    {
        age = .5;
        life = .2;
        startSize = <.1,.1,.1>;
        updateParticles();
        integer randSound = (integer)llFrand(2.99);
        if(randSound == 0)
        {
        llTriggerSound("righthand", 1);
    }
    if(randSound == 1)
        {
        llTriggerSound("lefthand", 1);
    }
    if(randSound == 2)
        {
        llTriggerSound("kick", 1);
    }
        float damage = llVecMag(llDetectedVel(0))+llVecMag(llGetVel());
        health = health - damage;
        if(health<=0)
        {
            age = 1;
            life = 5;
            startSize = <4,4,4>;
            llTriggerSound("swordhit", 1);
            updateParticles();
            llSetAlpha(1,ALL_SIDES);
            llRezObject("Bone Chip",llGetPos() + <.5,-.5,-.5>,<llFrand(6) - 3,llFrand(6) - 3,5>,<0,0,0,0>,1);
            llRezObject("Tendon strips",llGetPos() + <-.5,.5,-.5>,<llFrand(6) - 3,llFrand(6) - 3,5>,<0,0,0,0>,1);
llRezObject("Heart",llGetPos() + <-.5,-.5,.5>,<llFrand(6) - 3,llFrand(6) - 3,5>,<0,0,0,0>,1);
            llRezObject("Liver, Kidney",llGetPos() + <0,-.5,-.5>,<llFrand(6) - 3,llFrand(6) - 3,5>,<0,0,0,0>,1);
llRezObject("Unrecognizable flesh",llGetPos() + <-.5,-.5,-.5>,<llFrand(6) - 3,llFrand(6) - 3,5>,<0,0,0,0>,1);
            llRezObject("Stomach",llGetPos() + <-.5,0,-.5>,<llFrand(6) - 3,llFrand(6) - 3,5>,<0,0,0,0>,1);
llRezObject("Bone",llGetPos() + <.5,-.5,.5>,<llFrand(6) - 3,llFrand(6) - 3,5>,<0,0,0,0>,1);
            llRezObject("Large Intestines",llGetPos() + <.5,0,-.5>,<llFrand(6) - 3,llFrand(6) - 3,5>,<0,0,0,0>,1);
llRezObject("Bone",llGetPos() + <-.5,0,.5>,<llFrand(6) - 3,llFrand(6) - 3,5>,<0,0,0,0>,1);
            llRezObject("Unrecognizable flesh",llGetPos() + <.5,.5,.5>,<llFrand(6) - 3,llFrand(6) - 3,5>,<0,0,0,0>,1);
llRezObject("Tendon strips",llGetPos() + <.5,.5,.5>,<llFrand(6) - 3,llFrand(6) - 3,5>,<0,0,0,0>,1);
            llRezObject("Bone",llGetPos() + <0,0,.5>,<llFrand(6) - 3,llFrand(6) - 3,5>,<0,0,0,0>,1);
llRezObject("Bone Chip",llGetPos() + <.5,0,0>,<llFrand(6) - 3,llFrand(6) - 3,5>,<0,0,0,0>,1);
            llRezObject("Bone Chip",llGetPos() + <.5,0,.5>,<llFrand(6) - 3,llFrand(6) - 3,5>,<0,0,0,0>,1);
            llDie();
        }
    }
    land_collision_start(vector where)
    {
        age = .5;
        life = .2;
        startSize = <.1,.1,.1>;
        updateParticles();
        integer randSound = (integer)llFrand(2.99);
        if(randSound == 0)
        {
        llTriggerSound("righthand", 1);
    }
    if(randSound == 1)
        {
        llTriggerSound("lefthand", 1);
    }
    if(randSound == 2)
        {
        llTriggerSound("kick", 1);
    }
        float damage = llVecMag(llGetVel());
        health = health - damage;
        if(health<=0)
        {
            age = 1;
            life = 5;
            startSize = <4,4,4>;
            llTriggerSound("swordhit", 1);
            updateParticles();
            llSetAlpha(1,ALL_SIDES);
            llRezObject("Bone Chip",llGetPos() + <.5,-.5,-.5>,<llFrand(6) - 3,llFrand(6) - 3,5>,<0,0,0,0>,1);
            llRezObject("Tendon strips",llGetPos() + <-.5,.5,-.5>,<llFrand(6) - 3,llFrand(6) - 3,5>,<0,0,0,0>,1);
llRezObject("Heart",llGetPos() + <-.5,-.5,.5>,<llFrand(6) - 3,llFrand(6) - 3,5>,<0,0,0,0>,1);
            llRezObject("Liver, Kidney",llGetPos() + <0,-.5,-.5>,<llFrand(6) - 3,llFrand(6) - 3,5>,<0,0,0,0>,1);
llRezObject("Unrecognizable flesh",llGetPos() + <-.5,-.5,-.5>,<llFrand(6) - 3,llFrand(6) - 3,5>,<0,0,0,0>,1);
            llRezObject("Stomach",llGetPos() + <-.5,0,-.5>,<llFrand(6) - 3,llFrand(6) - 3,5>,<0,0,0,0>,1);
llRezObject("Bone",llGetPos() + <.5,-.5,.5>,<llFrand(6) - 3,llFrand(6) - 3,5>,<0,0,0,0>,1);
            llRezObject("Large Intestines",llGetPos() + <.5,0,-.5>,<llFrand(6) - 3,llFrand(6) - 3,5>,<0,0,0,0>,1);
llRezObject("Bone",llGetPos() + <-.5,0,.5>,<llFrand(6) - 3,llFrand(6) - 3,5>,<0,0,0,0>,1);
            llRezObject("Unrecognizable flesh",llGetPos() + <.5,.5,.5>,<llFrand(6) - 3,llFrand(6) - 3,5>,<0,0,0,0>,1);
llRezObject("Tendon strips",llGetPos() + <.5,.5,.5>,<llFrand(6) - 3,llFrand(6) - 3,5>,<0,0,0,0>,1);
            llRezObject("Bone",llGetPos() + <0,0,.5>,<llFrand(6) - 3,llFrand(6) - 3,5>,<0,0,0,0>,1);
llRezObject("Bone Chip",llGetPos() + <.5,0,0>,<llFrand(6) - 3,llFrand(6) - 3,5>,<0,0,0,0>,1);
            llRezObject("Bone Chip",llGetPos() + <.5,0,.5>,<llFrand(6) - 3,llFrand(6) - 3,5>,<0,0,0,0>,1);
            llDie();
        }
    }
}

 

Share this post


Link to post
Share on other sites

I would help you as much as possible with this, as I have lots of fresh and current inworld experience with particles and the llParticleSystem functions, but you might not fully understand every implication of everything I say, and it could lead to disaster.

Enjoy the forums, I can't anymore. Anything I think I could post to try and help anyone just makes my mouth taste bad now. Good luck. Enjoy your LSL.

Oh, and anything of mine you got inworld, just throw it away, it's probably badly coded.

 

Edited by Berksey
  • Thanks 1
  • Sad 1

Share this post


Link to post
Share on other sites
31 minutes ago, Rolig Loon said:

It should. 

Should I look for collision detect script or its a wrong direction?

Share this post


Link to post
Share on other sites

Here is a script I created but the particles go all the time. sound only in a collision ... why so? how to fix?

default
{
    state_entry()
    {
        llCollisionSound("93368301-6f65-c430-76eb-a54004b14514", 1.0);

llParticleSystem([PSYS_PART_MAX_AGE,1.00,
PSYS_PART_FLAGS, 303,
PSYS_PART_START_COLOR, <1.00000, 1.00000, 1.00000>,
PSYS_PART_END_COLOR, <1.00000, 1.00000, 1.00000>,
PSYS_PART_START_SCALE,<0.15531, 0.15531, 0.00000>,
PSYS_PART_END_SCALE,<1.00744, 1.00675, 0.00000>,
PSYS_SRC_PATTERN, 1,
PSYS_SRC_BURST_RATE,0.30,
PSYS_SRC_BURST_PART_COUNT,10,
PSYS_SRC_BURST_RADIUS,0.00,
PSYS_SRC_BURST_SPEED_MIN,30.00,
PSYS_SRC_BURST_SPEED_MAX,30.00,
PSYS_SRC_ANGLE_BEGIN, 0.00,
PSYS_SRC_ANGLE_END, 3.14,
PSYS_SRC_MAX_AGE, 0.0,
PSYS_SRC_TEXTURE, "18284696-0566-2376-fa5f-21fae84547da",
PSYS_PART_START_ALPHA, 1.00,
PSYS_PART_END_ALPHA, 0.25]);
    }
}

 

Share this post


Link to post
Share on other sites
24 minutes ago, Berksey said:

I would help you as much as possible with this, as I have lots of fresh and current inworld experience with particles and the llParticleSystem functions, but you might not fully understand every implication of everything I say, and it could lead to disaster.

Enjoy the forums, I can't anymore. Anything I think I could post to try and help anyone just makes my mouth taste bad now. Good luck. Enjoy your LSL.

Oh, and anything of mine you got inworld, just throw it away, it's probably badly coded.

 

Hello! Can you help me please with this script? I need a script so that when hit in the object of the bullets there were partiles.

Share this post


Link to post
Share on other sites

@Rolig Loon

I found this awesome script by you on THIS forum! It fits almost perfect I just need to remove timer. Or do I need the timer only very short? 

I need particles to stop but only when I stop shooting... Help please!

 

default
{
    collision_start(integer number)
    {
        llParticleSystem([
             // all of the particle parameters go here
              ]);
        llSetTimerEvent(20.0); // That is, fire the timer in 20 seconds
    }

    timer()
    {
        llSetTimerEvent(0.0);  // That is, turn the timer off
        llParticleSystem([]);   // That is, turn the particles off
    }
}

 

Edited by MIVIMEX

Share this post


Link to post
Share on other sites

When you stop shooting, or when you stop getting shot? You could have collision_stop() event stop the particles..or as you said just reduce the timer to a 1 or 2 seconds.

  • Thanks 1

Share this post


Link to post
Share on other sites
27 minutes ago, Love Zhaoying said:

When you stop shooting, or when you stop getting shot? You could have collision_stop() event stop the particles..or as you said just reduce the timer to a 1 or 2 seconds.

Yes, stop getting shot, pardon me. Could you tell please where collision_stop() event goes?

Also do I need any integers here? (like in this example)

collision_end(integer total_number)
{
    llOwnerSay("The collision I've had with " + llDetectedName(0) + "has ended.");
}

Thanks!

Edited by MIVIMEX

Share this post


Link to post
Share on other sites

A collision_end event isn't actually going to work quite that way.  A collision_end event will always be triggered at the instant when the trigger that alerted a collision_start event is removed.  That's not what you are talking about here.  You are faced with multiple collision events, one for each bullet impact. What you want to do is test for when the series of impacts stops, not when an individual one does.  That's exactly what the little snippet you posted does.   I would just shorten the timer interval.....
 

collision_start(integer num)
{
    Bloody_awful();	// Your particle routine to spurt blood
    llSetTimerEvent(2.0);
}

timer()
{
    llSetTimerEvent(0.0);
    llParticleSystem([]);
}

So, each time a bullet hits, it starts the bloody particles.  Two seconds later, the timer turns them off .... unless another bullet has struck within that 2 seconds.  If bullets keep hitting the target prim faster than one every 2 seconds, the timer never fires, so the particles never stop.  The timer is reset by llSetTimerEvent(2.0) each time a bullet strikes.

 

  • Thanks 1

Share this post


Link to post
Share on other sites

@Rolig Loon   @Love Zhaoying  @Berksey

 

In continuation of yesterday's topic. Maybe you can help me add the ability to ON/OFF the particles by the chat command? I reworked particles so the script is already good enough. But agree it would not be bad to add a switch so that the blood does not splash when in the crowd at an accidental collision. With your help I've got such a script but it produces a syntax error. Can anyone know what's wrong there? (Error: line 17, column 4) Please help! And thanks for any help!

//* script_starts_here
//
default
{
state_entry()
{
llListen(0,"","","");
}
listen(integer chan, string name, key id, string msg)
{
if(msg=="stop")
{
llParticleSystem([]);
}   
else if(msg=="start")

{
    collision_start(integer number)
    {
        llParticleSystem([PSYS_PART_MAX_AGE,1.00,
PSYS_PART_FLAGS, 259,
PSYS_PART_START_COLOR, <0.89, 0.93, 0.97>,
PSYS_PART_END_COLOR, <0.98, 0.98, 0.98>,
PSYS_PART_START_SCALE,<0.22, 0.21, 0.00>,
PSYS_PART_END_SCALE,<0.79, 0.79, 0.00>,
PSYS_SRC_PATTERN, 2,
PSYS_SRC_BURST_RATE,0.00,
PSYS_SRC_BURST_PART_COUNT,2,
PSYS_SRC_BURST_RADIUS,0.00,
PSYS_SRC_BURST_SPEED_MIN,0.65,
PSYS_SRC_BURST_SPEED_MAX,2.01,
PSYS_SRC_ANGLE_BEGIN, 0.90,
PSYS_SRC_ANGLE_END, 0.81,
PSYS_SRC_MAX_AGE, 0.0,
PSYS_SRC_TEXTURE, "18284696-0566-2376-fa5f-21fae84547da",
PSYS_PART_START_ALPHA, 1.00,
PSYS_PART_END_ALPHA, 0.00,
PSYS_SRC_ACCEL, <0.00, 0.00, 0.04>]);
        llSetTimerEvent(1.0); // That is, fire the timer in 20 seconds
    }

    timer()
    {
        llSetTimerEvent(0.0);  // That is, turn the timer off
        llParticleSystem([]);   // That is, turn the particles off
    }
}

 

Share this post


Link to post
Share on other sites
2 hours ago, MIVIMEX said:

else if(msg=="start")

{

      collision_start(integer number)

Look right there.  Count the {curly brackets} and ask yourself, "Where is the end of the listen event?"

Edited by Rolig Loon
  • Thanks 1

Share this post


Link to post
Share on other sites

You can stop asking for Berksey. She isn't coming back. You guys are stuck with the ugly sister now. Also, if you would do us the courtesy of not pasting code into people's IM windows inworld, that would be great. It might not actually do anything bad, but it's probably not the best way to get help.

Edited by PheebyKatz

Share this post


Link to post
Share on other sites
2 hours ago, Rolig Loon said:

Look right there.  Count the {curly brackets} and ask yourself, "Where is the end of the listen event?"

Maybe I'm blind,.. I really do not see what's wrong ... I tried all possible places for curly braces, I'm really noob in scripting.

I considered it most logical to try to put brackets in the end. Fail again. What is wrong?..

Share this post


Link to post
Share on other sites

As written, your listen event starts with 

 

4 hours ago, MIVIMEX said:

listen(integer chan, string name, key id, string msg)

{

if(msg=="stop")

{

llParticleSystem([]);

}

else if(msg=="start")

{

But it doesn't stop, because there's no } curly bracket there.  The next thing that happens is the start of a collision_start event, which can't begin because it's still in the unfinished listen event. You need to say what the script is supposed to do if(msg == "start") and then finish writing the listen event.

  • Thanks 1

Share this post


Link to post
Share on other sites

Perhaps warning that one should also be in the habit of using listen handlers even when they aren't needed is in order. It might complicate things for your current project, but I have it on good account that even when a script is simple, one should always code as if it's a complicated and convoluted arrangement with lots that could potentially go wrong.

We've all been learning lately that just because something works the way it's supposed to when used as it should be used doesn't make it right, and I really hoped that our community would uphold better coding practices than allowing a listen event to happen without a listen handler.

EDIT: I know you "liked" the post, but this was just me being sarcastic, please ignore it. We can do better.

Edited by PheebyKatz
  • Like 1

Share this post


Link to post
Share on other sites
19 minutes ago, Rolig Loon said:

You need to say what the script is supposed to do if(msg == "start") and then finish writing the listen event.

What should it be? to turn on the particles again? To indicate the entire system of particles twice in two places? or maybe a script from the very beginning indicated wrong?

if(msg=="stop")
{
llParticleSystem([]);  <<<< wrong?

 

or llresetscript?..

Edited by MIVIMEX

Share this post


Link to post
Share on other sites

You're doing fine.  Stand back and take a deep breath.  ;)  I think your intention is that "start" means "start making particles," so that's what you planned to do there.  Remember, your script worked perfectly well until you added that small on/off switch by creating a  listen event, so you don't want to change any of its basic logic.  Therefore, you just have to tell the script what to do in this new place where you are telling it to "start".  You have two choices.  One is to repeat the entire block of code that defines the llParticleSystem, as you suggested.  The other choice is to move that block of code into a spot where it is accessible to both the original collision_start event and your new listen event. That is, make it a user-defined function or at least assign its contents to a global list variable that you can call from either place. Either solution will work.  It's your decision as the scripter to decide which one fits your style and design sense.

  • Thanks 1

Share this post


Link to post
Share on other sites
54 minutes ago, Rolig Loon said:

The other choice is to move that block of code into a spot where it is accessible to both the original collision_start event and your new listen event. That is, make it a user-defined function or at least assign its contents to a global list variable that you can call from either place.

Thank you very much for your advice! I tried to do so on the example of another particle script. but still the same error. a riddle! Im completely lost...

integer running=TRUE;

// Mask Flags - set to TRUE to enable
integer glow = TRUE;            // Make the particles glow
integer bounce = FALSE;          // Make particles bounce on Z plan of object
integer interpColor = TRUE;     // Go from start to end color
integer interpSize = TRUE;      // Go from start to end size
integer wind = FALSE;           // Particles effected by wind
integer followSource = TRUE;    // Particles follow the source
integer followVel = TRUE;       // Particles turn to velocity direction

// Choose a pattern from the following:
// PSYS_SRC_PATTERN_EXPLODE
// PSYS_SRC_PATTERN_DROP
// PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY
// PSYS_SRC_PATTERN_ANGLE_CONE
// PSYS_SRC_PATTERN_ANGLE
integer pattern = PSYS_SRC_PATTERN_ANGLE_CONE;

// Select a target for particles to go towards
// "" for no target, "owner" will follow object owner 
//    and "self" will target this object
//    or put the key of an object for particles to go to
key target = "self";

// Particle paramaters
float age = 100;                  // Life of each particle <-- invrease that value for larger fog
float maxSpeed = 1;            // Max speed each particle is spit out at
float minSpeed = 1;            // Min speed each particle is spit out at
string texture;                 // Texture used for particles, default used if blank
float startAlpha = 0.4;           // Start alpha (transparency) value
float endAlpha = 0.05;           // End alpha (transparency) value
vector startColor = <.8,.8,.8>;    // Start color of particles <R,G,B>
vector endColor = <.7,0.7,0.7>;      // End color of particles <R,G,B> (if interpColor == TRUE)
vector startSize = <2, 2, 2>;     // Start size of particles 
vector endSize = <4.0,4.0,0.0>;       // End size of particles (if interpSize == TRUE)
vector push = <0,0,0>;          // Force pushed on particles

// System paramaters
float rate = .5;            // How fast (rate) to emit particles
float radius = 3;          // Radius to emit particles for BURST pattern
////////////////////////////////////////////////////////////////////
integer count = 10;        // How many particles to emit per BURST <-- increase that value for more tense fog
////////////////////////////////////////////////////////////////////
float outerAngle = 1.57;    // Outer angle for all ANGLE patterns
float innerAngle = 1.58;    // Inner angle for all ANGLE patterns
vector omega = <0,0,1>;    // Rotation of ANGLE patterns around the source
float life = 0;             // Life in seconds for the system to make particles

// Script variables
integer flags;

FOGParticles()
{
    if (target == "owner") target = llGetOwner();
    if (target == "self") target = llGetKey();
    if (glow) flags = flags | PSYS_PART_EMISSIVE_MASK;
    if (bounce) flags = flags | PSYS_PART_BOUNCE_MASK;
    if (interpColor) flags = flags | PSYS_PART_INTERP_COLOR_MASK;
    if (interpSize) flags = flags | PSYS_PART_INTERP_SCALE_MASK;
    if (wind) flags = flags | PSYS_PART_WIND_MASK;
    if (followSource) flags = flags | PSYS_PART_FOLLOW_SRC_MASK;
    if (followVel) flags = flags | PSYS_PART_FOLLOW_VELOCITY_MASK;
    if (target != "") flags = flags | PSYS_PART_TARGET_POS_MASK;

    llParticleSystem([  PSYS_PART_MAX_AGE,age,
                        PSYS_PART_FLAGS,flags,
                        PSYS_PART_START_COLOR, startColor,
                        PSYS_PART_END_COLOR, endColor,
                        PSYS_PART_START_SCALE,startSize,
                        PSYS_PART_END_SCALE,endSize, 
                        PSYS_SRC_PATTERN, pattern,
                        PSYS_SRC_BURST_RATE,rate,
                        PSYS_SRC_ACCEL, push,
                        PSYS_SRC_BURST_PART_COUNT,count,
                        PSYS_SRC_BURST_RADIUS,radius,
                        PSYS_SRC_BURST_SPEED_MIN,minSpeed,
                        PSYS_SRC_BURST_SPEED_MAX,maxSpeed,
                        PSYS_SRC_TARGET_KEY,target,
                        PSYS_SRC_ANGLE_BEGIN,innerAngle, 
                        PSYS_SRC_ANGLE_END,outerAngle,
                        PSYS_SRC_OMEGA, omega,
                        PSYS_SRC_MAX_AGE, life,
                        PSYS_SRC_TEXTURE, texture,
                        PSYS_PART_START_ALPHA, startAlpha,
                        PSYS_PART_END_ALPHA, endAlpha
                            ]);
}
//////////////////////////////////////////////////////////
default
{
    state_entry()
    
    {
      llListen(0,"","","");
    }

  listen(integer chan, string name, key id, string msg)
    {
       if(msg=="stop")
    {  
    running=FALSE;
    llParticleSystem([]);
    }
 
       else if(msg=="start")
    {
    running=TRUE;
    FOGParticles();
    }
    
     collision_start(integer number)
    {  
    running=TRUE
    FOGParticles();
    llSetTimerEvent(1.0);
    }
     timer()
    {
        llSetTimerEvent(0.0);
        running=FALSE;
        llParticleSystem([]);
        }
        }
       
       
       
       

 

Share this post


Link to post
Share on other sites

Cool.  You're almost there.  All you need to do is go back and count your {curly brackets} to be sure that they match.  (Hint: they don't.  Your listen event doesn't have a closing bracket.)

You can do two things to help avoid this problem in the future.  The easiest is to indent your scripts religiously so that you can see where brackets that open and close each scope should be.  The other thing you can do is install an external script editor on your computer.  There's a good list of them at http://wiki.secondlife.com/wiki/LSL_Alternate_Editors  .  Personally, I like Sublime Text, but you'll find scripters who have many other favorites.  Almost any of them will have much better error messages and helpful features (like auto indenting) than the editor in the SL viewer. 

  • Thanks 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...