2

I am creating a game with a polar bear that attacks the player no matter what. I do this by having an invisible Zombie riding it:

summon polar_bear ~ ~1 ~ {Passengers:[{id:"zombie",Invulnerable:1b,Silent:1b,ActiveEffects:[{Id:14,Amplifier:0,Duration:20000000,ShowParticles:0b}]}]

When the polar bear is killed by the player, I want the zombie to die too, or else an invisible zombie would be walking around! I have this code:

kill @e[type=zombie,x=-100,y=12,z=-100,dx=200,dy=0,dz=200]

I'm making this in a superflat world and the blocks go up to 11 on the y-axis. This means when the zombie is standing on the ground, it dies. Although, this doesn't work. The game thinks the zombie's y-cor is 12 even when it is riding the polar bear.

How would I fix that?

1 Answer 1

1

I accually found a solution using the OnGround tag:

Once:

scoreboard objectives add tobekilled dummy

Repeating:

scoreboard players set @e[type=Zombie] tobekilled 1 {OnGround:1b}

kill @e[score_tobekilled_min=1]

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .