#Molang General

1 messages · Page 3 of 1

polar steeple
#

what about this 👀

swift rivet
#

No. You have to calculate gravity yourself inside of parametric motion. Parametric motion is basically just "set particle position to xyz", so you need to calculate such xyz that it looks like gravity

#

Another option is to get rid of parametric motion and instead use acceleration, where you can calculate it such that it works exactly like your parametric motion formula

polar steeple
stoic kiln
#

What is context.other used for?

slim fern
#

How do we do ranges in molang in the sense that I want to return something within a range of 20 and 60 for instance?

swift rivet
#

Wdym? Like a random value? Remap 0-1 float to a custom range? Test if a value is within the range?

slim fern
inner jasper
slim fern
#

It can't use extent

brittle remnant
#

Is there a query for checking for a full inventory in an entity? I have an item generator entity that spawns a loot table about every 13 seconds and since it has a hopper component it takes them all in. I was hoping to stop it's controller animations once full, or at least test for it if possible. Got any ideas? 💡

abstract nacelle
brittle remnant
scarlet brook
#
"v.flying_nimbus = (q.is_riding ? (q.get_ride -> q.owner_identifier) == 'dbe:flying_nimbus') || (q.is_riding ? (q.get_ride -> q.owner_identifier) == 'dbe:black_flying_nimbus'); ",
#

How can i convert it to script?

#

OBs: it is a var that i use to play an animation when i'm riding a flying nimbus

azure geode
#

"v.damage_percentage < 100 ? {v.damage_state = 0;};",

#

is this right?

#

cant work out what the syntax is from the docs

azure geode
#

i just want to set the damage state if the percentage is less than 100

somber edge
#

How to convert variable to visible number on screen?

#

Using texture psck

cedar willow
#

is there any molang (in Resource pack Animation Controller) that could read something abt attachable (item) that coud be modified using script?

#

Like query.remaining_durability but it doesn't work in RP

#

Or read abt the player holding the item? Like tag. Or some variable?

swift rivet
#

Nope

#

Best option is to probably just switch out the item

#

Or put some item into an empty slot and detect that

cedar willow
swift rivet
#

I mean if you can edit player.json there are options, but otherwise no

cedar willow
swift rivet
#

Can probably read item tags, and ID but not much else

cedar willow
swift rivet
#

You can check for items in different slots tho

cedar willow
#

Well, then I guess I could put some trigger item into Offhand

#

But then player cant use Offhand anymore

swift rivet
cedar willow
#

Can we make a suggestion for ScriptAPI to be able to trigger animation of Attachable 😦

cedar willow
#

Hows abt item name?

#

nvm

#

is_name_any return the namespace not the anvil name thing

swift rivet
#

Yes

#

But maybe it also works with item names, it could be worth a shot

cedar willow
#

Let me try

cedar willow
#

😦

severe cave
#

Is it possible to query the player's movement speed based on keyframe animation, with the speed starting from 0 and increasing, and set all keyframes to increment from zero? When the speed is greater than or equal to 1, all keyframes should revert to their default values. This way, the amplitude of the animation's movements gradually increases with the movement speed. If possible, how can I achieve this?

flint socket
#

how would i make a sine like this?

rough hedge
#

How do I save the value of q.anim_time in a variable once it clears a condition (for example, math.pow(q.anime_time, 3) > 30)? ( it will continue to update after the condition is meant but I want it to be updated once)

abstract nacelle
supple knoll
flint socket
#

thanks

supple knoll
spiral bane
#
            "loop" : true,
            "bones" : {
                "root" : {
                    "position" : [ "this", "query.is_owner_identifier_any('minecraft:zombie') ? -6.0 : 0.0", "this"]
                },
                "l_leg" : {
                    "rotation" : [ "-90.0 - this", "-10.0 - this", "-this" ]
                },
                "r_leg" : {
                    "rotation" : [ "-90.0 - this", "10.0 - this", "-this" ]
                }
            }

Does anyone know how to fix this? I tried to use query.is_owner_identifier_any('minecraft:zombie') to change the root position of all zombie jockeys to -6.0 and the rest of the zombies to 0.0. But it does not work for some reason.

languid lily
#

Is there a workaround to make v.attack_time work on an attachable?

spiral bane
grim wagon
#

What even is the point of having public and private molang variables...

#

there is literally only one place where it matters (c.owning_entity) and it makes animating attachbles basically impossible for no reason

#

all query functions are public, why not variables

swift rivet
#

That's a good question, I agree that it does seem unnecessarily restrictive

grim wagon
#

I have been hurt by attachables.

half sorrel
#

no one even checks the molang offten

shell berry
#

What's the syntax for query.any_tag? When I use "q.any_tag('tag')" the log says that the token is unrecognized

abstract nacelle
spiral bane
#

How to detect an entity moving backwards and distinguish it from the forward movement? Is there a query for it?

abstract nacelle
delicate flame
#

What's the appropriate equation to get my object to rotate with the circle path? Currently I have it spinning like the black arrow

coral forge
#

You'd have to set the x and z of it to trig functions of some kind. If this is in a resource pack, something like: "position":["<radius>*math.cos(q.anim_time)",0,"<radius>*math.sin(q.anim_time)"], replacing <radius> with the radius of the circle

delicate flame
#

Hmmm 🤔 okay 👍

plucky holly
#

Is there any ways to detect item in off hand using "query" after 1.21.20 update? And what "query.equipped_item_is_attachable" is formated like?

plucky holly
#

And slot.weapon.mainhand

#

How to use query.equipped_item_is_attachable ?

abstract nacelle
plucky holly
#

