Skip to content

Instantly share code, notes, and snippets.

@warmist
Created July 5, 2014 08:07
Show Gist options
  • Save warmist/b5b6dfdf1d9c88c1a91e to your computer and use it in GitHub Desktop.
Save warmist/b5b6dfdf1d9c88c1a91e to your computer and use it in GitHub Desktop.
Arena testing thingy.
local dwarf = 465
local mass=15
function count_alive( )
local ret=0
for k,v in ipairs(df.global.world.units.active) do
if not v.flags1.dead then
ret=ret+1
end
end
return ret
end
local pos=copyall(df.global.cursor)
function spawn()
local change=mass-count_alive()
for i=1,change do
pos_r={x=pos.x+math.random(-8,8),
y=pos.y+math.random(-8,8),
z=pos.z}
local unit=dfhack.units.createUnit(dwarf,math.random(0,1),pos_r)
if math.random()>0.99 then
-- unit.name.first_name="Elite"..math.random(0,100000)
-- dfhack.units.makeHistorical(unit)
-- dfhack.units.makeNemesis(unit)
else
unit.name.first_name="Mobster"..math.random(0,100000)
end
end
dfhack.timeout(10,'ticks',spawn)
end
dfhack.timeout(10,'ticks',spawn)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment