Skip to content

Instantly share code, notes, and snippets.

@Putnam3145
Putnam3145 / SpawnUnitR3.lua
Created October 17, 2013 09:21 — forked from warmist/SpawnUnitR3.lua
Just in case I ever feel the need to modify it.
--create unit at pointer or given location. Usage e.g. "spawnunit DWARF 0 Dwarfy"
--Made by warmist, but edited by Putnam for the dragon ball mod to be used in reactions
--note that it's extensible to any autosyndrome reaction to spawn anything due to this; to use in autosyndrome, you want \COMMAND spawnunit CREATURE caste_number name \LOCATION
args={...}
function getCaste(race_id,caste_id)
local cr=df.creature_raw.find(race_id)
return cr.caste[caste_id]
@Putnam3145
Putnam3145 / Spawnunit.lua
Last active December 27, 2015 03:09 — forked from warmist/Spawnunit.lua
forked it so I can make age more proper. Also fixed it for r4's release and moved random numbers to local rng instead of global.
--create unit at pointer or given location. Usage e.g. "spawnunit DWARF 0 Dwarfy"
--Made by warmist, but edited by Putnam for the dragon ball mod to be used in reactions
--note that it's extensible to any autosyndrome reaction to spawn anything due to this; to use in autosyndrome, you want \COMMAND spawnunit CREATURE caste_number name \LOCATION
args={...}
local rando=dfhack.random.new()