You need an family Boolean 'InBatlle'. When they start a battle, set the Boolean to true. False when they stop fightiing.
Now.
I dont know how you currently check when they stop fighting. So
Event --- When they stop fighting.
--------------- Call function "ride"
New event
On function "ride"
Local variable 'Pos_X'
Local variable 'Pos_Y'
------sub > every tick
-----------------------Set those locals to the position of the object that stopped with fighting.
------sub > system > pick all family
------ > Family > Is boolean instance variable 'InBatlle' set > inverted. This picks all those that are not in a fight.
-------> Family > Pick nearest (to position Pos_x and Pos_y.
----------------------- Find path to falily.x and family.y
New event
-> family > on path found
-----------------------Follow path
-----------------------Set InBatlle to false
Now they will find a path to the nearest.
To make em find a new path, every so much time.
New event.
-> family > is moving along path
Sytem > compare two values > Family.Pathfinding.CurrentNode = 2 (zero based, so when it starts moving to the second index)
--------------------------Call function "ride"
Now they dont find paths at the same time, and not to often.