NPC:SetEnemy
Description
Sets the target for an NPC.
Arguments
2 boolean newenemy = true
Calls NPC:SetCondition(COND.NEW_ENEMY) if the new enemy is valid and not equal to the last enemy.
Example
If an NPC has no specific target, they will start to target the closest player they are hostile to, or nothing if there are none. This is run every tick on the server and can be a bottleneck if player and/or entity counts are high, so consider adding a CurTime cooldown if you plan on using this in-game.