How to make an entity follow a dolphin

I'm trying to use the dolphin's TreasurePos data to make a pathfinder to certain coordinates. How can I make an entity (like a boat) follow the dolphin but not go underwater (doesn't change it's y pos)

Continue to help post