Should have included that in the topic, writing a set of instructions for SSF is not "really" scripting.
Dunno what you can do in SSF, but as someone above said, tree turns from Entity to NPC when it's an ent, so easiest way would be checking if you're facing anything, in that case stop cutting.
OR if you are still not facing anything, you could check if there exists an NPC with name..., if so, calculate the distance from it, if it's >= 2, you are safe.