Air Dagger V1
Crits do extra damage and sends you up
← Back to main
Code Block:
api.giveItem(myId, "Moonstone Axe", 1,{customDisplayName: "Air Dagger", customDescription: "Crits does exta damage with a Wind Burst effect"});
// --- Air Dagger Code ---
const airStrikeCooldowns = {};
function onPlayerDamagingOtherPlayerAir(attackerId, victimId, baseDamage, withItem, bodyPartHit, damagerDbId) {
if (
!withItem ||
withItem !== "Moonstone Axe" ||
api.getHeldItem(attackerId)?.attributes?.customDisplayName !== "Air Dagger"
) {
return;
}
// Cooldown check
const now = api.now();
const lastUsed = airStrikeCooldowns[attackerId] || 0;
if (now - lastUsed < 2000) {
return;
}
// Check if block 1 below is air
const pos = api.getPosition(attackerId);
if (!pos) return;
const [x, y, z] = pos.map(Math.floor);
const blockBelow = api.getBlock(x, y - 1, z);
if (blockBelow !== "Air") return;
// Apply cooldown
airStrikeCooldowns[attackerId] = now;
let finalDamage = baseDamage;
// ✅ Air Strike
api.applyEffect(attackerId, "Air Strike", 2000, {displayName:"Air Strike Cooldown", icon:"Moonstone Axe"})
api.applyEffect(attackerId, "Slowness", 1000, {inbuiltLevel: 1})
api.applyImpulse(attackerId, 0, 20, 0);
api.applyHealthChange(victimId, -Math.round(finalDamage * 1), attackerId);
const facing = api.getPlayerFacingInfo(attackerId);
const dir = facing.dir;
const plane_vector_magnitude = Math.sqrt(dir[0] * dir[0] + dir[2] * dir[2]);
const knockbackX = dir[0] / plane_vector_magnitude * 10;
const knockbackY = 0;
const knockbackZ = dir[2] / plane_vector_magnitude * 10;
api.applyImpulse(victimId, knockbackX, knockbackY, knockbackZ);
// ✨ Use new p1() particle blast
p1(pos[0], pos[1], pos[2]);
api.broadcastSound("submachine_tail_only_shot_01", 1, 1);
}
World Code:
//Timeout Code by Sulfrox
let ordinary_tick_function,do_next_tick_queue=new Set,timed_functions_queue=[];function tick(t){if("function"==typeof ordinary_tick_function&&ordinary_tick_function(t),do_next_tick_queue.forEach((t=>{"function"==typeof t&&t(),do_next_tick_queue.delete(t)})),timed_functions_queue.length&&timed_functions_queue[0][0]{"function"==typeof t&&do_next_tick_queue.add(t)},setTimeOut=(t,e)=>{let n=Date.now()+e;"function"==typeof t&&(timed_functions_queue.push([n,t]),timed_functions_queue.sort((([t],[e])=>t-e)))};
// Handle attack logic
onPlayerDamagingOtherPlayer = function(attackerId, victimId, damage, withItem, bodyPartHit, damagerDbId) {
if (held && held.name === "Moonstone Axe" && held.attributes?.customDisplayName === "Air Dagger") {
onPlayerDamagingOtherPlayerAir(attackerId, victimId, baseDamage, withItem, bodyPartHit, damagerDbId)
}
};
//Particle effect by Mr Chestplate
function p1(x, y, z) {
api.playParticleEffect({
dir1: [0, -8, 0],
dir2: [0, 3, 0],
pos1: [x - 4, y, z - 4],
pos2: [x + 4, y, z + 4],
texture: "square_particle",
minLifeTime: 0.2,
maxLifeTime: 0.6,
minEmitPower: 2,
maxEmitPower: 2,
minSize: 0.1,
maxSize: 0.2,
manualEmitCount: 400,
gravity: [0, -10, 0],
colorGradients: [
{
timeFraction: 0,
minColor: [100, 100, 100, 1],
maxColor: [150, 150, 150, 1],
},
],
velocityGradients: [
{
timeFraction: 0,
factor: 2,
factor2: 2,
},
],
blendMode: 1,
})
}