Sorry for pinging:( forgot to turn it off

abstract nacelle
plucky holly
#

Thank you very much

plucky holly
spiral bane
#

Is there any way get the distance from a target in animations? I know query.distance_from_camera works for the player but not for the target entity.

abstract nacelle
stone zephyr
#

hello, how to detect if anim_time surpassed to two seconds? is anim_time a micro? or millisecond?

stone zephyr
#

oh

stone zephyr
#

how do you make your entity turn smooth instead of just direct turning, is it possible?

#

i have heard of yaw_speed but doesn't know how do i make it turn smoothly

#

Turning left or right*

supple knoll
#

any way to get the time the particle was spawned/created (for acceleration)?

abstract nacelle
abstract nacelle
supple knoll
#

how can i save it?

abstract nacelle
supple knoll
#

i'm trying to make a spiralish thingy, i already made it through scripts

stone zephyr
abstract nacelle
stone zephyr
stone zephyr
#

Okay, thanks!

stone zephyr
#

nope, haven't tried it yet :v

polar steeple
#

how do i make an xyz var

stone zephyr
polar steeple
#

huh
starting value not possible?

stone zephyr
#

idk, but that's how i make one. Hope someone goes in here to assist you. I haven't really messed with molangs more enough.

You can also just make it:
v.my_vector_x, v.my_vector_y, v.my_vector_z but that's long or bad practice i guess

swift rivet
#

I wouldn't use structs unless you have a reason to, as each strict nesting level takes a bit of extra performance

#

But if you want to e.g. pass a vector variable from scripting, I usually do something like that in the emitter initialization v.vec ?? {v.vec.x=0; v.vec.y=0; v.vec.z=0;}; since variables passed from scripting are populated before emitter initializes, so using a null coalescing ?? for initialization is a must

polar steeple
swift rivet
#

Not sure

#

You could do just v.vec.x=0; v.vec.y=0; v.vec.z=0;

#

And then add the ?? part after exporting

#

Tho it's only useful if you intend to pass values from scripting

polar steeple
#

i can't seem to figure it out
you have any example?

swift rivet
#

Examples of what?

polar steeple
#

is there a query for when an entity with range attack shoot
the charge one don't work for me

iron hedge
#

What's the purpose of q.has_block_state?
Can it be used anywhere outside of block permutation conditions?

inner jasper
inner jasper
#

I was gonna say maybe in entities for those that have blocks as a target perhaps?

sharp light
sharp light
#

breaks after about 8m

iron hedge
#

oh
i've never had issues with it
ig i'll stop using it then

inner jasper
sharp light
#

its probably more than that but I've never had consistent results with it

polar steeple
#

any idea what is wrong

inner jasper
polar steeple
inner jasper
#

Hence its suggesting to USE has_proeprty

polar steeple
#

nvm
but that error is kinda miss leading
client_sync: true was needed

inner jasper
#

How was it misleading?

polar steeple
inner jasper
#

It clearly says:
q.property - property does nto exist

polar steeple
#

ah
i read it q.property does not exist

sterile shore
#

How did I fix this mistake

inland forum
sterile shore
inland forum
#

version?

sterile shore
#

1.21

inland forum
sterile shore
#

.

#

2

inland forum
#

?

sterile shore
#

manifest

inland forum
#

format version

sterile shore
inland forum
#

min_engine_version

sterile shore
#

what?

#

@inland forum

inland forum
#

entity client?

sterile shore
#

1.21

#

@inland forum

inland forum
#

full

sterile shore
inland forum
#

full screen

sterile shore
inland forum
#

you tried to put "format_version": "1.10.0" in entity client

inland forum
sterile shore
#

This error only appears when I open the Minecraft pause menu, but it is just a warning, it does not interfere with the code, but it is very annoying so I want to find a way to remove this error.

inland forum
#

although in this case 1.21.2 is not an acceptable version and it also exceeds the version of your manifest

inland forum
inland forum
#

So, your addon works correctly? The only problem is the message, right?

lilac flame
# sterile shore help

Just check if the player isn't in the UI before the expression so it doesn't interfere with the paperdoll

sturdy turtle
#

got renamed back from dear to molang

lucid nacelle
#

can variables defined in the in behavior pack be accessed from rp?

polar steeple
#

i was using
q.item_is_charged('main_hand')
thinking it get triggered when mainhand item is changed 🤦‍♂️
is there something like this?

#

when we were able to get item id it was as simple as storing the id on entry and keeping track of it

abstract nacelle
#

ah, no

#

nvm

#

idk, use scripting XD

rough jasper
#

How do I detect if the enemy got hit?
(q.hurt_time doesn’t work)

sleek glen
#

You could do all of this in an animation controller.

abstract nacelle
lime lark
#

that is nice

cedar willow
#

can anyone make a new bug report on query.any_tag('wood')

#

Mojang forgot to add Warped, Crimson, Bamboo and Cherry blocks type as wood

brisk sentinel
#

what does "context.other->q.remaining_durability" mean? specifically the "context.other->"

ornate wren
#

The other item for repair… I think it's the 2nd one in the UI.

summer marsh
#

hi there, is it possible using molang to get if the entity is over a slab?

polar steeple
#

not sure if there is other ways

summer marsh
#

will try that, thx!

umbral glacier
#

Is there a way to run a function every few seconds that spawns an entity at a random position around each player?

#

I'm not clear if there's ways to run these sorts of timed functions/scripts

dense ore
#

does anyone know how to add this check

(t.iterator = 0; loop(27, {query.is_item_name_any('slot.inventory', t.iterator, 'minecraft:arrow') ? {return true;}; t.iterator = t.iterator + 1;}); t.iterator = 0; loop(9, {query.is_item_name_any('slot.hotbar', t.iterator, 'minecraft:arrow') ? {return true;}; t.iterator = t.iterator + 1;}); {query.is_item_name_any('slot.weapon.offhand', 0, 'minecraft:arrow') ? {return true;};}; return false);

as part of the expresion below

"v.charge_amount = q.main_hand_item_use_duration > 0.0f ? (math.clamp((q.main_hand_item_max_duration - q.main_hand_item_use_duration) / 5, 1, 3)) : 0;"

kind bolt
inner jasper
#

Anyone know the values that q.hurt_direction returns?

inner jasper
polar steeple
#

it is a number,, but i am not sure what it represent

inner jasper
#

That's not really helpful.

brisk sentinel
#

what's the molang for getting the facing?

#

is that possible in particle?

brisk sentinel
#

what does From Motion does?

inner jasper
#

Can you use c.owning_entity in attacheables to query if owenr is sneaking etc?

iron hedge
waxen oriole
#

Guys, is there a query to check if the player is using an item on a specific block?

#

Question 2: is thera a query to check if the player has or hasn't a tag?

tawny mica
#

ok according to the documentation q.armour_color_slot will take the armor slot and will return the color value

#

But....

iron hedge
shell berry
#

How can I make a block that detects if there is a solid block right above with molang?

tawny mica
tawny mica
polar steeple
#

can we use query.is_item_name_any to change item icon?

gritty beacon
#

Is it possible to test for the biome a mob is in?

flat ledge
# tawny mica what values wwould it show for undyed leather armor?
"undyed_helmet": "q.armor_texture_slot(0) == 0 && q.armor_color_slot(0,0) == 0.62745099 && q.armor_color_slot(0,1) == 0.39607846 && q.armor_color_slot(0,2) == 0.25098039"

You can read more about the specific values for the query and how the molang is used in a BPAC on the readme of my pack on github.

https://github.com/mittens4all/Red-Leather-Yellow-Leather

GitHub

Minecraft Bedrock 1.21 Behavior Pack, detects color of dyed leather armor. - mittens4all/Red-Leather-Yellow-Leather

lament fulcrum
grim wagon
#

to access private variables without editing the entity

spiral bane
#

What value does query.distance_from_camera return when on a server?

swift rivet
#

Probably 0 or error but it should be simple enough to test anyways

unreal arch
#

How would I check if a block is Obsidian using molang, but without using the diamond_pick_diggable tag

flat ledge
umbral glacier
#

is there some way to store a permanent variable with molang? i want, on a global level, for the game to save when the Ender Dragon is defeated

umbral glacier
#

it occurs to me the exact same thing could be done with tags, but i'm not sure how to query if ANY player has a tag

half verge
#

molang/molang_file_name.molang

umbral glacier
#

Thank you!

rough hound
#

I am so confused. What even is Molang? It's not Script API, it's not commands. What is it?

inner jasper
rough hound
rough hound
inner jasper
#

It's mainly used in client stuff such as render controllers, animations(and controllers) but can also be used in world gen.

sharp light
#

-- this section is incomplete, the variable, domain, and syntax pages are still useful

umbral glacier
#

Alright; I posted a forum in another section but have found out more information in the last five minutes.

How do I loop through each player? Like, check scoreboard against each player?

#

Is there a function that returns an array of all players?

#

I need a value that persists across closing and reopening the game. Ideally a global one (which does not appear to exist)

flat ledge
inland forum
flat ledge
inland forum
flat ledge
flat ledge
inland forum
#

you have to use it with a property and q.property

umbral glacier
umbral glacier
#

There’s a feature rule that counts iterations, I should be able to set that to 0 to gate generating the feature. What’s confusing me is setting up the global value

#

I like the fake player idea but don’t know how to execute it. I hate being “that guy” with all this, lmao

#

Were I working in JS I feel I know exactly what to do, but I’m unsure if I can even use the javascript api to generate structures using features

spiral bane
#

Omg, I finally figured out how to change variable values in animation transitions. You define the value for it, add "return" and then put the conditions to be met.

spiral bane
#

Actually, on_entry works better because you can then put math.random_integer in it.

alpine moth
#
{
  "format_version": "1.10.0",
  "animation_controllers": {
    "controller.animation.scan": {
      "states": {
        "default": {
          "transitions": [
            {
              "walking": "(1.0)"
            }
          ],
          "on_entry": [
            "/execute @e[tag=prototype,type=wolf] ~~~ function scan"
            "/execute @e[type=zombie_villager] ~~~ function scan"
            "/execute @e[type=husk] ~~~ function scan"
          ]
        },
        "walking": {
          "transitions": [
            {
              "default": "(1.0)"
            }
          ],
          "on_entry": [
            "/execute @e[tag=prototype,type=wolf,tag=wolf] ~~~ function scan"
            "/execute @e[type=zombie_villager,tag=zombie] ~~~ function scan"
            "/execute @e[type=husk,tag=husk] ~~~ function scan"
          ]
        }
      }
    }
  }
}
#

is this correct?

rotund copper
#

does q.property work for attachables?

#

ik this is easy to test myself im just asking in case someone already knows

rotund copper
#

It doesn't

#

Anyway why does c.owning_entity in an attachable just throw "error: unhandled request for unknown variable c.owning_entity"?

inner jasper
rotund copper
#

yea most queries just work directly like that

#

Anyway, weird

#

This means that there's absolutely no way to get entity properties in attachables right? Like not even through public variables?

inner jasper
#

Yeah.

swift rivet
rotund copper
#

Oh great

#

Thanks will try that

#

in the attachable's pre animation do I have to do v.lol = c.owning_entity -> v.my_public_variable_constantly_set_to_the_property; or v.lol = c.owning_entity -> q.property('namespace:my_property');?

swift rivet
#

Either way should work, even just v.lol = c.owning_entity;

rotund copper
#

Awesome

#

Thanks

humble yarrow
#

How do I detect if a player is riding a specific entity cause the query.is_riding is only a true or false and doesn't take any parameters

spiral bane
#

I believe that's only possible via scripting. I asked for the same thing a while ago and that was the only answer I got.

humble yarrow
#

[Molang][error]-minecraft:player.0.c18e65aa-7b21-4637-9b63-8ad63622ef01.Noor | Error: query.property does not have an actor.

Why does my player shows this error?

rough hound
#

will this work in molang?

#
"shoot_first_person_hold": "c.is_first_person && q.is_using_item"
#

will that run when I'm in first person and right-click

rough hound
#

Alr my animation is a lil broken

#

I got it working for the first time

#

I have it as

#

query,is_sneaking

#

and when I first sneak, it works

#

but it stops working after that

#

no matter how many times I sneak again

rough hound
#

is this a proper molang?

#
"shoot_first_person_hold": "query.is_item_name_any('slot.weapon.mainhand', 'jm:testgun2') && query.is_using_item"
#

because it's not working unfortunately

flat ledge
rough hound
#

but the animation is bugged

#

I gotta fix it

tawny mica
tawny mica
flat ledge
muted carbon
#

What is the molang for offhand

muted carbon
#

Um

flat ledge
slim fern
#

anyone have an idea why v.attack_time doesn't work in attachables? Is there any alternative?

spiral bane
#

How to use query.is_item_name_any on a sub item category? I want to target an invisibility potion.

spiral bane
#

Can I ignore the slot name in query.is_item_name_any?

flat ledge
spiral bane
flat ledge
gaunt swallow
#

how do you get the turning speed of a mob?

sharp light
gleaming adder
#

How can I obtain the x y z coordinates of my entity's target?

ocean umbra
#

how do i generate a semi random number from 0 to 2 for a block permutation with molang?

#

i want to use texture variations but it doesn't work with custom geometries.

gleaming adder
ocean umbra
#

that's a hard no

#

i guess i will have to do it with scripts.

humble yarrow
#

How do I fix this error [Molang][error]-minecraft:player.0.c18e65aa-7b21-4637-9b63-8ad63622ef01.Steve | Error: query.property does not have an actor.

I run a molang in a render controller part of the entity

This is it
q.property('smile:ride') == true && variable.short_arm_offset_right == 0.5

humble yarrow
ornate wren
gaunt swallow
#

what's the query to knw when an entity is using an ranged attack? not when it shoots but when is trying to attack something

sharp light
ornate wren
#

Yeah, that sounds right.

#

I seem to remember the public variable system breaking not too long ago.

sharp light
ornate wren
#

Dude, I wish Mojang had a team to manage commands, filters, and Molang like they do with scripting systems.

#

I'm so sad these systems are always lagging behind or just totally in the gutter.

sharp light
ornate wren
#

Actually, yeah, come to think of it… outside deferred, the client's been left in the dust for years. They're really locked in on the all the server-side stuff right now.

sharp light
gleaming adder
#

Is my animation controller good?

{
  "format_version": "1.10.0",
  "animation_controllers": {
    "controller.animation.spidone": {
      "initial_state": "idle",
      "states": {
        "idle": {
          "animations": ["animation.spidone.idle"],
          "transitions": [
            {
              "summoning": "q.mark_variant == 1"
            },
            {
              "walk": "q.mark_variant == 2"
            }
          ]
        },
        "summoning": {
          "animations": ["animation.spidone.summoning"],
          "transitions": [
            {
              "idle": "q.mark_variant == 0"
            },
            {
              "walk": "q.mark_variant == 2"
            }
          ]
        },
        "walk": {
          "animations": ["animation.spidone.walk"],
          "transitions": [
            {
              "idle": "q.mark_variant == 0"
            },
            {
              "summoning": "q.mark_variant == 1"
            }
          ]
        }
      }
    }
  }
}
#

It doesn't work

split bolt
#

how can i make queries like this one. there's not a blue pencil like the Bridge V1?

stoic nacelle
#

Is this valid?
v.ext.x.z = 1,2

abstract nacelle
#

if you want to make .x and .z axis from a vector3 in once, use this formula json v.extXZ = Math.sqrt(Math.pow(v.ext.x, 2) + Math.pow(v.ext.z, 2)

rough hedge
#

Does anyone have a good example of using { } brace scope delimiters for setting up a variable?

stoic nacelle
#

When did Mojang add .molang files?

#

Is the content just accessible anytime or do I have to do something else?

#

Is it usable in features?

swift rivet
polar steeple
#

(Math.cos(query.anim_time * 90 + 180)+1)*3.75
if i want the frequency to be faster, should i multiply
query.anim_time * 90
by query.ground_speed?
or is there any other query

spiral bane
spiral bane
#

Thank you.

polar steeple
polar steeple
#

i need it to depend on the movement speed
query.ground_speed is not working

rough hedge
#

How can I output values to the debug log or anything that lets me see values of expressions/variables in-game?

polar steeple
#

alr
thanks

rough hedge
#

How can I acess thw developer version?

rustic marlin
#

I made a suggestion on the Minecraft Feedback server that we should get a molang query for getting the client-side camera rotation. Much appreciated if you upvote it: #1325377682103599215 message

torpid vault
safe brook
#

with render controllers

#

and then just push values there

polar steeple
#

context.<name>
when and why do we use query like this?
dose all query work with it?

rich wyvern
#

Can someone explain how query.movement_direction works and what it outputs. Any documentation gives me vague answers and never includes the output. I want to use it to where the robe of my mob will rotate opposite of the current movement direction.

stark echo
#

Does a molang query for a flying entity exist

stark echo
#

I tried query.is_on_ground but no effect

stark echo
#

Does query.ground_speed work on, as the name implies, on the ground or regarding general speed of the entity

latent summit
#

What can I do so that one medelo I add in the player is only seen in the first person and another model so that it is only seen in the third person

proud token
#

you can reassign variables in animation controllers in on_entry/off_entry right?
and can you retrieve this entity variable in attachables with c.owning_entity?
I made the entity variable public.

sleek glen
proud token
indigo rampart
inner jasper
indigo rampart
#

yes, I mean the difference in usage

inner jasper
indigo rampart
#

so context is like built-in vars that can't be changed??

inner jasper
#

Kind of yeah.

#

There's things like, is_first_person, owning_entity.

indigo rampart
#

that's it

#

why is it v.attack_time or v.is_first_person then...

inner jasper
#

Because those gets reset upon reload whereas the ones I mentioned don't.

indigo rampart
#

what reload? u mean cmd /reload?

inner jasper
#

Did you read what I sent?

stuck yoke
#

Does anyone know how to fix this error?😭😭😭

lilac flame
#

It's telling you

stuck yoke
#

@lilac flame

#

;-;

lilac flame
#

query.has_property('my:property') ? query.property('my:property') : 0
if the actor has the property, then get the value, else return 0

stuck yoke
#

?

lilac flame
#

That's how you are meant to use it. You must check if the actor has the property before accessing it.

stuck yoke
#

I don't understand 😭

lilac flame
#

What do you not understand?

stuck yoke
#

All

lilac flame
#

You asked how to fix the error that occurs when trying to access a property that doesn't exist on an actor. I told you that you need to add a simple check to see if the actor has the property before accessing the value of the property. In conclusion, the simple solution would be to replace every reference of you trying to access the property with the fail-safe measure that I sent.

#

I would also recommend you check if your entity has that property to begin with

#

And if it has the client_sync property set to true

stuck yoke
#

I think I'm getting it

#

Looking at the player.json file again

#

Missing wesl3y:mode

#

Do you think that's the problem?

lilac flame
#

It's very likely. Is the player.json file the one in your behavior or resource pack?

stuck yoke
lilac flame
#

Can you send your player.json file?

stuck yoke
cedar willow
#

erm

#

in particle how can i set a random value for each particle that stay constant?

cedar willow
#

but how...

cedar willow
#

this one is for emitter

#

i want to run that per particle (each particle has its own random value)

inner jasper
#

Would it not be it's own emitter?

cedar willow
#

i could just run 1

cedar willow
inner jasper
#

I believe the wax particles does this.

split bolt
#

there's a script to make that a entity summon a row of a ground attack like the Evocation Fang?

sour pewter
#

I have question - what's that mean: "Error: query.property does not have an actor"???

zinc raft
#

Can someone explain to me how I can detect the direction of movement of a flying entity? I think q.movement_direction doesn't work for flying entities. I have a helicopter. I want it to lean slightly forward or lower its nose when it moves forward, and when it goes in reverse it should raise the nose of the helicopter. If I move sideways, for example, if I move laterally to the right, the helicopter will also lean to the right, and if it moves to the left it will lean a little to the left, just like it would happen in real life.

#

.

#

Please, I have been investigating for months how to achieve this and I have not been able to, so I am asking one of you to help me in this regard.

abstract nacelle
zinc raft
#

and what query or math accompanies it? because of course, that query detects the direction of movement, but how do I assign an action to it when it detects that movement is taking place in that direction?

#

? 🙂

abstract nacelle
# zinc raft How can I do that? To change it from global to local?

well, there is a lot of formulas on the internet, you can search it by yourself, probably its like this, idk if this works

            "v.x = (math.cos(query.body_y_rotation) * query.movement_direction[0] + math.sin(query.body_y_rotation) * query.movement_direction[2]);"

"v.z = (-math.sin(query.body_y_rotation) * query.movement_direction[0] + math.cos(query.body_y_rotation) * query.movement_direction[2])"
          ]
        }
      }
    }
  }
}
#

