Basically, ground transport go like:
TransportPickup(id_of_unit_to_load)
{
if(get XZ_HYPOT(get UNIT_XZ(id_of_unit_to_load) - get PIECE_XZ(base_piece_of_transport))<=[85])//[85] is the distance at which pickup is allowed. Theorically it could be anything, but Spring is hard coded to have transport not move closer than a certain distance to target, so it's safer to keep that [85]
{
set BUSY to 1;// not sure what it really does, but tradionnal ground/hover/sea transport script have it. My guess would be that it tell the engine to wait before moving the transport and retrying to unload
// here you may have some animation of the transport opening and extending an arm, using some get PIECE_Y, get UNIT_Y, get UNIT_XZ, get PIECE_XZ, get XZ_ATAN, get XZ_HYPOT to get the proper angle and distance
attach-unit id_of_unit_to_load to some_arm_piece_of_the_transport;
// Some more animation of the arm coming back
attach-unit id_of_unit_to_load to 0 - 1;//0 - 1 is a special code telling the transport to "hide" the transported unit.
// Maybe the final part of the animation?
set BUSY to 0;
}//end of the if target in range
}//enf of if TransportPickup
TransportDrop(id_of_unit_to_unload, xz_of_position_to_unload)
{
if( some formula to check if the distance between transport and unload zx position is small enough)
{
set BUSY to 1;
// some opening animation
attach-unit id_of_unit_to_unload to some_arm_piece_of_the_transport;
// animation of arm extending to reach xz_of_position_to_unload
drop-unit id_of_unit_to_unload;
// closing animation
set BUSY to 0;
}//end of the if
}// end of transportdrop function
Ok, maybe that wasn't very helpful, try to look up some the code of some transport. Sadly, the Cavedog script has some needless complication (it calls another function, boomcalc, just to compute the distance, and if you have an uncobbled script instead of a genuine source bos, all those func_var and static_var make it very confusing.
I'd link you to my
most advanced transport script, with lots of define to change its behavior and that should be easy to slap on any unit but sadly it's even more complex to read.
As for your question about displaying loaded units on three point of the transport, well, instead of "attach-unit id_of_unit to 0 - 1;", you do a "attach-unit id_of_unit to piece_unit_should_be_hung_on;" Since you want the transport to load three units and hang them on three piece, I guess you should have a static-var, initialised to 0 in the create, decreased in transportdrop(..), increased in transportpickup(..), and then some "if" on that var to select where to attach it.
I aren't sure that was really helpful. Do you already have the unit you want such transport script to be mounted on?