It's just happened again, after running perfectly for about 2 hours. This time I don't know if it was switching targets, cause all the targets were in front of my character (the last time it did it about every second), but it wasn't attacking anything with auto retaliate on. The NPCs were the the count draynor, the kendal and a trapped soul. I don't know how long it stayed like that, I hope it wasn't long, I hadn't checked in for about 10 minutes
Edit: And again, about 30 minutes later. This time it was turning from one npc to another again. Pausing the script and taking over for a second fixes it. This time it was between 2 sand snakes. The logger doesn't show anything out of the ordinary compared to when it's working fine