Need some help with manipulating the summoned monster level

I would like to make a mod that removes the level scaling.
I opened the original map in the editor and edited the area levels so that each area has the same min and max level.
However, those area levels only apply to monsters spawned by proxies. Monsters that are summoned seem to use the equasion from the charLevel field from the Character section of their record. By default this equasion uses the charLevel variable(same name as the field, which was confusing). This varaible seems to be the player character level.
For example, I tested my mod with a level 100 char, and Barrog (the first boss of the game in Lower Crossing) was level 6, but some of his ads were about level 100. After looking at the records, it seems that these monsters are summoned by one of his skills.

I thought of two solutions to solve this problem but I’m stuck on both of them.

First would be to somehow make the charLevel field use an equasion based on the area level. The problem is that I don’t think I have access to any variable that gives me the area level in the enemy records. The equasion records that the proxies use (like lv2_normal.dbr) use a variable called averagePlayerLevel and those seem to work with area level. Can I perhaps somehow edit the enemy template so that I have access to this variable in the enemy records?

The secont option would be to make the charLevel field “1” and attach a script to the summons to increase their level when they are added to the game. I put the following function in the onAddToWorld field of the Scripts section in the records of the summoned monsters:

function gd.LevelTest.LevelMonster(id)
	local mob = Character.Get(id)

I harcoded 20 because I wanted to make sure the GiveLevels function works before trying to find the right value. I used GrimInternals to see if the prints work and they do. But the monster level doesn’t increase. Is there anything wrong with the script?

If anyone knows how to get past either of these two issues or has a different idea for achieving the same result, I would appreciate it.

If you have fixed levels for you zones, then simply set the level in the monsters’ dbr to 42 or whatever the zone level is.

Only complication with that is you will have to check if the monsters are used in any other zones. If they are you will need to create copies for each zone.

Thank you for the reply!

The problem is that if I set the level, it will be the same for all 3 difficulties. I don’t think I can set a different charLevel for each difficulty.
The monsters are summoned by the same skill on all difficulties. So I cannot make copies of the monsters and have the boss summon a different one on each difficulty.

Right difficulties…
Well a few more things i can think of:

  • leave the level field blank, it should either default to map or char level
  • If the formula for the level has access to the difficulty variable you could maybe use that. Deleting the field and begining to type something in should give you a drop down with what variables are available.
  • create difficulty specific summons, summon spell, summoner monster.
  • with lua you can add a onaddtoworld event to all monsters with scaling level. You will have to replace them with a copy created in lua( now you can set a level, look at nemesis code).

Thank you for the help!
I went for your last suggestion. After looking at some other people’s code and a lot of trial and error, I managed to achieve the result I wanted.
Here is the code (maybe it will be useful to someone at some point):

gd.LevelTest = {}

gd.LevelTest.SummonLevelMap = {
	zombie_soldiera01_summon = {3, 22, 33},
	zombiemutated_b01_summon = {3, 22, 33}

function gd.LevelTest.GetMonsterLevel(level)
	local result = level
	if (result == 1) then
		result = 2
	return result, nil

function gd.LevelTest.GetDifficultyIndex()
	local dif = Game.GetGameDifficulty()
	if (dif == Game.Difficulty.Normal) then
		return 1
	elseif (dif == Game.Difficulty.Epic) then
		return 2
		return 3

function gd.LevelTest.MakeRecordString(record)
	local recordWithExt = record .. ".dbr"
	local path = "records/creatures/enemies/" .. recordWithExt
	return path

function gd.LevelTest.ReplaceMonster(id, recordName)
	local c = Character.Get(id)
	if(c:GetLevel() == 1) then
		local coords = c:GetCoords()
		local spawn = Character.Create(gd.LevelTest.MakeRecordString(recordName), gd.LevelTest.GetMonsterLevel(gd.LevelTest.SummonLevelMap[recordName][gd.LevelTest.GetDifficultyIndex()]))

function gd.LevelTest.DestoryOnInitialUpdate(id)
	local c = Character.Get(id)
	if(c:GetLevel() == 1) then

function gd.LevelTest.ReplaceZSA01S(id)
	gd.LevelTest.ReplaceMonster(id, "zombie_soldiera01_summon")

function gd.LevelTest.ReplaceZMB01S(id)
	gd.LevelTest.ReplaceMonster(id, "zombiemutated_b01_summon")

A few notes:

  • ReplaceSomeName functions at the end are called from the onAddToWorld field of the respective monster and DestoryOnInitialUpdate function is called from the onInitialUpdate field
  • trying to destroy the old monster in the functions called from onAddToWorld always resulted in a game crash
  • I haven’t done enough testing, but it seems to work on normal difficulty, and it should work on epic and ultimate too

A quick windows explorer search in the records shows that there are about 100 monsters with summon in their name, so I will have to do quite a bit of work if I want to remove the scaling on all.