@name NPC pet
@inputs Find
@persist NPC:entity
#By Bobsymalone
Owner = owner()
OwnerPos = Owner:pos()

if (Find&~Find) {
    findByClass("npc_*")
    NPC = findClosest(OwnerPos)
    NPC:npcRelationship("player","neutral",900)
    NPC:npcRelationship(Owner,"like",999)
}

if (NPC) {
    interval(1000)
    DPos = NPC:pos() - OwnerPos
    WalkPos = OwnerPos + DPos:normalized()*100

    #This next bit stops the NPC from continually trying to run to spot it's standing in, 
    #and also stops it being distracted while standing still

    if (DPos:length()>120) {NPC:npcGoRun(WalkPos)} else {NPC:npcStop()}
}

