Hud Colors Change particules

Répondre
Partager Rechercher
Bonjour le forum ,

Voila je créer des typer fx particules ( effet de particules quand l'avatar écrit ) et j'aimerais pouvoir créer un hud ou en trouver un full perm sur le market qui permet de pouvoir changer la couleurs de mes particules avec une palette de couleurs qui se porte en hud .

Exemple : mini_201103033140386144.png

merci beaucoup d'avance ^-^
hellow, il suffit de mettre ça ds un simple cube....de le porter en HUD et d' adapter le llSay à ton objet...



vector hsl_to_rbg(float h, float s, float l)
{
vector rbg;
float temp1;
float temp2;
if(l < .5)
{
temp2 = l*(1.0+s);
}
else
{
temp2 = l+s-l*s;
}
temp1 = l*2.0-temp2;
float Rtemp3 = h+1.0/3.0;
if(Rtemp3 < 0.0)
{
Rtemp3 = Rtemp3+1.0;
}
else if(Rtemp3 > 1.0)
{
Rtemp3 = Rtemp3-1.0;
}
float Gtemp3 = h;
if(Gtemp3 < 0.0)
{
Gtemp3 = Gtemp3+1.0;
}
else if(Gtemp3 > 1.0)
{
Gtemp3 = Gtemp3-1.0;
}
float Btemp3 = h-1.0/3.0;
if(Btemp3 < 0.0)
{
Btemp3 = Btemp3+1.0;
}
else if(Btemp3 > 1.0)
{
Btemp3 = Btemp3-1.0;
}
if(6.0*Rtemp3 < 1.0)
{
rbg.x = temp1+(temp2-temp1)*6.0*Rtemp3;
}
else if(2.0*Rtemp3 < 1.0)
{
rbg.x = temp2;
}
else if(3.0*Rtemp3 < 2.0)
{
rbg.x = temp1+(temp2-temp1)*((2.0/3.0)-Rtemp3)*6.0;
}
else
{
rbg.x = temp1;
}
if(6.0*Gtemp3 < 1.0)
{
rbg.y = temp1+(temp2-temp1)*6.0*Gtemp3;
}
else if(2.0*Gtemp3 < 1.0)
{
rbg.y = temp2;
}
else if(3.0*Gtemp3 < 2.0)
{
rbg.y = temp1+(temp2-temp1)*((2.0/3.0)-Gtemp3)*6.0;
}
else
{
rbg.y = temp1;
}
if(6.0*Btemp3 < 1.0)
{
rbg.z = temp1+(temp2-temp1)*6.0*Btemp3;
}
else if(2.0*Btemp3 < 1.0)
{
rbg.z = temp2;
}
else if(3.0*Btemp3 < 2.0)
{
rbg.z = temp1+(temp2-temp1)*((2.0/3.0)-Btemp3)*6.0;
}
else
{
rbg.z = temp1;
}
return rbg;
}

integer start_face;

float hue;
float sat;
float lum;

vector vSize=<.3,.2,.01>;

default
{
on_rez( integer sparam )
{
llResetScript();
}

state_entry()
{
llSetLinkPrimitiveParamsFast(LINK_THIS,[
PRIM_SIZE, vSize,
PRIM_ROTATION,llEuler2Rot(<0.0,270.0,270.0>*DEG_TO_RAD),
PRIM_TYPE, PRIM_TYPE_BOX, PRIM_HOLE_SQUARE, <0,1,0>, 0.0, <0,0,0>, <.8,1,0>, <.0,0,0>,
PRIM_TEXTURE, ALL_SIDES, "5748decc-f629-461c-9a36-a35a221fe21f", <1,1,0>, <0,0,0>, 0.0,
PRIM_TEXTURE, 0, "404e4461-8a22-fbf7-7652-4b81dc7da325", <1,1,0>, <0,0,0>, 0.0,
PRIM_TEXTURE, 2, "01c02d68-dfb0-d907-7397-cba857c61144", <1,1,0>, <0,0,0>, -PI_BY_TWO
]);
lum = 0.5;
}

touch_start(integer num)
{
start_face = llDetectedTouchFace(0);
if(start_face == 4)
{
llSay(0,"vecteur_couleur"+"|"+(string)hsl_to_rbg(hue, sat, lum));
}
}

touch(integer num)
{
vector st = llDetectedTouchST(0);
integer face = llDetectedTouchFace(0);
if(start_face != face) return;
if(face == 0)
{
sat = st.y;
hue = st.x;
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,4, hsl_to_rbg(hue, sat, lum), 1.0]);
}
else if(face == 2)
{
lum = st.x;
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,4, hsl_to_rbg(hue, sat, lum), 1.0]);
}
}
}
Lightbulb
Merci beaucoup MenthalOH

Par contre je ne comprend pas trop " adapter le llSay à ton objet. "

Dans mon objet typer fx j'ai le script , l'animation , et la texture . Dans mon script je ne vois pas ou modifier pour qu'il parle au hud ( ton script ) .

