#MolangVariableMap (solved)

1 messages · Page 1 of 1 (latest)

outer harness
#

How to use this? I've created a custom variable for the particle i am creating and its

variable.particle_offset_x

and in script i set the variable

    const molng = new MolangVaribaleMap();
    molang.setFloat("variable.particle.offset.x", offset.x);

but it didn't work.. it didn't move the particle tho.. idk why

#

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);
        }
    }
vestal pecan
outer harness
#

yes

outer harness
# vestal pecan Have you used this variable in the particle
"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..

outer harness
#

both the initialization and the emitter shape?

outer harness
sterile willow
#

just not reset them

#

and also

#

it would be better to use setVector3 instead of several setFloats

outer harness
sterile willow
outer harness
#

ohhh, i thought i need to initialize the variable first😅😅 It worked now!! Thankk you!!