Hi, I have a simple script here, but for whatever reason. I just can't figure out how to return or end the script if an entity exists.
for (const entity of world.getDimension("overworld").getEntities({type: 'chaotic:multi'})) {
const multiType = entity.getDynamicProperty('multiType')
if (multiType == 'generic'){
const x = entity.location.x
const y = entity.location.y + 1
const z = entity.location.z
const items = world.getDimension("overworld").getEntities({tags:["item"],location:{x:x,y:y,z:z},maxDistance:1})
const random = Math.floor(Math.random() * (1 - 1 + 1)) + 1
if (random == 1){
world.structureManager.place("chaotic:itemPotionBomb",world.getDimension("overworld"),{x:x,y:y,z:z})
}
}
}
I'm somewhat new to scripting, so lmk what I'm supposed to do