-- Allows instant transmission.
math.randomseed(dfhack.getTickCount())
if df.global.gamemode~=1 then
qerror("Adventure mode only (for now). Sorry!")
end
function getIsWalkable(coords)
local ttype=dfhack.maps.getTileType(coords)
local tileshape=df.tiletype.attrs[ttype].shape
if df.tiletype_shape.attrs[tileshape] ==
end
function getPowerLevel(unit)
local speed = 1000/dfhack.units.computeMovementSpeed(unit)
local strength = unit.body.physical_attrs.STRENGTH.value/3550
local endurance = unit.body.physical_attrs.ENDURANCE.value/1000
local toughness = unit.body.physical_attrs.TOUGHNESS.value/2250
local spatialsense = unit.status.current_soul.mental_attrs.SPATIAL_SENSE.value/1500
local kinestheticsense = unit.status.current_soul.mental_attrs.KINESTHETIC_SENSE.value/1000
local willpower = unit.status.current_soul.mental_attrs.WILLPOWER.value/1000
local bodysize = unit.body.blood_count*10
local powerlevel = (bodysize*speed*((strength*endurance*toughness*spatialsense*kinestheticsense*willpower)^(1/6)))*300
return powerlevel
end
function getSubjectPronoun(unit)
local sex = unit.status.current_soul.sex
if sex == 1 then return "he"
elseif sex == 0 then return "she"
else return "it"
end
end
function getObjectPronoun(unit)
local sex = unit.status.current_soul.sex
if sex == 1 then return "him"
elseif sex == 0 then return "her"
else return "it"
end
end
function getPowerLevelComparison(unit1,unit2)
local randomnumber = math.random(2)
local subjectPronoun = getSubjectPronoun(unit2)
local objectPronoun = getObjectPronoun(unit2)
local comparison = getPowerLevel(unit2)/getPowerLevel(unit1)
if comparison < .8 then
if comparison < .1 then
if randomnumber == 1 then return "Hmm, " .. subjectPronoun .. "'s not very powerful..."
else return "Ha, " .. subjectPronoun .. "'s so weak!" end
elseif randomnumber==1 then return "I can definitely take " .. objectPronoun .. "."
else return "Eh, " .. subjectPronoun .. " shouldn't be too difficult to beat." end
elseif comparison >= .8 and comparison <= 1.2 then
if comparison == 1 then return "Huh. Identical power levels? Either this is me or this is weird."
else return "I'm about as strong as " .. objectPronoun .. "." end
elseif comparison > 1.2 and comparison <= 10 then return "Okay, " .. subjectPronoun .. "'s a bit stronger than I am!"
elseif comparison > 10 and comparison <= 100 then return "Oh man, " .. subjectPronoun .. "'s a lot stronger than me! I hope my skill can prevail."
elseif comparison > 100 and comparison <= 10000 then return "Okay, I do NOT want to fight that!"
elseif comparison > 10000 and comparison <= 1000000 then return "No way can I win against a foe like that!"
else return "QUACK!"
end
end
local player = df.global.world.units.active[0]
local unitcaste
if ...==nil then
for _uid,unit in ipairs(df.global.world.units.all) do
print(_uid,df.creature_raw.find(unit.race).caste[unit.caste].caste_name[0],dfhack.TranslateName(dfhack.units.getVisibleName(unit)),getPowerLevelComparison(player,unit))
end
qerror("type the number for the creature you want to teleport to!")
end
local unitToTeleportTo = df.global.world.units.all[tonumber(...)]
dfhack.gui.showAnnouncement("You put two fingers up to your head and concentrate...",11)
player.pos.x = unitToTeleportTo.pos.x-1
player.pos.y = unitToTeleportTo.pos.y
player.pos.z = unitToTeleportTo.pos.z
If you want the DFhack thing, my last one seems to be the exact same error, with VERRRRRY minor changes.