#MolangVariableMap not working for projectile
1 messages · Page 1 of 1 (latest)
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
);```
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
still doesnt fix
let molang = new MolangVariableMap();
molang.setFloat("variable.directionx", 0);
molang.setFloat("variable.directiony", 0);
molang.setFloat("variable.directionz", 25);
dimension.spawnParticle(
"spellcraft:generic_spell_trail",
//change this to the provided particle
{
x: projectile.location.x - 0.1,
y: projectile.location.y - 0.3,
z: projectile.location.z
},
molang
);
the color one doesnt matter it was just a test
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.
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",
u shouldn't name variables like variable.<name>, it needs to be just <name>
but everything else seems fine
Ooh, that also works, thx