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 3408 times)

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: Would love to make a mod that adds more to legends mode artifacts
« Reply #15 on: June 15, 2015, 08:02:08 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.
*yoink* ty much, I was starting to doubt that it would repeat the script the way I was thinking since I realized it would just go the first year specified and close itself down before getting to the next.
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: Would love to make a mod that adds more to legends mode artifacts
« Reply #16 on: June 15, 2015, 10:04:46 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.
Oh, that's great!  I'd actually prefer the script to continue working in the "activated world" so long as I can avoid doing something to the player's fort.

I'm going to have more questions about generating rampaging beast historical events and such, but those don't belong in this thread.   Meanwhile, certainly looking forward to a world where artifacts occur "off screen."  Makes them seem less game-y.
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

Max™

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

Code: [Select]
df.global.world.history.events:new()
 df.global.world.history.events:insert('#',{new=df.history_event_hf_attacked_sitest,
year = whenever,
seconds = whatever,
id = df.global.hist_event_next_id,
site = you get the idea,
hfid = beast.id,
}
)
   df.global.hist_event_next_id = df.global.hist_event_next_id+1
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: Would love to make a mod that adds more to legends mode artifacts
« Reply #18 on: June 15, 2015, 12:06:55 pm »

Awesome, now the awakened stone Rustchamber the Ceiling of Lashes can be slain by swordsdwarf Uzol Tangathîstlig wielding the dog bone shortsword Trustedvein at Worthyfurnace in the early spring of 98, long before any player forts have been established.
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

Max™

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

Indeed, and, the same basic layout with {new = df.history_event_ and any of these:
hf_confrontedst
artifact_lostst
artifact_recoveredst
artifact_foundst
hf_razed_buildst
hf_destroyed_sitest
hist_figured_diedst
simple_battle_subtype

and so on.
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Would love to make a mod that adds more to legends mode artifacts
« Reply #20 on: June 16, 2015, 01:33:39 am »

Code: [Select]
df.global.world.history.events:new()
 df.global.world.history.events:insert('#',{new=df.history_event_hf_attacked_sitest,
year = whenever,
seconds = whatever,
id = df.global.hist_event_next_id,
site = you get the idea,
hfid = beast.id,
}
)
   df.global.hist_event_next_id = df.global.hist_event_next_id+1

does this actually do anything

Max™

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

If inserted into an appropriate function with the appropriate arguments, that's the same layout mostly as the stuff I added so the artifacts have proper history links.
Logged

Marya Clare

  • Bay Watcher
    • View Profile
Re: Would love to make a mod that adds more to legends mode artifacts
« Reply #22 on: June 17, 2015, 12:12:11 pm »

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?

And thus be able to recreate the age old scene of a group of adventurers traveling to a cave and finding a dragon lying on a bed of coins and gems. If this is implemented all dragons will finally be able to live up to their names:D
Logged

Marya Clare

  • Bay Watcher
    • View Profile
Re: Would love to make a mod that adds more to legends mode artifacts
« Reply #23 on: June 19, 2015, 02:12:35 pm »

Code: [Select]
df.global.world.history.events:new()
 df.global.world.history.events:insert('#',{new=df.history_event_hf_attacked_sitest,
year = whenever,
seconds = whatever,
id = df.global.hist_event_next_id,
site = you get the idea,
hfid = beast.id,
}
)
   df.global.hist_event_next_id = df.global.hist_event_next_id+1

Where would that string of code go?
Logged

Max™

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

You'd have to define the right arguments but it's the same format as the bit I added in artifake to let them link to history right.
Logged
Pages: 1 [2]