How to make a zombie spawn for a baby with a certain probability after killing a zombie, minecraft v 1.20.1
KejinX opened this issue ยท 0 comments
This is a test script after killing a cow a zombie appears, it works fine, but I don't know how to add a nbt tag so that instead of a regular zombie a baby zombie spawns:
[
{
"on": "mob_killed",
"parameters": {
"mob": "minecraft:cow",
"player": true,
"helditem": ["minecraft:wooden_sword", "minecraft:stone_sword", "minecraft:iron_sword", "minecraft:golden_sword", "minecraft:diamond_sword", "minecraft:netherite_sword"]
},
"conditions": {
"dimension": "minecraft:overworld",
"random": 0.3
},
"spawn": {
"mob": "minecraft:zombie",
"mindistance": 1,
"maxdistance": 1,
"mincount": 0,
"maxcount": 1,
"attempts": 20
}
}
]
Although after several attempts to add the nbt tag to this script, I seemed to have succeeded and after killing the zombies, the babies began to spawn, but I just need them to spawn with a complete replacement of the regular zombie.
Here is my attempt to add the nbt tag:
[
{
"on": "mob_killed",
"parameters": {
"mob": "minecraft:cow",
"player": true,
"helditem": ["minecraft:wooden_sword", "minecraft:stone_sword", "minecraft:iron_sword", "minecraft:golden_sword", "minecraft:diamond_sword", "minecraft:netherite_sword"]
},
"conditions": {
"dimension": "minecraft:overworld",
"random": 0.3
},
"spawn": {
"mob": "minecraft:zombie",
"nbt": {
"tag":"IsBaby",
"contains":"1"
},
"mindistance": 1,
"maxdistance": 1,
"mincount": 0,
"maxcount": 1,
"attempts": 20
}
}
]
And I would also like to know how to prevent a child zombie from turning into another zombie.
Don't judge me too harshly, I don't understand codes and scripts very well, I'm learning in the process what and how to do....