Je suis un peu perdu toute mes excuses .
Merci à toi MenthalOH

Objet Main gauche par exemple mais le même dans la main droite :

Pour résumer dans mon typer il y a en + l'animation et ma texture .

Cliquez ce bouton ou survolez le contenu pour afficher le spoiler
integer ownerTyping = 0;
key owner;
integer perm = 0;
//////////Colors///////////////
vector white = <0.0,0.0,0.0>;
vector blue = <0.0,0.3,1.0>;
vector purple = <0.5,0.0,1.0>;
vector red = <1.0,0.0,0.0>;
vector orange = <1.0,1.0,0.5>;
vector pink = <1.0,0.0,0.6>;
vector yellow = <1.0,1.0,0.0>;
vector gray = <0.35,0.35,0.35>;
vector brown = <0.5,0.3,0.15>;
vector black = <0.0,0.0,0.0>;
//////////Settings/////////////
string typingSound = "49ba126f-9128-b6de-b7ab-0c0973428441";//You can replace this sound UUID with your own sound UUID or place a sound in the root prim and paste the name here
float volume = 1.0;//volume of your typing sound can be 0.0 = no volume to 1.0 = full volume
vector color = white;//default color. Choose from colors above
float alpha = 0.0;//default alpha transparency 0.0 = invisible / 1.0 = visible
float glow = 0.0;//the amount you want the prim to glow when you type (0.0 = no glow / 1.0 = full glow)
string type = "typing";//the name of the typing animation in the inventory. You can replace the animation in the inventory and place the new name here.
//////////Particle/////////////
particleEffect()
{
llLinkParticleSystem(LINK_THIS,
[//You can paste your own Particle Parameters Here and delete the parameters below.
//if you are familiar with how to change the parameter settings, you can do that below
PSYS_SRC_TEXTURE,llGetInventoryName(INVENTORY_TEXTURE,0),//drop a texture in the inventory to use with the provided particle effect
PSYS_PART_START_SCALE,<0.5,0.5,0.5>,
PSYS_PART_END_SCALE,<0.1,0.1,0.1>,
PSYS_PART_START_COLOR,<1.0,1.0,1.0>,
PSYS_PART_END_COLOR,<1.0,1.0,1.0>,
PSYS_PART_START_ALPHA,1.0,
PSYS_PART_END_ALPHA,0.5,
PSYS_SRC_BURST_PART_COUNT,2,
PSYS_SRC_BURST_RATE,0.05,
PSYS_PART_MAX_AGE,0.3,
PSYS_SRC_MAX_AGE,0.0,
PSYS_SRC_PATTERN,(integer)8,
PSYS_SRC_BURST_SPEED_MIN,0.1,
PSYS_SRC_BURST_SPEED_MAX,0.1,
PSYS_SRC_BURST_RADIUS,0.5,
PSYS_SRC_ANGLE_BEGIN,(float)0.0*PI,
PSYS_SRC_ANGLE_END,(float)1.0*PI,
PSYS_SRC_OMEGA,<0.0,0.0,0.0>,
PSYS_SRC_ACCEL,<0.0,0.0,-0.1>,
PSYS_PART_FLAGS,(0
|PSYS_PART_INTERP_COLOR_MASK
|PSYS_PART_INTERP_SCALE_MASK
|PSYS_PART_EMISSIVE_MASK)
//|PSYS_PART_FOLLOW_VELOCITY_MASK
//|PSYS_PART_WIND_MASK
//|PSYS_PART_BOUNCE_MASK
//|PSYS_PART_FOLLOW_SRC_MASK
//|PSYS_PART_TARGET_POS_MASK
//|PSYS_PART_TARGET_LINEAR_MASK
]);
}
default
{
state_entry()
{
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,ALL_SIDES,color,alpha]);//sets the prim color and visibility to default
owner = llGetOwner();//gets the your avatar key for later use
llPreloadSound(typingSound);
}
timer()
{

if((llGetAgentInfo(owner) & AGENT_TYPING) && !ownerTyping)
{
llStopSound();//stop the default typing sound
ownerTyping = 1;//set the flag to 1 (TRUE) so it recognizes you are typing and doesnt spam this portion of the script
llStopAnimation("type");//stop the default typing animation
llStartAnimation(type);//start your custom animation
llLoopSound(typingSound,volume);//play the typing sound at your chosen volume
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_GLOW,ALL_SIDES,glow]);//sets the prim glow to the default glow
//llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,ALL_SIDES,color,alpha]);//sets the prim color and visibility to default
particleEffect();//starts the particle effect
}

