#MolangVariableMap not working for projectile

1 messages · Page 1 of 1 (latest)

spring gale
#

I believe it needs to be variable.color not just color. And your particle has the variables in its code?

simple pollen
# spring gale I believe it needs to be variable.color not just color. And your particle has th...

sorry let me send new code this doesnt explain what im doing very well and is old

                let molang = new MolangVariableMap();
                //molang.setColorRGB("color", { red: 1, green: 0, blue: 0 });
                molang.setFloat("directionx", 0);
                molang.setFloat("directiony", 0);
                molang.setFloat("directionz", 25);

                dimension.spawnParticle(
                    "spellcraft:generic_spell_trail",
                    //change this to the provided particle
                    projectile.location,
                    molang
                );```
spring gale
#

Yes and in your script you used "color" and "directionx" etc, however I believe it requires that you use "variable.color" and "variable.directionx" etc

simple pollen
#

the color one doesnt matter it was just a test

spring gale
#

If I had to guess it's some other factor then. Your MolangVariableMap code works fine for me, and it all lines up with what I have done in the past.

All I can say is check your error log and share your full code.

silent galleon
#

this might help```js

mc.world.afterEvents.itemUse.subscribe(async (s) => {
    const player = s.source;

    const molang = new mc.MolangVariableMap();
    molang.setSpeedAndDirection("variable.actor", 1.5, player.getViewDirection());
    player.dimension.spawnParticle(
        "minecraft:dragon_breath_fire",
        player.getHeadLocation(),
        molang,
    );
});```while this is the particle.json part ```json

"minecraft:emitter_shape_point": {
"direction": [ "variable.actor.direction_x", "variable.actor.direction_y", "variable.actor.direction_z" ]
},
"minecraft:particle_initial_speed": "variable.actor.speed * 20",

latent cargo
#

but everything else seems fine

silent galleon
#

Ooh, that also works, thx