[LSL]The teleport With Particle script hack

Standard

SIM内テレポーター with Particle

*sitした時にパーティクルが発生するように修正。

//–The teleport With Particle script 1.0 START–
// Only in a identical SIM functions,
// You can set a your favorite sit pose and the particle is generated.
// C4u,01,02,2009

//You have to chage this line
//Write the animation name put into contents
string gAni_n = “HERO1-4″;

//You have to chage this line
//Set animation position
//<back and front position, right and left position, top and bottom position>
vector mSitPos = <0.0,0.0,0.8>;

rotation mSitRot = ZERO_ROTATION;
string mSitText = “Teleport”;

key mAvatar = NULL_KEY;
integer mRun = FALSE;
integer mListenHandle = 0;
integer mListenChannel = -1;

//You have to chage this line
//Write teleport place name
list mTeleport = [
"place1",
"place2"
];

//You have to chage this line
//Write location of the place
list mTeleportPoint = [
<112.0,115.0,21>,
<142.0,145.0,21>
];

teleport( vector destpos ) {
integer jumps = (integer)(llVecDist(destpos, llGetPos()) / 10.0) + 1;
list rules = [ PRIM_POSITION, destpos ];
integer count = 1;
while ( ( count = count << 1 ) < jumps){
rules = (rules=[]) + rules + rules;
}
llSetPrimitiveParams( rules + llList2List( rules, (count – jumps) << 1, count) );
}

default {
state_entry(){
llSitTarget(mSitPos,mSitRot);
llSetSitText(mSitText);
mRun = FALSE;
}

on_rez(integer start_param){
llResetScript();
}

changed(integer change){
if (change & CHANGED_LINK){
llSleep(0.5);
mAvatar = llAvatarOnSitTarget();
if (mAvatar != NULL_KEY) {

//Genoa add Start
llParticleSystem( [
PSYS_PART_START_ALPHA, 1.0,
PSYS_PART_END_ALPHA, 0.0,
PSYS_PART_START_COLOR ,<0,1,1>,
PSYS_PART_START_SCALE,< 3.0, 3.0, 0 >,
PSYS_SRC_BURST_PART_COUNT,3,
PSYS_SRC_BURST_RATE,4.0,
PSYS_PART_MAX_AGE,3.9,
PSYS_SRC_PATTERN,PSYS_SRC_PATTERN_DROP,
PSYS_PART_FLAGS,PSYS_PART_INTERP_COLOR_MASK
] );
//Genoa add End

llRequestPermissions(mAvatar, PERMISSION_TRIGGER_ANIMATION); //Genoa add
llStartAnimation(gAni_n); //Genoa add
mListenHandle = llListen(mListenChannel,””,NULL_KEY,””);
llDialog(mAvatar, “Where you go?”,mTeleport,mListenChannel);
llSetTimerEvent(30);
}
}
}

timer(){
llParticleSystem([]); //Genoa add
llWhisper(0,”Timeout!”);
llSetTimerEvent(0);
llUnSit(mAvatar);
mAvatar = NULL_KEY;
llListenRemove(mListenHandle);
}

//Genoa add START
run_time_permissions(integer perm)
{

key perm_key = llGetPermissionsKey();

if (perm_key == mAvatar)
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
list anms = llGetAnimationList(mAvatar);
integer i;
for (i = 0; i < llGetListLength(anms); i++)
{
llStopAnimation(llList2Key(anms, i));
}
llStartAnimation(gAni_n);

}
}
}
//Genoa add END

listen(integer channel, string name, key id, string message){
if (channel == mListenChannel){
if (id == mAvatar){
llSetTimerEvent(0);
llListenRemove(mListenHandle);
integer tid = llListFindList(mTeleport, [message]);
if (tid != -1){
vector orgPoint = llGetPos();
llWhisper(0,”Teleport to ” + message + “, please wait.”);
mRun = TRUE;
teleport(llList2Vector(mTeleportPoint,tid));
llWhisper(0,”Teleport complete.”);
llUnSit(mAvatar);
llStopAnimation(gAni_n); //Genoa add
llParticleSystem([]); //Genoa add
teleport(orgPoint);
}else{
llWhisper(0,”Teleporter received a illegal message!”);
llUnSit(mAvatar);
llStopAnimation(gAni_n); //Genoa add
llParticleSystem([]); //Genoa add
mAvatar = NULL_KEY;
}
}
}
}
}

//Special thanks BlackSheep-LSL@Wiki
//–The teleport With Particle script END–

[参考]

BlackSheep-LSL@Wiki
LSL Portal – SL Wiki

[LSL]The teleport script hack

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s