else if(!(llGetAgentInfo(owner) & AGENT_TYPING) && ownerTyping)
{
ownerTyping = 0;//set the flag to 0 (FALSE) so it recognizes you stopped typing and doesnt spam this portion of the script
llStopAnimation(type);//stop your custom typing animation
llStopSound();//stop your typing sound
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_GLOW,ALL_SIDES,0.0]);//sets the prim glow off (0.0)
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,ALL_SIDES,color,0.0]);//sets the prim color and the visibility to invisible (0.0)
llLinkParticleSystem(LINK_THIS,[]);//turns the particle effect off
}
}
changed(integer change)
{
if(change & CHANGED_OWNER)//owner has changed so reset the script and get a new owner
{
llResetScript();
}
}
attach(key id)
{
if(id != NULL_KEY)//you just attached this item so it goes invisible and no glow and no particle
{
llSetTimerEvent(0.25);//starts the timer to check whether you are typing or not now that the object is attached
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_GLOW,ALL_SIDES,0.0]);//sets the prim glow off (0.0)
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,ALL_SIDES,color,0.0]);//sets the prim color and the visibility to invisible (0.0)
llLinkParticleSystem(LINK_THIS,[]);//turns the particle effect off
llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION);
}
else//you just detached this item so it goes visible so you can see it if you dropped it on the ground
//it sets the color and makes the prim visible, but turns the glow off and the particle off
{
if(perm)
{
perm = 0;//permissions to animate your avatar have been removed
llStopAnimation(type);//stop the animation if in case you were typing when this was detached
}
llSetTimerEvent(0.0);//stop the timer so it doesnt respond while detached
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_GLOW,ALL_SIDES,0.0]);//sets the prim glow off (0.0)
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,ALL_SIDES,color,alpha]);//sets the prim color and visibility to default
llLinkParticleSystem(LINK_THIS,[]);//turns the particle effect off
}
}
run_time_permissions(integer perm)//the script has asked if it can animate your avatr when you attached this object to your avatar
{
if(perm & PERMISSION_TRIGGER_ANIMATION)
{
perm = 1;//permission granted
}
else
{
perm = 0;//permission denied
}
}
}

Dernière modification par elsa1993 ; 04/11/2020 à 12h01.
dans le HUD...


vector hsl_to_rbg(float h, float s, float l)
{
vector rbg;
float temp1;
float temp2;
if(l < .5)
{
temp2 = l*(1.0+s);
}
else
{
temp2 = l+s-l*s;
}
temp1 = l*2.0-temp2;
float Rtemp3 = h+1.0/3.0;
if(Rtemp3 < 0.0)
{
Rtemp3 = Rtemp3+1.0;
}
else if(Rtemp3 > 1.0)
{
Rtemp3 = Rtemp3-1.0;
}
float Gtemp3 = h;
if(Gtemp3 < 0.0)
{
Gtemp3 = Gtemp3+1.0;
}
else if(Gtemp3 > 1.0)
{
Gtemp3 = Gtemp3-1.0;
}
float Btemp3 = h-1.0/3.0;
if(Btemp3 < 0.0)
{
Btemp3 = Btemp3+1.0;
}
else if(Btemp3 > 1.0)
{
Btemp3 = Btemp3-1.0;
}
if(6.0*Rtemp3 < 1.0)
{
rbg.x = temp1+(temp2-temp1)*6.0*Rtemp3;
}
else if(2.0*Rtemp3 < 1.0)
{
rbg.x = temp2;
}
else if(3.0*Rtemp3 < 2.0)
{
rbg.x = temp1+(temp2-temp1)*((2.0/3.0)-Rtemp3)*6.0;
}
else
{
rbg.x = temp1;
}
if(6.0*Gtemp3 < 1.0)
{
rbg.y = temp1+(temp2-temp1)*6.0*Gtemp3;
}
else if(2.0*Gtemp3 < 1.0)
{
rbg.y = temp2;
}
else if(3.0*Gtemp3 < 2.0)
{
rbg.y = temp1+(temp2-temp1)*((2.0/3.0)-Gtemp3)*6.0;
}
else
{
rbg.y = temp1;
}
if(6.0*Btemp3 < 1.0)
{
rbg.z = temp1+(temp2-temp1)*6.0*Btemp3;
}
else if(2.0*Btemp3 < 1.0)
{
rbg.z = temp2;
}
else if(3.0*Btemp3 < 2.0)
{
rbg.z = temp1+(temp2-temp1)*((2.0/3.0)-Btemp3)*6.0;
}
else
{
rbg.z = temp1;
}
return rbg;
}

integer start_face;
integer canal;

float hue;
float sat;
float lum;

vector vSize=<.3,.2,.01>;

key owner;

