basics to caching information in entities? 1.21.8

Basically the title, im making a datapack for my sister. i have the basics of it working but it does not scale to multiples, so i would like to store information in an entity, rather than a scoreboard. its a bridge making function that goes like this currently for the user:

# sets end points
/function bridge:set_anchor {name:"A"}
/function bridge:set_anchor {name:"B"}

/function bridge:create_bridge {start:"A",end:"B"}

inside of bridge:create_bridge, what i want to have happen is

  • create a marker
  • store the current xyz position inside of it (can just use the markers position for this i suppose), and the xyz position of its destination
  • call another function that recursively moves the marker one block closer per iteration, and run setblock to place a block at its location.

what i have currently uses a single scoreboard, which works well enough if only one bridge is being made at a time. however if you put two together its not the best time.

Continue to help post