Dungeon Enemy Spawns

Discuss modding questions and implementation details.
Post Reply
reaven
Posts: 11
Joined: Thu Feb 18, 2021 7:31 am

Dungeon Enemy Spawns

Post by reaven »

Hey all!

So I'm just starting fiddling with daggerfall unity modding. My idea here is to alter the number of enemies that spawn in dungeons. I've been looking at the code and I see several methods for handling the enemy spawn, but I cant really say which are used inside dungeons. Any direction would be welcome!

More specifically, my idea would be to add an additional chance of another enemy spawn when an enemy is placed inside a dungeon. I'd like to make this customizable but I'll play with that later.

Thanks!

reaven
Posts: 11
Joined: Thu Feb 18, 2021 7:31 am

Re: Dungeon Enemy Spawns

Post by reaven »

So, after some research, I've found what I think I want to change: The 'AddRandomEnemies' method from 'RDBLayout' class.
I've made some changes on the unity code to make a prototype of what I intend to do with the mod. Now my question is, can I mod this at all? I've seen examples of overriding with FormulaHelper and subscribing to events but Im not sure if overridding something like this is supported.

reaven
Posts: 11
Joined: Thu Feb 18, 2021 7:31 am

Re: Dungeon Enemy Spawns

Post by reaven »

I've been thinking that maybe subscribing to the event OnTransitionDungeonInterior I could call AddRandomRDBEnemyClassic() to spawn additional enemies for the random enemy spots in the dungeon, given a random chance to trigger. But this method has a lot of parameters, some of which I'm not sure how to obtain from my mod class.
Any experienced modder or dev could chip in? Is this a valid approach?
Thanks!

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

Re: Dungeon Enemy Spawns

Post by Ralzar »

Off the top of my head, one way to do this that I actually considered but never got around to:

On transitioning into dungeon, find all enemies. Then do a foreach where you do a roll (against Luck?) if you want to add a second enemy. Placing the second enemy slightly positioned off from the first.
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

reaven
Posts: 11
Joined: Thu Feb 18, 2021 7:31 am

Re: Dungeon Enemy Spawns

Post by reaven »

Nice idea, maybe this is easier to from a mod POV. I'll give it a shot. Thanks!

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

Re: Dungeon Enemy Spawns

Post by BadLuckBurt »

I think Ralzar's suggestion is the best way to approach this for now.

I had a quick glance at the code that generates the enemies when creating a dungeon block and it's very much tied to that creation process atm. It would be nice to split that up at some point to allow for easier modding.
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

reaven
Posts: 11
Joined: Thu Feb 18, 2021 7:31 am

Re: Dungeon Enemy Spawns

Post by reaven »

BadLuckBurt wrote: Thu Feb 25, 2021 10:46 am I think Ralzar's suggestion is the best way to approach this for now.

I had a quick glance at the code that generates the enemies when creating a dungeon block and it's very much tied to that creation process atm. It would be nice to split that up at some point to allow for easier modding.
Yeah, that was my impression... thanks for the input

l3lessed
Posts: 795
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Dungeon Enemy Spawns

Post by l3lessed »

If you do Ralzars approach, don't forget to check the environment around some how, or you'll begin spawning enemies outside the walls and floors.

You could use a sphere cast, sized to the enemy capsule size, going from the center of the enemy and the first open space it finds from a certain distance spawns another enemy.

If they aren't a flying enemy, you also would need to shoot a raycast down from that found spawn location and ensure there is a floor under them too, so they don't get spawned over ledges and fall to death instantly.
My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

Post Reply