default
{
state_entry()
{
llSetLinkPrimitiveParamsFast(LINK_THIS,[
PRIM_SIZE, vSize,
PRIM_ROTATION,llEuler2Rot(<0.0,270.0,270.0>*DEG_TO_RAD),
PRIM_TYPE, PRIM_TYPE_BOX, PRIM_HOLE_SQUARE, <0,1,0>, 0.0, <0,0,0>, <.8,1,0>, <.0,0,0>,
PRIM_TEXTURE, ALL_SIDES, "5748decc-f629-461c-9a36-a35a221fe21f", <1,1,0>, <0,0,0>, 0.0,
PRIM_TEXTURE, 0, "404e4461-8a22-fbf7-7652-4b81dc7da325", <1,1,0>, <0,0,0>, 0.0,
PRIM_TEXTURE, 2, "01c02d68-dfb0-d907-7397-cba857c61144", <1,1,0>, <0,0,0>, -PI_BY_TWO
]);
lum = 0.5;
owner = llGetOwner();
canal = (integer)("0xA" + llGetSubString((string)owner, 0,6 ));
}

touch_start(integer num)
{
start_face = llDetectedTouchFace(0);
if(start_face == 4)
{
llSay(canal,(string)hsl_to_rbg(hue, sat, lum));
}
}

touch(integer num)
{
vector st = llDetectedTouchST(0);
integer face = llDetectedTouchFace(0);
if(start_face != face) return;
if(face == 0)
{
sat = st.y;
hue = st.x;
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,4, hsl_to_rbg(hue, sat, lum), 1.0]);
}
else if(face == 2)
{
lum = st.x;
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,4, hsl_to_rbg(hue, sat, lum), 1.0]);
}
}

changed(integer change)
{
if(change & CHANGED_OWNER)
{
llResetScript();
}
}
}



et dans l' objet....j' ai un peu enlevé des trucs inutiles.....


integer ownerTyping = 0;
key owner;
integer perm = 0;

string typingSound = "49ba126f-9128-b6de-b7ab-0c0973428441";//You can replace this sound UUID with your own sound UUID or place a sound in the root prim and paste the name here
float volume = 1.0;//volume of your typing sound can be 0.0 = no volume to 1.0 = full volume
vector color;//default color. Choose from colors above

string type = "typing";//the name of the typing animation in the inventory. You can replace the animation in the inventory and place the new name here.
//////////Particle/////////////
particleEffect()
{
llParticleSystem([//You can paste your own Particle Parameters Here and delete the parameters below.
//if you are familiar with how to change the parameter settings, you can do that below
PSYS_SRC_TEXTURE,llGetInventoryName(INVENTORY_TEXTURE,0),//drop a texture in the inventory to use with the provided particle effect
PSYS_PART_START_SCALE,<0.5,0.5,0.5>,
PSYS_PART_END_SCALE,<0.1,0.1,0.1>,
PSYS_PART_START_COLOR,color,
PSYS_PART_END_COLOR,color,
PSYS_PART_START_ALPHA,1.0,
PSYS_PART_END_ALPHA,0.5,
PSYS_SRC_BURST_PART_COUNT,2,
PSYS_SRC_BURST_RATE,0.05,
PSYS_PART_MAX_AGE,0.3,
PSYS_SRC_MAX_AGE,0.0,
PSYS_SRC_PATTERN,(integer)8,
PSYS_SRC_BURST_SPEED_MIN,0.1,
PSYS_SRC_BURST_SPEED_MAX,0.1,
PSYS_SRC_BURST_RADIUS,0.5,
PSYS_SRC_ANGLE_BEGIN,(float)0.0*PI,
PSYS_SRC_ANGLE_END,(float)1.0*PI,
PSYS_SRC_OMEGA,<0.0,0.0,0.0>,
PSYS_SRC_ACCEL,<0.0,0.0,-0.1>,
PSYS_PART_FLAGS,(0
|PSYS_PART_INTERP_COLOR_MASK
|PSYS_PART_INTERP_SCALE_MASK
|PSYS_PART_EMISSIVE_MASK)
]);
}

integer canal;
integer ecoute;


default
{
state_entry()
{
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,ALL_SIDES,<1.0,1.0,1.0>,0.0]);//sets the prim color and visibility to default
owner = llGetOwner();//gets the your avatar key for later use
llPreloadSound(typingSound);

canal = (integer)("0xA" + llGetSubString((string)owner, 0,6 ));
ecoute = llListen(canal, "","","");
color = <1.0,1.0,1.0>;
}

listen(integer ch, string name, key id, string msg)
{
color = ((vector)msg);
}


timer()
{
if((llGetAgentInfo(owner) & AGENT_TYPING) && !ownerTyping)
{
llStopSound();//stop the default typing sound
ownerTyping = 1;//set the flag to 1 (TRUE) so it recognizes you are typing and doesnt spam this portion of the script
llStopAnimation("type");//stop the default typing animation
llStartAnimation(type);//start your custom animation
llLoopSound(typingSound,volume);//play the typing sound at your chosen volume

particleEffect();//starts the particle effect
}

else if(!(llGetAgentInfo(owner) & AGENT_TYPING) && ownerTyping)
{
ownerTyping = 0;//set the flag to 0 (FALSE) so it recognizes you stopped typing and doesnt spam this portion of the script
llStopAnimation(type);//stop your custom typing animation
llStopSound();//stop your typing sound

llParticleSystem([]);//turns the particle effect off
}
}
changed(integer change)
{
if(change & CHANGED_OWNER)//owner has changed so reset the script and get a new owner
{
llResetScript();
}
}

