Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 70 71 [72] 73 74 ... 122

Author Topic: What's going on in your modding?  (Read 275258 times)

Enemy post

  • Bay Watcher
  • Modder/GM
    • View Profile
Re: What's going on in your modding?
« Reply #1065 on: November 05, 2019, 10:53:42 pm »

I've found it crucial to keep notes. List the things you have to make, and check them off as you finish them.
Logged
My mods and forum games.
Enemy post has claimed the title of Dragonsong the Harmonic of Melodious Exaltion!

MachoNacho

  • Bay Watcher
  • pug
    • View Profile
Re: What's going on in your modding?
« Reply #1066 on: November 05, 2019, 11:49:52 pm »

I am almost done with the 7 deadly sins megabeasts. Just need to get the pride creature to actually use the summoning interaction I gave it.
Logged
pug

TomiTapio

  • Bay Watcher
  • OldGenesis since 2012
    • View Profile
    • My Flickr animal photos
Re: What's going on in your modding?
« Reply #1067 on: November 06, 2019, 07:00:36 am »

I've found it crucial to keep notes. List the things you have to make, and check them off as you finish them.
Yep, a changelog (for users and self) and a pile of to-do items.

Spoiler (click to show/hide)
Logged
==OldGenesis mod== by Deon & TomiTapio. Five wood classes, four leather classes. Nine enemy civs. So much fine-tuning.
47.05e release: http://dffd.bay12games.com/who.php?id=1538
OldGenesis screenshots: https://twitter.com/hashtag/OldGenesis?src=hashtag_click&f=image
My Finnish language file: http://dffd.bay12games.com/file.php?id=14884

ZM5

  • Bay Watcher
  • Accomplished RAW Engineer
    • View Profile
    • Steam
Re: What's going on in your modding?
« Reply #1068 on: November 06, 2019, 07:28:39 am »

I keep stuff around as well for to-do lists for creatures and the like. Comes in handy and its kind of motivating to check off stuff thats done and see the list shrink.

Kyubee

  • Bay Watcher
  • modding is hard
    • View Profile
Re: What's going on in your modding?
« Reply #1069 on: November 06, 2019, 10:15:55 pm »

I keep stuff around as well for to-do lists for creatures and the like. Comes in handy and its kind of motivating to check off stuff thats done and see the list shrink.

Explains why i never have the drive lol. No list
Logged
My (long abandoned) mod: http://www.bay12forums.com/smf/index.php?topic=176501.0
The litten is wandering around the dump now, occasionally exploding.

DerMeister

  • Bay Watcher
    • View Profile
Re: What's going on in your modding?
« Reply #1070 on: November 07, 2019, 07:21:36 am »

I want add incubators (for solve sentient eggs bug) and reaction of milking sentient creature by DFhack. Can anyone make this for me?
Logged

Eric Blank

  • Bay Watcher
  • *Remain calm*
    • View Profile
Re: What's going on in your modding?
« Reply #1071 on: November 07, 2019, 04:37:36 pm »

Making violent, hateful forest elves. They won't trade, only slaughter in the name of their trees. But aren't item or baby snatchers. Just assholes. Should they have local banditry? Or just kill neutrals?

But that makes me rethink the regular elves. Maybe tone down their fanatical hate of damaging plant or animal life.
Logged
I make Spellcrafts!
I have no idea where anything is. I have no idea what anything does. This is not merely a madhouse designed by a madman, but a madhouse designed by many madmen, each with an intense hatred for the previous madman's unique flavour of madness.

ZM5

  • Bay Watcher
  • Accomplished RAW Engineer
    • View Profile
    • Steam
Re: What's going on in your modding?
« Reply #1072 on: November 08, 2019, 04:42:05 am »

Making violent, hateful forest elves. They won't trade, only slaughter in the name of their trees. But aren't item or baby snatchers. Just assholes. Should they have local banditry? Or just kill neutrals?

