FallingWalkway.lsl 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // :SHOW:1
  2. // :CATEGORY:Gaming
  3. // :NAME:Falling walkway script
  4. // :AUTHOR:Ferd Frederix
  5. // :KEYWORDS:Game, Bridge
  6. // :REV:2.0
  7. // :WORLD:OpenSim
  8. // :DESCRIPTION:
  9. // A part of a bridge or walkway that falls when walked on.
  10. // Put in a walkway and reset it. When an avatar walks on it, it will move downward 2 meters for one minute, then restore.
  11. // Place Hypergate water below the prim for them to fall into.
  12. // :CODE:
  13. Reset()
  14. {
  15. llSetStatus(STATUS_PHANTOM, FALSE);
  16. llVolumeDetect(FALSE);
  17. llSleep(0.1);
  18. llVolumeDetect(TRUE);
  19. }
  20. vector initPos;
  21. default
  22. {
  23. state_entry()
  24. {
  25. initPos = llGetPos();
  26. Reset();
  27. }
  28. collision_start(integer num) {
  29. if (osIsNpc(llDetectedKey(0)))
  30. return;
  31. vector newPos = initPos;
  32. newPos.z -= 2;
  33. llSetPos(newPos);
  34. llSetTimerEvent(60);
  35. }
  36. timer()
  37. {
  38. Reset();
  39. llSetPos(initPos);
  40. llSetTimerEvent(0);
  41. }
  42. changed(integer what) {
  43. if (what & CHANGED_REGION_START)
  44. llResetScript();
  45. }
  46. }