Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Shooting particles towards prim - how to?

Drahreg Flynn
Registered User
Join date: 23 Apr 2008
Posts: 2
05-01-2009 15:09
Hello,

I created a particle script shooting particles towards owner - now I want it to shoot particles at a prim specified in script. I already added key of the prim, but don't know how to set PSYS_PART_TARGET_POS_MASK correctly. And what changes have to be made to the code itself in order not to shoot at owner, but at prim?

Thanks a lot for help!!


ParticleStart(key target)
{
llParticleSystem([
PSYS_PART_FLAGS, 483,
PSYS_SRC_PATTERN, 2,
PSYS_PART_START_ALPHA, 1.00,
PSYS_PART_END_ALPHA, 0.00,
PSYS_PART_START_COLOR, <1.00,0.00,1.00>,
PSYS_PART_END_COLOR, <1.00,1.00,0.00>,
PSYS_PART_START_SCALE, <0.25,0.25,0.00>,
PSYS_PART_END_SCALE, <1.00,1.00,0.00>,
PSYS_PART_MAX_AGE, 0.85,
PSYS_SRC_MAX_AGE, 0.00,
PSYS_SRC_ACCEL, <0.00,0.00,2.00>,
PSYS_SRC_ANGLE_BEGIN, 0.00,
PSYS_SRC_ANGLE_END, 0.70,
PSYS_SRC_BURST_PART_COUNT, 5,
PSYS_SRC_BURST_RADIUS, 0.10,
PSYS_SRC_BURST_RATE, 0.05,
PSYS_SRC_BURST_SPEED_MIN, 0.00,
PSYS_SRC_BURST_SPEED_MAX, 0.40,
PSYS_SRC_OMEGA, <0.00,0.00,0.00>,
PSYS_SRC_TEXTURE, "",
PSYS_SRC_TARGET_KEY, "afad565e-441d-5e30-b5ce-65f479f0503e",
PSYS_PART_TARGET_POS_MASK
]);

}

default
{
state_entry()
{
ParticleStart(llGetOwner());

}
}
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
05-01-2009 15:49
When you ran that, there should have been one of those error icons over the object. Click those to find out what is wrong.

In this case it says "Object: PSYS error: Rule 21 error, PSYS_SRC_TARGET_KEY needs key data."

For your sample, the fix would be:

PSYS_SRC_TARGET_KEY, (key)"afad565e-441d-5e30-b5ce-65f479f0503e",

LSL is cruel like that, sometimes it pretends that keys and strings are the same thing, other times it cares about the difference.
Drahreg Flynn
Registered User
Join date: 23 Apr 2008
Posts: 2
05-01-2009 16:36
You're right, it works! Thanks a lot!!!
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
05-01-2009 17:15
beware now, if you ever delete and/or re-rez the target, the key will change, so you may want to use a listen event on a specific channel. and in the target have it say a message on that channel so it can get the target that way.

in the particle source:
CODE

ParticleStart(key target)
llParticleSystem([
particle params...
blah blah blah
PSYS_SRC_TARGET_KEY, target,
}

default
{
state_entry()
{
llListen(-654,"target", NULL_KEY,"hello");///listens for the message "hello" from a target named "target" on channel -654
}

listen(integer chan, string name, key id, string str)
(
ParticleStart(id)
}
}


and then in the target

CODE

default
{
on_rez(integer param)
{
llSay(-654,"hello);//you can also use llRegionSay to make sure it's heard anywhere in the sim
}
}

}
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369