idk if the use of body_y_rotation is correct in this case

#

maybe q.target_y_rotation is better, idk

zinc raft
abstract nacelle
zinc raft
#

How can I search for it on the internet? Motion calculator or convert from global to local? Or how? I'm still going to try your code to see if it works or not.

zinc raft
zinc raft
#

.

#

I use this for the lever of my helicopter, when it moves forward the lever tilts forward, but I would like to add animations depending on whether it goes forward or in reverse or to the sides and so on,

#

I also use it to tilt my helicopter, logically with fewer degrees of inclination, but the problem is that it only works when the helicopter is moving, but it completely ignores the direction in which it is moving.

zinc raft
abstract nacelle
#

v.x > 0 ? 90 : 0

#

try that

#

and you will see if it works or not

zinc raft
#

wow, thanks a lot, that was already breaking my head trying to think of how to add it xD

zinc raft
abstract nacelle
#

its for testing if it works

zinc raft
#

I understand, I'll try it and see how it goes

lethal lodge
#

hello someone knows how I can make a mob when attacking a player the mob grab it and the player does not oue to let go until the mob dies or something specific happens

lethal lodge
abstract nacelle
lethal lodge
red glacier
#

can i detect player attack?

#

previously i used variable.attack_time but in attachable it doesn't work

thick salmon
#

