Skip to content

Instantly share code, notes, and snippets.

@Rumrusher
Created October 9, 2013 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rumrusher/6903877 to your computer and use it in GitHub Desktop.
Save Rumrusher/6903877 to your computer and use it in GitHub Desktop.
CHOOSE YOUR MOUNTS To apply this you need to go into the unit's profile in adventure mode, fort mode is just highlight and enter. first pick is Rider, the second is mount, this code is a modify version of Hugelueman's marry revise code... also warmists.
function Mount (rider,horse)
--for k,horse in pairs(unit_list) do
--if unit_rider.pos.x==horse.pos.x and unit_rider.pos.y==horse.pos.y
--and unit_rider.pos.z==horse.pos.z then --check if they are on the same tile
horse.general_refs:insert("#",{new=df.general_ref_unit_riderst,unit_id=rider.id})
rider.relations.rider_mount_id=horse.id
rider.flags1.rider=true
horse.flags1.ridden=true
require("utils").insert_sorted(df.global.world.units.other.ANY_RIDER,rider,"id")
return
end
unit_1 = dfhack.gui.getSelectedUnit()
if unit_1 == nil then
print ("You must place the cursor over the first target.")
return
end
print("Target the Mount and press enter")
test = dfhack.lineedit("")
unit_2 = dfhack.gui.getSelectedUnit()
if unit_2 == nil then
print ("You must place the cursor over the second target.")
return
end
dfhack.with_suspend(Mount, unit_1, unit_2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment