Skip to content

Instantly share code, notes, and snippets.

@Rumrusher
Rumrusher / spellbook.lua
Last active December 15, 2015 08:59 — forked from warmist/spellbook.lua
My spellbook spells.
--show a list of 'spells'
local dlg=require("gui.dialogs")
function doNothing()
print("doing nothing real good but here have a site")
require("plugins.dfusion.adv_tools").addSite(nil,nil,nil,nil,nil,nil,df.global.world.units.active[0].civ_id)
end
function SummonSelf()
for k,v in pairs(df.global.world.nemesis.all) do
@Rumrusher
Rumrusher / test2.lua
Created March 25, 2013 04:30
Warmlor Anga a edit of warmist's companion order script I used to make a quick menu for easy access to lua scripts. this goes well with my spellbook gist
--warmlor Anga Big Old Book of Dfhackery Spells for the adventurer/fort manager on the go.
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"
@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
@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 / 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 / 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 / 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 / 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 / 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 / RandomKillstreak.gml
Last active August 29, 2015 13:55
modified from 2 lorgens codes ps I have a github account who knew.
//killstreak plugin by Lorgan (original idea by Vindicator)
object_event_add(Character,ev_create,0,"
killStreak = 0;
currentStreak = global.paramPlayer.stats[KILLS];
");
object_event_add(Character,ev_step,ev_step_normal,"
if (!global.isHost) exit;