|
Layla Honi
Registered User
Join date: 1 Nov 2007
Posts: 171
|
10-15-2008 22:35
I found a nice smoke script called Particlesmoke to use for motor exhaust. I'm just learning scripts and really don't know much yet. I reworked the scale and settings to what I needed, but I don't know how to make it work in my linked vehicle. The vehicle is more than 31 prims and the parts that will have the smoke will be part of the linked attachment you will wear. There will be eight instances of this smoke particle in the set. As it is now, the vehicle starts on sitting and stops when getting up. I want to make the script work on start/stop command also. I dont know if this will effect the way the smoke script will work, but if so, a version for start/stop will be needed too. I also would like a version that will work with a 31 prim limit vehicles with and without start/stop commands. If someone could make the requiired modifications with comments and details instructions and repost here and/or IM me inworld, I would appreciate it very much. Here is the script: // Particle Script 0.5 // Created by Ama Omega // 3-26-2004
integer keystate = 0 ;
// Mask Flags - set to TRUE to enable integer glow = FALSE; // Make the particles glow integer bounce = FALSE; // Make particles bounce on Z plane 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 = 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_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 = "";
// Particle paramaters float age = 0.25; // Life of each particle float maxSpeed = 1.5; // Max speed each particle is spit out at float minSpeed = 0.8; // Min speed each particle is spit out at string texture = "4f714019-c1cf-6b16-994f-44b217022f1a"; // Texture used for particles, default used if blank float startAlpha = 0.8; // Start alpha (transparency) value float endAlpha = 0.0; // End alpha (transparency) value vector startColor = <0.5,0.5,0.5>; // Start color of particles <R,G,B> vector endColor = <0,0,0>; // End color of particles <R,G,B> (if interpColor == TRUE) vector startSize = <0.01,0.01,0.0>; // Start size of particles vector endSize = <0.2,0.2,0.0>; // End size of particles (if interpSize == TRUE) vector push = <.2,0,3>; // Force pushed on particles
// System paramaters float rate = 0.1; // How fast (rate) to emit particles float radius = 0.0; // Radius to emit particles for BURST pattern integer count = 5; // How many particles to emit per BURST float outerAngle = 0; // Outer angle for all ANGLE patterns float innerAngle = 0.1; // Inner angle for all ANGLE patterns vector omega = <0,0,0>; // Rotation of ANGLE patterns around the source float life = 0; // Life in seconds for the system to make particles
integer flags; list sys; integer type; vector tempVector; rotation tempRot; string tempString; integer i;
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; sys = [ 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 ]; llParticleSystem(sys); }
default { state_entry() { //updateParticles(); keystate = 0 ; //target = llGetLinkKey(2) ; updateParticles() ; //llParticleSystem([]) ; } }
|
|
arton Rotaru
Registered User
Join date: 27 Aug 2007
Posts: 43
|
10-16-2008 02:36
Put this in one of your attached smoke prims. This works with chat commands, spoken by the objects owner and when sitting also. ////// // Particle Globals here // ///// default { state_entry() { llListen(50, "","","");// listen on chat channel 50. } listen(integer channel, string name, key id, string message) { if (llGetOwnerKey(id) == llGetOwner()) // make sure only the vehicle owner can start the smoke. { if (message == "start") // start smoke if the owner say "start" on chat channel 50. { llMessageLinked(LINK_SET, 0 , "start" , ""); //Sends a start message to the other linked smoke prims. updateParticles();// start smoke. } else if (message == "stop") //kill smoke if the owner say "stop" on chat channel 50. { llMessageLinked(LINK_SET, 0 , "stop" , ""); //Sends a stop message to the other linked smoke prims. llParticleSystem([]); // kill particles. } } } } Put this in the other 7 linked smoke prims. It's listen to the linkedmessages send by the first script. ////// // Particle Globals here // ///// default { link_message(integer sender_num, integer num, string str , key id) { if (str == "start") { updateParticles(); // start smoke } else if (str == "stop") { llParticleSystem([]); // kill smoke. } } } In your vehicle script, you have something like the following, I guess. If you don't want it to start the smoke when sitting, comment out the lines "llSay(50, "start"  ; and llSay(50, "stop"  ; and llMessageLinked(LINK_SET, 0 , "start" , ""  ; and llMessageLinked(LINK_SET, 0 , "stop" , ""  ; If you don't want it listen by an avatar, use a negative channel for the llListen(); and llSay(); like -1000 or something. changed(integer change) { if (change & CHANGED_LINK) { key agent = llAvatarOnSitTarget(); if (agent) { if (agent != llGetOwner()) { llSay(0, "You aren't the owner"); llUnSit(agent); llPushObject(agent, <0,0,100>, ZERO_VECTOR, FALSE); onsit = FALSE; } else { onsit = TRUE; llSay(50, "start");// start the smoke on sit. llMessageLinked(LINK_SET, 0 , "start" , ""); //Sends a start message to the other linked smoke prims. llSetStatus(STATUS_PHYSICS, TRUE); llRequestPermissions(agent, PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS | PERMISSION_CONTROL_CAMERA); } } else { llSay(50, "stop");// stop the smoke on unsit. llMessageLinked(LINK_SET, 0 , "stop" , ""); //Sends a stop message to the other linked smoke prims. llSetStatus(STATUS_PHYSICS, FALSE); llReleaseControls(); } } } If you only use a 31 prim vehicle, you can integrate the llListen() in your vehicle script and tell the childs via llLinkedMessage();
|
|
Layla Honi
Registered User
Join date: 1 Nov 2007
Posts: 171
|
10-17-2008 23:23
Thanks Arton, I got the smoke to work on chat command channel, but I'm afraid I'm lost on the last part of what you posted. You said "if you don't want it to start the smoke when sitting, comment out the lines "llSay(50, "start"  ; and llSay(50, "stop"  ; and llMessageLinked(LINK_SET, 0 , "start" , ""  ; and llMessageLinked(LINK_SET, 0 , "stop" , ""  ;" ...but it doesn't start when sitting. It looks like it will work great with the chat command, which is what I want. I'm trying to get the flight script and other things to work on start stop command too. I have it working for the flight script put it still starts when I sit too. I think I know what I have to do, which I will try. If it doesn't work, I'll be back.
|
|
arton Rotaru
Registered User
Join date: 27 Aug 2007
Posts: 43
|
10-18-2008 12:37
In the last part, with the "changed" event, I added the LLSay(50, "start"  ;.... lines. I don't know which script you use for your vehicle. You need to add the llSay(); commands to the section in your script, where it checks if an avatar is sitting or not. This happens in the "changed(integer change)" event. llAvatarOnSitTarget(); returns the Key of the avatar who is sitting on an object. In this part it checks if the sitting avatar is the objects owner or not. If not it unsit him. changed(integer change) { if (change & CHANGED_LINK) { key agent = llAvatarOnSitTarget(); if (agent) { if (agent != llGetOwner()) { llSay(0, "You aren't the owner"  ; llUnSit(agent); llPushObject(agent, <0,0,100>, ZERO_VECTOR, FALSE); onsit = FALSE; If the sitter is the owner, we are in the next part wich will request the permissions and so on. Here I added the commands to start the smoke. else { onsit = TRUE; llSay(50, "start"  ;// start the smoke on sit. llMessageLinked(LINK_SET, 0 , "start" , ""  ; //Sends a start message to the other linked smoke prims. llSetStatus(STATUS_PHYSICS, TRUE); llRequestPermissions(agent, PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS | PERMISSION_CONTROL_CAMERA); The last part is triggered when you stand up from your seat. It noticed a linkchange but we have no one sitting. So we know someone is standing up from the seat and I added the llSay(50, "stop"  ; command there. else { llSay(50, "stop"  ;// stop the smoke on unsit. llMessageLinked(LINK_SET, 0 , "stop" , ""  ; //Sends a stop message to the other linked smoke prims. llSetStatus(STATUS_PHYSICS, FALSE); llReleaseControls(); If you have problems with it, just post that part of your vehicle script with the change event and lets see what we can do.
|