Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //note: this is a basic cutscene-script by ExarnCun (lolsalat) feel free to clone and edit as you want!
- function main(func){
- //players can't jump anymore
- func.sendCommand(func.var1, "/execute @a[r=20] ~ ~ ~ /effect @p 8 100000 128");
- //players can't walk anymore
- func.sendCommand(func.var1, "/execute @a[r=20] ~ ~ ~ /effect @p 2 100000 7");
- //this cutscene takes 150 ticks (=7.5 seconds)
- for(frame = 0; frame < 150; frame++){
- //execute command /say Hello at the first Tick
- if(frame == 0){
- sendCommand("/say Hello");
- }
- //execute command /say World at the 100th Tick
- if(frame == 100){
- sendCommand("/say World");
- }
- //wait for one Tick
- sleep(50);
- }
- //remove effects
- func.sendCommand(func.var1, "/execute @a[r=20] ~ ~ ~ /effect @p clear");
- function sendCommand(command){
- func.sendCommand(func.var1, command);
- }
- // sleep function copy-pasted from http://www.phpied.com/sleep-in-javascript/
- function sleep(milliseconds) {
- var start = new Date().getTime();
- for (var i = 0; i < 1e7; i++) {
- if ((new Date().getTime() - start) > milliseconds){
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement