#MolangVariableMap (solved)
1 messages · Page 1 of 1 (latest)
heres the file
and the code
static sendParticlesNew(dim = "overworld", particleName = "unknown", pos = {x,y,z}, count = 1, offset = {x:0,y:0,z:0})
{
for (let i = 0; i < count; i++)
{
const molng = new MolangVariableMap()
molng.setFloat("particle_offset_x", offset.x);
molng.setFloat("particle_offset_y", offset.y);
molng.setFloat("particle_offset_z", offset.z);
world.getDimension(dim).spawnParticle(particleName, pos, molng);
}
}
Have you used this variable in the particle
yes
"minecraft:emitter_initialization": {
"creation_expression": "variable.random_scale = math.random(0.4, 6.5);variable.particle_offset.x = 0.0;variable.particle_offset.y = 0.0;variable.particle_offset.z = 0.0;"
},
"minecraft:emitter_rate_instant": {
"num_particles": 1
},
"minecraft:emitter_lifetime_looping": {
"active_time": 1
},
"minecraft:emitter_shape_point": {
"offset": ["v.particle_offset.x", "v.particle_offset.y", "v.particle_offset.z"]
},
ive tried another approach but it didnt work when setting it on script but worked when setting a value on the particle file..
Shouldn't you add a v.
both the initialization and the emitter shape?
ohh i already tried it and still didn't work..
ur js code is correct, but u reset the variables in json to 0 so it doesn't work
just not reset them
and also
it would be better to use setVector3 instead of several setFloats
uhh what reset? do i need the initialization or not?🥹
u are adding 3 variables in JS code and then setting them to 0 there
ohhh, i thought i need to initialize the variable first😅😅 It worked now!! Thankk you!!