#(Fixed) Function randomizer not work?

1 messages · Page 1 of 1 (latest)

rigid prism
#

Title, used to use this on my previous addons, but it does not seem to work here :(

{
    const array = [
        "durandal_attack",
        "durandal_attack2",
        "durandal_attack3",
        "durandal_attack4",
        "durandal_attack_insta"
    ];

    world.beforeEvents.worldInitialize.subscribe(({ itemComponentRegistry }) => {
        itemComponentRegistry.registerCustomComponent("lbr_durandal:trigger", {
            onHitEntity(event) {
                const player = event.attackingEntity;
                player.runCommand(`function ${array[Math.floor(Math.random() * array.length)]}`);
            }
        });
    });
}
thorny perch
hasty silo
#
system.beforeEvents.startup.subscribe(
rigid prism
rigid prism
#

(Fixed) Function randomizer not work?

hasty silo
#

was just sending part of the code