Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2

Author Topic: Would love to make a mod that adds more to legends mode artifacts  (Read 3401 times)

Marya Clare

  • Bay Watcher
    • View Profile

I was getting tired of seeing countless necromancer books/slabs being produced in legends mode.

No sure if this would be possible but could more artifact types (weapons/clothes/furniture/useless items like toys) be added to be randomly generated in legends mode, that aren't products of a player fortress?

I also want to find a way to have engravings added to fortress ruins that are pre-generated from world gen.

Think of how awesome it would be if you stumbled upon a world gen made tomb and found it filled with engravings and hidden artifacts...although some have been utilized into the various traps that can be found around tombs.
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: Would love to make a mod that adds more to legends mode artifacts
« Reply #1 on: June 12, 2015, 11:43:14 am »

There is an "artifake" script maturing in the DFHack thread.  It would be relatively straightforward to generate a bunch of them after worldgen at various sites, and maybe even every few game years thereafter... but inserting them into worldgen so that they can affect history seems to be in Toady's domain.

I could be mistaken, however... do the DFHack wizards know of a way to trigger scripts during worldgen?  I'd be interested in a related idea to ensure that custom creatures got spawned at some fortress sites during worldgen.
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

Knight Otu

  • Bay Watcher
  • ☺4[
    • View Profile
Re: Would love to make a mod that adds more to legends mode artifacts
« Reply #2 on: June 12, 2015, 11:58:05 am »

It's not something that can be done through simple raw modding, at least. I don't know anything about DF Hack, so I can't add anything to Dirst's point in that direction. I can say, though, that Toady is going to work on world-gen artifacts, maybe not soon, but soonish-ish - After the upcoming tavern release, there should be at least one more tavern release for games and such, along with bugfix releases after each, and then work on the world-gen artifacts should start. Of course, the releases before that have to be finished first.
Logged
Direforged Original
Random Raw Scripts - Randomly generated Beasts , Vermin, Hags, Vampires, and Civilizations
Castle Otu

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: Would love to make a mod that adds more to legends mode artifacts
« Reply #3 on: June 12, 2015, 06:41:47 pm »

Hmmmm, once I get the names incorporated I wonder if I could have it drop artifakes at different sites.

I think if I can get mifki to show me the trick for using the in-game random name generator I could have a script that pulls up a list of suitable sites: lairs with megabeasts, sacked fortresses, mountain halls, towns with x population, shrines and goes through a list of types and drops them with some semi-randomized distribution. I'd need to make sure I have the proper position so they don't end up in walls or whatnot, and there is no way to keep them from being stolen that I know of, but yeah... that should actually be doable.
« Last Edit: June 12, 2015, 06:47:21 pm by Max™ »
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Would love to make a mod that adds more to legends mode artifacts
« Reply #4 on: June 13, 2015, 04:26:26 am »

It should be fully possible to insert them during worldgen.

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: Would love to make a mod that adds more to legends mode artifacts
« Reply #5 on: June 13, 2015, 07:41:07 am »

Yeah I was thinking about that actually, cause you can call scripts while it's running huh.

I've almost got names running and I've still got an idea floating around about seeing if I can do a framework like you did with the absurd saiyan power levels for artifacts to have it set their attack velocity/penetration/edge length to arbitrary values, but if someone doesn't get the world-gen artifact insertion going before I do I'll definitely try to get one set up.
Logged

Manzeenan

  • Bay Watcher
  • [SLOWLEARNER]
    • View Profile
Re: Would love to make a mod that adds more to legends mode artifacts
« Reply #6 on: June 13, 2015, 10:42:14 am »

so are artifact weaponss going to be made of absurd metals? like a tin warhammer? and is it possible to spawn in a titan/forgotten beast/Megabeast to guard the artifact?
Logged

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: Would love to make a mod that adds more to legends mode artifacts
« Reply #7 on: June 13, 2015, 03:31:36 pm »

Well, if it used artifake you could give it a specific material, or have it put down items from a few specific materials, and it shouldn't be impossible to have them spawned in lairs or shrines with beasts. Just have to put a check for a beast and then artifake one in there.
Logged

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: Would love to make a mod that adds more to legends mode artifacts
« Reply #8 on: June 14, 2015, 08:49:16 am »

Incidentally, I learned a good deal about how artifacts are worked into the world while I was adding in the proper historical event links (so an artifake shows up in legends as having been made by the right unit at the right time and such) which means they can be inserted into historical events like being stolen, claimed, taken as loot, and so forth.

I think I'm happy with names.lua now unless I find a neat little trick to get it to work on exiting the screen (instead of running the script twice to get the screen+apply it) and it works well to just have the option to give a first name to an artifake, shouldn't be too hard to have them pull in the right stuff in a historical-insertion script now.

Gonna poke at that some later I think, see what low-hanging fruit I can find, as it is I'm pretty sure I could fake it by retroactively inserting artifacts after world-gen but they wouldn't get interacted with properly until after it was updated again, but I think I can use the same general method to scatter them around.

I'd like to avoid just having it go through a list and putting a war hammer at site 1, helmet at site 5, right glove at site 9, etc but I'll need to read up a bit on the random stuff available to see if I could assemble a list of said options and then have it run through and plunk them down one at a time every few years at different sites until world-gen finishes.
Logged

Manzeenan

  • Bay Watcher
  • [SLOWLEARNER]
    • View Profile
Re: Would love to make a mod that adds more to legends mode artifacts
« Reply #9 on: June 14, 2015, 07:45:45 pm »

hmm interesting
Spoiler (click to show/hide)
Logged

scamtank

  • Bay Watcher
    • View Profile
Re: Would love to make a mod that adds more to legends mode artifacts
« Reply #10 on: June 14, 2015, 08:54:15 pm »

I can't imagine why not. Unlike the entities, the materials don't have weird generated names, but rather just DIVINE_1, 2, 3.
Logged

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: Would love to make a mod that adds more to legends mode artifacts
« Reply #11 on: June 15, 2015, 02:25:59 am »

Yeah, you can do that now if you know the name of em, I actually made a point to stick to the way the createitem script works as much as possible, so you can make an artifact gold bed, tetrahedrite mechanism, platinum war hammer, or blazing metal long sword.

Was thinking about this some more, I think having a set of pre-defined artifacts with suitable metals and such that would be preferentially dropped in dorf sites, stuff like more obscure/non-native type but still usable boons which get dropped in megabeast lairs, things like crowns and amulets and daggers in tombs, maybe thrones and statues in human/goblin sites, artifact wooden armor and bows and stuff in elf sites.

Once I get down and dig into the world_gen stuff with gm-editor I'll get a better idea of how to set the triggers, then it'll just be a matter of getting the script set up to... hell, can't eventful pick up when world-gen starts?

Hmmm, even if you had to manually trigger it it wouldn't be too hard, just hit a keybind once the history starts ticking within the first ten or fifteen years.

I could have it go through the hist_fig lists and cross-reference it with their own site_links, then once the various triggers activate have it do a hmmm, this is in no way going to be remotely working code, just an outline to get it in my head.
Code: (artinsert-concept) [Select]
function setBaseLists()
local dorflist = {}
 whatever.the.hell advfort.does.to.determine for dorfs_can_make == true
return dorflist
local beastlist = {}
 do.the.same.for.dorflist.but for dorfs_can_make == false
return beastlist
local tomblist = {}
 for _,k in ipairs(jewelrystuff) do
  if k.bling then sort.and.label[k]
return tomblist
local treehumperlist = {}
 get.stuff.stinky elves_can_make == true
return treehumperlist
local otherlist = {}
 if not stuff.covered.above then others_can_make == true
return otherlist
end

function assignMaterials(allthosedamnlists)
 if dorflist do steel except war hammers do platinum
 if beastlist do divine_1 except mauls do gold or something
 if tomblist do crazy_precious_shit like ruby crowns and platinum amulets
 if treehumperlist do interesting_woods like nether_cap and feather and glumprong
 if otherslist do slade thrones and statues and shit for demon sites gold and bronze for humans
end

scriptArgs={...}

utils=require('utils')

validArgs = validArgs or utils.invert({
 'rate', --how many years between artinsert running
 'freq', --how many artifakes to create each time artinsert runs
 'type', --whether it should be limited to one, a few, or all of the types from the lists above
})

if year = date+args.rate do
     siteCheck(args.freq, args.type)
    return sites
function siteCheck()
 for k, v in ipairs(conditions) do
  if k.some.trigger == some.state[v] do
return k
function unitCheck()
  for i,j in ipairs(histfigs) do
   if site_links[k] do
    if i.goals == suitable.goals then
  local cid = i.unit_id
 local creator = df.units.find(cid)
return creator

function getBase()
  if creator.race == dorfs then
 baseopts == dorflist
  if creator.is_power == true then
 baseopts == beastlist
  if df.hist_figs.find(creator).site_links == tomb then
 baseopts == tomblist
  if creator.race == treehumpers then
 baseopts == treehumperslist
  if df.hist_figs.find(creator).site_links == dark_fortress or town then
 baseopts == otherslist
  randomNumsomethingHere()
   baseopts[randomoutput] == base
 return base

artifake -base -creator
names -random --(I'll need to add that in as a flag so it just calls the random input/applies it)
update_next_id stuff
date = date+args.year
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: Would love to make a mod that adds more to legends mode artifacts
« Reply #12 on: June 15, 2015, 05:22:24 am »

It should be fully possible to insert them during worldgen.
How does one get a script to run during worldgen?  Something that would be called back every year or so would be perfect.
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Would love to make a mod that adds more to legends mode artifacts
« Reply #13 on: June 15, 2015, 05:49:57 am »

It should be fully possible to insert them during worldgen.
How does one get a script to run during worldgen?  Something that would be called back every year or so would be perfect.

Calling it every year isn't too difficult, but you have to set up a frame repeater that checks if the cur year is different from some cached year. Basically like this:

Code: [Select]
curYear=-1
function worldgenThing()
    if df.global.cur_year>curYear then
        curYear=df.global.cur_year
        --do stuff
    end
end
require('repeat-util').scheduleEvery('something',5,'frames',worldgenThing)

Might want some further checks to make sure it's currently in worldgen, but that should work.

StagnantSoul

  • Bay Watcher
  • "Player has withdrawn from society!"
    • View Profile
Re: Would love to make a mod that adds more to legends mode artifacts
« Reply #14 on: June 15, 2015, 05:52:41 am »

Glanced at the first bit of the title as I scrolled by. Thought you were thinking of weaponizing love.
Logged
Quote from: Cptn Kaladin Anrizlokum
I threw night creature blood into a night creature's heart and she pulled it out and bled to death.
Quote from: Eric Blank
Places to jibber madly at each other, got it
Quote from: NJW2000
If any of them are made of fire, throw stuff, run, and think non-flammable thoughts.
Pages: [1] 2