Advertisement
lolsalat

Cutscene (MineScript)

Mar 5th, 2016
560
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. //note: this is a basic cutscene-script by ExarnCun (lolsalat) feel free to clone and edit as you want!
  2.  
  3. function main(func){
  4.  
  5. //players can't jump anymore
  6. func.sendCommand(func.var1, "/execute @a[r=20] ~ ~ ~ /effect @p 8 100000 128");
  7. //players can't walk anymore
  8. func.sendCommand(func.var1, "/execute @a[r=20] ~ ~ ~ /effect @p 2 100000 7");
  9.  
  10. //this cutscene takes 150 ticks (=7.5 seconds)
  11. for(frame = 0; frame < 150; frame++){
  12.  
  13.  
  14. //execute command /say Hello at the first Tick
  15. if(frame == 0){
  16. sendCommand("/say Hello");
  17. }
  18.  
  19. //execute command /say World at the 100th Tick
  20. if(frame == 100){
  21. sendCommand("/say World");
  22. }
  23.  
  24. //wait for one Tick
  25. sleep(50);
  26. }
  27.  
  28. //remove effects
  29. func.sendCommand(func.var1, "/execute @a[r=20] ~ ~ ~ /effect @p clear");
  30.  
  31. function sendCommand(command){
  32. func.sendCommand(func.var1, command);
  33. }
  34.  
  35. // sleep function copy-pasted from http://www.phpied.com/sleep-in-javascript/
  36. function sleep(milliseconds) {
  37. var start = new Date().getTime();
  38. for (var i = 0; i < 1e7; i++) {
  39. if ((new Date().getTime() - start) > milliseconds){
  40. break;
  41. }
  42. }
  43. }
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement