Skip to content

Instantly share code, notes, and snippets.

@Rumrusher
Rumrusher / tofort16.lua
Last active September 28, 2022 09:30 — forked from warmist/tofort.lua
Switch to fort mode and back to advmode with little saving 9/28/2022 now there's two versions of this old script one more close to the original, and one made for using in playerforts... and adv nobles owning campsites
-- changes from advmode to fort safely and back (hopefully)
--[[Now to warn you about saving and loading in either game mode might lead
to some side issues, for saving in fort mode switching to adv mode needs the adv to be `bodyswap`
back in again. for Saving in Adv to switch to Fort mode you probably be safe-ish if the site.
isn't a nano fort or a site that isn't 3x3 small. otherwise the game will try to resize the map.
oh and switching to fort mode on any pre-gen site larger than 4x4 might implode one pc if
you don't have like 20 gigs of memory for the 16x16 embark size.
ok so this version of this script has be updated again so that caravans and visitors and migrants
could show up at any edge of the map... and maybe leave from any spot... of the z level you assign the site too.
@Rumrusher
Rumrusher / telekinesis.lua
Created May 4, 2016 18:51
started as a Jump code Max and I co-created from the propel.lua from rose scripts now modified to now only throw items around. uses warmists get creature at xyz functions
function telekinesis(itemSource,itemTarget)
local curpos
if df.global.ui_advmode.menu==1 then
curpos=df.global.cursor
else
print ("No cursor located! uhh wouldn't had effected anything though.")
return
end
@Rumrusher
Rumrusher / addciv.lua
Created March 16, 2016 19:36
this script will randomly add an avaliable civ to embark screen and constant use will add more. up to 10+
local dlg=require("gui.dialogs")
local testciv=df.global.world.entities.all
require("utils").insert_sorted(dfhack.gui.getCurViewscreen().available_civs,df.global.world.entities.all[112],"id")
require("utils").insert_sorted(dfhack.gui.getCurViewscreen().available_civs,df.global.world.entities.all[302],"id")
require("utils").insert_sorted(dfhack.gui.getCurViewscreen().available_civs,df.global.world.entities.all[234],"id")
require("utils").insert_sorted(dfhack.gui.getCurViewscreen().available_civs,df.global.world.entities.all[134],"id")
require("utils").insert_sorted(dfhack.gui.getCurViewscreen().available_civs,df.global.world.entities.all[32],"id")
require("utils").insert_sorted(dfhack.gui.getCurViewscreen().available_civs,df.global.world.entities.all[274],"id")
require("utils").insert_sorted(dfhack.gui.getCurViewscreen().available_civs,df.global.world.entities.all[47],"id")
@Rumrusher
Rumrusher / additionalciv.lua
Created October 25, 2013 12:10
for fort mode though I couldn't find a good way to add military with this so you have to wing it
function addaciv()
local testciv=df.global.world.entities.all
--df.viewscreen_choose_start_sitest.available_civs:insert("#",{new=df.global.world.entities.all,112})
--require("utils").insert_sorted(df..available_civs,df.global.world.entities.all[1],"id")
require("utils").insert_sorted(dfhack.gui.getCurViewscreen().parent.available_civs,df.global.world.entities.all[112],"id")
require("utils").insert_sorted(dfhack.gui.getCurViewscreen().parent.available_civs,df.global.world.entities.all[302],"id")
require("utils").insert_sorted(dfhack.gui.getCurViewscreen().parent.available_civs,df.global.world.entities.all[234],"id")
require("utils").insert_sorted(dfhack.gui.getCurViewscreen().parent.available_civs,df.global.world.entities.all[134],"id")
require("utils").insert_sorted(dfhack.gui.getCurViewscreen().parent.available_civs,df.global.world.entities.all[32],"id")
require("utils").insert_sorted(dfhack.gui.getCurViewscreen().parent.available_civs,df.global.world.entities.all[274],"id")
@Rumrusher
Rumrusher / Mount.lua
Created October 9, 2013 16:17
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
@Rumrusher
Rumrusher / Mount-Order.lua
Created October 8, 2013 18:12
Rider Controls pretty basic bind this to Alt-M
local dlg = require("gui.dialogs")
function CompN1()
local adv=df.global.world.units.active[2]
--for k,v in pairs(df.global.world.units.active) do
--if adv.relations.group_leader_id==adv.id then
local sx,sy,sz
sx=adv.pos.x
sy=adv.pos.y
@Rumrusher
Rumrusher / CompanionOrder.lua
Last active December 17, 2015 00:19
modded Companion order that allows you to set up a worker for comfort to do so you need to have the pointer on top of the unit you want to set up.
local gui = require 'gui'
local dlg = require 'gui.dialogs'
local args={...}
local is_cheat=(#args>0 and args[1]=="-c")
local cursor=xyz2pos(df.global.cursor.x,df.global.cursor.y,df.global.cursor.z)
local permited_equips={}
permited_equips[df.item_backpackst]="UPPERBODY"
permited_equips[df.item_quiverst]="UPPERBODY"
permited_equips[df.item_flaskst]="UPPERBODY"
@Rumrusher
Rumrusher / comfort.lua
Last active December 17, 2015 00:09 — forked from warmist/advfort.lua
Companion fort created for adventure mode could be used in any other mode.(good luck using it in legends)
-- allows to do jobs in adv. mode.
keybinds={
nextJob={key="CUSTOM_B",desc="Next job in the list"},
prevJob={key="CUSTOM_V",desc="Previous job in the list"},
continue={key="A_WAIT",desc="Continue job if available"},
down_alt1={key="CUSTOM_CTRL_D",desc="Use job down"},
down_alt2={key="CURSOR_DOWN_Z_AUX",desc="Use job down"},
up_alt1={key="CUSTOM_CTRL_E",desc="Use job up"},
up_alt2={key="CURSOR_UP_Z_AUX",desc="Use job up"},
use_same={key="A_MOVE_SAME_SQUARE",desc="Use job at the tile you are standing"},
@Rumrusher
Rumrusher / spawnunit.lua
Created April 18, 2013 21:07
Updated spawnunit for r3 originally made by warmist using it will spawn a unit ontop of the active[0] unit aka the adventurer.
function getCaste(race_id,caste_id)
local cr=df.creature_raw.find(race_id)
return cr.caste[caste_id]
end
function CreateUnit(race_id,caste_id)
local race=df.creature_raw.find(race_id)
if race==nil then error("Invalid race_id") end
local caste=getCaste(race_id,caste_id)
local unit=df.unit:new()
unit.race=race_id
@Rumrusher
Rumrusher / Rum_tools.lua
Created March 25, 2013 23:33
Rum_tools for' dfusion most of these scripts are rough and kinda made for testing bugs that could been made into features. beware.
local _ENV = mkmodule('plugins.dfusion.Rum-tools')
local dfu=require("plugins.dfusion")
local ms=require "memscan"
menu=dfu.SimpleMenu()
RaceNames={}
function setrace(name)
RaceTable=BuildNameTable()
print("Your current race is:"..GetRaceToken(df.global.ui.race_id))
local id
if name == nil then