#Spawning entity variant with scripts
1 messages · Page 1 of 1 (latest)
in the spawnEntity method, there is a SpawnEntityOptions interface
one of the properties is spawnEvent
you can put an event on the entity, and idk for sure but you might be able to get variant that way
Yea
Use component groups to store ur variant data and put it in events
After that u can make a script and depending on how u want to execute ur event (player/world, for now i will tell u both)
-
If u want to execute it as player:-
player.runCommand('event entity @e[type=entity:identifier] your:event') -
If u want to execute it as world:- world.getDimension("overworld").runCommand('event entity @e[type=entity:identifier] your:event')
This is the most basic
And hybrid combo
hm so if you can do that
const myEntity = world.getDimension("overworld").spawnEntity("my:entity", { x: 0, y: 0, z: 0 }, { spawnEvent: "your:event" })
surely this would work too
Yea
Idk what he really needs it for, so it's kinda difficult to suggest answers
trye