#Script API General

1 messages · Page 35 of 1

warm mason
#

I don't think there is such a thing. Well, you can just write a script that displays all the IDs for you

distant tulip
#

animation and scale the root boon to 0

warm mason
distant tulip
#

not sure about that one

drowsy scaffold
last latch
#

world.afterEvents.projectileHitEntity.subscribe(({ getEntityHit }) => console.log(getEntityHit()))

Native function [ProjectileHitEntityAfterEvent::getEntityHit] object bound to prototype does not exist. at <anonymous> (Main.js)

#

is this again BDS fault?

granite badger
#

event => event.getEntityHit()
You have to do this otherwise the reference will disappear

last latch
#

weird, i have done this earlier

#

but sure

remote oyster
#

Destructuring is sensitive in this environment.

last latch
#

(atleast i think i have)

wary edge
#

Why do people destructure?

#

Like, what's the benefit?

chilly fractal
#

Idk... like why do gangsters love taking dr#gs? They harm themselves, why do they do it???

jolly citrus
#

ill try soon

#

is there a way to check for enchantments on items that are incompatible with it

#

i have infinity enchantment on an ender pearl and would like to detect

#

enchantments component doesn't work

untold magnet
#

uh, what should i use to make this:

    onTick: t => {
      const entities = t.block.dimension.getEntities({ location: t.block.center(), maxDistance: 3 });
      for (const entity of entities) {
        if (entity) world.sendMessage('entityFound')
        else world.sendMessage('noEntity')
      }
    }```undetect entities, like when the block doesn't have entities around it, it will run a function or something, bec this one ↑ isn't working, for some reason.
warm mason
chilly fractal
# jolly citrus enchantments component doesn't work
function enchantItemFunc(player, ench) {
  let mainHand = player.getComponent('equippable').getEquipment(EquipmentSlot.Mainhand), enchComp = mainHand.getComponent('enchantable');
  if (enchComp) {
    let lvl = enchComp.hasEnchantment(e.type), id = ench.type.id;
    if (lvl == ench.type.maxLevel || lvl >= ench.level) return function(){player.sendMessage(`§g[§6§lServer§r§g] §cEnchantment §7${normalizeTypeId(id)}§c Already At Maximum Level!`); playSound(player, 'random.bassattack');}();
      try {
        if (enchComp.canAddEnchantment(ench)) {
          enchComp.addEnchantment(ench);
          player.getComponent('equippable').setEquipment(EquipmentSlot.Mainhand, mainHand);
          playSound(player, 'beacon.power');
          player.sendMessage(`§g[§6§lServer§r§g] §aSuccessfully Added The Enchantment §5${normalizeTypeId(id)} §3${ench.level}`);
        }
      } catch (e) {
        playSound(player, 'random.bassattack');
        player.sendMessage(`§g[§6§lServer§r§g] §cEnchantment §7${normalizeTypeId(id)} §cAlready At Maximum Level!`);
      }
  }
}

And just remove normalizeTypeId or do this:

function normalizeTypeId(id) {
  let configuredID = id.includes(':') ? null : 'e:'+id;
  return configuredID.split(':')[1].map((word) => word.charAt(0).toUpperCase() + word.substring(1));
}
#

Edited code snippet, use the new one, thanks!

chilly fractal
last latch
#

i found a interesting bug

#

when i add nausea using Script API there is no visual effect

#

but when i add using commands the effect is present

#

oh no nevermind

#

🤦

#

i need to make it way longer than 60 ticks

jolly citrus
#

why is team not lined up w the other entries

/**
 * 
 * @param {Player} player 
 * @returns 
 */
function displayStats_lite(player) {
    let timers = [];
    if (player.getDynamicProperty("spawntag") > 0) {
        timers.push(` §c§lSpawn Tag§r§7: §c${secondsToMinutesAndSeconds(player.getDynamicProperty("spawntag"))}\n`);
    }
    let team = FindPlayerTeam(player.name)
    if (team != null) {
        let teams = JSON.parse(world.getDynamicProperty("teams")) || {};
        let req = Object.entries(teams).find(([teamName]) => teamName?.toLowerCase() === team?.toLowerCase())?.[1];
        let online = 0;
        let leader = world.getPlayers({ name: req.leader })[0];
        if (leader) online++;
    
        req.members.map(captain => {if (player) online++});
    
        req.captains.map(captain => {if (player) online++});
        timers.push(`\n`)
        timers.push(` §6§lTeam§r§7: §e${team}\n`)
        if (req.hq.slice(0, 3).every(value => value === 0)) {
            timers.push(` §6§lHQ§r§7: §eNot Set\n`)
        }
        else {
            timers.push(` §6§lHQ§r§7: §e${req.hq[0]}\n`)
        }
        timers.push(` §6§lDTR§r§7: §e${req.dtr}\n`)
        timers.push(` §6§lOnline§r§7: §e${online}\n`)
    }

    let stats = [];
    if (timers.length !== 0) {
        stats = [timers.join('')];
    } else {
        return 0;
    }

    
    if (stats[0].endsWith('\n')) {
        stats[0] = stats[0].slice(0, -1);
    }

    return stats.join('\n');
}
#

o i fixed it

#

i had to add §r to the last line cos it ended in bold

jolly citrus
#

is there a way to prevent ppl from using pressure plates in certain locations

#

i need them to be disablee for enemies in faction claims

chilly fractal
#

I think there is an event but lemme try to get it if it does exist

#

It's for afterEvent so you can't cancel but here

jolly citrus
#

maybe i can temporarily clear the pressure plate

chilly fractal
#

No it's after it's used.

jolly citrus
#

is what i meant

#

i know it wont like

#

disable the initial ignition

chilly fractal
#

Yes I know, but the event fires after you do step.

jolly citrus
#

but it doesn’t matter in my case tbh

chilly fractal
#

Alright then

jolly citrus
#

but its ok cos you’ll only be able to use pressure plates to toggle doors and stuff

chilly fractal
#

Good evening.

jolly citrus
#

tnt is disabled

jolly citrus
#

anyone have an inv to build a realm or mc realm hub dm me it please 🙏🏼

jade grail
#

How do dynamic properties work?

valid ice
jade grail
valid ice
#

Yes, it will. It's like scoreboards.

jade grail
#

? is it these properties which it changes?

valid ice
#

Those are entity properties, not dynamic properties

jade grail
#

i think i understand

valid ice
#

Dynamic properties are exclusing to script API

jade grail
#

is there a way for me to get the dynamic property?

#

i found a way to set it

valid ice
#

getDynamicProperty() is the method to get it

jade grail
#

thanks alot

untold magnet
#

h,m
how can i
const entities = block?.dimension.getEntities;
to use different { maxDistance } on it
like when the script spots entities at distance 16 it will do something
but when the script spots entities at distance 8 it will do another something

#

just like
if (entities({ maxDistance: 16 }).length !== 0) { ,,, }
if (entities({ maxDistance: 8 }).length !== 0) { ,,, }
??

#

na thats stupid ^
kinda

terse tide
#

Its possible to make custom ropes?

subtle cove
#

block's location gets distributed in the query as an anchor for the following properties like maxDistance

fiery solar
# subtle cove most methods are unbound, U can do ```js const entities = arg => block?.dimensio...

I think it's bad form to use the spread operator on an object from the API (block) like that unless you need all the properties. It's slow, not to mention it's a little confusing to anyone reading the code.

