SHARE
TWEET

Untitled

a guest Jun 17th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. //Sweep attack script
  3. function tick(event) {
  4.   event.item.setDurabilityValue(event.player.getTempdata().get("cooldown"));
  5.   if (event.player.getTempdata().get("cooldown") < 1) {
  6.     event.player.getTempdata().put("cooldown", +0.2);
  7.   }
  8.   if (event.player.getTempdata().get("cooldown") == 1) {
  9.     event.item.setDurabilityShow(false);
  10.   }
  11. }
  12. function interact(event) {
  13.   if (event.player.getTempdata().get("cooldown") == 1) {
  14.   var x = event.player.getX();
  15.   var y = event.player.getY();
  16.   var z = event.player.getZ();
  17.   var nearbyEntities = event.player.world.getNearbyEntities(x, y, z, 2, 2);
  18.     if (nearbyEntities.length > 0) {
  19.       for (var i = 0; i < nearbyEntities.length; i++) {
  20.         var entity = nearbyEntities[i];
  21.         var faction = entity.getFaction();
  22.         var status = faction.playerStatus(event.player);
  23.         if (status <= 0 && entity.getHealth() > 0){
  24.           entity.damage(10);
  25.           entity.setAttackTarget(event.player);
  26.         }
  27.       }
  28.     }
  29.     var token = event.player.world.spawnClone(event.player.x,y+2,event.player.z,1,"commandproxy");
  30.     event.player.getWorld().spawnParticle("sweepAttack", x+1.5, y+0.8, z+1.5, 0, 0, 0, 0, 1);
  31.     event.player.getWorld().spawnParticle("sweepAttack", x+2, y+0.8, z, 0, 0, 0, 0, 1);
  32.     event.player.getWorld().spawnParticle("sweepAttack", x+1.5, y+0.8, z-1.5, 0, 0, 0, 0, 1);
  33.     event.player.getWorld().spawnParticle("sweepAttack", x, y+0.8, z+2, 0, 0, 0, 0, 1);
  34.     event.player.getWorld().spawnParticle("sweepAttack", x-1.5, y+0.8, z+1.5, 0, 0, 0, 0, 1);
  35.     event.player.getWorld().spawnParticle("sweepAttack", x-2, y+0.8, z, 0, 0, 0, 0, 1);
  36.     event.player.getWorld().spawnParticle("sweepAttack", x-1.5, y+0.8, z-1.5, 0, 0, 0, 0, 1);
  37.     event.player.getWorld().spawnParticle("sweepAttack", x, y+0.8, z-2, 0, 0, 0, 0, 1);
  38.     token.executeCommand("/playsound dsurround:sword.swing player @a ~ ~-2 ~ 5 1");
  39.     token.despawn();
  40.     event.item.setDurabilityValue(0);
  41.     event.player.getTempdata().put("cooldown", 0);
  42.     event.item.setDurabilityShow(true);
  43.   }
  44. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top