Untitled

 avatar
unknown
plain_text
2 years ago
2.1 kB
7
Indexable
var player = event.getTarget();
var Rand = Math.Random() * 100;
 
ability();
function ability() {
    var dataId = "-on-ability";

    if (npc.hasTempData(dataId)) {
        event.setCancelled(true);
        return;
    } 

    if (Rand <= 10) {
        return;
    }

    if (player == null)
        return;

    var API = world.getTempData("API");     
    npc.setTempData(dataId, true);

    API.runTaskTime(function() {
        var newPos = {
            x: player.getX(),
            y: player.getY(),
            z: player.getZ(),
        }

        player.knockback(1, npc.getRotation());
        npc.setPosition(newPos.x, newPos.y, newPos.z);
        world.spawnParticle("cloud", newPos.x, newPos.y, newPos.z, 0.2, 0.2, 0.2, 0.5, 20);
        npc.executeCommand("playsound minecraft:note.bassattack " + player.getName());
    }, 5, 15);

    API.runLater(function() {
        player.knockback(8, npc.getRotation());
        npc.removeTempData(dataId);
    }, 80);
}

if (player != null) {
    if (Rand <= 20 && Rand > 10) {
        player.knockback(4, npc.getRotation());
        world.spawnParticle("smoke", npc.getX(), npc.getY(), npc.getZ(), 0.2, 0.2, 0.2, 0.5, 150);  
        npc.executeCommand("playsound jinryuudragonbc:DBC2.strongpunch " + player.getName());          
    }
}

if (Rand <= 30 && Rand > 20) {
    var nearbyEntities = npc.getSurroundingEntities(8, 1);

    world.spawnParticle("lava", npc.getX(), npc.getY(), npc.getZ(), 0.2, 0.2, 0.2, 0.5, 50);
    world.spawnParticle("smoke", npc.getX(), npc.getY(), npc.getZ(), 0.2, 0.2, 0.2, 0.5, 100);
    world.spawnParticle("flame", npc.getX(), npc.getY(), npc.getZ(), 0.2, 0.2, 0.2, 0.5, 80);
    world.spawnParticle("cloud", npc.getX(), npc.getY(), npc.getZ(), 0.2, 0.2, 0.2, 0.5, 100);
    npc.say("&c¡PISOTÓN!");
    for (var i = 0; i < nearbyEntities.length; i++) {
        var jugador = nearbyEntities[i];
        if (jugador != null) {
            world.explode(jugador.getX(), jugador.getY(), jugador.getZ(), 2, false, false); 
            jugador.knockback(4, npc.getRotation());
        }
Editor is loading...