attach(key id)
{
if(id != NULL_KEY)//you just attached this item so it goes invisible and no glow and no particle
{
llSetTimerEvent(0.25);//starts the timer to check whether you are typing or not now that the object is attached

llParticleSystem([]);//turns the particle effect off
llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION);
}
else//you just detached this item so it goes visible so you can see it if you dropped it on the ground
//it sets the color and makes the prim visible, but turns the glow off and the particle off
{
if(perm)
{
perm = 0;//permissions to animate your avatar have been removed
llStopAnimation(type);//stop the animation if in case you were typing when this was detached
}
llSetTimerEvent(0.0);//stop the timer so it doesnt respond while detached

llParticleSystem([]);//turns the particle effect off
}
}

run_time_permissions(integer perm)//the script has asked if it can animate your avatr when you attached this object to your avatar
{
if(perm & PERMISSION_TRIGGER_ANIMATION)
{
perm = 1;//permission granted
}
else
{
perm = 0;//permission denied
}
}
}
super
génial tout a fait cela que je recherche ... par contre il y a juste une chose que j'ai du mal a comprendre quand je porte le hud et que je tape dans le chat je vois bien ma particules par exemple verte ... si je met sur le hud la particules en rouge elle ne passe en rouge que quand j’arrête de taper et reprend , en gros le changement de couleur ne se fait pas instantanément
quand je change la couleurs sur le hud ..

Pense tu un moyen de régler cela ?

big thx en tout les cas pour ta patience
merci ManthaOH
est petite dernière chose et je ne t’embête plus ^^ avec un script comme celui la comment dois je le modifier pour l'utiliser avec le hud ?( ton script colors change plus haut )

L'avantage de celui la c'est que j'entre l'uuid de ma texture je te le colle si jamais tu a 2 mns pour me montrer quoi changer pour qu'il fonctionne avec le hud .

milles merci



Cliquez ce bouton ou survolez le contenu pour afficher le spoiler
// SECTION ONE: APPEARANCE -- These settings affect how each particle LOOKS.
integer glow = TRUE; // TRUE or FALSE(*)
vector startColor = <1,1,0>; // RGB color, black<0,0,0> to white<1,1,1>(*)
vector endColor = <1,1,1>; //
float startAlpha = 1.0; // 0.0 to 1.0(*), lower = more transparent
float endAlpha = 0.0; //
vector startSize = <7.5,7.5,0>; // <0.04,0.04,0>(min) to <10,10,0>(max>, <1,1,0>(*)
vector endSize = <5.5,5.5,0>; // (Z part of vector is discarded)
string texture = "fire-ring"; // Texture used for particles. Texture must be in prim's inventory.

// SECTION TWO: FLOW -- These settings affect how Many, how Quickly, and for how Long particles are created.
// Note,
integer count = 3; // Number of particles created per burst, 1(*) to 4096
float rate = 0.1; // Delay between bursts of new particles, 0.0 to 60, 0.1(*)
float age = 1.0; // How long each particle lives, 0.1 to 60, 10.0(*)
float life = 0.0; // When to stop creating new particles. never stops if 0.0(*)

// SECTION THREE: PLACEMENT -- Where are new particles created, and what direction are they facing?
float radius = 4.25; // 0.0(default) to 64? Distance from Emitter where new particles are created.
float innerAngle = 0.5; // "spread", for all ANGLE patterns, 0(default) to PI
float outerAngle = 0; // "tilt", for ANGLE patterns, 0(default) to TWO_PI, can use PI_BY_TWO or PI as well.
integer pattern = PSYS_SRC_PATTERN_EXPLODE; // Choose one of the following:
// PSYS_SRC_PATTERN_EXPLODE (sends particles in all directions)
// PSYS_SRC_PATTERN_DROP (ignores minSpeed and maxSpeed. Don't bother with count>1 )
// PSYS_SRC_PATTERN_ANGLE_CONE (set innerangle/outerange to make rings/cones of particles)
// PSYS_SRC_PATTERN_ANGLE (set innerangle/outerangle to make flat fanshapes of particles)
vector omega = <0,0,0>; // How much to rotate the emitter around the <X,Y,Z> axises. <0,0,0>(*)
// Warning, there's no way to RESET the emitter direction once you use Omega!!
// You must attach the script to a new prim to clear the effect of omega.

// SECTION FOUR: MOVEMENT -- How do the particles move once they're created?
integer followSource = TRUE; // TRUE or FALSE(*), Particles move as the emitter moves, (TRUE disables radius!)
integer followVel = TRUE; // TRUE or FALSE(*), Particles rotate towards their direction
integer wind = FALSE; // TRUE or FALSE(*), Particles get blown away by wind in the sim
integer bounce = FALSE; // TRUE or FALSE(*), Make particles bounce on Z altitude of emitter
float minSpeed = 0.3; // 0.01 to ? Min speed each particle is spit out at, 1.0(*)
float maxSpeed = 0.2; // 0.01 to ? Max speed each particle is spit out at, 1.0(*)
vector push = <0,0,0>; // Continuous force pushed on particles, use small settings for long lived particles
key target = "self"; // Select a target for particles to arrive at when they die
// can be "self" (emitter), "owner" (you), "" or any prim/persons KEY.
integer interpColor = TRUE; // Go from start to end color
integer interpSize = TRUE; // Go from start to end size

// SECTION FIVE: Ama's "Create Short Particle Settings List"
integer enableoutput = FALSE; // If this is TRUE, clicking on your emitter prim will cause it to speak
// very terse "shorthand" version of your particle settings. You can cut'n'paste
// this abbreviated version into a call to llParticleSystem([ ]); in another script.
// Pros: Takes up far less scripting space, letting you focus on the rest of your code.
// Cons: makes tune your settings afterwards rather awkward

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
]);
}

string smoke_texture = texture;

MakeSmoke(string xTexture) //This is the function that actually starts the particle system.
{
llParticleSystem([ //KPSv1.0
PSYS_PART_FLAGS , 0 //Comment out any of the following masks to deactivate them
//| PSYS_PART_BOUNCE_MASK //Bounce on object's z-axis
//| PSYS_PART_WIND_MASK //Particles are moved by wind
| 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_SRC_MASK //Particles follow the emitter
//| PSYS_PART_FOLLOW_VELOCITY_MASK //Particles are created at the velocity of the emitter
//| PSYS_PART_TARGET_POS_MASK //Particles follow the target
| PSYS_PART_EMISSIVE_MASK //Particles are self-lit (glow)
//| PSYS_PART_TARGET_LINEAR_MASK //Undocumented--Sends particles in straight line?
,

//PSYS_SRC_TARGET_KEY , NULL_KEY, //Key of the target for the particles to head towards
//This one is particularly finicky, so be careful.
//Choose one of these as a pattern:
//PSYS_SRC_PATTERN_DROP Particles start at emitter with no velocity
//PSYS_SRC_PATTERN_EXPLODE Particles explode from the emitter
//PSYS_SRC_PATTERN_ANGLE Particles are emitted in a 2-D angle
//PSYS_SRC_PATTERN_ANGLE_CONE Particles are emitted in a 3-D cone
//PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY Particles are emitted everywhere except for a 3-D cone

PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_ANGLE_CONE
,PSYS_SRC_TEXTURE, xTexture //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, 10.0 //Lifetime, in seconds, that a particle lasts
,PSYS_SRC_BURST_RATE, 0.2 //How long, in seconds, between each emission
,PSYS_SRC_BURST_PART_COUNT, 15 //Number of particles per emission
,PSYS_SRC_BURST_RADIUS, 0.1 //Radius of emission
,PSYS_SRC_BURST_SPEED_MIN, 0.1 //Minimum speed of an emitted particle
,PSYS_SRC_BURST_SPEED_MAX, 0.3 //Maximum speed of an emitted particle
,PSYS_SRC_ACCEL, <0.0,0.0,0.01> //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.4 //Starting transparency, 1 is opaque, 0 is transparent.
,PSYS_PART_END_ALPHA, 0.0 //Ending transparency
,PSYS_PART_START_SCALE, <0.1,0.1,1.0> //Starting particle size
,PSYS_PART_END_SCALE, <1.0,1.0,1.0> //Ending particle size, if INTERP_SCALE_MASK is on
,PSYS_SRC_ANGLE_BEGIN, 0.1 //Inner angle for ANGLE patterns
,PSYS_SRC_ANGLE_END, 0.11 //Outer angle for ANGLE patterns
,PSYS_SRC_OMEGA, <0.0,0.0,0.0> //Rotation of ANGLE patterns, similar to llTargetOmega()
]);
}

