There's going to be some buildings that the player may build towers nearby to destroy, but I want the towers to give priority to walking enemies, so they will only shoot the buildings if there is no walking enemy in range

Black: building that is being shot by blue turret
Blue: will switch targets if red walks in range
Red: is higher priority than black
This is the "get target" event

Both walking enemy and building are in the "Enemy" family
"Items" family is the turret family
I tryed giving each enemy a "priority" variable, and tell turret to "pick Enemy with highest 'priority'", but that did nothing. It just locks on the building untill it's destroyed