here's "Get in" which works if you're already riding a minecart and have the Xpointer on top of the yourself
shove this code in the order list
{name="Get in",f=function (unit_list,pos)
if not CheckCursor(pos) then
return false
end
adv=df.global.world.units.active[0]
item=getItemAtPos(getxyz())
print(item.id)
for k,v in pairs(unit_list) do
v.riding_item_id=item.id
ref=df.general_ref_unit_riderst:new()
ref.unit_id=v.id
item.itemrefs:insert("#",ref)
end
return true
end},
shove this any where near the other loose functions
function getItemAtPos(x,y,z) -- gets the item index @ x,y,z coord
--local x,y,z=getxyz() --get 'X' coords
local vector=df.global.world.items.all -- load all items
for i = 0, #vector-1 do -- look into all items offsets
local curpos=vector[i].pos --get its coordinates
local cx=curpos.x
local cy=curpos.y
local cz=curpos.z
if cx==x and cy==y and cz==z then --compare them
return vector[i] --return index
end
end
--print("item not found!")
return nil
end
function getxyz() -- this will return pointers x,y and z coordinates.
local x=df.global.cursor.x
local y=df.global.cursor.y
local z=df.global.cursor.z
return x,y,z -- return the coords
end
and now you can order companions to ride shotgun on your cart.
though you might end up having them all killed if you don't learn proper driving.