Advertisement
Guest User

Dance_All_NPC

a guest
Sep 22nd, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.80 KB | None | 0 0
  1. // :CATEGORY:OpenSim NPC
  2. // :NAME:Dance_all_NPC
  3. // :AUTHOR:Fritigern
  4. // :CREATED:2013-07-30 13:36:07.930
  5. // :EDITED:2013-09-18 15:38:51
  6. // :ID:210
  7. // :NUM:284
  8. // :REV:1.0
  9. // :WORLD:OpenSim
  10. // :DESCRIPTION:
  11. //From http://opensimulator.org/wiki/User:Fritigern/Scripts#NPC_stuff
  12. // License: http://creativecommons.org/licenses/by-sa/2.5/
  13. // You are free:
  14. // to Share — to copy, distribute and transmit the work
  15. // to Remix — to adapt the work
  16. // to make commercial use of the work
  17. //
  18. // Get your NPCs (and whoever else may be in the region) to dance.
  19. // To make this work, create a prim, fill it with (dance) animations, put this script in it, click the prim, and PAR-TAY!.
  20. // :CODE:
  21. list avies;
  22.  
  23.  
  24. list thedance;
  25.  
  26.  
  27. list olddance;
  28.  
  29.  
  30. list dancers;
  31.  
  32.  
  33. integer duration = 10;
  34.  
  35.  
  36.  
  37.  
  38.  
  39. EverybodyDanceNow()
  40.  
  41.  
  42. {
  43.  
  44.  
  45. llSetText("Dancing",<1,1,1>,1);
  46.  
  47.  
  48. avies = osGetAvatarList();
  49.  
  50.  
  51. integer n;
  52.  
  53.  
  54.  
  55.  
  56.  
  57. if(llGetListLength(thedance) != 0)
  58.  
  59.  
  60. {
  61.  
  62.  
  63. for(n=0;n<llGetListLength(thedance);++n)
  64.  
  65.  
  66. {
  67.  
  68.  
  69. olddance = olddance + llList2String(thedance,n);
  70.  
  71.  
  72. }
  73.  
  74.  
  75. }
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84. for(n=0;n<llGetListLength(avies);n=n+3)
  85.  
  86.  
  87. {
  88.  
  89.  
  90. integer animnum = llFloor(llFrand(llGetInventoryNumber(INVENTORY_ANIMATION)));
  91.  
  92.  
  93. string animation = llGetInventoryName(INVENTORY_ANIMATION,animnum);
  94.  
  95.  
  96. key avieID = llList2Key(avies,n);
  97.  
  98.  
  99. dancers = dancers + [avieID];
  100.  
  101.  
  102. thedance = thedance + [animation];
  103.  
  104.  
  105. }
  106.  
  107.  
  108.  
  109.  
  110.  
  111. for(n=0;n<llGetListLength(dancers);++n)
  112.  
  113.  
  114. {
  115.  
  116.  
  117. key avie = llList2Key(dancers,n);
  118.  
  119.  
  120. string dance = llList2String(thedance,n);
  121.  
  122.  
  123. osAvatarPlayAnimation(avie, dance);
  124.  
  125.  
  126.  
  127.  
  128.  
  129. }
  130.  
  131.  
  132. }
  133.  
  134.  
  135.  
  136.  
  137.  
  138. Stop_HammerTime()
  139.  
  140.  
  141. {
  142.  
  143.  
  144. llSetText("Stopped Dancing",<1,1,1>,1);
  145.  
  146.  
  147. integer n;
  148.  
  149.  
  150. for(n=0;n<llGetListLength(dancers);++n)
  151.  
  152.  
  153. {
  154.  
  155.  
  156. key avie = llList2Key(dancers,n);
  157.  
  158.  
  159. string dance = llList2String(thedance,n);
  160.  
  161.  
  162. osAvatarStopAnimation(avie, dance);
  163.  
  164.  
  165. }
  166.  
  167.  
  168. dancers = [];
  169.  
  170.  
  171. thedance = [];
  172.  
  173.  
  174. avies = [];
  175.  
  176.  
  177. }
  178.  
  179.  
  180.  
  181.  
  182.  
  183. default
  184.  
  185.  
  186. {
  187.  
  188.  
  189. touch_start(integer numdet)
  190.  
  191.  
  192. {
  193.  
  194.  
  195. state on;
  196.  
  197.  
  198. }
  199.  
  200.  
  201. }
  202.  
  203.  
  204.  
  205.  
  206.  
  207. state on
  208.  
  209.  
  210. {
  211.  
  212.  
  213. state_entry()
  214.  
  215.  
  216. {
  217.  
  218.  
  219. EverybodyDanceNow();
  220.  
  221.  
  222. llSetTimerEvent(duration);
  223.  
  224.  
  225. }
  226.  
  227.  
  228.  
  229.  
  230.  
  231. touch_start(integer numdet)
  232.  
  233.  
  234. {
  235.  
  236.  
  237. state off;
  238.  
  239.  
  240. }
  241.  
  242.  
  243.  
  244.  
  245.  
  246. timer()
  247.  
  248.  
  249. {
  250.  
  251.  
  252. EverybodyDanceNow();
  253.  
  254.  
  255. }
  256.  
  257.  
  258. }
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267. state off
  268.  
  269.  
  270. {
  271.  
  272.  
  273. state_entry()
  274.  
  275.  
  276. {
  277.  
  278.  
  279. Stop_HammerTime();
  280.  
  281.  
  282. }
  283.  
  284.  
  285.  
  286.  
  287.  
  288. touch_start(integer numdet)
  289.  
  290.  
  291. {
  292.  
  293.  
  294. state on;
  295.  
  296.  
  297. }
  298.  
  299.  
  300. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement