tModLoader Dynamic Invasions

Discussion in 'Works-in-Progress' started by hamstar, Aug 14, 2017.

  1. hamstar

    hamstar Steampunker

    Note: Requires Mod Helpers

    Implements dynamic mob invasions. Use a [​IMG] Cross-Dimensional Aggregator to summon your own invasions.

    Crafted at a [​IMG] Tinker's Workshop with:
    • [​IMG] 1x Magic/Ice Mirror
    • [​IMG] 1x Dark Shard
    • [​IMG] 1x Light Shard
    • [​IMG] 5x Banners (any npc); specifies each invading mob's type
    • [​IMG] 1x Music Box (any recorded); specifies invasion's music
    • Mob types can be customized by crafting with their respective banner. All mobs (including modded ones) that drop banners can be added. Note: Some mobs won't want to stick around if they're not in their respective biome/time-of-day/event, currently. Hoping to fix this, soon.
    • The Aggregator requires Eternia Crystals to summon. Cost increases with use.
    • Config file: Documents/My Games/Terraria/ModLoader/Mod Configs/Dynamic Invasions Config.json

    For modders

    Source available: hamstar0/tml-dynamicinvasions-mod

    API now available.

    var spawnInfo = new List<KeyValuePair<int, ISet<int>>>();

    // Summons an invasion of Chaos Elementals
    var npcEntry = new KeyValuePair<int, ISet<int>>( ItemID.ChaosElementalBanner, new HashSet<int>{NPCID.ChaosElemental} );
    spawnInfo.Add( npcEntry );
    spawnInfo.Add( npcEntry );
    spawnInfo.Add( npcEntry );
    spawnInfo.Add( npcEntry );
    spawnInfo.Add( npcEntry );

    DynamicInvasionsAPI.StartInvasion( MusicID.Plantera, spawnInfo );


    Requires tModLoader (0.10). Copy the above .tmod file to your 'Documents/My Games/Terraria/ModLoader/Mods' folder to play.

    Future plans
    • Automatic (randomized) invasion events every so often.
    • Mid bosses.
    • Waves (hopefully).

    • Added mod compat tweak to solve RecipeBrowser load issues
    • Tweaked inbox message
    • Adjusted invasion spawn rate (InvasionSpawnRatePerType) from 1100 to 2000
    • Added world unload cleanup
    • Renamed base mod class files
    • Changed snake case to camel case
    • Updated to MH v4.2.4 conventions
    • Added instruction inbox message on enter world + sync
    • Set spawn rate as a config setting (upped it to 1100 from 1000)
    • Added recipe to revert the Cross Dimensional Aggregator back into a Magic Mirror.
    • Fixed an incompatibility issue with DebugHelpers changes
    • Removed dark and light shards from aggregator recipe
    • Updated to Mod Helpers v2.0.1
    • Set debug config setting to be individual flags
    • Updated player code
    • Added MP player load bug failsafe
    • Added support for Hamstar Helpers v1.2.0 issue report
    • Added mod icon
    • Added API
    • Minor internal refactoring
    • Minor internal class access fix
    • Lots of general refactoring.
    • Fixed multiplayer item lag issue.
    • Invasions now restricted to world surface.


    Last edited: Apr 8, 2019
  2. Caseratis

    Caseratis Terrarian

    So if I use a Zombie banner then I get a zombie apocalypse? Do modded banners work as well? Whatever the case, you made another good mod.
    Lunatic Lobbyist likes this.
  3. hamstar

    hamstar Steampunker

    Modded banners won't work, currently. I'll (try) to add those soon.
    Actually, it should.

    I could use some some feedback on balance. If you think of any cool invasion combos, feel free to post them as well.

    Also, if anyone gets any multiplayer lag or desync issues, let me know. This is still a WIP, after all.
    Last edited: Aug 14, 2017
  4. Sapharan

    Sapharan Golem

    I have a suggestion straight away. But on the other hand i can just do it crafting this item. Skeleton faction invasions (the factions from dungeon).
    hamstar likes this.
  5. bootr bawss

    bootr bawss Skeletron Prime

    wow this looks cool, but I think 5 banners is a little much. maybe bump it down to 1
  6. hamstar

    hamstar Steampunker

    So it's only 1 npc type per invasion...?
    TheWorfer27 and Lunatic Lobbyist like this.
  7. bootr bawss

    bootr bawss Skeletron Prime

    oh, its 5 different banners? I thought it was 5 for the same mob.
  8. Gratuitous Lurking

    Gratuitous Lurking Terrarian

    Ok, this sounds awesome :3 gonna give it a try. I can imagine it'd be a crazy idea, and the fact you can select the banners would make grinding certain enemies easier, like, say, grouping a bunch of Granite or Marble enemies together.
    hamstar likes this.
  9. Planterarria

    Planterarria Official Terrarian

    This mod looks amazing. I do have a suggestion: you could put a boss trophy with the same crafting recipe with 10 NPC banners instead of 5 [multiple of the same banner makes those spawn more frequent] as the next tier up. then another tier which requires luminite in combination with the other crafting materials but 3 boss trophies instead of 1 [2 spawn occasionly, while one spawns rarer but is buffed] and 15 NPC banners.
    Just a suggestion. hope this mod keeps updating!
    hamstar likes this.
  10. hamstar

    hamstar Steampunker

    • Lots of general refactoring.
    • Fixed multiplayer item lag issue.
    • Invasions now restricted to world surface.

    • Minor internal class access fix

    Attached Files:

    Last edited: Aug 20, 2017
    Lunatic Lobbyist likes this.
  11. minemoney123

    minemoney123 Terrarian

    I feel that mobs on invasions should spawn faster, it took me almost 10 minutes to get 60%
  12. Cubicalman

    Cubicalman Terrarian

    So, I have a question. What do you use to craft the Cross-Dimensional Agreggator? I've look all over the page and can't find it.
  13. hamstar

    hamstar Steampunker

    You probably crafted a summon item of banners from shy npcs. Some npcs are hard-coded to flee if the occasion is wrong. I'm working on a (hackish) fix for this.

    Recipe is indicated in the first post...
  14. bootr bawss

    bootr bawss Skeletron Prime

  15. Saobie

    Saobie Terrarian

    So i have all the required stuff on me. 1 Magic Mirror, 1 Light Shard, 1 Dark Shard, 5 seperate banners (Devourer, Milkyway Weaver, Bone Serpent, Dune Splicer, World Feeder), and 1 music box for the Old Ones Army ost

    I cant seem to craft it though. What is the crafting station? It is a workbench right?
  16. Saobie

    Saobie Terrarian

    Nvm. Should specify its crafting station is a tinker table :p
    hamstar likes this.
  17. Twichlove999

    Twichlove999 Eye of Cthulhu

    maybe make it renewable? if you make an invasion and grow unhappy with it, you should be able to ''uncraft'' it and get the resources (except the shards) back...
    i had trouble getting magic mirrors in my world which is why i want a way to uncraft it.
    bootr bawss and hamstar like this.
  18. hamstar

    hamstar Steampunker

    I can do that.
  19. Twichlove999

    Twichlove999 Eye of Cthulhu

    Thanks :D
    by the way i saw somethings in the config file, you can craft banners from trophies?
  20. bootr bawss

    bootr bawss Skeletron Prime

    would it be at all possible to use modded banners and music boxes in a future update?