Brilliant! I took out the sprite line and it's working now. Thanks.

I wonder why it mattered whether the unit was mercenary or not when I left the line in though. Doesn't seem to make much sense. Oh well.