A teenager obsessed with mass killings who murdered three members of his family was travelling to his old primary school when he was arrested.