u/Zealoutarget19

▲ 0 r/bloxd

a bit of world code i cobbled together with some stuff i found

/*
tutorial:
get a gpmg and right click for a nuke
*/

onPlayerClick = (p, alt, x, y, z, b) => {

if (alt === true) {

var h = api.getHeldItem(p);

var pos = api.getPosition(p);

var x = pos[0];

var y = pos[1];

var z = pos[2];

var dir = api.getPlayerFacingInfo(p).dir;

var velocityMultiplier = 4;

var damageMultiplier = 1;

var gravityMultiplier = 2; // you probably wont need this for fireballs as they have almost zero gravity

if ((h?.attributes?.customAttributes?.shotsLeft > 0) && (h?.name === "GPMG")) {

api.attemptCreateThrowable(p, "Capitano Grenade", [x, y + 1.7, z], dir, velocityMultiplier, damageMultiplier, gravityMultiplier, { customAttributes: {} });

api.attemptCreateThrowable(p, "Grenade Launcher", [x, y + 1.7, z], dir, 5.15, damageMultiplier, gravityMultiplier, { customAttributes: {} });

// fireballs can deal a max of 60 dmg (i think) at 1 damageMultiplier

// you can change the projectile to anything else

}

}

};

//made by someone, upgraded by awesomeguy543 //on bloxdhub // ================== SETTINGS ================== let fallTimeSeconds = 2.1 let fallTicks = fallTimeSeconds * 20 let scheduledExplosions = [] let fallingExplosives = [] let despawnQueue = [] let pendingDespawn = 0 // ================== TICK ================== tick = () => { pendingDespawn++ if (pendingDespawn === 3 && despawnQueue.length) { for (let m of despawnQueue) api.despawnMob(m) despawnQueue = [] } // Delayed explosions for (let i = scheduledExplosions.length - 1; i >= 0; i--) { let e = scheduledExplosions[i] e.ticks-- if (e.ticks <= 0) { createExplosion(e.pos, e.strength) scheduledExplosions.splice(i, 1) } } // Falling TNT for (let i = fallingExplosives.length - 1; i >= 0; i--) { let f = fallingExplosives[i] api.setBlock(f.pos[0], f.pos[1], f.pos[2], "Air") f.pos[1]-- api.setBlock(f.pos[0], f.pos[1], f.pos[2], "Moonstone Explosive") f.ticks++ if (f.ticks >= fallTicks) { api.setBlock(f.pos[0], f.pos[1], f.pos[2], "Air") createExplosion(f.pos, f.strength) fallingExplosives.splice(i, 1) } } } // ================== EXPLOSION ================== function createExplosion(pos, strength = 2) { let m = api.attemptSpawnMob("Draugr Zombie", pos[0], pos[1], pos[2]) api.setMobSetting(m, "attackItemName", strength == 1 ? "RPG" : "Super RPG") api.setMobSetting(m, "attackRadius", 1e6) api.setMobSetting(m, "attackInterval", 1e6) api.setMobSetting(m, "baseWalkingSpeed", 0) api.setMobSetting(m, "baseRunningSpeed", 0) api.setMobSetting(m, "attackImpulse", 0) api.setPlayerOpacity(m, 0) let p = api.attemptSpawnMob("Draugr Zombie", pos[0], pos[1] - 2, pos[2]) api.setMobSetting(p, "baseWalkingSpeed", 0) api.setMobSetting(p, "baseRunningSpeed", 0) api.setMobSetting(p, "initialHealth", 1e6) api.setPlayerOpacity(p, 0) api.applyMeleeHit(p, m, [0, 0, 0]) despawnQueue.push(m, p) pendingDespawn = 0 }

// ================== Orbital Strike ==================

onPlayerThrowableHitTerrain = (player, arrowName, boomerangEntity) => {



// NUKE SHOT

if (arrowName === "Grenade Launcher") {

let pos = api.getPosition(boomerangEntity)

api.setPosition(boomerangEntity, 0, -999, 0)



let rings = [ 3, 7, 12, 16, 20]



for (let r of rings) {

for (let i = 0; i < 20; i++) {

let a = Math.PI * 2 * i / 20

let x = Math.round(Math.cos(a) * r)

let z = Math.round(Math.sin(a) * r)



let p = [pos[0] + x, pos[1], pos[2] + z]



fallingExplosives.push({

pos: [p[0], p[1] + 40, p[2]],

ticks: 0,

strength: 2

})



scheduledExplosions.push({

pos: p,

strength: 2,

ticks: fallTicks

})

}

}

}



// STAB SHOT

if (arrowName === "Capitano Grenade") {

let pos = api.getPosition(boomerangEntity)

api.setPosition(boomerangEntity, 0, -999, 0)



let heights = [100,96,92,88,84,80,76,72,68,64,60,56,52,48,44,40,36,32,28,24,20,16,12,8,4,0,-4,-8,-12,-16,-20,-24,-28,-32,-36,-40,-44,-48,-52,-56,-60,-64,-68,-72,-76,-80,-84,-88,-92,-96,-100]



scheduledExplosions.push({ pos, strength: 3, ticks: 0 })



for (let h of heights) {

scheduledExplosions.push({

pos: [pos[0], pos[1] + h, pos[2]],

strength: 3,

ticks: 0

})

}

}

}



// ================== MOB SPAWN BLOCK ==================

onWorldAttemptSpawnMob = mobId => {

if (mobId !== "Draugr Zombie") return "preventSpawn"

}

sorry if the formatting is a bit off i have no idea how to put code in

anyways

give yourself a gpmg and right click

reddit.com
u/Zealoutarget19 — 5 days ago
▲ 1 r/bloxd

unrelated complaints about custom games (and price of warhammer 40k miniatures)

custom games used to have gud stuff, but now its all kinda bad.

most are made by people who cant code and only use press to buy boards.

like, for half of the games, the entire code can be found on bloxdhub.

so yeah.

i really hate custom games.

also why are warhammer 40k miniatures so expensive ITS LITERALLY JUST A PIECE OF PLASTIC

reddit.com
u/Zealoutarget19 — 7 days ago