Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: DFHack: Outsider invasion: Spawn invasion based on your wealth and pop  (Read 3537 times)

danamlund

  • Escaped Lunatic
    • View Profile

This is a DFHack script that simulates an invasion that gets more difficult based on wealth and pop.

https://github.com/danamlund/scripts/blob/master/outsider-invasion.lua

Usage:
1) download outsider-invasion.lua to your dwarf_fortress/hack/scripts/ folder.
2) In your dfhack console type:
Code: [Select]
outsider-invasion -now3) For more options type:
Code: [Select]
outsider-invasion -help
This will spawn a random type of invasion with number of invaders, equipment, and skills that are scaled to the wealth and pop of your fortress.

Types of invasions:
1) goblins: Goblins and trolls with metal weapons and metal armor.
2) elves: Elves with wooden weapons and armor. Very high skills to compensate for poor equipment.
3) semimegabeasts: An invasion of either minotaurs, ettin, cyclops, or giants. Not balanced very well.

Challenge:
My newish 40 strong military handled a -strength 1000 goblins invasion with only a few casualties.
Code: [Select]
outsider-invasion -invasion-type goblins -cap 200 -now -strength 1000How much fun can your military handle?

Bugs:
 - It crashes dwarf fortress quite regularly.
 - More laggy than regular invasions.
 - I only got CAN_LEARN or INTELLIGENT units to work together (so no cave dragons and unicorns). And I could not get the semimegabeasts to work together either.
 - Building destroyers do not destroy buildings.
 - Balance, both risk and rewards.

Help:
I would love to get feedback on the code. (Maybe reduce crashes)
Help with balance issues.
I would also like saves with a visit from the different semimegabeasts. (so far I have just guessed at their skills/equipment)

DFHack tricks used:
I spawn units that attack the fortress and not each other by setting these flags:
Code: [Select]
unit.flags1.marauder = true
unit.flags1.active_invader = true
unit.flags1.invader_origin = true
unit.flags1.invades = true
unit.flags1.hidden_ambusher = true
And when I want them to flee I only set:
Code: [Select]
marauder = true
Other features:
You can spawn in an invasion in arena mode under your cursor. You can see goblins vs elves (or elves vs themselves if you forget to set '-arena-side <number>').

You can auto spawn an invasion every 12 months by adding the following line to your dwarf_fortress/dfhack.init (This is not recommended due to frequent crashes):
Code: [Select]
outsider-invasion -every-months 12
Design your own invasion. I hope the code is clean enough that you can figure out how to create your own invasion challenge. And I would love to see what you come up with.
« Last Edit: June 11, 2017, 01:19:56 pm by danamlund »
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile

Here's a idea for those who want to experiment. Create new army, fill it out (experimentation required) and figure out how to make it come to fort. My experiments with adventurer were very fruitful (e.g. 100 dwarves army or ALL historical figures in one army) :D

danamlund

  • Escaped Lunatic
    • View Profile

That is exactly the problem I failed not solve.
So instead I made this script that just spawns in monsters out of nowhere. It is not in the spirit of dwarf fortress, but it is still a new source of fun.
« Last Edit: June 11, 2017, 01:21:31 pm by danamlund »
Logged