I'm curious where that error might have come from.
I don't understand from the script where you are summoning these Hydras... Does the script determine the nearest free space near the main Hydra? I'm not sure that this will happen correctly in 100% of cases.
But otherwise, it looks normal...