Does anyone have any scripts that are similar to this? Struggling to wrap my head around it

Yes it is doable in Grasshopper. You didn’t wrap enough :thinking:
See this if it helps

There tons of examples …
And read this