Tibia Wiki

Retargeting is to stop attacking something and attack another target.

Some creatures can change their target, some do it only when the player they are attacking has moved out of range or disappeared (most weaker creatures). Most creatures that use distance attacks, as well as other creatures, will retarget to the closest player (most middle-strength and stronger creatures) and some creatures like Dragons, Cyclopses, Serpent Spawns and Giant Spiders seem to randomly change their target.

Challenge will not work on Pirates, since they attack the weakest player they can see, as soon as a knight uses challenge on them, they'll immediately retarget to the lowest lvl.

This is dangerous for Mages or low level players that are hunting with a blocker.

If a creature does retarget to a weaker player, knights may use the challenge spell to force the creature to retarget to them again.

Another good tip is to always keep the blockers between the creature and the shooters, that makes retargeting less likely.