#spawn an entity with dynamic properties
1 messages · Page 1 of 1 (latest)
const entity = dimension.spawnEntity('minecraft:pig', location);
entity.setDynamicProperty('something', true);
thanks
it works with addRider(....spawnEntity....)?
Give it a try
What do you mean?
It's exclusive to a few types to ride the entity
no
causes an error is setDynamicProperty
without it there is no error
use this and addrider(entity)
that's what I use
[Scripting][error]-InvalidArgumentError: Unexpected type passed to function argument [0]. Expected type: Entity
uhuhh... Send ur code
function spawn_entity(data){
let entityA = data.entity.dimension.spawnEntity("example:example",{x:data.entity.location.x, y:data.entity.location.y, z:data.entity.location.z});
data.entity.getComponent("minecraft:rideable").addRider(entityA.setDynamicProperty('example', example));
}
mc.world.afterEvents.entitySpawn.subscribe((data) => {
return spawn_entity(data);
});
Dont put setDynamicProperty in there
Should be in a separate line
can you give an example?
i puted setDynamicProperty in let, but error stayed
data.entity.getComponent("minecraft:rideable").addRider(entityA.setDynamicProperty('example', example)); HERE you cant do this you have to do it in a separate line
data.entity.getComponent("minecraft:rideable").addRider(entityA);
entityA.setDynamicProperty('example', example)
shouldn't this compare another entity?
entityA returns an entity, entityA.setDynamicProperty("abc",123) returns VOID so
so you are adding VOID to ride the entity
void isnt a thing so nothing will ride that entity
to make an entity ride it you ll have to make sure that the entity is an ENTITY
ok i understand thanks
but if i return entityA it spawn another entity, or no?