Difference between revisions of "Multirezzer"
Jump to navigation
Jump to search
m (<pre> tags) |
m (<lsl> tag to <source>) |
||
(6 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{LSL Header}} | |||
==Description/Information== | ==Description/Information== | ||
Rezzes up to ten objects upon [[ | Rezzes (Spawns) up to ten objects upon [[Collision_start|collision]] with a user. Each object can be a maximum of 10 meters away from the rez point on any plane. | ||
To make the rezzings occur on something other than a collision, change collision_start on line 25 to touch_start or another acceptable command. | |||
==Script== | ==Script== | ||
Line 10: | Line 9: | ||
<!--Make sure to not copy the <pre> tags into Second Life.--> | <!--Make sure to not copy the <pre> tags into Second Life.--> | ||
< | <source lang="lsl2"> | ||
vector velocity; | vector velocity; | ||
integer shot = FALSE; | integer shot = FALSE; | ||
Line 56: | Line 55: | ||
llRezObject( "Object", llGetPos()+<0,0,9>, <0,0,0>, <0,0,0,1>, i ); | llRezObject( "Object", llGetPos()+<0,0,9>, <0,0,0>, <0,0,0,1>, i ); | ||
llRezObject( "Object", llGetPos()+<0,0,-9>, <0,0,0>, <0,0,0,1>, i ) | llRezObject( "Object", llGetPos()+<0,0,-9>, <0,0,0>, <0,0,0,1>, i ); | ||
integer i; | integer i; | ||
}} | }} | ||
Line 82: | Line 81: | ||
} | } | ||
} | } | ||
</ | </source> | ||
{{LSLC|Library|Multirezzer}} | {{LSLC|Library|Multirezzer}} |
Latest revision as of 23:11, 24 January 2015
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Description/Information
Rezzes (Spawns) up to ten objects upon collision with a user. Each object can be a maximum of 10 meters away from the rez point on any plane.
To make the rezzings occur on something other than a collision, change collision_start on line 25 to touch_start or another acceptable command.
Script
vector velocity;
integer shot = FALSE;
integer fade = FALSE;
float alpha = 1.0;
default
{
state_entry()
{
llSetStatus(STATUS_DIE_AT_EDGE, TRUE);
}
on_rez(integer start_param)
{
llSetStatus(STATUS_DIE_AT_EDGE, TRUE);
llSetBuoyancy(1.0);
llCollisionSound("", 1.0); // Disable collision sounds
velocity = llGetVel();
float vmag;
vmag = llVecMag(velocity);
if (vmag > 0.1) shot = TRUE;
llSetTimerEvent(0.0);
}
collision_start(integer num)
{
if (llDetectedType(0) & AGENT)
{
// llTriggerSound("frozen", 1.0);
llRezObject(">:) invisible", llDetectedPos(0), ZERO_VECTOR, llGetRot(), 0);
{
integer i;
for ( i=0; i<num; i++ ) {
llRezObject( "Object", llGetPos()+<3,3,2>, <0,0,0>, <0,0,0,1>, i );
llRezObject( "Object", llGetPos()+<-3,-3,2>, <0,0,0>, <0,0,0,1>, i );
llRezObject( "Object", llGetPos()+<-3,3,2>, <0,0,0>, <0,0,0,1>, i );
llRezObject( "Object", llGetPos()+<3,-3,2>, <0,0,0>, <0,0,0,1>, i );
llRezObject( "Object", llGetPos()+<-8,0,2>, <0,0,0>, <0,0,0,1>, i );
llRezObject( "Object", llGetPos()+<8,0,2>, <0,0,0>, <0,0,0,1>, i );
llRezObject( "Object", llGetPos()+<0,-8,2>, <0,0,0>, <0,0,0,1>, i );
llRezObject( "Object", llGetPos()+<0,8,2>, <0,0,0>, <0,0,0,1>, i );
llRezObject( "Object", llGetPos()+<0,0,9>, <0,0,0>, <0,0,0,1>, i );
llRezObject( "Object", llGetPos()+<0,0,-9>, <0,0,0>, <0,0,0,1>, i );
integer i;
}}
}
}
timer()
{
if (!fade)
{
if (shot)
{
llDie();
}
}
else
{
llSetAlpha(alpha, -1);
alpha = alpha * 0.95;
if (alpha < 0.1)
{
llDie();
}
}
}
}