molang

rotund copper
#

anyone know how to make a smooth version of q.vertical_speed?

#

this is what I tried but it didn't work

"scripts": {
                "initialize": [
                    "v.vertical_speed_prev = q.vertical_speed;"
                ],
                "pre_animation": [
                    //didn't work, rat king ascension/descension animation still at low fps :(
                    "v.vertical_speed_smoothened = math.lerp(v.vertical_speed_prev, q.vertical_speed, q.frame_alpha);",
                    "v.vertical_speed_prev = q.vertical_speed;"
                ],
sly prairie
#

@rotund copper I would try incorporating query.time_stamp into this.

{
  "initialize": [
    "v.smooth_speed = 0;",
    "v.vertical_speed_prev = 0;",
    "v.time_stamp_prev = 0;"
  ],
  "pre_animation": [
    "q.time_stamp > v.time_stamp_prev ? {v.vertical_speed_prev = q.vertical_speed; v.time_stamp_prev = q.time_stamp;};",
    "v.smooth_speed = math.lerp(v.vertical_speed_prev, q.vertical_speed, q.frame_alpha);"
  ]
}
#

Since frame_alpha returns the time between ticks, we want to update the previous vertical speed variable to a new(er) value every tick. This pairs nicely with the time_stamp query

sage bronze
#

i just thought of something that might be a game changer last night

#

offsets only occurring once per world

#

im only running into two problems

#
  1. how do i detect if a variable has a value set?

  2. how do i save the variable to disc so it never gets overwritten and always stays the same?

#

if anyone can help me with this, thatd be AMAZING

swift rivet
#
  1. Use null coalescing ??. E.g. v.test = v.test ?? math.random(0, 1); or v.test ?? {v.test = math.random(0, 1);};
  2. World gen? If so, then idk
sage bronze
#

im trynna find a way to do custom seeds

swift rivet
#

There isn't a way to save variable to disk with just molang, you have to use some other method like e.g. entity properties. But idk of any way to do that with world gen

sage bronze
#

great

#

so there are no variable types in molang that do this?

#

i just need to make sure that once the variable is set it can never change

#

yep no variables for this...

#

wtf mojang

#

ridiculous

sage bronze
#

this is literally the only thing stopping seeds

swift rivet
#

Is there any way to query something from world gen?

sage bronze
#

no

swift rivet
#

Even height map?

sage bronze
#

you cant query the world seed

sage bronze
#

but those have nothing to do with this issue

#

q.noise is unseeded - meaning its not locked to the world seed, its locked to a specific seed

sage bronze
#

being able to apply odffsets can give a similar effect, but without the ability to permanently store a variable once per world...

#

its pointless

#

and i dont want to use a janky workaround (temp leaking)

swift rivet
#

Is there anything else you can do to read information about the world, other than q.noise? Like e.g. can you read the bedrock pattern at the bottom of the world?

sage bronze
#

bedrock pattern is unseeded

#

it has always been that way

#

its the same pattern across all seeds

#

and you cant read anything about the world anyways other than biome information which is completely separate from the terrain

swift rivet
#

If you can query biome at specific position, that can also be used to create a unique value per world seed

sage bronze
#

not for what im doing at least

#

theres no biome query

sinful flare
#

hmm does anyone know if there is a molang query which i can use in an animation file like shield.animation.json to check whether the player holding the shield has a slim skin or classic skin?

south coral
#

uh is this the right thing to detect if the entity gets hurt?

#

for an animation controller

red lintel
#

One message removed from a suspended account.

sly prairie
#

@red lintel I'm guessing this error comes up when you pause the game. If so, this happens when Minecraft renders the player model just above the Dressing Room button.

#

"Actor" means an entity in the world. That player model is not tied to your player entity in game, and thus there are no properties it can query, and query.property fails.

#

You need to check if the player being rendered has an actor; you could guard your query.property query with query.has_property, or you can use a combination of query.is_in_ui or variable.is_paperdoll

red lintel
slim verge
sly prairie
#

Hm, I guess then Molang does not guard like I expected. May need to use a ternary then.
!v.is_paperdoll && !q.is_in_ui && query.has_property('yes:is_shooting') ? q.property ('yes:is_shooting') : 0

slim verge
#

I tried something similar already, but let me just double check

sly prairie
slim verge
#

let me make a new pack with only 1 property cuz I'm using a bunch & maybe it's caused by something else

#

ok !v.is_paperdoll && !q.is_in_ui does work

#

then I must be calling a q.property() elsewhere cuz all of the ones in player.entity.json are wrapped

#

ok turns out it's because I was calling a property that isn't defined in player.json. Error message was unclear; thanks for your help

#

but like holy crap this one error had taken up like 100 GB of logs

sly prairie
#

Oh yeah, those get evaluated every frame. Very dangerous stuff. That's why I have only the GUI enabled lol

winged cedar
#

Is it just me or math.random(0, 1) is always 0?

sharp light
#

can you check if the block positioned 2m below an entity is not air?

rustic marlin
#

So I just learned that q.get_nearby_entities was removed back in 1.20. I was really looking forward to using that. Did they have any kind of replacement for that for sending data between entities in a controlled way?

inner jasper
#

What are you trying to do?

rustic marlin
#

Have several entities sync their arbitrary molang data with some particular central entity.

#

These were added in the same update that q.get_nearby_entities was removed.

#

Though it is very restricted.

inner jasper
rustic marlin
#

There will definitely be scripting going on behind the scenes, but one of the troubles is I should like the entities to have different molang values per client.

inner jasper
rustic marlin
#

And I gotta be careful with syncing them that way since the client doesn't seem to receive all the property updates in the same frame.

inner jasper
rustic marlin
#

What new feature is being used here?

inner jasper
#

In scripting.

rustic marlin
inner jasper
rustic marlin
#

Oh I see.

#

Hmm, it doesn't appear to be on the MS docs when looking through the experimental APIs. This is a method on the Entity class, yes?

rustic marlin
#

Oh I see.

#

Found it. It is a very interesting new feature.

swift rivet
swift rivet
rustic marlin
#

Yeah it definitely has its limits, and will be generally harder to use than what I will be using, but it works for my purposes.

rustic marlin
swift rivet
#

Different controller name. But you should be careful with it as it actually creates logical controllers on the entity that remain until it gets unrendered, so it could be a source of memory or performance leaking

rustic marlin
#

Oh

#

Smells unsupported then. lol

swift rivet
#

you could also split your values into binary and play animation for each bit, in this way you can just use pre-existing animations, but sometimes it may not play all animations at the same time, so you could loose some data in the process

rustic marlin
#

That sounds extremely painful to maintain. lol

swift rivet
#

Or dedicate multiple properties to each client and then just sync only "client id" via animation, and use that to choose the right property

rustic marlin
#

The number of properties needed per client is far too high. And I want it to support arbitrarily many players.

swift rivet
#

You could dynamically spawn new entities

rustic marlin
#

I think I'll stick with setPropertyOverride for this since I am prototyping for future Marketplace projects, so it being experimental isn't an issue.

swift rivet
#

Yeah ok then that's the best option for sure

#

Btw are you part of the team or doing your own thing through a publisher?

rustic marlin
#

I am a member of Yeggs.

swift rivet
#

Ah ok, I see

rustic marlin
#

Why do you ask?

swift rivet
#

Was just curious about how that publisher thing works, in case you were doing that

rustic marlin
#

Ah, yeah I have no idea. lol

#

I assume they just partner with randoms. I wouldn't suspect they give them assignments or anything.

prisma quarry
#

how can i make this attachable scale the texture properly?

#

im trying to use the vanilla pumpkin blur which is 256x256

#

seems like it should be scaling on the 16x16 cube im putting it on but its not

#

what can i do to fix this?

sinful flare
#

hey is it possible to get the remaining durability in the attachable, when I tried using query.remaining_durability in it, then it just throws an error that the item is not provided

sage bronze
#

what in the world is this even saying

#

sure looks like t.iterate = 98304 is an expression to me

#

nvm

#

used = not ==

rough jasper
#

Hey guys, how do I check if an attachable is used (q.is_using_item doesn't work)

slim verge
rough jasper
slim verge
#

at least you figured it out 👍

stoic nacelle
#

How do you call variables from bridge's .molang file to a feature json?

buoyant hatch
#

Can I use variables or something to make the tame particles max amount 0 for a certain entity?

#

I've tired it a few different ways, using variables on the entity but they were undefined for the other tameable entites. And I've also tried query.has_property but that needed context. (Which particles cant use owning_entity)

cedar willow
#

In attachable, is there a way to get rename item?

ember wyvern
#

I want to render a entity that is only visible to a certain player

floral hill
#

Does anybody have experience with q.bone_orientation_trs. I seem to get the error (no matter what bone name I use) query.bone_orientation_trs couldn't find the specified bone in the current entity's queryable geometry

buoyant hatch
#

Isn't there a client entity thing called queryable geometry. I would guess the model has to be defined in there first

prisma quarry
#

I've been told there is a query that can disable the player camera bob animation. After some experimenting of my own, i haven't found any way to add a query to disable it, but I would appreciate some help if you can!! #1346955844209868871 message

proud relic
#

uhhh whats molang?

slow sandBOT
#
What is MoLang?

MoLang is a simple expression-based language designed for fast, data-driven calculation of values at run-time. Molangs structure is largely based on simple 'C' language-family style syntax.

Documentation: https://bedrock.dev/docs/stable/Molang

Where is MoLang Used?
MoLang is used in various subsystems within Minecraft Addons. For example: Client Entities, Animations, Animation Controllers, and more.

slim verge
stoic kiln
#

Also, the format version for the model has to be at least 1.16.0 I think.

floral hill
#

I was querying from an entity, and this entity had multiple geometries, I think the issue here is that it has multiple bones of the same name

latent canyon
#

What Text Editor can I use for molang? and how do I port it into minecraft

timid minnow
#

what exactly does q.movement_direction() output?

river grotto
river grotto
river grotto
river grotto
# latent canyon Thank You!!!

Btw if you're new, I would strongly recommend bridge v2, it's less involved and easier for newcomers to get into addon making

latent canyon
river grotto
latent canyon
#

not ticket

#

sorry item

#

Not sure why I said ticket

river grotto
timid minnow
#

although I've tested it and its outputs seem to be 1 to -1 or exactly 1, 0, or -1 sometimes 😭

fathom cove
#

Hello, I'm trying to make a billboard entity. My entity has velocity and seemsto always try to face it no matter what i do. I have this animation script that tries to make it face the camera but it doesnt seem to be working

#

"rotation": ["-query.body_x_rotation + query.camera_rotation(0)", "-query.body_y_rotation + query.camera_rotation(1)", 0]
This seems to sort of wor except for axis X where entity still tilts down

fathom cove
#

Why isnt there a modulo operation in molang 💀

swift rivet
#

math.mod() tho it works a bit differently in negative numbers

sly prairie
#

It works like a remainder, right? If you need proper modulo, try the following.
a % b = Math.mod(Math.mod(a, b) + b, b)

fathom cove
river grotto
#

I'm confused, what's the difference between math.die_roll and math.random_integer
I haven't seen die_roll used in anything at all, so what does it do differently, or does it not exist or something like that and bridge v2 is just lying to me

proud token
#

it exists

river grotto
proud token
#

ive never used it before, im not sure.

river grotto
#

Damn, thanks for assuring me the fact that it's real at least

#

I'm sure I might eventually find information on how its used

sly prairie
#

math.random_integer rolls a random integer between min and max. math.die_roll_integer does the same thing given a roll count of 1; it differs when you give it a higher roll count.

#

It accumulates the total of all rolls. So with math.die_roll_integer(3, 1, 6), it should in theory roll three random numbers between 1..6 and give you the result; which would be between 3 and 18

river grotto
#

I've been trying to make an animation where the rotation is a random angle every 0.5 seconds but math.random_integer would always run seemingly every tick, and so I was wondering of there are alternatives, do you have any in mind

fathom cove
#

how can i store a variable in an animation? Say that my animation has an expression that calculates variable.foo and the animation in the next frame will depend on that previoys variable.foo value

#

also what is this error?

slim verge
fathom cove
#

yeah but why? why the need for a redundant temporary variable

#

mojank?

#

should stop asking at this point 💀

slim verge
#

who knows

#

q.bone_orientation_trs barely works as well

fathom cove
#

is there a query to get the entity age?

#

in ticks

river grotto
#

query.state_time

#

And
query.is_alive

#

Then you'd want to divide the value by 0.05 since state_time is in seconds

fathom cove
#

i needed to check if im on the entity first tick

#

so state_time == 0 i guess?

river grotto
#

Well the first tick is within the first 0.05 seconds

#

So more like:

#

Query.is_alive && Query.state_time <= 0.05

#

Hope this helps

fathom cove
#

alright thanks

fathom cove
river grotto
river grotto
#

Query.state_time is used as a query to return the amount of time a queried entity has been in its current state

#

So what I said would check if the entity is alive and then afterwards how long it has been for

river grotto
fathom cove
#

hmm i thought is_alive was a boolean without side effect. Are you implying that calling is_alive would alter the subsequent call of state_time? itherwise i dont see how my thing above would not give some results at least

fathom cove
river grotto
fathom cove
#

alternatively is there a way to get the entity movement speed vector? i was looking at minecraft:query_movement_direction and the docs dont even mention the data type

river grotto
river grotto
#

But you never asked the game to return it

#

Its kind of like trying to get if the entity is using an item without asking

fathom cove
#

the is alive? i didnt care for the entity to be alive or not, at least while testing

fathom cove
river grotto
#

It returns how long it has been in any state

fathom cove
#

so my entity just has 1 state so that should be equivalent

river grotto
#

So what I said you have to do is query the is alive state, and then test hiw long it's been there for

leaden wasp
#

Is molang does true = 1 and false = 0 still

leaden wasp
#

for the molang in block permutations, is it possivle to look for 2 individual values, like q.block_state(cmd:balls) = 2 || 3

grizzled glade
#

I have a question

#

wait I'm in the wrong area lmao

river grotto
#

Question:
Is there a way to allow for math.random_integer to be affected by slowing down an animation?
I'm trying to make an animation of several cubes at random rotations, for the entire duration of the animation, but math.random_integer is quicker than I would like it to be, so can I slow it down?

#

I've tried to use query.anim_time + query.delta_time / 10 and other math-related calculations, but to no avail

rotund copper
#

how do you check if the block above an entity is solid?

#

or at least it it's not air

proud token
#

air does not have a tag.

rotund copper
#

yea

#

i ended up using a property with a script that constantly sets it

proud token
#

server side solutions for client side stuff

#

gotta love it.

dawn vapor
#

Hi, can I check to see if the armor has a trim using molang?

proud token
sly prairie
#

Try variable.has_trim within the attachable @dawn vapor

fathom cove
#

Is there an editor with syntax highlight for molang?

dawn vapor
#

is it possible to get trim id via molang?

inner jasper
#

No.

#

You can only detect if an item has a trim.

dawn vapor
#

thank you

worthy raven
#

im trying to sync an entities bone roation and position to another entity is that possible?

delicate hinge
#

query.graphics_mode_is_any does it work in behavior?

polar steeple
#

can we somehow get the camera position?

swift rivet
#

rotation_to_camera gives you a direction (normalized vector) while distance_from_camera gives you distance (magnitude of the vector). Combine the 2 and you'll have camera position, relative to the entity origin

abstract nacelle
floral hill
#

Unfortunately not

abstract nacelle
#

anyone can help me why the second animation isnt canceling the first animation?


{
    "format_version": "1.8.0",
    "animations": {
        "animation.ch.orkling.move_body": {
            "loop": true,
            "bones": {
                "body": {
                    "rotation": ["math.sin(q.anim_time * 200) * 20", "math.cos(q.anim_time * 200) * 20", 0]
                }
            }
        },
        "animation.ch.orkling.physics": {
            "loop": true,
            "bones": {
                "body": {
                    "rotation": ["-this", "-this", 0]
                },
                "leftChichi": {
                    "rotation": [0, 0, 0]
                },
                "rightChichi": {
                    "rotation": [0, 0, 0]
                }
            }
        }
    }
}```
#

why -this isnt working?

river grotto
abstract nacelle
#

I want to set a this value to a variable and use it in another animation, Idk if thats possible, but first I need to know if this works properly

river grotto
abstract nacelle
river grotto
abstract nacelle
#

the animation are working when I change its values, so the problem is this argument :/

#

its weird

river grotto
#

Could I see the entity file?

errant widget
#

does anyone know why a texture pack would crash just pc players?

unborn orchid
#

How to make a particle seeable through walls?

fathom cove
#

You probably need a custom material with no depth test

polar steeple
#

math.min(v.controls==1?1:0,math.sin(q.life_time)*300)

this play the scaling transition only when the animation started, sense v.controls==1?1:0 is always the min after q.life_time pass 1, how do i make it so the right side always reset after v.controls==1 condition is true, i think i should use a variable instead of q.life_time but how do i make it do the behavior i wanted

river grotto
swift rivet
#

They do, but only some properties. None of the ones needed for rendering through blocks are available sadly

river grotto
#

Interesting

#

Sadly, it doesn't make a difference

glacial ridge
#

Has anyone ever accessed or modified variable.trim_path on armor render controllers ? I want to use a different path for a custom render controller I'm using for helmets specifically.

inner jasper
#

Anyone know why ?? doesn't allow direct queries on the left hand side? I already solved it by storing the query in a variable. I'm just intrigued why.

swift rivet
#

How would you use it on a query? It's meant to handle uninitialised variables and there is no such thing as uninitialised queries

inner jasper
#

And, q.property can also be undefined if said actor does not have that property.

swift rivet
#

q.has_property

inner jasper
#

That still doesn't solve if it has an actor or not.

swift rivet
inner jasper
#

I took

Null coalescing operator, for handling missing variables or stale actor references
Stale actor as having no actors as well? That's not the case then?

swift rivet
#

There is probably some query you can use that returns a predictable value in the entity context vs outside and doesn't error. E.g. q.is_alive

inner jasper
swift rivet
inner jasper
#

I still find it hilariously painful that the examples in the HTML docs still use get_nearby_entities which is removed.

swift rivet
#

Also q.get_relative_block_state which never existed afaik

shrewd jewel
#

is this right for the player sleeping animation?
animation controller:

"sleeping": "(query.is_sleeping && query.is_alive) || query.any_tag('knocked')"

script:

player.addTag('knocked')
coral forge
#

Queru.any_tag is for item ajd block tags sadly. You'd be better off using a scoreboard, as query.scoreboard can be used to query for that

swift rivet
#

There is an entity event filter for checking entity tags tho

proud token
polar steeple
polar steeple
# proud token hm

Used it some time ago, and when i removed it from the display i got confused why it stopped working

rustic marlin
#

Gentlemen, I've cracked the case. The entities which I was using in my add-on had a lot going on in their pre_animation scripts. They would define several temp variables, and then those temps would be referenced in the animations of the entity. But as it turns out, a recent update seems to have changed how this is handled. There is a lot of unpredictable temp leakage now with this kind of setup. Switching it to use regular variables stopped the entanglement.

swift rivet
#

Yeah, using temps in this way is risky. I only use them within the same expression, or when ik for a fact that 2 expressions run one after another (e.g. x, y and z in particle position field)

rustic marlin
#

So it seems. It's such a shame though, since I specifically used temps here to help the game save on some RAM.

#

The entity in my latest add-on passes a lot of data to the animations. So all that is just extra data that has to be stored on every instance of the entity.

river imp
#

@small citrus

split bolt
#

¿how can i make that the lunge direction reaches towards directily to the player's location?

brisk sentinel
#

I've been scanning back on my old files and I found this. I know that it changes the texture based on my property however I forgot what query.property does and I cannot find any documentation on it, does somebody know what it does?

brisk sentinel
sly prairie
#

It's the "properties" object in the description. e.g.

"description": {
  "identifier": "foo:bar",
  "properties": {
    "property:ore_type": {
      "type": "int",
      "range": [0, 16],
      "default": 0,
      "client_sync": true
    }
  }
}
brisk sentinel
supple knoll
#

Are molang variables scoped? I'm actually implementing MoLang for a different reason, and there's nothing about that on the wiki (i'm going towards 1:1 copy of the bedrock one)

#

Like here it creates a loop, if I assign a variable in a loop, will it be accessible afterwards

supple knoll
#

well i'll assume it's not scoped

sly prairie
#

In theory they are scoped. In the loop expression, t.next only exists inside of the scope defined by loop.

#

I would test that very question you have. If you can access t.next, then the scope mechanic is not working.

strong basin
#

Can I ask where is mo lang used for in add-ons?

river grotto
#

Render controllers, animations, animation controllers, geometries, entities, attachables, particles off the top of my head

shrewd badge
#

can you really not return a value from a brace scope? seems like it just returns the root expression regardless of the depth. e,g,

v.foo = { return 1; };
honest flint
#

can you convert numeric values into string with molang?
I want to use sound variants for my entity, but it's only accepting strings and my entity property is using integers

worthy raven
#

what molang is used when an attachable is used to attack for example like sword? in the attachables animation controllers file?

river grotto
brisk sentinel
worthy raven
#

is it possible to make an animation play only for first person like without using any animation controllers like the animation itself only play for first person?

ruby tinsel
#

is there a list of which molang functions are availabe in each context?
for example, I'd like to know which functions are available when using molang in a feature_rule

urban bough
#

math.clamp(-variable.tcos0,-variable.tcos0,0)
Could anyone tell me why the bone is still rotating in the positive direction? Even though the max rotation should be 0.

#

math.clamp(-variable.tcos0,-math.abs(variable.tcos0),0)
math wasn't mathing for me

sinful vault
#

Is there any way I can make my mobs run different animations when in different water depths, even combining molangs.

rain oracle
worthy raven
#

is there a molang to detect when an entity charges an attack using the charge shoot trigger?

toxic raven
#

I wanna change armor model depending on player's hand type. Is it possible to do so by using q.bone_aabb in armor attachable file?

river grotto
toxic raven
river grotto
#

No problem, happy to help!

toxic raven
river grotto
#

Darn

toxic raven
#

I want to change armor for every player

#

Like... Alex type players get different armor model

#

And steve type players have the standard one

#

Here's what it looks like. I made it on java and now I wanna port it to bedrock

river grotto
#

It doesn't say it only works in first person, to be specific
It means that you need to have been in first person at least one time when entering the world to make it function

toxic raven
river grotto
#

No because it applies to every player at the same time

toxic raven
#

It makes things even worse

river grotto
#

No you aren't understanding, im pretty sure

toxic raven
#

maybe

river grotto
#

You cant use variables from one specific entity to another specific entity of the same type

#

Like if you use query.is_sprinting for example

#

A sprinting player cannot make the sprinting animation play on a different non sprinting player

#

Animations and render controllers will apply all entities with the same identifier but will only play if the entity is doing the thing the variable/query is action it is being tested for

worthy raven
#

hello i wanna ask how animation_update_time works cause i want an animation to never continue player if it doent have a taget anymore and if the animation time is at 0.5 something

neon kelp
#

how do i substring

turbid yew
#

Is there a way to query what the local client player's tags are? I want to make an entity render differently if the player viewing it has a specific tag. Maybe I could for_each over player entities and then check q.is_local_player somehow.... but I don't know how to do this.

turbid yew
#

Also, I know there's "entity.target->" to change the query context to the entity's target, but are there other members?

turbid yew
#

Microsoft's molang documentation just bloody sucks.

indigo rampart
turbid yew
#

Yeah, it refers to the current entity rather than the local player. Doesn't work for my purposes.

indigo rampart
#

Oh you are modifying render controllers so no access to scripting?

turbid yew
#

I said I was working on a render controller, or at least I thought I did...

#

But yeah, render controller.

turbid yew
swift rivet
#

You can query scoreboard (that's set to be displayed in some way)instead of tags.

#

The thing with tags is that they are entirely server side, the client has no idea whether they exist or not. You'd need to have some kind of mechanism for registering which tags should be synced to the client

#

The official recommended way to sync data from server to client is actor properties

turbid yew
#

So, can't be used in render controllers.

swift rivet
#

Ahh riight, they removed this capability some time ago

#

Next best thing, provided you can't use properties, would be playing animations that set molang variable to some value

ocean umbra
#

can we use molang to provide particle textures?

dawn vapor
#

can we get item name via molang?

river grotto
dawn vapor
river grotto
icy kite
#

How to detect slim skin

river grotto
worthy fable
#

minecraft:query_is_riding_any_entity_of_type
Can someone send an example of how this works?

#

The explanation they gave wasn't clear enough for me...

inner jasper
#
"variable.riding_y_offset_on_vehicle_where_other_entites_can_stand = query.is_riding_any_entity_of_type('minecraft:minecart', 'minecraft:boat', 'minecraft:chest_boat') ? -3.0 : 0.0;",
worthy fable
#

This query does work alone?

#

Looks like it does, I will try this

#

Thank you

inner jasper
iron hedge
#

oh it's actually used...

inner jasper
#

Yep, in vanilla.

polar steeple
ocean umbra
worthy raven
#

is there a molang that checks what specific effect an entity has?

icy kite
#

how to make player.entity.json compatible with other packs like JavaAnims 1.7

tight scroll
#

There is any way to query if the player has a tag?

tight scroll
#

do query scoreboard works with animations?

tight scroll
river grotto
#

So it can only be used with the playanimation command

river grotto
dawn vapor
#

Hey guys, quick question — what exactly does variable.trim_path return? I'm guessing it's a string like "textures/trims/wild". Is that correct?

rough jasper
#
[Molang][error]-minecraft:player.0.c5045992-eba4-4c7e-ad4a-469df35178d5.tutorial_skin_1 | entity/player.entity.json | query.is_item_name_any('slot.weapon.mainhand','tst:sniper')&&variable.is_first_person&&v.attack_time > 0.0&&!query.is_sneaking | Error: query.is_item_name_any called without a specified entity.
rough jasper
#

And if impossible, what is the alternative

river grotto
#

I think the problem is you just did it wrong

river grotto
#

The actual format is:
query.is_item_name_any('slot.weapon.mainhand', 0, 'tst:sniper')

rough jasper
river grotto
#

Well that's good to hear
I didnt have very much faith in what I said either way, so glad you found the solution

vagrant mica
#

is there a query for blocks of a specific type in a specific direction

polar steeple
#

can i get the attachable holder type using a molang?

#

query.owner_identifier

river grotto
#

Isn't there also query.is_local_player?

polar steeple
#

not what i am looking for

river grotto
#

Nvm then

polar steeple
#

can we conditionally change render controllers?

river grotto
#

Yes (unless I misunderstood the question again, lol) it works the same way as scripts -> animate

jolly echo
#

I wonder if we'll ever see multi line molang

inner jasper
jolly echo
#

I just remember that some of the json parsers used by Mojang while parsing addons do support multiline strings...

south coral
#

Query for detecting if the entity has a certain name?

polar steeple
proud token
polar steeple
#

oh yeah

proud token
#

q.is_name_any('name')

proud token
polar steeple
#

we relay on tools to correct us a lot, lol

south coral
polar steeple
#

can we query rider from ride
i want to see if rider is in first person perspective from the ride

swift rivet
#

You can probably estimate this by checking camera position and direction and seeing if it's close enough from ride

polar steeple
#

my entity is 10 block tall 😅

swift rivet
#

Doesn't matter, you can get camera position and compute its distance from a point 10 blocks above the entity, or wherever player head is supposed to be

polar steeple
#

i think that leave a large area for errors

swift rivet
#

Never know until you try. And to clarify once again, I'm not suggesting that you simply check distance_from_camera query, because it measures distance from the entity origin, which will be 10 blocks below camera as you said. I'm saying that you can instead measure the distance to camera from a different point 10 blocks above the entity where the player head is supposed to be, by using direction_to_camera, distance_from_camera and some math. Whether it will be prone to errors or not depends on how riding entities works and how their movement interpolation affects molang camera queries, but I'd say unless your entity is moving at unreasonably high speeds, you'll have at most an error of 1 block, which imo is plenty of precision for this kind of thing

polar steeple
#

unless your entity is moving at unreasonably high speeds
uhhh... it does lol

#

i solved the problem with a simpler approach

#

thanks for your time tho

polar steeple
#
[Molang][error]-... animation_controllers | controller.animation.xxxx.yyyy | states | default | transitions | player_checks | v.player_check_time < q.life_time | Error: unhandled request for unknown variable 'variable.player_check_time'
#

how do i add a cooldown to an ac

swift rivet
#

q.state_time

polar steeple
#

why is this not working as expected in game
0.4 + (math.clamp(3 - query.item_in_use_duration, 0, 3)/5)

#

query.item_in_use_duration increase while the item is in use
so math.clamp(3 - query.item_in_use_duration, 0, 3) should make it decrease from 3 to 0
dividing by 5 make it from 0.6 to 0
+0.4 make it 1 to 0.4

but all i get in game is const value

summer marsh
#

hi there, can someone help me to identify where these errors came from? [Molang][error]-monster | Error:unknown token: monster [Molang][error]-monster | unrecognized token: monster
I tried to serach my entire project, but couldnt find what is generating this error at all

iron hedge
#

monster isn't in your project anywhere?

summer marsh
#

no, I have no molang refering to "monster" at all

inner jasper
#

Is there a query for detecting shooting? That is, snow golem shooting?

#

Ah, seems to be q.facing_target_to_range_attack

river grotto
#

Is there a query that gets the rotation of a bone?
I've heard of bone_orientation_trs but also heard that it doesn't work for custom bones and wanted to know if it works on a custom entity

abstract nacelle
#

how can I replicate this function on molang?
2 % 3 == 0

#

% operator exists on molang?

abstract nacelle
#

ah, thank you!

swift rivet
#

math.mod is not one to one with modulo operator tho, math.mod returns negative results for negative numbers while % is always positive

sly prairie
#

Necroing, yet there's a workaround to Math.mod returning the remainder: ((a % b) + b) % b—or equivalently, Math.mod(Math.mod(a, b) + b, b)

loud thicket
#

A new sorcerer's channel?

final zealot
#

Is it possible to read structs with brackets or somehow access multiple variables dynamically in a loop? 🤔 Similar to what template literals do in JavaScript
Like loop(10, {t.value = v.values[t.i];}) or loop(10, {t.value = v.value_${t.i};})

swift rivet
#

No. Inline the loop or make a giant if-else statement to imitate arrays and access different variables based on some index value

mossy shell
#

how do you query when a mob is range attacking?

proud token
#

might be useful

mossy shell
polar steeple
#

i am using "anim_time_update":"v.animation_time"
and

/playanimation @e [type=myname:test22] animation.test22.test a 1 "v.animation_time=0.5;"

to set the animation to a specific time, but running the command sometimes do nothing after i use it multiple times

mild rose
#

How to detect if the player is looking down according to the camera?

river grotto
ruby tinsel
#

could anyone suggest a good way of debugging molang? I would love to have a way to inspect variables in real time

delicate flame
#

is this not how you check for entity properties?

brave mango
delicate flame
brave mango
#

I can’t even get it to stop erroring “variable.x is being used by but no definition is found by “entity””

#

Wow gorgeous!!
Hmm obviously something to do with the transition of one of your airgaurd states but I couldn’t tell u why, I’m definitely no pro.
Are you properly querying to make sure the anim times are coming to and end before switching your states?

delicate flame
polar steeple
#

I think the latest Blockbench update have that too?

abstract nacelle
#

Im interested in a way to debug molang values

inner jasper
#

Yeah it's not really possible.

abstract nacelle
#

😭

#

China dev edition can do that lol

inner jasper
#

Well, thats their dev builds lol.

ruby tinsel
#

I'm trying to use molang variables on an entity to execute some server stuff by using bp/animation_controllers, for some reason I get unknown variable error, could anyone help shed light on this?

vital tartan
#

Quick question
Is the below molang expression correct to play an anim on a attachable?

c.item_slot->q.remaining_durability < c.item_slot->q.max_durability
#

I'm not getting any errors which is the weird part but nothing is happening.

sly prairie
#

context.item_slot is a string, AFAICT. You should be able to simply query those two without needing an arrow function. @vital tartan

dense venture
#

hi

late cipher
#

Anyone knows how exactly does blockbench accept molang instructions scripts for particles? i have been trying to anymate fire breath but haven’t been sucessfull trying to shape the amount and direction of the fire

abstract nacelle
indigo rampart
mint hollow
river grotto
#

And no cross posting

mint hollow
#

Sorry

river grotto
#

It's fine

mint hollow
#

My question is how to skip the acceptance screen and go straight to the download of the resource packs

#

Since there is not much documentation about that

river grotto
#

I've heard it's only possible in featured servers

mint hollow
#

I work with PocketMine custom server

river grotto
#

Only featured servers can use it but not all featured servers may choose to use it

mint hollow
#

Okey

uncut ember
#

Do we have any access to date/time in textures such that you could create seasonal packs, for example how we have chests turn to presents on Christmas?

mint hollow
severe dagger
#

Is there a way to detect player digging / mining with a query? 🤔

coarse smelt
#

huh
ParticleEffect::_extractComponents | minecraft:particle_appearance_tinting | variable.gray = Math.random(0.5, 0.9); variable.chance = Math.random(0.0, 0.9); variable.chance > 0.2 ? variable.gray : 0.1725 | Error: complex expressions (contains either '=' or ';') must end with a ';'

Any idea what it wants?
this is directly from snowstorm where it seems to work 🤷‍♂️ :

"minecraft:particle_appearance_tinting": {
                "color": ["variable.gray = Math.random(0.5, 0.9); variable.chance = Math.random(0.0, 0.9); variable.chance > 0.2 ? variable.gray : 0.1725", "variable.chance > 0.2 ? variable.gray : 0.7294", "variable.chance > 0.2 ? variable.gray : 0.6588", 1]
            }
#

oh never mind, it seems it wanted ; also at the end where snowstorm did not ... the error message is confusing 🙂

fallow thicket
#

am assuming that works for players

#

if not, then accessing a property set in script I guess

proud token
fallow thicket
proud token
proud token
#

not the best solution

fallow thicket
reef oak
#

I have been trying to pass this variable to the player using playAnimation, it works but there is a content log error saying unknown variable v.body_tilt. I know its because its not inititalised. But im not sure how to initialise it. I am trying to avoid using player.json. Ping me if anyone knows how i can initialse this variable

rider.playAnimation("animation.player.dragon.riding.base", { nextState: "animation.player.none", stopExpression: "v.body_tilt = math.lerp(v.body_tilt, v.attack_time == 0 ? math.clamp(-q.target_y_rotation * 0.5, -30, 30), 0.2); return 0;", controller: "controller.animation.player.ride"})
river grotto
reef oak
#

It works, but it still gives me content log error

arctic mist
little magnet
#

can we use molang to set the numebr of iterations a feature_rule places? like do 'x - 1' iterations for 'x' numbers of 'y specific block' found in this chunk?

#

i can post in world generation if no one here knows. i just have posted there a lot latelyXD

fleet birch
#

#1276385844407566426 message

#

This needs pinned

sacred shuttle
wise bloom
#

I have a question, can you store a math.random as a permanent variable?

math.random when used as a variable in an entity render controller to select a texture and/or geometry causes the value stored to constantly update and thus the textures are constantly changing every tick. What's a way to do this assign a randomly selected value to an entity one time and stick that way?

lapis shell
#

anyone know how to trigger animation when the entity get hurt?

#

recently using query.health, but I don't know how to use it🗿 whenever health decrease the animation scale it's not quite right, when health on 0.5 it's the right animation

astral prawn
#

Is there a thing like "query.has_tag"?

worthy fable
astral prawn
#

Thing

river grotto
#

But you guys should really just go look

#

Because it's a query for the tags of the item the entity is holding has

blazing hornet
#

I’m 3k comment

ruby tinsel
#

did anyone manage to make a player face the body direction of a mount? kind of like boats

scenic cedar
#

Does anyone know what query.bone_rotation does and how it's used? I couldn't find much documentation on it.

round wyvern
round wyvern