Advertisement
Pinksamurai

Teleport by Collision in an Experience

Jul 8th, 2022 (edited)
2,051
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. vector destination = <56, 15, 2222>; //Change the coordinated with the coordinated you want the avatar to arrive at on the same region.
  2. vector facing = <1,0,0>; // This is the direction <x,y,z> the avatar will be facing. In this case the avatar will be facing the global east when they arrive. Change it to the direction you want them to face west is <-1,0,9> north is <0,1,0> north east is <1,1,0> etc.
  3.  
  4. default
  5. {
  6. state_entry()
  7.   {
  8. llVolumeDetect(TRUE); // This allows the avatar to fall or walk through the prim or object without having to make it phantom.
  9.   }
  10. collision_start(integer num_detected) //When an avatar walks into or on the object or prim.
  11.   {
  12. key collider = llDetectedKey(0);  // Get the UUID of the avatar
  13. if (ZERO_VECTOR == llGetAgentSize(collider)) // If there is no avatar
  14. return;  //stop
  15. llRequestExperiencePermissions(collider, ""); // This requests the avatar for permission to use participate in the Experience. It is asked only once. If the avatar accepts, they will not be asked for permission again unless they revoke/cancel the permission.
  16.   }
  17. experience_permissions(key agent)
  18.   {
  19. llTeleportAgent(agent, "", destination, facing); // Teleport the avatar to the set destination and facing the set direction.
  20.   }
  21. experience_permissions_denied(key agent, integer reason) // When the experience doesn't work and can't run.
  22.   {
  23. if (17 != reason)
  24. llInstantMessage(agent, "NO PERMS, reason: "+llGetExperienceErrorMessage(reason)); // Tell the avatar the reason in an IM.
  25. //llRegionSayTo(agent, 0, "NO PERMS, reason: "+llGetExperienceErrorMessage(reason)); // Tell the avatar the reason in public chat.
  26.   }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement