#simple trail system

1 messages · Page 1 of 1 (latest)

coarse grove
#

if I'm not wrong this could cause lag

#

it's great, but maybe adding a one second tick could help, not sure I never tested it.

coarse grove
#

idk if a 1 second tick you just added would help lol, 20 is equivalent to an actual second.

#

but when you do that, look at the particles because they might be ruined or delayed.

#

yeah, I thought you wanted to make it a second

#

I don't know if a millisecond would make much difference

wind hemlock
#

20 minecraft ticks is a full second.

#

Roughly. Lag will definitly change it.

#

Gotcha. I meant serverside lag in general.

#

Is the const part neccesary?

wind hemlock
#

No. I was wanting to use it, I was just wondering if the const was neccesarry for the script.

devout ivy
#
import { world, system } from "@minecraft/server";

system.runInterval(() => {
    for (const player of world.getAllPlayers()) {
        const 
            { location, dimension } = player,
            effectId = player.getTags().find(find => find.startsWith("trail:"))[0];
        dimension.spawnParticle(effectId, location);
    };
});
wind hemlock
#

Gotcha

#

I meant const trails

modern zealot
fervent acorn
#

it's not even that advanced

ripe plank
#

@ripe plank i tried to Modifiy it a bit, i hope its good

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

// trails, you can easily add some
const trails = [
    [
        '1',
        'minecraft:basic_flame_particle'
    ],
    [
        '2',
        'minecraft:totem_particle'
    ],
    [
        '3',
        'minecraft:villager_happy'
    ],
    [
        '4',
        'minecraft:villager_angry'
    ],
    [
        '5',
        'minecraft:lava_drip_particle'
    ],
    [
        '6',
        'minecraft:enchanting_table_particle'
    ],
]

system.runInterval(() => {
    for (const player of world.getAllPlayers()) {
        const location = player.location

        trails.some((trail) => {
            if (player.hasTag(trail[0])) {
                player.spawnParticle(trail[1], location);
                return true // if you want that the player can have multiple particles at the same time, just remve the returns and instead of using 'some' use 'forEach' :D 
            } else {
                return false
            }
        })
    }
}, 1)
devout ivy
ripe plank
devout ivy
#

or maybe use string[] array

#

and when getting element from index, use index + 1

ripe plank
#

but for this small thing a tag system is enough

sweet vector
#

Would this not work just as good?

const particles = [
{
tag: "test",
particle: "minecraft:basic_flame_particle",
}
]

system.runInterval(() => {
for (const player of world.getAllPlayers()) {
const tags = player.getTags()
for (const particle of particles) {
If (tags.include(particle.tag)) {
player.runCommand('particle ' + particle.particle + ' ' + player.location.x + ' ' + player.location.y + ' ' + player.location.z)
}
}
}
}, 1)
#

There are probably some errors, just typed this out on my phone on discord

upbeat schooner