You can make it via global procedure with trigger "entity spawns".
Use condition "if entity = entity type >villager" then spawn Guardian on XYZ
You can of course make a bit offset, so it will be X+1/2 or Z+1/2, so they don't stack together (though they will move eventually, so it's not that important).
You can also make chance of Guardian spawning, because with procedure above, Guardian will spawn for every villager. So you can make easy additional condition to make it appear, for example, 20% of time, like here:
(yes, I spawned bandit instead of Guardian, serving opposite purpose, but you see, they really need guardians with such cruel modders like me :P)
"Random [0,1]" gives you random between 0 and 1, so if you multiply it by 100, you will get percent drawing procedure.
Thank you!
But when I set the "Spawn weight" to 1 for example, they spawn everywhere.
And I need them to spawn ONLY in the village. How to implement this?
I tried to figure it out myself but failed.
First follow exactly what Toma400said, he was spot on. Then turn off "Enable entity spawning" because were not using that kind of spawning since we made the global procedure
For anyone new seeing this, on an entity spawn it first checks if the entity is a villager. T
hen I used a [is (random number) the same as (fixed number)] to make odds, the one in my example is 1 out of 7 chance.
A small change as I'm still learning myself, you can import a better odds template in the procedure templates, very useful for all procedures to look into it
You can make it via global procedure with trigger "entity spawns".
Use condition "if entity = entity type >villager" then spawn Guardian on XYZ
You can of course make a bit offset, so it will be X+1/2 or Z+1/2, so they don't stack together (though they will move eventually, so it's not that important).
You can also make chance of Guardian spawning, because with procedure above, Guardian will spawn for every villager. So you can make easy additional condition to make it appear, for example, 20% of time, like here:
(yes, I spawned bandit instead of Guardian, serving opposite purpose, but you see, they really need guardians with such cruel modders like me :P)
"Random [0,1]" gives you random between 0 and 1, so if you multiply it by 100, you will get percent drawing procedure.
First follow exactly what Toma400 said, he was spot on. Then turn off "Enable entity spawning" because were not using that kind of spawning since we made the global procedure
For anyone new seeing this, on an entity spawn it first checks if the entity is a villager. T
hen I used a [is (random number) the same as (fixed number)] to make odds, the one in my example is 1 out of 7 chance.
A small change as I'm still learning myself, you can import a better odds template in the procedure templates, very useful for all procedures to look into it