But that makes me rethink the regular elves. Maybe tone down their fanatical hate of damaging plant or animal life.
Short of thieving/snatching there isnt really a way to guarantee goblin-style hostility I don't think. With KILL_NEUTRAL they'll attack you on sight in adv mode but I dont think it makes them automatically send sieges in fort mode.

brolol.404

  • Bay Watcher
    • View Profile
Re: What's going on in your modding?
« Reply #1073 on: November 08, 2019, 05:52:17 am »

If you are using dfhack check out my night of the werepumpkins code. It forces an entity to send timed (or random) sieges.

brolol.404

  • Bay Watcher
    • View Profile
Re: What's going on in your modding?
« Reply #1074 on: November 08, 2019, 06:07:55 am »

Here is the write up for it:

Code: [Select]
This script counts down to a specific date, displays a pop-up window and then finds
a random surface location and spawns a creature at that location a set number of times.

I originally planned for this to be done in one event, as one function
"function wp_moon_hunters()" that displayed a pop-up window and spawned 100 creatures
at random locations around the surface of the map. However, running multiple lines of
code (in this case thousands) at the same time crashes the game. So, instead this script
is done using multiple spawning wave functions. Each wave is separated by a day (1200 ticks)
and consists of 20 creatures; however, these numbers could be manipulated for more variety.

The countdown function is the countdown to the event. Note that it is not called until the
last line of the script file (after everything is read). It calls each event wave at the date
specified by finding the difference between the current date and the specified event date
and then using "dfhack.timeout(ticks+1,'ticks',FUNCTION_NAME)", like so:

   local ticks = date_moon_hunters_START - current_tick

The total ticks in a year is calculated with the following equation. This variable never changes:

   local year_tick_total = 1200*28*12

   This is equivalent to 403200 (1200 ticks in a day * 28 days in a month * 12 months in a year)

The current tick is calculated using:

   local current_tick = df.global.cur_year_tick