SprayParticles(string xTexture) //This is the function that actually starts the particle system.
{
llParticleSystem([ //KPSv1.0
PSYS_PART_FLAGS , 0 //Comment out any of the following masks to deactivate them
//| PSYS_PART_BOUNCE_MASK //Bounce on object's z-axis
//| PSYS_PART_WIND_MASK //Particles are moved by wind
| 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_SRC_MASK //Particles follow the emitter
//| PSYS_PART_FOLLOW_VELOCITY_MASK //Particles are created at the velocity of the emitter
| PSYS_PART_TARGET_POS_MASK //Particles follow the target
| PSYS_PART_EMISSIVE_MASK //Particles are self-lit (glow)
//| PSYS_PART_TARGET_LINEAR_MASK //Undocumented--Sends particles in straight line?
,

PSYS_SRC_TARGET_KEY , llGetKey(), //Key of the target for the particles to head towards
//This one is particularly finicky, so be careful.
//Choose one of these as a pattern:
//PSYS_SRC_PATTERN_DROP Particles start at emitter with no velocity
//PSYS_SRC_PATTERN_EXPLODE Particles explode from the emitter
//PSYS_SRC_PATTERN_ANGLE Particles are emitted in a 2-D angle
//PSYS_SRC_PATTERN_ANGLE_CONE Particles are emitted in a 3-D cone
//PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY Particles are emitted everywhere except for a 3-D cone

PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_EXPLODE

,PSYS_SRC_TEXTURE, xTexture //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, 60.0 //Lifetime, in seconds, that a particle lasts
,PSYS_SRC_BURST_RATE, 0.02 //How long, in seconds, between each emission
,PSYS_SRC_BURST_PART_COUNT, 6 //Number of particles per emission
,PSYS_SRC_BURST_RADIUS, 0.2 //Radius of emission
,PSYS_SRC_BURST_SPEED_MIN, 0.9 //Minimum speed of an emitted particle
,PSYS_SRC_BURST_SPEED_MAX, 1.8 //Maximum speed of an emitted particle
,PSYS_SRC_ACCEL, <0.0,0.0,0.0> //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.4 //Starting transparency, 1 is opaque, 0 is transparent.
,PSYS_PART_END_ALPHA, 0.0 //Ending transparency
,PSYS_PART_START_SCALE, <10.0, 10.0, 10.0> //Starting particle size
,PSYS_PART_END_SCALE, <0,0,0.0> //Ending particle size, if INTERP_SCALE_MASK is on
,PSYS_SRC_ANGLE_BEGIN, PI //Inner angle for ANGLE patterns
,PSYS_SRC_ANGLE_END, PI //Outer angle for ANGLE patterns
,PSYS_SRC_OMEGA, <0.0,5.0,5.0> //Rotation of ANGLE patterns, similar to llTargetOmega()
]);
}


default
{
state_entry()
{
updateParticles();
llListen(0, "", llGetOwner(), "");
}
touch(integer num_detected)
{
state default2;
}
listen(integer channel, string name, key id, string message)
{
if(llToLower(message) == "staroff")
{
state off;
}
}
}

state default2
{
state_entry()
{
SprayParticles(smoke_texture);
llSetTimerEvent(15.0);
llListen(0, "", llGetOwner(), "");
}
timer()
{
state default;
}
touch(integer num_detected)
{
state default;
}
listen(integer channel, string name, key id, string message)
{
if(llToLower(message) == "staroff")
{
state off;
}
}
}
state off
{
state_entry()
{
llParticleSystem([]);
llListen(0, "", llGetOwner(), "");
}
listen(integer channel, string name, key id, string message)
{
if(llToLower(message) == "staron")
{
state default;
}
}
}
re....bon, j' ai encore viré qlq trucs inutiles, ya surement moyen de faire mieux, mais plus trop le temps...ça, ça devrait marcher....avec le HUD d' avant.....



// SECTION ONE: APPEARANCE -- These settings affect how each particle LOOKS.
integer glow = TRUE; // TRUE or FALSE(*)
vector color; // RGB color, black<0,0,0> to white<1,1,1>(*)
//vector endColor = color; //
float startAlpha = 1.0; // 0.0 to 1.0(*), lower = more transparent
float endAlpha = 0.0; //
vector startSize = <7.5,7.5,0>; // <0.04,0.04,0>(min) to <10,10,0>(max>, <1,1,0>(*)
vector endSize = <5.5,5.5,0>; // (Z part of vector is discarded)
string texture = "fire-ring"; // Texture used for particles. Texture must be in prim's inventory.

// SECTION TWO: FLOW -- These settings affect how Many, how Quickly, and for how Long particles are created.
// Note,
integer count = 3; // Number of particles created per burst, 1(*) to 4096
float rate = 0.1; // Delay between bursts of new particles, 0.0 to 60, 0.1(*)
float age = 1.0; // How long each particle lives, 0.1 to 60, 10.0(*)
float life = 0.0; // When to stop creating new particles. never stops if 0.0(*)

// SECTION THREE: PLACEMENT -- Where are new particles created, and what direction are they facing?
float radius = 4.25; // 0.0(default) to 64? Distance from Emitter where new particles are created.
float innerAngle = 0.5; // "spread", for all ANGLE patterns, 0(default) to PI
float outerAngle = 0; // "tilt", for ANGLE patterns, 0(default) to TWO_PI, can use PI_BY_TWO or PI as well.
integer pattern = PSYS_SRC_PATTERN_EXPLODE; // Choose one of the following:

vector omega = <0,0,0>; // How much to rotate the emitter around the <X,Y,Z> axises. <0,0,0>(*)

integer followSource = TRUE; // TRUE or FALSE(*), Particles move as the emitter moves, (TRUE disables radius!)
integer followVel = TRUE; // TRUE or FALSE(*), Particles rotate towards their direction
integer wind = FALSE; // TRUE or FALSE(*), Particles get blown away by wind in the sim
integer bounce = FALSE; // TRUE or FALSE(*), Make particles bounce on Z altitude of emitter
float minSpeed = 0.3; // 0.01 to ? Min speed each particle is spit out at, 1.0(*)
float maxSpeed = 0.2; // 0.01 to ? Max speed each particle is spit out at, 1.0(*)
vector push = <0,0,0>; // Continuous force pushed on particles, use small settings for long lived particles
key target = "self"; // Select a target for particles to arrive at when they die
// can be "self" (emitter), "owner" (you), "" or any prim/persons KEY.
integer interpColor = TRUE; // Go from start to end color
integer interpSize = TRUE; // Go from start to end size

// SECTION FIVE: Ama's "Create Short Particle Settings List"
integer enableoutput = FALSE; // If this is TRUE, clicking on your emitter prim will cause it to speak

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, color,
PSYS_PART_END_COLOR, color,
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
]);
}


SprayParticles(string xTexture) //This is the function that actually starts the particle system.
{
llParticleSystem([ //KPSv1.0
PSYS_PART_FLAGS , 0 //Comment out any of the following masks to deactivate them
//| PSYS_PART_BOUNCE_MASK //Bounce on object's z-axis
//| PSYS_PART_WIND_MASK //Particles are moved by wind
| 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_SRC_MASK //Particles follow the emitter
//| PSYS_PART_FOLLOW_VELOCITY_MASK //Particles are created at the velocity of the emitter
| PSYS_PART_TARGET_POS_MASK //Particles follow the target
| PSYS_PART_EMISSIVE_MASK //Particles are self-lit (glow)
//| PSYS_PART_TARGET_LINEAR_MASK //Undocumented--Sends particles in straight line?
,

PSYS_SRC_TARGET_KEY , llGetKey(), //Key of the target for the particles to head towards

PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_EXPLODE

,PSYS_SRC_TEXTURE, xTexture //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, 60.0 //Lifetime, in seconds, that a particle lasts
,PSYS_SRC_BURST_RATE, 0.2 //How long, in seconds, between each emission
,PSYS_SRC_BURST_PART_COUNT, 6 //Number of particles per emission
,PSYS_SRC_BURST_RADIUS, 0.2 //Radius of emission
,PSYS_SRC_BURST_SPEED_MIN, 0.9 //Minimum speed of an emitted particle
,PSYS_SRC_BURST_SPEED_MAX, 1.8 //Maximum speed of an emitted particle
,PSYS_SRC_ACCEL, <0.0,0.0,0.0> //Acceleration of particles each second
,PSYS_PART_START_COLOR, color //Starting RGB color
,PSYS_PART_END_COLOR, color //Ending RGB color, if INTERP_COLOR_MASK is on
,PSYS_PART_START_ALPHA, 0.4 //Starting transparency, 1 is opaque, 0 is transparent.
,PSYS_PART_END_ALPHA, 0.0 //Ending transparency
,PSYS_PART_START_SCALE, <10.0, 10.0, 10.0> //Starting particle size
,PSYS_PART_END_SCALE, <0,0,0.0> //Ending particle size, if INTERP_SCALE_MASK is on
,PSYS_SRC_ANGLE_BEGIN, PI //Inner angle for ANGLE patterns
,PSYS_SRC_ANGLE_END, PI //Outer angle for ANGLE patterns
,PSYS_SRC_OMEGA, <0.0,5.0,5.0> //Rotation of ANGLE patterns, similar to llTargetOmega()
]);
}

string smoke_texture = texture;

key owner;
integer canal;
integer ecoute;


default
{
state_entry()
{
color = <1.0,1.0,1.0>;
updateParticles();
llListen(0, "", owner, "");
owner = llGetOwner();
canal = (integer)("0xA" + llGetSubString((string)owner, 0,6 ));
ecoute = llListen(canal, "","","");
}

touch_end(integer num_detected)
{
state default2;
}

listen(integer channel, string name, key id, string message)
{
if(channel == 0)
{
if(llToLower(message) == "staroff")
{
state off;
}
}
else if (channel == canal)
{
llParticleSystem([]);
color = (vector)message;
updateParticles();
}
}
}



state default2
{
state_entry()
{
SprayParticles(smoke_texture);
llSetTimerEvent(15.0);
llListen(0, "", llGetOwner(), "");
ecoute = llListen(canal, "",owner,"");
}

timer()
{
llSetTimerEvent(0.0);
state default;
}

touch_end(integer num_detected)
{
state default;
}

listen(integer channel, string name, key id, string message)
{
if(channel == 0)
{
if(llToLower(message) == "staroff")
{
state off;
}
}
else if (channel == canal)
{
color = (vector)message;
}
}
}



state off
{
state_entry()
{
llParticleSystem([]);
llListen(0, "", llGetOwner(), "");
ecoute = llListen(canal, "",owner,"");
}
listen(integer channel, string name, key id, string message)
{
if(channel == 0)
{
if(llToLower(message) == "staron")
{
state default;
}
}
else if (channel == canal)
{
color = (vector)message;
}
}
}
Répondre

Connectés sur ce fil

 
1 connecté (0 membre et 1 invité) Afficher la liste détaillée des connectés