So I'm trying to make a system that will kill any mob that doesn't have a squid on it's head (I'm starting with zombies as once I figure it out for one mob I can easily add a different mob). So how I started was I made a scoreboard objective that I called nearSquid.
/scoreboard objectives add nearSquid dummy
Then I rigged up some repeating/chain command blocks together and had them run these commands.
/execute @e[type=Zombie] ~ ~ ~ /scoreboard players set @e[type=Squid,r=2] nearSquid 1 /execute @e[type=Squid] ~ ~ ~ /scoreboard players set @e[type=Zombie,r=2] nearSquid 1
Therefore any zombies (that are near a squid) and squids (that are near zombies) get a score of 1. Now my problem is that how do I make the zombie/squid get a score of 0 when they aren't near the other one.
Now I know that this system has the flaw of if zombies are bunched close together they may be in the radius and be safe until the squid/zombie moves away. So if you have a different system that can fix this flaw I'd be happy to hear it. other wise how would I make the squids/zombies get a value of 0 when not near the other.
Hopefully I made myself clear. If not let me know and I'll will try to make it clearer.