The specific event date is calculated using:

   local date_moon_hunters_START = 1200*(7*28+9)
   
   This is (1200 ticks in a day * (# of months * 28 days in a month * # of days)

   The # of months starts at Granite (not January) and the # of days is up to the date (the day
   before the day of the event)

Knowing this, we can do some interesting things here. Using a random number, we can now choose
a random date (within a date range) and not just use a specific date. Lets say that we want this
event to happen between June to September. We can now roll a four sided die and set the result
to the month, like so:

   local m = math.random(4) + 3
   local date_of_event = 1200*(m*28+9)

   This will choose a random number between 1 and 4 and then add 3 to it. Assuming we got a
   random number of 2, this event would happen on the 10th of July. We can further complicate
   this date like so:

   local m = math.random(4) + 3
   local d = math.random(28) - 1
   local date_of_event = 1200*(m*28+d)

   This event will now happen sometime between the 1st of June and the 28th of September.
   Remember that the random number will be between 1 and 28 and the # of days is the day before
   the event. Assuming we got the random numbers 3 and 12, this event would happen on August 12th.

   Note that these variables would change everytime the game was loaded.

   You can do the same thing with years in the future as well. This code here says that if the
   difference between the current date and the specified event date is less than 0, the event
   has already passed this year and will take place next year.

   if ticks < 0 then
    ticks = ticks + year_tick_total
   end

   By multiplying another random number to year_tick_total, you can have this event happen
   multiple years in the future. Once again, this would change everytime the game was loaded.

   local y = math.random(5)
   if ticks < 0 then
    ticks = ticks + year_tick_total * y
   end

The wave functions make up the actual actions of the events. For this script, they display a
pop-up notification or spawn a creature at a random location, but could do anything that you
want to happen in the event.

   The pop-up notification is as follows. Note that this does not pause the game. I also read
   that it should come after a creature is spawned, but I have not noticed any issue with that.
   If you are using a pop-up notification and a creature spawn at the same time, I suggest
   that you put the pop-up notification at the end:

   dfhack.gui.showPopupAnnouncement("announcement", COLOR_WHITE , true )

   The creature spawn is a simple dfhack.run_command(). Note that this only accepts a string.
   If you want to pass a variable that isn't a string, you have to convert it into a string
   first. The "modtools/create-unit" has ambush tags, but you will get a pop-up notification
   for every creature that is spotted. So, if you are spawning 100 creatures, that is 100
   notifications. I suggest that you use your own pop-up notification if you want to announce
   an ambush and are using multiple creatures.

   The actual spawn loop could be done in a for loop (and is probably the correct format), but
   I like while loops, so that is what I used. You can spawn a random number of creatures here:

   local n = 0
   local t = math.random (11) + 9
   while n < t do
    dfhack.run_command("modtools/create-unit")
    n = n + 1
   end
 
   This will spawn anywhere from 10 to 20 creatures. You can also set a percentage chance trigger
   here for anything to even happen:

   local event_chance = math.random(10)
   if event_chance == 1 then
    local n = 0
    local t = math.random (11) + 9
    while n < t do
     dfhack.run_command("modtools/create-unit")
     n = n + 1
    end
   end

   This means that the event only has a 10% chance of happening. You can change this percentage
   chance by changing the equation:

   local event_chance = math.random(10)
   if event_chance < 5 then
    local n = 0
    local t = math.random (11) + 9
    while n < t do
     dfhack.run_command("modtools/create-unit")
     n = n + 1
    end
   end

   This means that the event now has a 40% chance of happening. You can further complicate
   this by setting different chances to different amount of creature spawns.

   local event_chance = math.random(10)
   if event_chance < 5 then
    local n = 0
    local t = math.random (11) + 9
    while n < t do
     dfhack.run_command("modtools/create-unit")
     n = n + 1
    end
   else
    local n = 0
    local t = math.random (5)
    while n < t do
     dfhack.run_command("modtools/create-unit")
     n = n + 1
    end
   end

   Now this means that the event will happen. However, there is a 40% chance that 10 to
   20 creatures will spawn and a 60% chance that 1 to 5 creatures will spawn. To complicate
   this further, let's remove the event guarantee:

   local event_chance = math.random(10)
   if event_chance < 5 then
    local n = 0
    local t = math.random (11) + 9
    while n < t do
     dfhack.run_command("modtools/create-unit")
     n = n + 1
    end
   elseif event_chance == 5 or event_chance == 6
    local n = 0
    local t = math.random (5)
    while n < t do
     dfhack.run_command("modtools/create-unit")
     n = n + 1
    end
   else
    -- do nothing
   end

   Now there is a 40% chance that 10 to 20 creatures will spawn, a 20% chance that 1 to 5
   creatures will spawn and a 40% chance that the event will not happen.

   You can also add in population requirements, like so:

   local k = 0
   local event_chance = math.random(10)
   for i,unit in pairs(df.global.world.units.active) do
    if dfhack.units.isDwarf(unit) then
     k = k + 1
    end
   end
   if k > 79 then
    if event_chance < 5 then
     local n = 0
     local t = math.random (11) + 9
     while n < t do
      dfhack.run_command("modtools/create-unit")
      n = n + 1
     end
    else
     local n = 0
     local t = math.random (5)
     while n < t do
      dfhack.run_command("modtools/create-unit")
      n = n + 1
     end
    end
   end

   This code counts all of the dwarves on the map and then requires at least a count of 80
   for the event to happen. If there are 80 dwaves, there is a 40% chance that 10 to 20
   creatures will spawn, a 60% chance that 1 to 5 creatures will spawn and a 40% chance that
   the event will not happen.

   Once again, you can add an else/elseif to the population minimum if statement to make
   a fewer number (or a different creature(s)) spawn depending on the current population:

   local k = 0
   for i,unit in pairs(df.global.world.units.active) do
    if dfhack.units.isDwarf(unit) then
     k = k + 1
    end
   end
   if k > 79 then
    -- spawn 50 to 100 creatures
   else if k > 49 then
    -- spawn 20 to 50 creatures
   else if k > 19 then
    -- spawn 5 to 10 creatures
   else
    -- do nothing
   end

I highly suggest using the print output while testing your script. You should put a
print output at the start of each function and for each important variable.

For example, this line of code will tell you the date of the event (in ticks), the current
tick and the difference between the two. This is a good way to find out when the event
should happen (e.g. 100 ticks from now or 10,000):

print("event tick:", date_event, "current tick:", current_tick, "ticks to event:", ticks)

This is also a good way to see what random number was chosen so that you can make
sure that the code is working as intended:

local n = math.random(5) + 3
printf(n)

I hope this helps with your own events, pre-determined random encounters and custom sieges!

Let me know if you have any questions.

Asin

  • Bay Watcher
  • A short and sturdy creature fond of modding.
    • View Profile
Re: What's going on in your modding?
« Reply #1075 on: November 11, 2019, 02:23:39 pm »

I'm currently in the planning stage of my own take on the "expanded underground/cavern mod." Still figuring out what sorts of things to add.

ZM5

  • Bay Watcher
  • Accomplished RAW Engineer
    • View Profile
    • Steam
Re: What's going on in your modding?
« Reply #1076 on: November 12, 2019, 12:01:37 pm »



Hahahaha. Soon.

peasant cretin

  • Bay Watcher
  • [MEANDERER][GNAWER]
    • View Profile
Re: What's going on in your modding?
« Reply #1077 on: November 16, 2019, 10:15:04 am »

Realized it'd be more sensible to strip mine my old mod instead of streamlining it.

This time clear and organized instead of wild electrical wire sprawl. The raws should be intelligible. Started from the core with woodworking (bowyering/carpentry) and wearables (clothier/leatherworker), and now working outward.

For an adventure mod crafting mod, I think the easily achievable ideal/constraint is a single, clean main-menu page, with most reaction topic submenu pages at 1 (unlikely for some reactions). Topic submenus should be intuitive and self-contained requiring no travel to other topics.


The experiment involving intermediate stage products has reached its end. For adventure mode, you can't have crafting granularity without  tedium. For example, before feather = fletching, branch = shaft, raw material = missile head, then combine to make missile. Those 4 dreadful steps I've compressed into 1. Feather + branch + (say) stone = 12 stone arrows/bolts.

We'll see how it goes.
Logged

LargeSnail

  • Bay Watcher
  • Sluggish Modder
    • View Profile
Re: What's going on in your modding?
« Reply #1078 on: November 19, 2019, 12:30:48 pm »

Centaur Tribes :) And a lot of new scripts that some modders can find useful. I'll upload some of them soon.

