selective monster spawning per dungeon or category of dungeon

Talk about the mods or features you'd like to see in Daggerfall Unity. Give mod creators some ideas!
User avatar
Ralzar
Posts: 1774
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: selective monster spawning per dungeon or category of dungeon

Post by Ralzar »

Sorry about derailing your thread :D
We'll try to keep it to small suggestions in there, instead of overhauls.
My released mods

"I feel like Ralzar specifically wrote those mods for me and then said "Use them". Just so he could watch me die more."
-FuzzyBeanPlays

User avatar
BadLuckBurt
Posts: 609
Joined: Sun Nov 05, 2017 8:30 pm

Re: Roleplay & Realism mod pack

Post by BadLuckBurt »

Ralzar wrote: Thu Nov 07, 2019 10:08 am A giant skeleton?
Only if you pump up the volume on it's scream as well :lol:

I don't know how easy it is to override the part of DFU that determines what types of monsters spawn in the dungeon types but that could be a way to at least stop bears from hanging out with zombies etc. The mixing never really bothered me but you guys do have a point.
Daggerfall Unity on UESP: https://en.uesp.net/w/index.php?title=T ... fall_Unity
Daggerfall Unity on Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt

darkner11
Posts: 8
Joined: Tue Oct 22, 2019 9:53 pm

Re: selective monster spawning per dungeon or category of dungeon

Post by darkner11 »

Hazelnut wrote: Thu Nov 07, 2019 1:56 pm Guys, I split this out from the discussion thread about my Roleplay and Realism mod as it has nothing to do with the contents of the mod itself. This kind of change is out of the scope in my eyes since it's a more fundamental gameplay change to Daggerfall, rather than a tweak or enhancement. So here it has it's own thread and hopefully will get implemented and developed by someone.
Thank you for informing us. Because I am not very knowledgable about the limits of coding, I did not realize my suggestion crossed such a threshold. It simply seemed to fit the roleplay/realism category.

User avatar
pango
Posts: 2885
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: selective monster spawning per dungeon or category of dungeon

Post by pango »

If the goal is just to change monsters spawning (not add dungeon types or anything more fancy), then the spawn tables are public and not readonly, so I guess a mod could simply modify this table:
https://github.com/Interkarma/daggerfal ... ers.cs#L28
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

Jay_H
Posts: 3419
Joined: Tue Aug 25, 2015 1:54 am

Re: selective monster spawning per dungeon or category of dungeon

Post by Jay_H »

Heck yeah. That's a very simple mod in the making. Who wants to take it up? :)
Farewell DFU community! My time here has been a joy.

User avatar
Ralzar
Posts: 1774
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: selective monster spawning per dungeon or category of dungeon

Post by Ralzar »

Wow... that file is surprisingly easy to edit... it’s just some tables, a diceroll and som basic if/else logic? Now I just have to figure out how to make a mod :D

Edit: And it contains the logic for level scaling in dungeons? This could be used as the fundamental part of a mod for removing or adjusting level scaling.
My released mods

"I feel like Ralzar specifically wrote those mods for me and then said "Use them". Just so he could watch me die more."
-FuzzyBeanPlays

User avatar
pango
Posts: 2885
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: selective monster spawning per dungeon or category of dungeon

Post by pango »

That's where a code editor will help you find from where data and methods are being used, and recreate the call tree...

RandomEncounters.ChooseRandomEnemy() is only called from PlayerEntity.IntermittentEnemySpawn(), so it seems to be only used for enemies randomly spawning, in dungeons or otherwise.

But EncounterTables are also used from RDBLayout, where initial dungeon enemies are selected:
Both DaggerfallDungeon.LayoutDungeon() and DaggerfallDungeon.LayoutOrsinium() call RDBLayout.AddRandomEnemies(), that either calls RDBLayour.ChooseRandomEnemyType() and RDBLayout.AddRandomRDBEnemyClassic(), or AddRandomRDBEnemy() (depending on whether player selected Alternate Random Enemies option), and that's where the rest of enemies leveling happens.

I'm not sure how humans level is adjusted to yours, I haven't found yet where it's done...
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
Ralzar
Posts: 1774
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: selective monster spawning per dungeon or category of dungeon

Post by Ralzar »

Haha, I spent quite a few hours today trying to figure out how to make a mod that manged to do anything with the .cs files. So far no luck. It works great just editing the files in Unity though :P It's jut managing to make those kind of changes in the live build that eludes me.
I see most of the tutorials are about asset injections (and a lot of it a bit out of date). I'm currently trying to look at similar mods, like Hazelnuts mod that changes how the language pacification works and compare the DFU script to the mod script. It feels like I'm close, but never quite there.
My released mods

"I feel like Ralzar specifically wrote those mods for me and then said "Use them". Just so he could watch me die more."
-FuzzyBeanPlays

User avatar
Hazelnut
Posts: 2680
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: selective monster spawning per dungeon or category of dungeon

Post by Hazelnut »

For changing the code, there needs to be a mod hook for it to use your modified code. Formula methods can be registered, as can many other bits and pieces. Some people use reflection and other methods to hack their code in, and I add the hooks I need when I need them or others request them. For example the UI window factory so replacement UI window classes can be registered.

As Pango pointed out, you can change those tables easily enough because they're unprotected and static. I would stick to that unless you really know what you're doing with c# and the DFU codebase.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Ralzar
Posts: 1774
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: selective monster spawning per dungeon or category of dungeon

Post by Ralzar »

Hm, so these tables are used by both static dungeon spawns and random spawns? Makes sense.
If I could change these, I could curate the tables to make them more themed. Only problem being that the game only uses a short range of each table based on the playerLevel +/- some boolean logic which assumes lists of length 20.

What I'd really want access to changing would be RandomEncounters.ChooseRandomEnemy() and whatever controls the min and max values for dungeon spawns, which is where I see things get really complicated :D
What I'd really like is to set other values for minMonsterIndex and maxMonsterIndex, which I am assuming is used to produce monsters from the tables based on playerlevel. Then you could use a wider (or whole) table to produce a wider range of enemies.

Ah well, I'm having fun either way.
My released mods

"I feel like Ralzar specifically wrote those mods for me and then said "Use them". Just so he could watch me die more."
-FuzzyBeanPlays

Post Reply