Portal Script

Thread Started By deadpool

2851
1
  • 53 Vote(s) - 3.36 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rate Thread
#1
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;)

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.577350.577350.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_AGE2.0
        
PSYS_PART_FLAGS323
        
PSYS_PART_START_COLORpStartColor
        
PSYS_PART_END_COLORpEndColor
        
PSYS_PART_START_SCALE, <0.040.04FALSE>, 
        
PSYS_PART_END_SCALE, <11FALSE>, 
        
PSYS_SRC_PATTERN2
        
PSYS_SRC_BURST_RATE,0.001000
        
PSYS_SRC_ACCEL,<0.000000.000000.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.000000.000000.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.0.0 && tPos.256.0 && tPos.0.0 && tPos.256.0 && tPos.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(sitterPERMISSION_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);
            }
        }
    }
//
    
listeninteger channelstring namekey idstring message ){
        if (
id == llGetOwner()||llGetOwnerKeyid) == 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();
    }
//

Reply


#2
nice post thanks for sharing
Reply




Forum Jump:

1 Guest(s)
Share this:

About Second Life Copybot

Second Life CopyBot Forum is a place where you can get items for Second Life and other vitual worlds for free. With our CopyBot viewers you can export and import any content from these virtual worlds and modify them in 3D software such as Blender, 3D studio Macx etc...