Scripts that I'll upload: cavernEmbark (Embark in any of the three cavern levels!), infoExtractor (Useful for me, it allows you to see tile types, tile captions, building coords, item properties, etc), discover (Learn new reactions and unlock new workshops for your fort [Only for your fort]).

Spoiler: Elven Mod (click to show/hide)

Tentacle Demon

  • Bay Watcher
    • View Profile
Re: What's going on in your modding?
« Reply #1079 on: November 19, 2019, 12:41:44 pm »

Realized it'd be more sensible to strip mine my old mod instead of streamlining it.

This time clear and organized instead of wild electrical wire sprawl. The raws should be intelligible. Started from the core with woodworking (bowyering/carpentry) and wearables (clothier/leatherworker), and now working outward.

For an adventure mod crafting mod, I think the easily achievable ideal/constraint is a single, clean main-menu page, with most reaction topic submenu pages at 1 (unlikely for some reactions). Topic submenus should be intuitive and self-contained requiring no travel to other topics.


The experiment involving intermediate stage products has reached its end. For adventure mode, you can't have crafting granularity without  tedium. For example, before feather = fletching, branch = shaft, raw material = missile head, then combine to make missile. Those 4 dreadful steps I've compressed into 1. Feather + branch + (say) stone = 12 stone arrows/bolts.

We'll see how it goes.
Now your mod is better.
Logged
Pages: 1 ... 70 71 [72] 73 74 ... 122