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!
Dungeon Enemy Spawns
-
- Posts: 13
- Joined: Thu Feb 18, 2021 7:31 am
Re: Dungeon Enemy Spawns
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.
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.
-
- Posts: 13
- Joined: Thu Feb 18, 2021 7:31 am
Re: Dungeon Enemy Spawns
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!
Any experienced modder or dev could chip in? Is this a valid approach?
Thanks!
- Ralzar
- Posts: 2211
- Joined: Mon Oct 07, 2019 4:11 pm
- Location: Norway
Re: Dungeon Enemy Spawns
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.
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.
-
- Posts: 13
- Joined: Thu Feb 18, 2021 7:31 am
Re: Dungeon Enemy Spawns
Nice idea, maybe this is easier to from a mod POV. I'll give it a shot. Thanks!
- BadLuckBurt
- Posts: 948
- Joined: Sun Nov 05, 2017 8:30 pm
Re: Dungeon Enemy Spawns
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.
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.
DFU on UESP: https://en.uesp.net/w/index.php?title=T ... fall_Unity
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt
.
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt
.
-
- Posts: 13
- Joined: Thu Feb 18, 2021 7:31 am
Re: Dungeon Enemy Spawns
Yeah, that was my impression... thanks for the inputBadLuckBurt 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.
-
- Posts: 1409
- Joined: Mon Aug 12, 2019 4:32 pm
- Contact:
Re: Dungeon Enemy Spawns
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.
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 Daggerfall Mod Github: l3lessed DFU Mod Github
My Beth Mods: l3lessed Nexus Page
Daggerfall Unity mods: Combat Overhaul Mod
Enjoy the free work I'm doing? Consider lending your support.
My Beth Mods: l3lessed Nexus Page
Daggerfall Unity mods: Combat Overhaul Mod
Enjoy the free work I'm doing? Consider lending your support.