Jump to content

Boat Wake Start and Stop


woogalie
 Share

You are about to reply to a thread that has been inactive for 2525 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hello!

How can I change this script to begin producing particles only when the boat is moving at say 3 knots or faster? Looks super lame when you raise the sails and the particles fly out when your not even moving :D

Here is the wake script

Quote

// ======= Header ==============
// BWind_WAKE_by_Balduin_Aabye
// BWind Boats -- wake script
// Balduin Aabye - JANUARY 2010
//
//------------------------------------------------------
//            Please do not remove this header
//                Permitted Free Uses
//  - allowed to use in your personal boats. 
//  - allowed to use in boats you wish to sell or give away in second life.
//  - allowed to modify any part to your particular needs
//                Not Allowed Uses
// - not allowed to re-package and give away, or sell this script. 
// - not allowed to change a few lines of code then call this your own work
// - not allowed to take this to another platform or any use other than Second Life sailing without the express permission from Balduin_Aabye 
// ======= End Header =========

generalParticleEmitterOn()                

{   
    llParticleSystem([                   
    PSYS_PART_FLAGS , 0 
    | PSYS_PART_INTERP_COLOR_MASK   //Colors fade from start to end
    | PSYS_PART_INTERP_SCALE_MASK   //Scale fades from beginning to end
    | PSYS_PART_FOLLOW_VELOCITY_MASK//Particles are created at the velocity of the emitter

    ,PSYS_SRC_PATTERN,           PSYS_SRC_PATTERN_ANGLE
    
    ,PSYS_SRC_TEXTURE,           "f622a6dd-e15d-33f9-a7e5-57504926b1d4"           //UUID of the desired particle texture, or inventory name
    ,PSYS_SRC_MAX_AGE,           0.0            //Time, in seconds, for particles to be emitted. 0 = forever
    ,PSYS_PART_MAX_AGE,          15.0            //Lifetime, in seconds, that a particle lasts. Original Value = 8
    ,PSYS_SRC_BURST_RATE,        0.0            //How long, in seconds, between each emission
    ,PSYS_SRC_BURST_PART_COUNT,  20              //Number of particles per emission
    ,PSYS_SRC_BURST_RADIUS,      0.15           //Radius of emission
    ,PSYS_SRC_BURST_SPEED_MIN,   0.5             //Minimum speed of an emitted particle
    ,PSYS_SRC_BURST_SPEED_MAX,   0.5            //Maximum speed of an emitted particle
    ,PSYS_SRC_ACCEL,             <0,0,-0.20>    //Acceleration of particles each second
    ,PSYS_PART_START_COLOR,      <1.0,1.0,1.0>  //Starting RGB color
    ,PSYS_PART_END_COLOR,        <1.0,1.0,1.0>  //Ending RGB color, if INTERP_COLOR_MASK is on 
    ,PSYS_PART_START_ALPHA,      0.5            //Starting transparency, 1 is opaque, 0 is transparent.
    ,PSYS_PART_END_ALPHA,        0.0            //Ending transparency
    ,PSYS_PART_START_SCALE,      <1.0,1.0,0.0>  //Starting particle size
    ,PSYS_PART_END_SCALE,        <2.5,2.5,0.0>  //Ending particle size, if INTERP_SCALE_MASK is on
    ,PSYS_SRC_ANGLE_BEGIN,       0.0* DEG_TO_RAD //Inner angle for ANGLE patterns
    ,PSYS_SRC_ANGLE_END,         120.0* DEG_TO_RAD//Outer angle for ANGLE patterns
    ,PSYS_SRC_OMEGA,             <0.0,0.0,0.0>  //Rotation of ANGLE patterns, similar to llTargetOmega()
            ]);
}

generalParticleEmitterOff()
{
    llParticleSystem([]);
}

default
{
    state_entry()
    {
            generalParticleEmitterOff();
    }
    link_message(integer sender_num, integer num, string str, key id)
    {
        if(str=="stop")
        {
            generalParticleEmitterOff();
        }
        if(str=="start")
        {
            generalParticleEmitterOn();
        }
    }
}

I tried something like this, but it does not like it 

Quote

if (llVecMag(groundSpeed*1.944)>3.0)

Thanks for reading 

Edited by woogalie
Link to comment
Share on other sites

1 hour ago, woogalie said:

if (llVecMag(groundSpeed*1.944)>3.0)

That doesn't work because the variable groundSpeed isn't present in that script.

if (llVecMag(llGetVel()*1.944)>3.0) should do the trick.

However, it would be more nifty if you do that check in the main script already (where groundSpeed will work as well), before you send the llMessageLinked to the particle script. Will have to be done in a timer() event. And make sure you don't send the link message over and over agian once it's greater than 3 knots.

Link to comment
Share on other sites

Woot, I got it. You are right, the main script has the variables in it. 

So on my main script I added the following. The main script already has places where it tells the prim with the particle script to start and stop. "llMessageLinked(LINK_ALL_CHILDREN , 0, "start", NULL_KEY);"

Quote

if (llVecMag(groundSpeed*1.944)>3.0)llMessageLinked(LINK_ALL_CHILDREN , 0, "start", NULL_KEY);
if (llVecMag(groundSpeed*1.944)<3.0)llMessageLinked(LINK_ALL_CHILDREN , 0, "stop", NULL_KEY);

Also at the top of the script I have the following. From when I was trying to play different sounds when sailing faster.

Quote

float fTriggerKnotSpeed= 0.0;
float fOldSpeed= 0.0;

Another one solved! Thanks arton Rotaru

Edited by woogalie
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2525 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...