Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.98 KB | None | 0 0
  1. list anims = ["Slash1","Slash2"];
  2. integer sheath;
  3. list swings = ["eff009eb-ea42-b520-8b9a-0a3f5d75370d","2fdd9c89-2803-b303-50e3-7072e94746da","fef93985-2118-3db4-ec5d-ce2a67cbc967"];
  4. list hits = ["162391e4-436e-9b74-156c-87b3bab7d31f","507673bf-ac2c-7bbb-eb13-017533d1a730","046af3e0-b1df-fbdd-a131-16eeaa1eb600"];
  5. float power = 4;
  6.  
  7.  
  8. default
  9. {
  10. state_entry()
  11. {sheath = TRUE;
  12. llRequestPermissions(llGetOwner(),PERMISSION_OVERRIDE_ANIMATIONS|PERMISSION_TAKE_CONTROLS|PERMISSION_TRIGGER_ANIMATION);
  13. llListen(1,"",llGetOwner(),"");
  14. }
  15. attach(key k) {
  16. if(k != NULL_KEY) {
  17. llResetScript();
  18. } else {
  19. }
  20. }
  21. run_time_permissions(integer perm) {
  22. if(perm) {
  23. llTakeControls(CONTROL_ML_LBUTTON,TRUE,FALSE);
  24. llTakeControls(CONTROL_FWD, TRUE, TRUE);
  25. }
  26.  
  27. }
  28. control(key id, integer level, integer edge) {
  29. if (h & CONTROL_FWD && llGetAgentInfo(llGetOwner()) & AGENT_IN_AIR){return;} {
  30. if(sheath == TRUE)
  31. return;
  32. vector impulse = llRot2Fwd(llGetRot());
  33. impulse = <impulse.x * power, impulse.y * power, 0 * power>;
  34. llApplyImpulse(impulse, FALSE);
  35. return;
  36.  
  37. if(h&c&CONTROL_ML_LBUTTON) {
  38. if(sheath == TRUE)
  39. return;
  40.  
  41. llSensor("","",AGENT,5,PI/2);
  42. llSetLinkAlpha(LINK_SET,1,ALL_SIDES);
  43. llTriggerSound(llList2Key(llListRandomize(swings,1),0),1);
  44. llStartAnimation(llList2String(llListRandomize(anims,1),0));
  45. }
  46. listen(integer channel,string name,key id,string message)
  47. {
  48. if(message == "drawm")
  49. {
  50. if(sheath == FALSE){
  51. return;
  52. }
  53. sheath = FALSE;
  54. llPlaySound("be972adb-49b0-33c0-20a7-9e14a174212e", 1);
  55.  
  56. llStartAnimation("Hold");
  57.  
  58.  
  59. llSetLinkAlpha(LINK_SET,1,ALL_SIDES);
  60.  
  61. }
  62. else if(message == "sling"){
  63. if(sheath == TRUE){
  64. return;
  65. }
  66. sheath = TRUE;
  67. llPlaySound("be972adb-49b0-33c0-20a7-9e14a174212e", 1);
  68. llStopAnimation("Hold");
  69.  
  70.  
  71. llSetTimerEvent(0);
  72.  
  73. llSetLinkAlpha(LINK_SET,0,ALL_SIDES);
  74.  
  75. }
  76. }
  77. sensor(integer d) {
  78. integer i;
  79. llTriggerSound(llList2Key(llListRandomize(hits,1),0),1);
  80. for(;i<=d&&llDetectedKey(i)!=NULL_KEY;++i)
  81.  
  82. {
  83. llRezObject("[ Slash ]",llDetectedPos(i) + llDetectedVel(i) / 4,-llDetectedVel(i),<0,0,0,0>,1);
  84. llOwnerSay("Killed " + llKey2Name(llDetectedKey(i)));
  85.  
  86. }
  87. llSetTimerEvent(0.5);
  88. }
  89. no_sensor() {
  90.  
  91.  
  92. llSetTimerEvent(0.5);
  93. }
  94. timer() {
  95.  
  96.  
  97. llSetTimerEvent(0);
  98. }
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement