Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

need help for direct particles to other avie

Marcha Chaika
Registered User
Join date: 2 Apr 2006
Posts: 5
10-08-2006 09:08
i need help how i can let particle effects go to an other avie and then not by manuel put the key off the avator but that the script find the key
so like this for example i type fire Marcha Chaika and then the particles go to that person pls somebodey help me i am stuck in this
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
10-08-2006 09:23
You need to use a sensor. The easiest would be to have the user enter the exact name of the avatar you wish to target, and then run a sensor scan for that name. The sensor event will contain the key of the avatar, and then you can use that to target the particles. If no one is found that matches that name, the no_sensor event will be returned.

Look up sensors in the Wiki.
Marcha Chaika
Registered User
Join date: 2 Apr 2006
Posts: 5
10-09-2006 18:26
ty verry much ziggy but hehe that whas what i not can get done i wisch i coud see a small example like how i put it and then direct to the command poof?
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
10-10-2006 06:48
From: Marcha Chaika
ty verry much ziggy but hehe that whas what i not can get done i wisch i coud see a small example like how i put it and then direct to the command poof?



If you want us to write your code for you just ask.....

CODE

// Newgates Poofie
// based on Particle Script 0.5 Created by Ama Omega
// A lot of the script is redundant but is retaiend for future development.
//
//
// Mask Flags - set to TRUE to enable
integer glow = TRUE; // 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 = TRUE; // 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_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 TargetId = "";
string TargetName;

// Particle paramaters
float age = 5; // Life of each particle
float maxSpeed = 5; // 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 = 1; // Start alpha (transparency) value
float endAlpha = 1; // End alpha (transparency) value
vector startColor = <1,1,1>; // Start color of particles <R,G,B>
vector endColor = <1,1,1>; // End color of particles <R,G,B> (if interpColor == TRUE)
vector startSize = <1,1,1>; // Start size of particles
vector endSize = <1,1,1>; // End size of particles (if interpSize == TRUE)
vector push = <1,1,1>; // Force pushed on particles

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

integer flags;
list sys;

integer i;

integer Channel = 9;

updateParticles()
{
Texture = llGetInventoryName(INVENTORY_TEXTURE, 0);
flags = 0;

if (TargetName == "owner") TargetId = llGetOwner();
if (TargetName == "self") TargetId = 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 (TargetId != NULL_KEY) 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,TargetId,
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);
}

Init()
{
llParticleSystem([ ]);
llOwnerSay(llGetScriptName() + " Running. Use /"+(string)Channel + " TargetName to activate");
llListen(Channel,"",llGetOwner(),"");
}

ClearTarget()
{
llParticleSystem([ ]);
Texture = "";
TargetName = "";
}

default
{
state_entry()
{
Init();
}

on_rez(integer number)
{
Init();
}

timer()
{
ClearTarget();
llSetTimerEvent(0);
}

listen(integer channel, string name, key id, string message)
{
list ldata = llParseString2List(message, [" "], [""]);
string firstName = llList2String(ldata,0);
string secondName = llList2String(ldata,1);
if( (firstName == "Me") || (firstName == "Owner") || (firstName == "me") || (firstName == "owner") )
{
TargetName = "owner";
updateParticles();
llSetTimerEvent(5);
}
else
{
TargetName = firstName;
if(llStringLength(secondName) > 0)
{
TargetName += " " + secondName;
}
llSensor("", "", AGENT, 25, PI);
}
}

sensor(integer total_number)
{
integer len = llStringLength(TargetName);
integer found = 0;
for(i = 0;i < total_number;i++)
{
key id = llDetectedKey(i);
string name = llKey2Name(id);
// Check for a name match with that entered by the user
// Just match the first few characters
string str = llGetSubString(name, 0, len - 1);
string str2 = llGetSubString(TargetName, 0, len - 1);
if(str == str2)
{
TargetId = id;
updateParticles();
found = 1;
llSetTimerEvent(5);
}
}
if(found == 0)
{
llOwnerSay("Sorry But I could not find " + TargetName);
llParticleSystem([ ]);
}
}

}
Marcha Chaika
Registered User
Join date: 2 Apr 2006
Posts: 5
10-10-2006 07:20
TY TY TY ziggy and newgate verry friendlie to help i hope in futere i not to stupppid to make things self good:D