Uploaded image for project: 'Minecraft (Bedrock codebase)'
  1. Minecraft (Bedrock codebase)
  2. MCPE-156309

[Addons] Reading/Refrencing different entities variables value using (-> Arrow Operator) is not working

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Incomplete
    • None
    • 1.18.31
    • None
    • Unconfirmed
    • Windows

      Unable to read/reference from different entity variable value

      I am trying to create a custom entity that rotates in the same way the player is rotating in real-time by reading query.body_y_rotation of the player and set this value in the animation of the custom entity to make it look like rotating the same way the player is rotating

      I read from Bedrock.dev website that if I want to read/reference a variable value from a different entity, I have to use the [->] Arrow Operator but the article was not clear enough to show me how exactly to use it. It said that I need to set the variable value that I want to reference to PUBLIC, which I already did. Then to use the [->]  ** arrow operator symbol in a different entity to read that public variable which I did but was not sure if it was the right way because it is not clear in the article how to use it. After I finished and launched Minecraft windows to try the code, it didn't work at all and the content log in Minecraft throw this error:-

      [Molang][error]-addon:entity_test | Error: unhandled request for unknown variable 'variable.player_y_rotation'

      It means that the entity is not reading that public variable value. I had tried for about 4 days and searched on the internet for solutions or similar problems but I found nothing. There is nothing about how to access/read other entity variable values from a different entity. I need to know how, to complete my add-on.

       

       

        1. animation.PNG
          animation.PNG
          18 kB
        2. custom entity entity.PNG
          custom entity entity.PNG
          30 kB
        3. player entity.PNG
          player entity.PNG
          42 kB

            TheSlayerX001 TheSlayerX001
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: