02-19-2013, 01:46 AM
How-to/Info:
•Copy paste the script below into a new script inworld.
•Save it & then put the script into two different objects.
•Pick up the two object and make sure they have different names.
•Rez both of the portals and then sit on one.
(It will delete the old portal if you rez one with the same name)
•System is using sitpos to ‘teleport’ user, so is limited by sitpos distances.
(300m normally, 520m by using a rotation trick which we use in this example;)
•Copy paste the script below into a new script inworld.
•Save it & then put the script into two different objects.
•Pick up the two object and make sure they have different names.
•Rez both of the portals and then sit on one.
(It will delete the old portal if you rez one with the same name)
•System is using sitpos to ‘teleport’ user, so is limited by sitpos distances.
(300m normally, 520m by using a rotation trick which we use in this example;)
PHP Code:
//•/•/•/•/•/•/•/Ð/A/M/E/N/•/H/A/X/•/•/•/•/•/•/•/•/•//
//Do not sell this; Karma knowz where you live ☠
//I've changed this from the Original version by Shadoskill Heckroth
//Extended range to 520m, modified effects
key Owner;
key Target = NULL_KEY;
integer Channel = -5055505;
integer Handle;
rotation TargetRot;
vector tPos = ZERO_VECTOR;
vector offsetVector= <0.57735, 0.57735, 0.57735>;
integer set = FALSE;
string Animation;
key SoundEffect = "be0cd87b-ae95-2fb5-6250-dcdd4d2ce732";
float Volume = 1.0;//0.00 to 1.00
//Made some particle values global, allowing us to change values then recall Particles(); function
float pRadius = 1.25;//if using for eg; a 3m round shape, you will want particle 1/2 the size
//so for my example @ 3m, i want particle radius slightly under 1.5, so fitting into the round shape
vector pStartColor = <0.226,1.000,0.716>;
vector pEndColor = <0.0,0.0,0.0>;
Particles(){
llParticleSystem([
PSYS_PART_MAX_AGE, 2.0,
PSYS_PART_FLAGS, 323,
PSYS_PART_START_COLOR, pStartColor,
PSYS_PART_END_COLOR, pEndColor,
PSYS_PART_START_SCALE, <0.04, 0.04, FALSE>,
PSYS_PART_END_SCALE, <1, 1, FALSE>,
PSYS_SRC_PATTERN, 2,
PSYS_SRC_BURST_RATE,0.001000,
PSYS_SRC_ACCEL,<0.00000, 0.00000, 0.00000>,
PSYS_SRC_BURST_PART_COUNT,99,
PSYS_SRC_BURST_RADIUS,pRadius,
PSYS_SRC_BURST_SPEED_MIN,0.100000,
PSYS_SRC_BURST_SPEED_MAX,0.200000,
PSYS_SRC_INNERANGLE,3.141593,
PSYS_SRC_OUTERANGLE,6.283185,
PSYS_SRC_OMEGA,<0.00000, 0.00000, 0.00000>,
PSYS_SRC_MAX_AGE,0.000000,
PSYS_PART_START_ALPHA,1.000000,
PSYS_PART_END_ALPHA,0.000000,
PSYS_SRC_TEXTURE, "",
PSYS_SRC_TARGET_KEY,llGetKey()
]);
}
//
rotation spin;
vector data(vector offset){
spin = llRotBetween(offsetVector,llVecNorm(offset));
vector new = llVecMag(offset) * offsetVector;
return new;
}
SetTarget(){
vector Pos = llGetPos();
vector oTarget = tPos + offsetVector;
if(tPos.x > 0.0 && tPos.x < 256.0 && tPos.y > 0.0 && tPos.y < 256.0 && tPos.z > 0.0){
vector st = data((oTarget-llGetPos())/llGetRot());
if(llVecMag(st) < 519.615235){
llSitTarget(st,ZERO_ROTATION / spin);
llOwnerSay( "/me : Position Locked : ");
}else{
llOwnerSay("/me : Self-Deleting : Distance Limit = 520m");
llDie();
}
}else{
llOwnerSay("/me : Self-Deleting : Portals are only functional if within the same region.");
llDie();
}
}
//
default{
//
state_entry(){
Owner = llGetOwner();
Particles();
llSetSitText("Teleport");
Handle = llListen(Channel,"","","");
Animation = llGetInventoryName(INVENTORY_ANIMATION,0);
llRegionSay(Channel, "Portal");
}
//
changed(integer change){
if(change & CHANGED_LINK){llTriggerSound(SoundEffect,Volume);
key sitter = llAvatarOnSitTarget();
if(sitter != NULL_KEY){
llRequestPermissions(sitter, PERMISSION_TRIGGER_ANIMATION);
llStartAnimation(Animation);
rotation Rot = llGetRot();
llSetRot(spin);
llSleep(llGetRegionTimeDilation()+1);//timedil check to avoid odd unsit experience(s() in laggy times)
llUnSit(llAvatarOnSitTarget());
llSetRot(Rot);
}
}
}
//
listen( integer channel, string name, key id, string message ){
if (id == llGetOwner()||llGetOwnerKey( id) == Owner){
Target = id;
tPos = llList2Vector(llGetObjectDetails(Target,[OBJECT_POS]),0);
if(message == "Portal" && set == FALSE){set = TRUE;
string thisName = llGetObjectName();
if(name == thisName){//we check to make sure theres not already one of the same portal
//Even though both portals use exact same script; they require the portals use diff names
llOwnerSay("/me >> Self-Deleting Replica \""+thisName+"\" @ "+(string)llGetPos()+";");
llDie();
}
else{llRegionSay(Channel,"Portal");//make sure not to create a loop!
SetTarget();
}
}
if(message == "!!!DIE!!!"){
llDie();
}
}
}
//
on_rez(integer start_param){
llResetScript();
}
//
}