#how to make an entity have random animation in 1 state

1 messages · Page 1 of 1 (latest)

errant sandal
#

I want to make dead body so i want to make it have different animation

vague geode
#

you could use math.random(0, 1), or according to the number of your animations

errant sandal
#

Like i have 5 animation i must set condition to (0,5)?

vague geode
#

then you can use query.has_property() == 0

errant sandal
#

Where to put that

vague geode
#

I think there must be a better way to do this

#

but I can't think of one right now

vague geode
#

Or in the entity's rp

errant sandal
#

Hmm can you give me an example or smth

vague geode
#

Your animation only plays once, right?

#

Oh actually, I think I get what you want

#

You have a specific entity dead right?

errant sandal
#

Yes

vague geode
#

To simulate a body or anything

vague geode
#

Do you know how properties work?

errant sandal
#

Idk about properties

vague geode
#

This is in the entity BP:

"property:dead": { 
    "type": "int", 
    "range": [0, 4], 
    "default": math.random(0, 4)
}
#

And in rp, it would be something like this:

{
  "format_version": "1.10.0",
  "minecraft:client_entity": {
    "description": {
      "identifier": "example:yourentity",
      "materials": { "default": "entity_alphatest" },
      "textures": {
        "default": "textures/entity/example"
      },
      "geometry": {
        "default": "geometry.example"
      },
      "animations": {
        "dead": "animation.dead1",
        "dead2": "animation.dead2",
        "dead3": "animation.dead3",
        "dead4": "animation.dead4",
        "dead5": "animation.dead5"
      },
      "animation_controllers": {
        { "dead": "query.property('property:dead') == 0" },
        { "dead2": "query.property('property:dead') == 1" },
        { "dead3": "query.property('property:dead') == 2" },
        { "dead4": "query.property('property:dead') == 3" },
        { "dead5": "query.property('property:dead') == 4" }
      ],
      "render_controllers": [ "controller.render.example" ]
    }
  }
}```
#

@errant sandal