Edit: Actually nevermind, I was wrong about the performance, I thought it would enumerate the accessor properties but apparently it doesn't. Interestingly the block's location property (or any other property for that matter since they're all accessors) doesn't actually get taken from the spread ... operator, {...block} is just a Vector3 because of the block's only 3 properties that are primitives are the x y and z properties.

subtle cove
#

object & function are only types I've tried so far

fiery solar
gritty surge
#

hey, im new to this but is there any way to detect an item aux inside an entity inventory?

cold grove
#

Mmm noo

rapid nimbus
cold grove
#

Whats the question?

rapid nimbus
wary edge
#

That is not a question.

cold grove
#

You cant create dimensions, it says its a private constructor

rapid nimbus
#

I know but I don't understand why this site has the "new Dimension()" script above

cold grove
#

Creator mistakes 🤷‍♀️
Not all classes has public constructors

rapid nimbus
#

On YouTube there is a Peruvian Youtuber who created a dimension that no one else can do, that is JhondPrincss.

cold grove
#

You can make custom dimensions teleporting far away the players to your pre made area or biome

rugged tinsel
#

that youtuber is also posting fake content

rapid nimbus
#

►Minecraft PE (Pagina) : https://MinecraftPERevolution.blogspot.com (Mods,Addons & Mas!)
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

►Como Instalar Mods: https://youtu.be/95HnQCCOgyc

►Como Instalar RTX (Android): https://youtu.be/fpO2v1nRHbo

►Morph Mod : https://youtu.be/sEf1Vd75nU4

▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
--- Conectate con mígo! ---
● Twitter - h...

▶ Play video
cold grove
#

Bro

rugged tinsel
#

it's just java with stitched pocket edition UI on top

rapid nimbus
rugged tinsel
cold grove
#

Thats not how it works...

rugged tinsel
#

you can get java edition on Android through an unofficial app, but it does not have the same style controls

cold grove
#

If there is a way, it will be a lot of information about it

crude ferry
#

How can we check the days played of the world?

past blaze
slow walrus
shy leaf
warm mason
#

He's just from the future

chilly fractal
#

Fr

chilly fractal
#

(Jk don't do it)

untold magnet
#

for a better result:
making the script detect how far is that entity, if it was ( 16 - 9 ) blocks far it will run a function
if it was ( 8 - 5 ) blocks far it will run another function, etc

chilly fractal
#

I really wanna know what you are tryna do

#

Cuz you've been asking how to use just one api method to check at different values.

#

I'm just curious

untold magnet
# chilly fractal I really wanna know what you are tryna do

i want to make my entity detect all types of entities around it by 16 × 8 × 16 area
each distance will have its own functions, entities in distance between 16 and 8 will be detected and run a function, entities in distance between 4 and 8 will have its own function
just like having 3 or 4 maxDistances, first one is 16, second one is 8, third one is 4, last one is 2

slow walrus
#

that's just simple math

untold magnet
#

trying to explain^

slow walrus
#

you grab all the entites in the max size bounding box, then iterate and test their distances

untold magnet
#

max Y is 8 not 16, i dont wanna make it detects entities in 16 × 16 × 16 area.

untold magnet
#

||I'll be back in 30m||

slow walrus
subtle cove
untold magnet
subtle cove
untold magnet
#
for (let x = playerX - radius; x <= playerX + radius; x++) {
      for (let y = playerY - radius; y <= playerY + radius; y++) {
        for (let z = playerZ - radius; z <= playerZ + radius; z++) {
          const block = player.dimension.getBlock({ x: x, y: y, z: z })```should i do something similar to this?
subtle cove
#

Uhm, no

untold magnet
#

knew it

slow walrus
#

bro what

subtle cove
#
const center = block.center()
for (const e of entities({maxDistance: 16})) {
    const loc = e.location
    const dist = Math.hypot(loc.x - center.x, loc.y - center.y, loc.z - center.z)
} ```
#

Something like that,

untold magnet
#

hmm,

untold magnet
subtle cove
#
if (dist <= 2) {}
else if (dist <= 4) {}
else if (dist <=8) {}
untold magnet
subtle cove
#

As long as there's 'return' in there, sure

ruby haven
#

I made a player.runcommand in the script but I want the entity to be summoned directly Infront of me facing cause if I use summon mz:custom_entity ^^^2 facing @s it will depend when the players camera is stable

ruby haven
remote oyster
# ruby haven I made a player.runcommand in the script but I want the entity to be summoned di...
import { world } from '@minecraft/server';

world.beforeEvents.chatSend.subscribe((event) => {
    const player = event.sender;
    const rotation = player.getRotation(); // Get player's pitch (x) and yaw (y)
    const location = player.location; // Get player's current position

    // Convert yaw to radians (for direction calculation)
    const yawRadians = (rotation.y * Math.PI) / 180;

    // Calculate the position 2 blocks in front of the player
    const x = location.x + Math.sin(yawRadians) * 2;
    const z = location.z + Math.cos(yawRadians) * 2;
    const y = location.y; // Same height as the player

    // Run the summon command at the calculated position facing the player
    system.run(() => {
        player.runCommand(`summon mz:custom_entity ${x} ${y} ${z} facing ${location.x} ${location.y} ${location.z}`);
    });
});

I just used the chatSend event for the example. Use whatever you like on getting the player object. Haven't tested it - on mobile at the moment.

ruby haven
#
import { world, system } from "@minecraft/server";

world.afterEvents.playerSpawn.subscribe(({ player, initialSpawn }) => {
  if (initialSpawn) {
    player.runCommand("function movenot");
    player.runCommand("scoreboard objectives add Trauma dummy");
    player.runCommand("scoreboard players add @s Trauma 10");
    player.runCommand("scoreboard objectives add Days dummy");
    player.runCommand("scoreboard players add @s Days 30");
    player.runCommand("scoreboard objectives setdisplay sidebar Days")
  };
  system.runInterval(() => {
    for (let player of world.getAllPlayers()) {
      if (world.scoreboard.getObjective("Days").getScore(player) <= 0) {
        player.runCommand("structure load smile ~-16.5~-1~-16.5 0_degrees none true");
        player.runCommand("summon mz:smile_base ~~~")
        world.scoreboard.getObjective("Days").removeParticipant(player);
      }
    }
  })
});

I want it to add to this

remote oyster
#

Please use:

```js
// Put your code here
```

#

Your edit was close. Need to fix it up top where you put js

ruby haven
#

Wait

chilly fractal
#

A system.runInterval inside of an event and it doesn't get cleared???? Nahhhh this guy is speedrunning getting a rift in the sky just like in the game "shades" when shadow first appears.

remote oyster
# ruby haven Done

Makes it easier to look at. Especially when you are looking at it from a mobile device lol.

chilly fractal
#

Now instead of it being intentional (the order of assassins opened it) nah he'd just do it causally without knowing

warm mason
ruby haven
chilly fractal
warm mason
ruby haven
warm mason
chilly fractal
warm mason
warm mason
remote oyster
# ruby haven ```js import { world, system } from "@minecraft/server"; world.afterEvents.play...

Here you go. Once again, not tested, and on mobile. But try it out. I also removed runInterval as it is not needed since you are using an after event.

import { world } from "@minecraft/server";

// Handle player spawn events
world.afterEvents.playerSpawn.subscribe(({ player, initialSpawn }) => {
    if (initialSpawn) {
        // Initial setup for the player
        player.runCommand("function movenot");
        player.runCommand("scoreboard objectives add Trauma dummy");
        player.runCommand("scoreboard players add @s Trauma 10");
        player.runCommand("scoreboard objectives add Days dummy");
        player.runCommand("scoreboard players add @s Days 30");
        player.runCommand("scoreboard objectives setdisplay sidebar Days");
    }

    // Check if the player's "Days" score is 0
    const daysObjective = world.scoreboard.getObjective("Days");
    const daysScore = daysObjective.getScore(player);

    if (daysScore <= 0) {
        // Spawn the entity in front of the player
        const rotation = player.getRotation();
        const location = player.location;

        const yawRadians = (rotation.y * Math.PI) / 180;
        const x = location.x + Math.sin(yawRadians) * 2;
        const z = location.z + Math.cos(yawRadians) * 2;
        const y = location.y;

        // Execute the commands when "Days" score reaches 0
        player.runCommand("structure load smile ~-16.5~-1~-16.5 0_degrees none true");
        player.runCommand(`summon mz:smile_base ${x} ${y} ${z} facing ${location.x} ${location.y} ${location.z}`);

        // Remove the player from the "Days" scoreboard
        daysObjective.removeParticipant(player);
    }
});
warm mason
# ruby haven Why?

Because you need to know what you are writing. Each time the player logs in, a new interval is started.

chilly fractal
remote oyster
chilly fractal
#

Really?

remote oyster
#

Yup

ruby haven
remote oyster
#

It could cause a leak if they added a delay and that delay overlapped.

warm mason
chilly fractal
# remote oyster Yup

I mean for one player sure, but the more players join the more intervals will be made and eventually performance issues before ultimately crashing

warm mason
remote oyster
warm mason
#

.

chilly fractal
#

So yes it's hard to crash

#

But still why?

#

Just make sure you're totally in the clear

ruby haven
#
import { world, system, Scoreboard, ScoreboardObjective } from "@minecraft/server";

world.afterEvents.playerSpawn.subscribe(({ player, initialSpawn }) => {
    if (initialSpawn) {
        player.runCommand("function movenot");
        world.scoreboard.addObjective('Trauma', null);
        world.scoreboard.addObjective('Days', null);
        world.scoreboard.getObjective('Trauma').addScore(player, 10);
        world.scoreboard.getObjective('Days').addScore(player, 30);
    }
});

system.runInterval(() => {
    for (let player of world.getAllPlayers()) {
        if (world.scoreboard.getObjective("Days").getScore(player) <= 0) {
            player.sendMessage("Time over")
            world.scoreboard.getObjective("Days").removeParticipant(player)
        }
    }
})

So in the player.sendmessage part I can run a command there

warm mason
#

You can do whatever you want there

chilly fractal
#

player.sendMessage() -> player.runCommand()

#

Boom

#

Or just add player.runCommand()

#

After the player.sendMessage()

#

Or before it

warm mason
chilly fractal
#

Yap town (I'm high) wooooooohooooo

#

Sorry I just slept 4am and woke up 8am

#

All my coffee supplies ran out and yeah I'm on 0% energy

ruby haven
#
import { world } from "@minecraft/server";

// Handle player spawn events
world.afterEvents.playerSpawn.subscribe(({ player, initialSpawn }) => {
    if (initialSpawn) {
        // Initial setup for the player
        player.runCommand("function movenot");
        player.runCommand("scoreboard objectives add Trauma dummy");
        player.runCommand("scoreboard players add @s Trauma 10");
        player.runCommand("scoreboard objectives add Days dummy");
        player.runCommand("scoreboard players add @s Days 30");
        player.runCommand("scoreboard objectives setdisplay sidebar Days");
    }

    // Check if the player's "Days" score is 0
    const daysObjective = world.scoreboard.getObjective("Days");
    const daysScore = daysObjective.getScore(player);

    if (daysScore <= 0) {
        // Spawn the entity in front of the player
        const rotation = player.getRotation();
        const location = player.location;

        const yawRadians = (rotation.y * Math.PI) / 180;
        const x = location.x + Math.sin(yawRadians) * 2;
        const z = location.z + Math.cos(yawRadians) * 2;
        const y = location.y;

        // Execute the commands when "Days" score reaches 0
        player.runCommand("structure load smile ~-16.5~-1~-16.5 0_degrees none true");
        player.runCommand(`summon mz:smile_base ${x} ${y} ${z} facing ${location.x} ${location.y} ${location.z}`);

        // Remove the player from the "Days" scoreboard
        daysObjective.removeParticipant(player);
    }
});

So will just write all the variables in this code to the original so that the summoning command will work

remote oyster
#
import { world, system } from "@minecraft/server";

// Interval handle to track the interval
let intervalHandle = null;

// Monitor "Days" score for all players
function monitorPlayerScores() {
    for (let player of world.getAllPlayers()) {
        const daysObjective = world.scoreboard.getObjective("Days");
        const daysScore = daysObjective.getScore(player);

        if (daysScore <= 0) {
            // Spawn the entity in front of the player
            const rotation = player.getRotation();
            const location = player.location;

            const yawRadians = (rotation.y * Math.PI) / 180;
            const x = location.x + Math.sin(yawRadians) * 2;
            const z = location.z + Math.cos(yawRadians) * 2;
            const y = location.y;

            // Execute the commands when "Days" score reaches 0
            player.runCommand("structure load smile ~-16.5~-1~-16.5 0_degrees none true");
            player.runCommand(`summon mz:smile_base ${x} ${y} ${z} facing ${location.x} ${location.y} ${location.z}`);

            // Remove the player from the "Days" scoreboard
            daysObjective.removeParticipant(player);
        }
    }
}

// Player spawn logic
world.afterEvents.playerSpawn.subscribe(({ player, initialSpawn }) => {
    if (initialSpawn) {
        // Initial setup for the player
        player.runCommand("function movenot");
        player.runCommand("scoreboard objectives add Trauma dummy");
        player.runCommand("scoreboard players add @s Trauma 10");
        player.runCommand("scoreboard objectives add Days dummy");
        player.runCommand("scoreboard players add @s Days 30");
        player.runCommand("scoreboard objectives setdisplay sidebar Days");
    }

    // Ensure the interval is only started once
    if (!intervalHandle) {
        intervalHandle = system.runInterval(() => monitorPlayerScores());
    }
});
chilly fractal
warm mason
#

So... Come on, no hasty codes for 1000 lines.

warm mason
remote oyster
ruby haven
warm mason
sacred blaze
remote oyster
ruby haven
remote oyster
#

I misunderstood earlier.

chilly fractal
#

Not when u get outta the event

remote oyster
#

The interval is needed in order to monitor the days.

warm mason
#
import { world, system, Scoreboard, ScoreboardObjective } from "@minecraft/server";

world.afterEvents.playerSpawn.subscribe(({ player, initialSpawn }) => {
    if (initialSpawn) {
        player.runCommand("function movenot");
        world.scoreboard.addObjective('Trauma', null);
        world.scoreboard.addObjective('Days', null);
        world.scoreboard.getObjective('Trauma').addScore(player, 10);
        world.scoreboard.getObjective('Days').addScore(player, 30);
    }
});

system.runInterval(() => {
    for (let player of world.getAllPlayers()) {
        if (world.scoreboard.getObjective("Days").getScore(player) <= 0) {
            let view = player.getViewDirection()
            let entity = player.dimension.spawnEntity("boss:id", {
              x: player.location.x + view.x*6,
              y: player.location.y + view.y,
              z: player.location.z + view.z*6
            })
            entity.teleport(entity.location, { facingLocation: player.location })
            world.scoreboard.getObjective("Days").removeParticipant(player)
        }
    }
})```
remote oyster
chilly fractal
#

It is literally called by itself

chilly fractal
#

Not a function

remote oyster
chilly fractal
#

💀

remote oyster
#

I'm about to flex on some new developers. Trying to remain humble.

warm mason
#

runInterval is simply separate from the player spawn event

chilly fractal
ruby haven
warm mason
chilly fractal
warm mason
chilly fractal
#

Good day ig?

#

Like good night for day time

ruby haven
ruby haven
# warm mason

I can run any command here without worrying lags right?

ruby haven
slow walrus
#

a memory leak happens when memory isn't properly deallocated

#

anyway, in this case memory wouldn't be the issue, the performance time would be

distant tulip
#

the variables count go up over time, and that is a memory leak

fading sand
#
let et
let startTime = 0
let initTime = 0
let projectileType = "minecraft:snowball"

world.afterEvents.entitySpawn.subscribe(({ entity }) => {
    if (entity.typeId == projectileType) {
        //NEED TO ADD TIMER
    }
});


const velocity = 0.5;

export const faceVelocity = {
    west: {
        x: -1,
        y: 1,
        z: 1
    },
    east: {
        x: -1,
        y: 1,
        z: 1
    },
    up: {
        x: 1,
        y: -1,
        z: 1
    },
    down: {
        x: 1,
        y: -1,
        z: 1
    },
    north: {
        x: 1,
        y: 1,
        z: -1
    },
    south: {
        x: 1,
        y: 1,
        z: -1
    }
}

const offset = 0.5;

export const faceOffset = {
    west: {
        x: -offset,
        y: 0,
        z: 0
    },
    east: {
        x: offset,
        y: 0,
        z: 0
    },
    up: {
        x: 0,
        y: offset,
        z: 0
    },
    down: {
        x: 0,
        y: -offset,
        z: 0
    },
    north: {
        x: 0,
        y: 0,
        z: -offset
    },
    south: {
        x: 0,
        y: 0,
        z: offset
    }
}

world.afterEvents.projectileHitBlock.subscribe((data) => {
    let { projectile, hitVector, location } = data;
    const blockHit = data.getBlockHit();
    let bounceVocity = ((Date.now() - initTime) * 0.000775 + startTime)
    const multiply = faceVelocity[blockHit.face];
    startTime = 0
    const add = faceOffset[blockHit.face];
    const newProj = projectile.dimension.spawnEntity(projectile.typeId, new Vector(location.x + add.x, location.y + add.y, location.z + add.z))
    newProj.applyImpulse({
        x: hitVector.x * multiply.x * velocity, y: hitVector.y * multiply.y * velocity, z: hitVector.z * multiply.z * velocity
    });
    console.warn(Date.now() - initTime)
    console.warn(bounceVocity)
    projectile.kill();
});

Is there anything outdated? Ig the event name is..

warm mason
#

.

fading sand
#

Thx

ruby haven
ruby haven
#

I tried but it still keeps running

ruby haven
warm mason
# ruby haven I tried this code and it keeps running when I reenter the game so I tried creati...
import { world, system, Scoreboard, ScoreboardObjective } from "@minecraft/server";

world.afterEvents.playerSpawn.subscribe(({ player, initialSpawn }) => {
    if (initialSpawn) {
        player.runCommand("function movenot");
        world.scoreboard.addObjective('Trauma', null);
        world.scoreboard.addObjective('Days', null);
        if (world.scoreboard.getObjective("Days").getScore(player) != undefined) return 
        world.scoreboard.getObjective('Trauma').addScore(player, 10);
        world.scoreboard.getObjective('Days').addScore(player, 30);
    }
});

system.runInterval(() => {
    for (let player of world.getAllPlayers()) {
        if (world.scoreboard.getObjective("Days").getScore(player) <= 0) {
            let view = player.getViewDirection()
            let entity = player.dimension.spawnEntity("boss:id", {
              x: player.location.x + view.x*6,
              y: player.location.y + view.y,
              z: player.location.z + view.z*6
            })
            entity.teleport(entity.location, { facingLocation: player.location })
            world.scoreboard.getObjective("Days").removeParticipant(player)
        }
    }
})```
ruby haven
strong oar
#

Can I ask the link for documentation for creating custom block component

wary edge
jolly citrus
#

like a way to change the scale

#

ive never worked with anims

strong oar
strong oar
#

Ohh thanks

meager zenith
#

what the npm commands do again? , i forgor

jolly citrus
subtle cove
# ruby haven I just tried it but it still keeps running when I reenter the game I don't why i...
import { world, system, Scoreboard, ScoreboardObjective } from "@minecraft/server";


const getObjective = (o, d) => world.scoreboard.getObjective(o) ?? world.scoreboard.addObjective(o, d)

const Days = getObjective("Days", null)
const Trauma = getObjective("Trauma", null)


world.afterEvents.playerSpawn.subscribe(({ player, initialSpawn }) => {
    if (initialSpawn) {
        player.runCommand("function movenot")
        if (Days.hasParticipant(player)) return
        Days.addScore(player, 30)
        Trauma.addScore(player, 10)
    }
});

system.runInterval(() => {
    for (let player of world.getAllPlayers()) {
        if (Days.getScore(player) <= 0) {
            let view = player.getViewDirection()
            let entity = player.dimension.spawnEntity("boss:id", {
                x: player.location.x + view.x * 6,
                y: player.location.y + view.y,
                z: player.location.z + view.z * 6
            })
            entity.teleport(entity.location, { facingLocation: player.getHeadLocation() })
            Days.removeParticipant(player)
        }
    }
});
jolly citrus
#

like python pip equivalent on node.js

meager zenith
gaunt salmonBOT
jolly citrus
#

so you dont need to constantly check the docs for everything like return types

jolly citrus
#

you can directly see them in ur code

#

for example

meager zenith
jolly citrus
#

@remarks tells you what it does, @param identifier explains the use of a specific parameter (in this case, identifier), @param identifier explains the use of a specific parameter (in this case, value) @throws tells you if the function can or can not throw errors

jolly citrus
#

ur only supposed to download the package suitable for ur current use case

meager zenith
#

oh i see

jolly citrus
meager zenith
#

oh ok

jolly citrus
#

just check which ones you're using in your manifest file to choose

meager zenith
#

thanks again for the help

jolly citrus
jolly citrus
meager zenith
# jolly citrus

yep i have been learning about the script api for the past like 4 months now, but now i won't have to look at the docs as much as i am used to

ruby haven
jolly citrus
ruby haven
#

What if they leave and join again?

jolly citrus
#

based on the .playerSpawn part idk if theres any more to it i didnt check original post

jolly citrus
subtle cove
jolly citrus
#

if you want to prevent that u should, for example, add a tag to identify whether or not a player has been in the world before

#

like playerSpawn -> check if has tag "oldplayer" if not run the code, then add tag "oldplayer"

untold magnet
#

yo, uh.


system.runInterval(() => {
  for (const player of world.getAllPlayers()) {
    let slots = 0;
    const inv = player.getComponent('minecraft:equippable');
    const parts = ['Head', 'Chest', 'Legs', 'Feet'];
    for (const part of parts) {
      const eSlot = inv?.getEquipment(part);
      if (!eSlot) continue;
      if (myArmor[parts.indexOf(part)].includes(eSlot?.typeId)) slots++;
    }
    if (slots === 2) console.warn('2');
    if (slots === 3) console.warn('3');
    if (slots === 4) console.warn('4');
  }
})```i used this method to detect if the player is wearing the full seg of armor or not, and it's kinda glitched so, is there any better way to do it?
ruby haven
#

I'm thinking of using the player.join and create a global variable called firstSpawn that has a value of true then change it afterwards that way I can avoid the repeating of the functions

ruby haven
subtle cove
jolly citrus
#
world.afterEvents.playerSpawn.subscribe(({ player, initialSpawn }) => {
    if (!player.hasTag("oldplayer")) {
        if (initialSpawn) {
            player.runCommand("function movenot")
            if (Days.hasParticipant(player)) return
            Days.addScore(player, 30)
            Trauma.addScore(player, 10)
            player.addTag("oldplayer")
        }
    }
});

this is one simple way to achieve the checks ur looking for

untold magnet
jolly citrus
#

what is myArmor

untold magnet
jolly citrus
jolly citrus
untold magnet
#

const myArmor = ['minecraft:iron_helmet', 'minecraft:iron_chestplate', 'minecraft:iron_leggings', 'minecraft:iron_boots'];

ruby haven
untold magnet
#

u guys will not understand if i explain, so i have to detect the armor using scripts, nothing else

jolly citrus
# untold magnet yo, uh. ```js system.runInterval(() => { for (const player of world.getAllPla...
let effects = {
    "bard": [
        ["regeneration", {
            amplifier: 0
        }],
        ["resistance", {
            amplifier: 1
        }],
        ["speed", {
            amplifier: 1
        }]
    ],
    "archer": [
        ["jump_boost", {
            amplifier: 0
        }],
        ["resistance", {
            amplifier: 1
        }],
        ["speed", {
            amplifier: 2
        }]
    ],
    "rogue": [
        ["jump_boost", {
            amplifier: 1
        }],
        ["speed", {
            amplifier: 3
        }],
        ["resistance", {
            amplifier: 0
        }],
    ],
    "miner": [
        ["haste", {
            amplifier: 1
        }],
        ["speed", {
            amplifier: 0
        }],
        ["fire_resistance", {
            amplifier: 0
        }],
        ["night_vision", {
            amplifier: 0
        }]
    ]
}

system.runInterval(() => {
    for (const player of world.getPlayers()) {
        let helmet = player.getComponent("equippable").getEquipment("Head");
        let chestplate = player.getComponent("equippable").getEquipment("Chest");
        let leggings = player.getComponent("equippable").getEquipment("Legs");
        let boots = player.getComponent("equippable").getEquipment("Feet");
        let foundSet = false;

        for (const [className, armorSet] of Object.entries(armors)) {
            if (
                helmet?.typeId === armorSet.helmet &&
                chestplate?.typeId === armorSet.chestplate &&
                leggings?.typeId === armorSet.leggings &&
                boots?.typeId === armorSet.boots
            ) {
                foundSet = true;
                player.setDynamicProperty("class", className);
                const classEffects = effects[className];
                for (const [effectType, options] of classEffects) {
                    const duration = effectType == "night_vision" ? 241 : effectType == "regeneration" ? 121 : 21;
                    if (effectType == "regeneration" && player.getEffect("regeneration") == undefined) {
                        player.addEffect(effectType, duration, options);
                    } else if (effectType != "regeneration") {
                        player.addEffect(effectType, duration, options);
                    }
                }
            }
        }
    }
}, 20);

modify it a bit but this is how i did it

ruby haven
#

The gameplay I'm trying to achieve is after the entity spawns I will add an objective called days after the days turns to 0 I will run a command

jolly citrus
#

quickly copy pasted u dont need half of this

untold magnet
jolly citrus
#

idk wym

ruby haven
untold magnet
#

I'll do it myself later.,.

jolly citrus
#

array

#
let armors = {
    "bard": {
        helmet: "minecraft:golden_helmet",
        chestplate: "minecraft:golden_chestplate",
        leggings: "minecraft:golden_leggings",
        boots: "minecraft:golden_boots"
    },
    "archer": {
        helmet: "minecraft:leather_helmet",
        chestplate: "minecraft:leather_chestplate",
        leggings: "minecraft:leather_leggings",
        boots: "minecraft:leather_boots"
    },
    "rogue": {
        helmet: "minecraft:chainmail_helmet",
        chestplate: "minecraft:chainmail_chestplate",
        leggings: "minecraft:chainmail_leggings",
        boots: "minecraft:chainmail_boots"
    },
    "miner": {
        helmet: "minecraft:iron_helmet",
        chestplate: "minecraft:iron_chestplate",
        leggings: "minecraft:iron_leggings",
        boots: "minecraft:iron_boots"
    }
}
#

i hope that explains the logic better i just noticed

#
for (const [className, armorSet] of Object.entries(armors)) {
            if (
                helmet?.typeId === armorSet.helmet &&
                chestplate?.typeId === armorSet.chestplate &&
                leggings?.typeId === armorSet.leggings &&
                boots?.typeId === armorSet.boots
            ) {
ruby haven
#

In my case what about using tags

#

I'm gonna check if the player has a tag called spawned will that work

distant gulch
#

Hello Humans

distant tulip
distant tulip
distant gulch
#

nevermind

#

Hello Minato 🇵🇸

untold magnet
distant tulip
untold magnet
untold magnet
#

i dont think so

distant gulch
#

well, youll need something like a custom effect handler

distant tulip
#

slowness and player model distortion

distant gulch
#

and manager idk

untold magnet
# distant tulip slowness and player model distortion
Large = 16
Mid = 8
Small = 4
Tiny = 2
-
with-out the protective armor
Large Distances = Nausea I
Mid Distances = Fetal Poison II
Small Distance = Darkness III + Slowness I
Tiny Distances = Fetal Poison V
-
with the protective armor:
Tiny Distances = Fetal Poison II + Nausea I
distant gulch
#

do - custom - effects!!!

#

Disintegration!!!!

distant tulip
#

lol
i imagined the player skin changing to a different one

untold magnet
#

maybe

untold magnet
#

nah

distant tulip
#

the green tint is a good idea

distant gulch
#

indeed

ruby haven
#
import { world, system } from "@minecraft/server";

world.afterEvents.playerSpawn.subscribe(({ player }) => {
  if (!player.hasTag("spawned")) {
    player.runCommand("function movenot");
    world.scoreboard.addObjective('Trauma', null);
    world.scoreboard.addObjective('Days', null);
    world.scoreboard.getObjective('Trauma').addScore(player, 10);
    world.scoreboard.getObjective('Days').addScore(player, 30);
    player.runCommand("scoreboard objectives setdisplay sidebar Days")
    player.addTag("spawned");
  }
});

system.runInterval(() => {
  for (let player of world.getAllPlayers()) {
    if (world.scoreboard.getObjective("Days").getScore(player) <= 0) {
      player.runCommand("structure load smile ~-16.5~~-16.5 0_degrees none true");
      let view = player.getViewDirection();
      let entity = player.dimension.spawnEntity("mz:smile_base", {
        x: player.location.x + view.x * 6,
        y: player.location.y + view.y,
        z: player.location.z + view.z * 6
      })
      entity.teleport(entity.location, { facingLocation: player.location })
      world.scoreboard.getObjective("Days").removeParticipant(player)
    }
  }
})

Already fixed the issue for the function that keeps repeating after a player rejoins a the world but it has this error

ruby haven
sharp elbow
#

If getObjective returns undefined, then getScore won't work. You need to check that the Days objective exists before trying to get a score—or use optional chaining and null coalescing—or create the objective in that same step.

#

The solution to go with depends on what behavior you want to have.

ruby haven
sharp elbow
#

Then I would probably omit the scoreboard objective creation step in playerSpawn and coalesce the creation and getting together. In code, that would be:

const DaysObj = world.scoreboard.getObjective('Days') ?? world.scoreboard.addObjective('Days');
if(DaysObj.getScore(player) <= 0) {
  // ...
}
#

Then when it tries to access that scoreboard objective, it will run the addObjective method if getObjective returns undefined.

thorn ocean
#

Has anyone been able to place a water block through scripts that automatically flows? Cuz I used fill commands and setBlockType and the water doesn't update until a block is placed next to it.

wary edge
subtle cove
thorn ocean
thorn ocean
past blaze
thorn ocean
wary edge
#

Nor world gen.

past blaze
past blaze
#

/setblock ~~~ flowing_water works for me

wary edge
#

They must've updated it.

thorn ocean
#

Yeah it doesn't work.

past blaze
thorn ocean
chilly fractal
#

Are there border_blocks around it?

#

Are there barrier blocks around it?

past blaze
chilly fractal
wary edge
#

Randomtickspeed maybe.

wary edge
past blaze
#

I'm pretty sure water uses queued ticks, so random tick speed will have no effect

chilly fractal
wary edge
thorn ocean
past blaze
wary edge
past blaze
wary edge
#

New world, vanilla.

past blaze
wary edge
#

Looks like they finally fixed it. Now do the same for world gen.

past blaze
#

I'm not well-versed in world gen. Perhaps someone else

granite badger
#

it's water that doesn't float, flowing_water does

gentle mist
#

Is it possible to do something like that,
If im right click a item the Chest UI menu will open
If i left click it to a player, so hit him with that, the menu will get open again, i take the kit i want, and than i challenged him, kf he accept we will match together

chilly fractal
#

Sure

#

It's possible but gonna be needing an inventory management system (for saving items with enchants and lore and setting on player and clearing it), and a ui system (very basic, I'm sure you know). And of course the duel system (like randomly selecting & setting map, countdown, class removal, managing the dynamicProperties or whatever you use to set the property of players wether the duel has started or not and cancel all moves if it hasn't started).

#

And of course your maps and the map management system.

#

All seems very possible but will take a good bit of time and effort.

#

Most of what I mentioned is very easy to do, like inventory management system, canceling player moves if the duel hasn't started, countdown, ui system

#

What would be a bit harder to do is the map system, as you have two choices, either save the whole map as each block with its data and stuff (very bad approach) or use structures to save areas, and you're gonna need more than one structure if your map is bigger than a 646464 cube I believe

#

Now I do have to make this clear: no one will do free work for you & this server isn't a hiring place, so you're not allowed to ask others for paid worked (paying them for it). People here will help you achieve your goals. So just make the code, test it, if it fails ask for help here and learn from your mistakes.

gentle mist
#

Ehm ik that?

chilly fractal
#

Alright then, you know how to make your desires. NOW GET THE F- jk jk

chilly fractal
valid ice
gentle mist
#

I dont have a problem, u started to tell me thst

chilly fractal
gentle mist
#

I asked no one for paid stuff or anything like that, i just ask for something if its possible

#

Dont be mad

chilly fractal
#

I'm not mad

gentle mist
#

If you have a problem, than dont answer me

valid ice
#

✨ anything is possible ✨

chilly fractal
#

I also answered your question

chilly fractal
gentle mist
#

You are they guy with herobrine chest UI right?

chilly fractal
#

Yeah he is

#

In this server the best of best is just chillin'

#

Ambro? Yessir
Sprunkles? Yessir
Herobrine? Yessir
Others (I'm thinking of other things rn so I can't remember, but also): Yessir

gentle mist
#

Poggy

chilly fractal
#

Think of anyone and i bet $1 they'll be chillin'

chilly fractal
slim spear
valid ice
#

She is, in fact, not chillin’

thorn ocean
#

Is it intentional that when using custom block components and using onUseOn, no blocks are automatically placed anymore?

wary edge
past blaze
#

I assume it's because block placing is being managed completely on the server side at that point

wary edge
#

Its also an issue if custom blocks have any custom components. Quick placing and whatever else is broken.

thorn ocean
wary edge
thorn ocean
drifting pollenBOT
thorn ocean
#

So it is a bug. That's a shame.

jade grail
#

im tryna do player.getComponent("minecraft:health").max but its coming out as undefined anyone know the error?

#

when i remove the max part it comes out as object: object

winter plaza
#

.effectiveMax

jade grail
ruby haven
#

Is it possible to set an entities rotation before it spawns

winter plaza
#

yes

winter plaza
jade grail
#

do u know how i can get the current hp aswell?

winter plaza
#

currentValue

jade grail
#

Thanks

#

0_0 how do u know entei?

#

mutual friend

ruby haven
winter plaza
distant tulip
winter plaza
#

yes.

jade grail
winter plaza
#

?

jade grail
#

click of my profile and check mutual friends

#

he use to go by gengar

distant tulip
winter plaza
winter plaza
jade grail
winter plaza
#

yes

distant tulip
#

well
that is not native script api method

jade grail
#

.

winter plaza
#

lol

jade grail
#

i think he wanted dimension.entityspawn

#

thingy

#

version

distant tulip
winter plaza
#
function Missions(player) {
  let body = 0;
  const score = getScore("missions", player);
  switch (score.currentValue) {
    case `0`:
      body = "1"
    break
  }
}
jade grail
winter plaza
#

switch doesn't work with score?

jade grail
#

u put it in

#

``

#

that why

#

its not a str

winter plaza
#
function Missions(player) {
  let body = "0";
  const score = getScore("missions", player);
  switch (score.currentValue) {
    case `0`:
      body = "1"
    break
  }
}
#

and so? is this correct?

jade grail
#

no

distant tulip
#

case 0:

jade grail
#

0_0 i awnsered it already

winter plaza
#

oh ok

winter plaza
distant tulip
#

why do you need switch for that

jade grail
#

ye not the best with conveying stuff

#

i just info dump

ruby haven
#

What's the difference between runcommandasync and runcommand?

distant tulip
jade grail
#

runcommand

#

it waits for the command to be done

#

-_- i think

#

idk im not good with js

valid ice
#

Yeah

#

Don't... don't use runCommand

jade grail
#

im assumming runCommand slows the entire code down

steady canopy
#

Hey i dont know where to put this question but.

Does someone have a solution for leaves decaying when you don't want them to decay but you can't set randomtickspeed to 0.

Because, i have a spawn map where most decorations are made of leaves and they will decay as soon as i set randomtickspeed to something higher than 0.

I can't set randomtickspeed to 0 because that won't let farms work.

distant tulip
valid ice
valid ice
steady canopy
#

and also if i place them manually

jade grail
#

-_- idk what catergory this is part of but im doing screen display when i display a subtitle then title the subtitle is deleted

steady canopy
#

these leaves are obviously placed manually

#

but they still decaying

#

so it makes no sense

valid ice
#

Weird

jade grail
#

and way around that?

ruby haven
#
system.runInterval(() => {
  for (let player of world.getAllPlayers()) {
    if (player.hasTag("logic_done")) continue;

    const DaysObj = world.scoreboard.getObjective('Days') ?? world.scoreboard.addObjective('Days', null);
    const daysScore = DaysObj.getScore(player);

    if (daysScore <= 0) {

      player.runCommand("structure load smile ~-16.5~-1~-16.5 0_degrees none true");
      let view = player.getViewDirection();
      let entity = player.dimension.spawnEntity("mz:smile_base", {
        x: player.location.x + view.x * 6,
        y: player.location.y + view.y,
        z: player.location.z + view.z * 6,
      });

      entity.teleport(entity.location, { facingLocation: player.location });

      DaysObj.removeParticipant(player);

      player.addTag("logic_done");
    }
  }
}, 20);
#

Is there a better way to spawn my entity where its rotation is already set the position is already set cause the entity that I'm spawning doesn't move

distant tulip
ruby haven
jade grail
distant tulip
#

uhm... i don't know what that mean

jade grail
#

how do i disable it reseting subtitle

distant tulip
#

save it somewhere and re-use it?

jade grail
#

0_0 that wont do

#

im linking it with json ui

#

every time it gets reset the ui gonna start flashing

winter plaza
# distant tulip ```js function Missions(player) { return getScore("missions", player)==0?1:0; ...

I'm going to use a lot of words, it can't be like this

export function stats_missions(player) {
  let body = "0";
  const form = new ui.ActionFormData();
  form.title(`Mission`);
  form.body(`${Missions(player, body)}`);
  form.button("§0");
  form.button("§0");
  form.show(player).then((r) => {
    if (r.selection === 0) {
      stats_menu(player);
    }
    if (r.selection === 1) {
      stats_missions(player);
    }
  }
);}

function Missions(player, body) {
  const score = getScore("missions", player);
  switch (score) {
    case 0:
      body = "test1"
    break
    case 1:
      body = "test2"
    break
  }
}
#

the body is undefined

distant tulip
#
const scoreStr = {
  0:"test1",
  1:"test2"
}
function Missions(player) {
  return scoreStr[getScore("missions", player)]
}
#

@winter plaza

#

avoid switch if it isn't needed
it is slow

winter plaza
#

ah ok

onyx lantern
#

dimension.getEntities

thorn flicker
jolly citrus
#

which events will be fired if a player in adventure mode punches a block

jolly citrus
#

why does this not work for me in survival or in adventur

subtle cove
#

Nothins triggered ig...

jolly citrus
#

can it be listened for from multiple files

#

i have it in 4 places now

#

but only one does not work

#

nvm it does trigger

#

not in adventure tho like i wanted

#

why is this returning false

Frozen.Info([x, y, z] + "==" + [19, 67, 10])
    if ([x, y, z] == [19, 67, 10])
#

Frozen.Info([x, y, z] + "==" + [19, 67, 10] + ": " + ([x, y, z] == [19, 67, 10]))

#

oh nvm chatgpt explained it to me

#

i forgot

neat hound
#

prob because they are objects

jolly citrus
#

i fixed

distant tulip
#

it would be so cool if we can select what entity to include/exclude in a structure with the structureManager

chilly fractal
#

It would be so cool to cancel entityHurt

untold magnet
#

ugh...

#
          const inv = eEntity?.getComponent('minecraft:equippable');
          let h = inv?.getEquipment('Head')?.typeId === 'minecraft:iron_helmet';
          if (h) console.warn('H-on')
          if (!h) console.warn('H-off')```why?
#

this should warn H-on only when I equip the iron helmet, it shouldn't warn H-off

#

why is it happening?

#

oh, nvm nvm

#

i fixed it

#

my bad

quick shoal
ruby haven
quick shoal
prisma narwhal
#

scripting thumbs_up

#

^ 100, 000th message here, in this thread

simple zodiac
#

Na uh

#

Look how often it has been mentioned

fiery solar
quick shoal
#

combat system help

How can I do a time out that can remove player's combat tag if thier not longer has pvping

honest spear
distant gulch
quick shoal
quick shoal
gentle mist
#

3 Heart System
All players have 3 Hearts, but you can only lose a heart if you get killed by an other player, that means, dying to mobs, fall damage or anything other, will not lose you one heart.
If you lost all 3 Hearts, you will kicked from the server and can't join it again.

Fight System
If you fight against a player and got hit by him, you are in combat. That means if you are in combat, you must escape or fight trough the end. If you get hit, a message for the player who got hit will showed, this message is a combat countdown, if you get hit the message will show up, it should look like this:
You got attacked by [player], you are now 30 seconds in combat.
In this 30 seconds you can easily lose a heart, that means if u are in the combat and fall down and die, you will lose a heart and the kill will get the player who get you in the combat. Also if you are trying to log out through the combat, if you will join back u will lose a heart.
If you are not anymore in the combat. A message will show up like that:
You are not anymore in combat, you are safe now.
But if you get hit again by a player, the combat is there again.
If a player get killed by a other player, a message for the whole server will show up like that:
[player] got killed while fighting against [player] (- 1 Heart)

Deathscreen
If you got killed by a other player, a animated Deathscreen will show up, the Deathscreen is showing a animation how ur heart get destroyed

Animated Heart
Your 3 Heart should show up between ur Hunger Bar and ur normal Hearts.

I can give example photos.

Is that possible?

gentle mist
#

Can i show u a example

warm mason
#

You can, but why?

gentle mist
#

Is that possible?

#

And here if you lost a heart

warm mason
gentle mist
#

And do u think its hard

warm mason
distant gulch
#

Does my manifest.json needs the module "script" when using a typescript compiler?

distant gulch
#

@warm mason since you are that eager to help

warm mason
warm mason
#

I've never used TS so I don't know how

#

🤷‍♂️

distant gulch
#

hmm okay

#

but still thanks

warm mason
distant gulch
#

I like it more than JS

#

(even if ts the same)

warm mason
#

It's much slower than JS

distant gulch
#

Atthe end it gets transpiled to machine-code so it will only effect that "speed"

#

right?

distant gulch
#

Transpilation or Compilation

warm mason
#

JS and TS are interpreted languages, and are run line by line each time, so the speed of JS affects this

#

And TS is also translated into JS, then into C++, then into assembler, and only after all this into machine code

distant gulch
#

Yes so only that initialization-time is more?

warm mason
distant gulch
#

Yes i know, sometimes i mix up Transpilation with Interpretation

#

Anyways, only the Transpilation takes longer on TS right?

#

So it wont affect the code

warm mason
distant gulch
warm mason
#

Well then decide for yourself. I think JS is faster

distant gulch
#

Sure everyone have's their op.

Anyways~

quick shoal
gentle mist
#

Can someone help me with what in a picture

distant gulch
quick shoal
#

Ohh sry

distant gulch
quick shoal
#

Sry I thought it was here so I can't find it here then i Think U deleted it

gentle mist
#

Ik its not the channel but idk where else, can someone change the red to good nice purple tone

gentle mist
#

Thankss

warm mason
quick shoal
distant gulch
#

nvm

gentle mist
gentle mist
#

But thank you that was very kind really

distant gulch
gentle mist
#

Maybe you or @warm mason can do one thing too for me

#

Can u remove the mouse cursor you can see there and change the heart to the purple like on the picture, or is it too hard

gentle mist
#

So just the blue to purple if its possible

remote oyster
#

It must be JavaScript in the manifest. Some of us use TS to write our code because we can utilize its capabilities for real time results versus runtime. However, for production we transpile it to JS.

#

@gentle mist

gentle mist
#

You mean for that what i want to do?

warm mason
remote oyster
#

Yea, just noticed lol.

#

@gentle mist ignore that. It was meant for @distant gulch

distant gulch
remote oyster
distant gulch
#

Yes i know, its my first time setting it up with TS

remote oyster
sage portal
# prisma narwhal ^ 100, 000th message here, in this thread

[Hate](#1067535608660107284 message) to [burst](#1067535608660107284 message) your [bubble](
#1067535608660107284 message), but [we've](#1067535608660107284 message) had [100k](#1067535608660107284 message) messages [for](#1067535608660107284 message) a [while](#1067535608660107284 message) now.

sterile epoch
#

are there any good NBT editors on pc

drifting ravenBOT
#
NBT Studio

NBT Studio is an NBT editing application, the spiritual successor to NBTExplorer. It has been rewritten completely from scratch to support a vast array of new features, while keeping the familiar layout of controls. New features include Bedrock support, SNBT support, undo/redo functionality, drag and drop, multiselect, and more! It's called Studio to make it sound more important than it really is.

https://github.com/tryashtar/nbt-studio/releases

wary edge
#

@sterile epoch

sterile epoch
#

thanks

gentle mist
#

Does Bedrock have Plugins

#

Ehh Does Plugins exist for Bedrock*

#

anyone have good github stuff thst is good for servers

jade grail
#

on servers ...

gentle mist
#

Which servers?

thorn ocean
#

So now the custom slabs are fully functional without that weird placing bug.

distant tulip
somber onyx
#
world.afterEvents.playerJoin.subscribe((event) => {
    let sender = event.playerId
    world.sendMessage(`§8[§2+§8]§r ${event.playerName} `)
    sender.sendMessage("§8§l>> §rHome and Warp system created by LunaireI")
})

how to make a message of custom join player message, I did ca but ca does not work why?

#

I do not understand the error

distant tulip
fervent topaz
#

u should probably use playerspawn instead of playerjoin

somber onyx
#

ok I undestand but, how define sender

gentle mist
fervent topaz
distant tulip
gentle mist
somber onyx
#

so this solution not perfect

fervent topaz
distant tulip
jade grail
#

export function value_changer_menu(player) {
let all_players = mc.world.getPlayers();
const form = new ui.ModalFormData()
.title("§l§1Value Changer")
.dropdown("§l§dPlayer", ["Default"], 0)
.textField("§l§bValue to change", "", "")
.textField("§l§2New Value", "", "");
form.show(player).then(r => { //ERROR LINE (line 300)
if (r.canceled) return;
let [dropdown, droptextField1, textField2] = r.formValues;
});
};

error with this?

jade grail
#

[Scripting][error]-ReferenceError: Native function [ModalFormData::show] does not have required privileges. at value_changer_menu (test/menu.js:300)

#

i think the problem is what im using to open the ui

#

not the code in it

wary edge
jade grail
#

thats what im using

wary edge
#

You need to wrap it around system.run.

jade grail
#

ok

winged gull
#

That wasn't the problem, their function is not gonna run after the timeout because they forgot to put ()=> before it, and the runTimeout also fixes the required privileges issue

#

the problem is they are passing the output of their menu showing function to runTimeout

#

which will not make it wait

#

they need to prefix it with ()=> to make it so the function itself is passed as the argument

#

it should be

mc.system.runTimeout(()=>menu.value_changer_menu(player), 20)
jade grail
winged gull
#

lol

jade grail
#

i had another project which i did same thing i went back to that

#

and checked what i did

winged gull
#

if you were using typescript it would have told you that was the problem

jade grail
#

i need learn it

#

for that to happen

winged gull
#

typescript makes everything wayyyy easier

#

it is a pain doing it in pure javascript

#

because you don't get those errors inside the editor

#

where it shows you exactly where the problem is

slow walrus
# distant gulch Does my ``manifest.json`` needs the module "script" when using a typescript comp...

when using typescript, you need to build it to js and then use that in the manifest.

for example, this is my tsconfig.json:

{
  "compilerOptions": {
    "module": "ES2020",
    "target": "ES2020",
    "moduleResolution": "Node",
    "allowSyntheticDefaultImports": true,
    "declaration": true,
    "noImplicitAny": true,
    "strict": true,
    "outDir": "./packs/BP/scripts/dist",
    "pretty": true
  },
  "exclude": ["node_modules"],
  "include": ["./packs/BP/scripts/src"]
}

so I have a src folder in scripts that contains all the .ts files, and then it outputs the .js and .d.ts to the dist folder in scripts, and my manifest uses the dist folder

And here's what it would look like in the manifest:

    "modules": [
        {
            "type": "script",
            "language": "javascript",
            "entry": "scripts/dist/entry.js",
            "uuid": "UUID",
            "version": [
                1,
                0,
                0
            ]
        }
    ],
solar dagger
#

uh how do i translate the entity name?

  blueprint.setLore([
    `${entity.typeId}`
  ]);
junior hill
#

world.afterEvents.playerBreakBlock.subscribe((event) => {
  const block = event.block;
  const player = event.player;
  const location = block.location;

  if (block.type.id === "swmc:door1") {
    const x = location.x;
    const y = location.y;
    const z = location.z;

    dimension.runCommand(`fill ${x} ${y - 1} ${z} ${x} ${y + 1} ${z} air replace swmc:door1`);
  }
});

Why wont this work?

chilly fractal
chilly fractal
# junior hill ```import { world } from "@minecraft/server"; world.afterEvents.playerBreakBloc...

Errors:

  • Using AfterEvent, This Fires After The Block Is Broken. Which I Believe May Return Undefined But I May Be Wrong.
  • Using Dimension When It Hasn't Been Defined Before.

Coding Mistakes:

  • Deconstructing Using A Line For Each Property Of The Location Object
  • Using Commands When Native Methods Exist.

Correct Code:

import { world, system, BlockVolume } from "@minecraft/server";

world.beforeEvents.playerBreakBlock.subscribe((event) => {
  const block = event.block, player = event.player, location = block.location;

  if (block.type.id === "swmc:door1") {
    const {x, y, z} = block.location;
    
    system.run(() => {
      player.dimension.fillBlocks(new BlockVolume({ x: x, y: y+1, z: z }, { x: x, y: y+1, z: z }), 'minecraft:air', {blockFilter: { includeTypes: ["swmc:door1"] }});
    });
  }
});```
distant gulch
proud saddle
#

playerInteractWithEntity for now triggers only if interacting was successful
what event to use to register unsuccessful interactions

proud saddle
turbid gulch
#

How can I use transferPlayer in BDS

remote oyster
#

@hot gust I think you may remember this?

warm mason
remote oyster
# warm mason What are the permission levels in scripts?

Oof, having me knock some dust off the old shelf.... I can't recall.

I do know some leverage is gained by adding the following to server.properties:

op-permission-level = 4

Though, I'd admit that my memory is rusty on how far that extends.

warm mason
#

Server permissions? Lol why

remote oyster
#

OP permissions for BDS are different than Realms, and local worlds. It's a hot mess honestly, and the devs know it already. I don't think they want to touch it because of the amount of refactoring it would take to handle it.

#

It's one of the reasons why the isOp method works, but doesn't. It depends on the environment and adequate level of OP permissions. Need to be at least 2 minimum so for BDS, that happens when you apply the property, making it viable to use. Realms lack it so it just simply does not work.

warm mason
#

No, I just don’t understand why the server needs permissions.

remote oyster
proud saddle
#

can we get a world tick(i mean total tick, not daily tick)

warm mason
warm mason
proud saddle
remote oyster
#

Without permission level 4 for Operator permission, technically can't use it.

warm mason
#

but I can simply set the level of rights higher.

warm mason
remote oyster
#

It's plausible that the API for server-admin may be given adequate permission under the hood. I don't know what the devs intentions are on the matter.

#

Busy at work, but to quickly touch base with the player, you are able to execute the /transfer command in chat which will move a player where needed, respectively.

The property you set in server.properties to gain level 4 permissions for OP should technically allow you to get that player object with that permission, and use runCommand() or runCommandAsync() to call that /transfer command with adequate permission for it to execute.

In theory Not a Theory - Confirmed

#

This obviously will not work in a Realm. Only BDS if it worked at all.

hot gust
#

this is how I was doing it

const playerObj = getPlayerByName("PlayerWhoIsAnOP");
            if (playerObj) {
                const command = /transfer ${player.name} XX.XX.XX.XX.XX 19132;
                playerObj.sendMessage(command);
            }```
untold magnet
#

uh,

#

for (let i = 0; i < 4; i++) ^

warm mason
#

code

#

array slots to the studio!

untold magnet
#

wha?

warm mason
#

Show the slots array

untold magnet
#

ah wait

#

lemme check something

untold magnet
jolly citrus
#

how do i check if two itemstacks are equal

#

im trying to compare two inventories to each other

jolly citrus
jolly citrus
#
/**
 * 
 * @param {ItemStack} i1 
 * @param {ItemStack} i2 
 * @returns 
 */
function compareItems(i1, i2) {
    Frozen.Info(`Item 1: ${JSON.stringify(i1.getLore())} | ${i1.typeId} | ${i1.nameTag ?? "undefined"} | ${i1.getComponent("durability").damage}`)
    Frozen.Info(`Item 2: ${JSON.stringify(i2.getLore())} | ${i2.typeId} | ${i2.nameTag ?? "undefined"} | ${i2.getComponent("durability").damage}`)
    if (i1.getLore() != i2.getLore()) return false;
    if (i1.typeId != i1.typeId) return false;
    if (i1.nameTag != i2.nameTag) return false;
    if (i1.getComponent("durability").damage != i1.getComponent("durability").damage) return false;
    return true;
}

why does it return false

warm mason
jolly citrus
#

thanks

warm mason
#

You can use my function to turn an object into a string and compare the strings

#

@jolly citrus

jolly citrus
#

thx ill check it out

#
system.runInterval(()=>{
    for (const player of world.getPlayers()) {
        if (vectorsAreEqual(player.getVelocity(),Vec3(0,0,0))) {
            let OldInventory = playerInventories.get(player.id)
            let Inventory = player.getComponent("inventory").container
            if (OldInventory) {
                
                let Result = compareInventories(Inventory,OldInventory)
                if (Result == false) {
                    world.sendMessage(`inventories were not identical`)
                }
                playerInventories.set(player.id,Inventory)
            } else {
                playerInventories.set(player.id,Inventory)
            }

        }
    }
},40)

why is OldInventory always identical to Inventory

#

if i drop an item from the first slot they both get updated to this new value on the next check not just Inventory

sharp elbow
#

Both are likely references to the same object. You should store a copy of the properties you want to save. Maybe by playerInventories.set(player.id, {...Inventory});?

#

I'm unsure if spreading the properties will work like that though

#

If I'm not mistaken—think of grabbing the container not as taking a snapshot of the inventory at a point in time, but grabbing an object that will dynamically be updated as the contents of the inventory change.

#

Naturally, then, the container you store in the map is the same as the container you have just acquired.

jolly citrus
#

saved each item stack in an array instead

jolly citrus
#

is it possible to clear the item a player has 'equipped' on their inventory cursor like shown in the image

wary edge
warm mason
#

#1307833431358570567 message

warm mason
warm mason
jolly citrus
wary edge
#

The itemstack itself is readonly.

jolly citrus
#

wait how does item swapping work on mobile devices

#

can they swap two items between slots

#

in their inventory

warm mason
#

This doesn't work at all on mobile devices

jolly citrus
warm mason
#

It should work fine, it's already in a stable version

jolly citrus
#

alright

warm mason
#

I don't know, but I don't think your phone players will like such innovations

jolly citrus
#

yeah i was going to make a click to enchant type of thing

#

for custom enchantment books

jolly citrus
distant gulch
#

Guys

#

how ast is the api?

#

like how fast can it react and respond

warm mason
distant gulch
chilly fractal
# distant gulch like how fast can it react and respond

Depending, you can get the ram gbs from player's device information, depending on how your script is crafted it will affect the performance time, if you have system.runJob(function*(){ /* Code */ }());
And have yield; in your code, your code should work fine on all devices, but it may delay iteration so it can work fine on any device. (This is if you need long running asynchronous operations or anything performance using), depending on how big your player render chunks from the settings it may make your code lag if you're running the code on a world, caching arrays while using for...let loops makes your code run faster. Uhhh idk what else to say.

distant gulch
chilly fractal
#

Yeah

distant gulch
#

should be right?

#

okay nice

distant gulch
# chilly fractal Yeah
import { system } from "@minecraft/server";
import Interval from "../assets/Interval";

export default class Game {
    public static init(): void {
        new Interval(Game.onTick);
    }

    public static currentTick: number = 0;

    public static onTick(): void {
        this.currentTick = system.currentTick;
    }
}

I declared Game.currentTick as system.currentTick every tick once so i dont need to re-get currentTick from system ( due i need currentTick in other files too )

#

is this smart?

#

or am i just dumb

#

.. i could just count it up by one every tick... im dumb lol

chilly fractal
#

Not sure what to say but I think just accessing might be faster.. but idk just use a tps checker and use both your method & just accessing directly and see whatever is faster

distant gulch
chilly fractal
#

Honestly just do system.currentTick

distant gulch
round bone
#

like some methods, classes etc. I could add to this API to provide even better experience

tawny jungle
#

how can I ensure that the player can only place within a certain distance?

round bone
tawny jungle
#

thanks

#

is there a way i can get mindistance in a similar way to getBlockFromViewDirection()?

sharp elbow
#

min distance?

tawny jungle
#

yeah i need minimum distance to something to work

#

but realized that probably not achievable without an entity

#

then forgot about this message

#

on a somewhat related note, why is this returning these numbers? im clicking right next to myself

            const y1 = playerLocation.y
            const z1 = playerLocation.z
            const x2 = player.getBlockFromViewDirection({ includeLiquidBlocks: false, includePassableBlocks: false })?.faceLocation.x
            const y2 = player.getBlockFromViewDirection({ includeLiquidBlocks: false, includePassableBlocks: false })?.faceLocation.y
            const z2 = player.getBlockFromViewDirection({ includeLiquidBlocks: false, includePassableBlocks: false })?.faceLocation.z
            const difference = { x: x1 - x2, y: y1 - y2, z: z1 - z2 };
            const distance = Math.sqrt(difference.x ** 2 + difference.y ** 2 + difference.z ** 2);
            console.warn(distance)```
output from console log:
terse tide
#

How do I make it so that when a block powered by redstone is close to my block it activates?

tawny jungle
#

nvm i was using facelocation. supposed to use block

terse tide
#

👍

tawny jungle
#

why does this function return different values depending on where its called in the file?

    const playerLocation = player.location
    const x1 = playerLocation.x
    const y1 = playerLocation.y
    const z1 = playerLocation.z
    const x2 = player.getBlockFromViewDirection({ includeLiquidBlocks: false, includePassableBlocks: false })?.block.x
    const y2 = player.getBlockFromViewDirection({ includeLiquidBlocks: false, includePassableBlocks: false })?.block.y
    const z2 = player.getBlockFromViewDirection({ includeLiquidBlocks: false, includePassableBlocks: false })?.block.z
    const distance = Math.sqrt((x1-x2) ** 2 + (y1-y2) ** 2 + (z1-z2) ** 2);
    return distance
}```
#

the first and second are each a call of the function in different places in the file, both under world.beforeEvents

junior hill
#

i tried afterEvent

#

what this is suppose to do is when u break a block it fills the block if the block is swmc:door1 it turns it into air

onyx lantern
#

is it possible to import scripts from different addons?

slow walrus
#

does the vector3 interface seriously have no operators

#

tf

#

not even addition and subtraction

wary edge
slow walrus
#

can't see a math one

onyx lantern
# wary edge No.

do you know if there are any plans to make this possible? or maybe if theres workarounds

onyx lantern
# wary edge What are you trying to do?

I just wanted to create an addon with all the scripts I normally use so I wouldn't need to reuse & update all the files of all my projects everytime I update one of the scripts

slow walrus
#

you wanna call those scripts from other addons?

onyx lantern
#

yep

slow walrus
wary edge
slow walrus
#

set up channel handlers on your main pack, and then you can invoke them from your other packs

onyx lantern
slow walrus
wary edge
#

If only. the best I've achieved is custom components and that's because it doesn't really require scripts, it just needs the custom components registered.

onyx lantern
slow walrus
#

sure

onyx lantern
slow walrus
#

there's some basic usage stuff in the readme that should help

onyx lantern
wary edge
slow walrus
onyx lantern
#

for example, on a block.json or item.json, a custom component that requires specific block or item id to be specified

#

and whateaver gets added as input could be used on the custom component code

fiery solar
wary edge
onyx lantern
wary edge
onyx lantern
wary edge
#

You're better creating your own "package" then bundling them.

onyx lantern
fiery solar
# onyx lantern I meant everything, classes, functions, databases, maps etc

I would definitely consider another option then. The usual solution to organizing shared logic would be either a monorepo or an NPM package.

Doing this through IPC would be a nightmare, require that a second addon be installed, be harder to update and might actually be the opposite of what you want.

onyx lantern
wary edge
#

I utilize tags to do lots of parameters. But then again, this might not be suited for you.

#

You have a differetn use case.

onyx lantern
onyx lantern
wary edge
onyx lantern
#

nevermind I just saw at your project

onyx lantern
#

hmmm

#

interesting

#

that might actually work for me

fiery solar
# slow walrus why would it be a nightmare?

For something like a database?

Because you have to serialize every function call to your shared API, send it through IPC (adding significant overhead), deserialize it on the other side (introducing an additional place for potential bugs to occur). You can't make any backwards-incompatible changes to the API, or else you break all the other add-ons that rely on it. You also have the limitation that you can't run anything synchronously.

Or instead of all that you could just bundle the scripts automatically into each of your add-ons code and just call the function normally.

There's certainly many uses for that library, but in my opinion a database is not one of them unless you need to create an add-on that facilitates communication between 2 or more other addons for something like concurrency control.

slow walrus
# fiery solar For something like a database? Because you have to serialize every function cal...

IPC already handles all serialization and deserialization, sending stuff through it doesn't add much overhead at all (unless you're sending well over 10,000 chars in which case you have other problems). newest IPC release is gonna be stable for a long time since there's not really anything that can be improved atp, and ofc it being asynchronous is expected, if they wanted an entirely synchronous database they'd use a local one, so it's up to them to decide

not really something I'd call a nightmare

#

dynamic property databases are also UUID linked so it might be a better idea to use one pack with IPC rather than bundling, so you can share the database between multiple packs

rain viper
#

I need help please, the truth is I don't know why it is not repaired so to speak, my goal is that it has leather armor and it is repaired at every moment so to speak

const equipmentSlots = ["Head", "Chest", "Legs", "Feet"];

system.runInterval(() => {
    const players = world.getAllPlayers();

    players.forEach(player => {
        const equippable = player.getComponent("equippable");
        
        if (equippable) {
            for(const slot of equipmentSlots){
                const item = equippable.getEquipment(slot)
                if(item && item.typeId){
                    if(item.typeId.startsWith("minecraft:leather_")){
                        const durabilidad = item.getComponent("durability")
                        if(item.typeId == "minecraft:leather_chestplate"){
                            console.warn(item.typeId)
                            durabilidad.damage = 10;
                        }
                    }else{console.warn("no c encuentra")}
                }else {console.warn("sin item")}
            }
        }
    });
}, 100);
rain viper
#

ok

dim tusk
dim tusk
deep garden
#

world.afterEvents.playerInteractWithBlock.subscribe(({ player, itemStack, block }) => {

    const item = itemStack.typeId;
    const target = block.typeId;


    if (item === "luna:filter_rod" && target === "minecraft:grass") {
        player.runCommand('say this works');
    }
});```

Am I supposed to include the block location to get this to work?
knotty plaza
deep garden
#

Oh gotcha, I changed it. Thanks for that 😉 I still can't get it to do anything though

warm mason
glacial widget
#
world.beforeEvents.playerInteractWithBlock.subscribe((ev) => {
const {player, itemStack:item, block} = ev

  if (item.typeId === "Your item" && block.typeId === "minecraft:grass_block") {
    system.run(() =>{
      player.sendMessage("EYE CAN TOUCH GRASS")
    })
  }
});
#

this a better method, always use beforeEvents for interact with block

#

just simple and less errors the using afterEvents

distant tulip
#

less errors? better?
in what way?

onyx lantern
#

@fiery solar the IPC system works amazingly, I think it will allow me and my friend @lament tree to do everything we have planned. incredibile job!

fiery solar
dapper viper
#

?

untold magnet
#

uh

#

is it possible to detect if a specific block is pushed by a piston?

#

i know i can use piston activate thing, but what if my block has been pushed by another block that has been pushed by a piston?

shy leaf
untold magnet
#

uh, trying to explain ^

shy leaf
#

not sure if it exists now, for pushed block i mean

quick shoal
#
[Scripting][error]-ArgumentOutOfBoundsError: Provided integer value was out of range.  Value: 1732114309912, argument bounds: [0, 4294967295]    at onPlayerHit (antiInterrup.js:65)
    at <anonymous> (antiInterrup.js:94)
#

Who can help me fix this error

untold magnet
#

nvm,

untold magnet
quick shoal
chilly fractal
#

Use beforeEvents

warm mason
terse tide
#

How i can detect If has powered redstone on faces of my block?

chilly fractal
#

@junior hill If you are facing an error send it here instead of pinging me and like 2 other guys with no text or error or issue or anything that stops you from using the script i gave you.

#

While yes I'm open for pings, I don't like random pings that aren't asking for help from me.

terse tide
#

You can help me?

chilly fractal
#

One sec

terse tide
#

Okay

terse tide
#

Ohhhh

#

Thanks

#

It will help me a lot

chilly fractal
#

You're welcome.

onyx lantern
#

Is it possible to add armor points for mobs without actually having them equipping an armor piece?

warm mason
#

no

junior hill
#

I used tried both

umbral scarab
#
import * as mc from "@minecraft/server";

mc.world.beforeEvents.chatSend.subscribe((event) => {
    const { sender, message } = event;

    console.log(`Sending message to server: ${sender}: ${message}`);

});
#

Why does this not work?

quick shoal
#

From contents log

umbral scarab
quick shoal
#

Wait a moment

umbral scarab
#

latest

quick shoal
#

Need beta

umbral scarab
#

ah

#

tyty

jolly citrus
#

is it possible to set a block to look different for a specific player

#

like client-sided

valid ice
#

Nay

jolly citrus
#

i wonder if we'll ever get more client manipulation features

#

they would be so useful

valid ice
#

Yarr

jolly citrus
#

yarr

valid ice
#

The existence of @minecraft/server eludes to a mysterious @minecraft/client 👀

wary edge
jolly citrus
#

you could achieve anything with that as long as you try hard enough no

valid ice
#

Packet stuff just got added for server-net. I expect more functionality in the future, would be great

jolly citrus
valid ice
#

Should be available in 1.20.50

jolly citrus
#

ill be tired of minecraft in 1 month again

valid ice
#

No clue

jolly citrus
#

approx.

jolly citrus
valid ice
#

Probably a couple of weeks

#

It’s the “winter drop” with the creaking

jolly citrus
#

how do i find out where my script slowdowns originate from

junior hill
valid ice
jolly citrus
#

the slowdowns r like 5ms-80ms how am i going o notice

wary edge
#

Use the debugger or script profiler

valid ice
#

You can log the time since script start to the current time
E.g. at the top of your code block, const startTime = Date.now()
And then in the warns use Date.now() - startTime

Or use the profiler, would probably be easier 😛

jolly citrus
#

should i be worried if i get slowdowns when playing alone

jolly citrus
valid ice
#

Any slowdown is cause for concern

fiery solar
chilly fractal
junior hill
chilly fractal
#

Alright put some console.warn('Working (number)'); statements in the script then

junior hill
#

Kk i will try

deep garden
#

@knotty plaza No logs but it's okay, I didn't think of before events like the others said.

@serty.name Oh I didn't know that 🤯 Thank you for that!

@glacial widget Oh I appreciate that a lot, never worked with system.run so I am glad for the example ❤️ Thank you

sage portal
#

I know you cant set nor clear it, but can you get a player's velocity?

whole saddle
#

Does anyone here know if you can use a SQLite database with the script api on a bds server? And if so, how?

sage portal
warm mason
warm mason
sage portal
#

I figured the same for clear and set velocity, but the game runs the error that you can't do that for player class entities

warm mason
jolly citrus
#

and how would it work

chilly fractal
sage portal
#

I'm looking for getVelocity, not clearVelocity

chilly fractal
#

These methods should work tho

fiery solar
#

@jolly citrus One of the types of particles you can create is aligned to an axis instead of always facing the player. You could spawn a square particle facing 6 different directions for a certain player based on some condition using player.spawnParticle (which is currently experimental), and do the same thing for other players (but with a different particle).

But it's a lot of processing, so you can't really do this for a common block. Here's a video of me testing a block that's invisible unless you have a golden helmet.

surreal axle
#

hey guys, anyone know how to solve this issue?
[Scripting] Unhandled promise rejection: TypeError: Native property setter [HttpRequest::method] cannot be assigned null or undefined.

code below:

const body = {
  CustomId: this.userId,
  CreateAccount: true,
  TitleId: "<myTitleId>",
};

const req = new HttpRequest(url);
req.body = JSON.stringify(body);

req.method = HttpRequestMethod.POST;
req.headers = [new HttpHeader("Content-Type", "application/json")];

return http.request(req);
fiery solar
terse pulsar
#

I can use the texts of .lang in sendMesage string?

surreal axle
#

switched back to the default version, 1.0.0-beta, and it started to work

shy leaf
slow walrus
jade grail
#

is there a way for me to save data to a world? like how i can save data to an entity using dynamic properties?

jade grail
#

of a way to save it to the world

chilly fractal
jade grail
chilly fractal
jade grail
#

i thought u could only set dynamic properties to entities but i was wrong

#

can i set it to items? aswell