Spawner and leveled monsters

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
zadkielmodeler
Posts: 43
Joined: Sat Sep 15, 2012 6:34 am

Spawner and leveled monsters

Post by zadkielmodeler »

Basically I had a request come in for my mod to make leveled creatures. I have basically figured out how to do it.
It looks something like this.

Code: Select all


function LevelMonsters()

 if party:getChampion(1)::getLevel() > 10
 
	
	Spawner:setSpawnedEntity(name)


 end


 if party:getChampion(1)::getLevel() > 20


 end

end


[code]

That would work, but I would need to already know what every single spawner in the game has already.
What I would like to do is put a for loop around this Spawner(i):setSpawnedEntity(name+"hard"), but for that I would need   local name = Spawner(i):getSpawnedEntity().
But that does not exist according to the scripting reference here for the spanwer. http://www.grimrock.net/modding/scripting-reference/

So any ideas, or could I turn this into a request for a  Spawner:getSpawnedEntity()?

The reason I don't want to do it the other way is because my dungeon is bigger than the original grimrock. And they had a team working on it. It is just me alone over here. I should have mentioned earlier I was planning to edit monsters.lua to make 2 harder versions of every monster with  (oldname)+hard or (oldname)+veryhard.

Yeah I hear you Komag, I have made custom monsters before, if the armor level gets too high it stops making sense for the player. I would have to consider leveling the weapons and spells and other items too.
Last edited by zadkielmodeler on Wed Apr 03, 2013 8:03 am, edited 2 times in total.
User avatar
Komag
Posts: 3658
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Spawner and leveled monsters

Post by Komag »

I used all spawn code, no spawner entities, as those don't have a way to adjust the monster level with code (IIRC) and the highest you can go up is only 5 anyway. Take a look at Master Quest source if you like.
Finished Dungeons - complete mods to play
Grimfan
Posts: 369
Joined: Wed Jan 02, 2013 7:48 am

Re: Spawner and leveled monsters

Post by Grimfan »

Your spawn code and leveling scripts should probably be in the editing superthread Komag. The stuff you have done would be invaluable for dozens of beginning and intermediate modders (and delving into your source code is not ideal for people like me who are enjoying your upgraded homage to the original game). :)
User avatar
Komag
Posts: 3658
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Spawner and leveled monsters

Post by Komag »

well it's not really plug-n-play, but kinda integrated and hard to just separate.

A few considerations on scaling and monster leveling:

- The original monsters were never intended to be leveled up to very high levels. One of the biggest problems is protection - at higher levels you start to not be able to do any damage to them except with special attacks, and this becomes severely unbalanced the higher you go. Some monster's HP adjustments get a little crazy at very high levels as well. Plus, the additional XP they grant (+10%/level) is not nearly enough to help a high level party level up. Due to these things I adjusted the definition of every single monster in the game, reducing the HP, Attack Power, and Protection increments down to between 1/3 and 1/10 of the original amounts depending, and leveled them up 3x the normal rate (according to a big 'ol chart I created in Excel) to give more XP. Even with all that I wasn't getting enough XP, so I added the little bonus jackpots at the end of each level (which scale both with party level and dungeon level), and added additional tome rewards for higher and higher leveled parties.

- It took many full-game playtests to get a good feel for balanced difficulty at higher levels for various imported parties. I spent a lot of time carefully tweaking the above adjustments, on a monster-by-monster basis

- MANY other things should be scaled in addition to just monsters. Health and Energy potions start to lose their potency, elemental spawner traps start to hurt less and less (or not at all), wands/swords start to become ineffective, etc. Any effects you have set up need to be scalable, such as special trap damage or special healing items. Any puzzles that require scaled items (if you set them up) will need to be able to accept any of the items in the scaling range (including receptors for scaled spells).

- All of this stuff adds complexity to your testing, so if you want to do it right you'll just need to budget more time to test test test!
Finished Dungeons - complete mods to play
alois
Posts: 112
Joined: Mon Feb 18, 2013 7:29 am

Re: Spawner and leveled monsters

Post by alois »

Maybe something like this may be helpful :)

In a script_entity named "spawners" put the following

Code: Select all

===== data ==========================

globalSpawners = {}
spawnerId = 0

-- ================= utilities =====================

function sumLevels()
	local sumLevels = 0
	for i=1,4 do 
		sumLevels = sumLevels + party:getChampion(i):getLevel()
	end
	return sumLevels
end

-- ================= functions =====================

function addSpawner(sid,creature,level,px,py,facing,coolDown,maxSpawn,levs,levmods)
	if (sid == nil) then
		spawnerId = spawnerId + 1
		sid = "spawner_" .. spawnerId
	end
	local spawner = {
		sid = sid,
		creature = creature,
		level = level,
		px = px,
		py = py,
		facing = facing,
		coolDown = coolDown,
		maxSpawn = maxSpawn,
		toSpawn = maxSpawn,
		levs = levs,
		levmods = levmods,
		activated = false,
	}
	globalSpawners[sid] = spawner
	return sid
end

function doSpawner(sid)
	local spawner
	if (type(sid) == "string") then
		spawner = globalSpawners[sid]
	else
		spawner = globalSpawners[sid.id]
	end
	if (findEntity(spawner.sid) ~= nil) then
		findEntity(spawner.sid):destroy()
	end
	if (spawner ~= nil) and (spawner.activated) then
		spawner.activated = true
		if (spawner.toSpawn > 0) then
			local sumLevels = sumLevels()
			local addstring = ""
			if (spawner.levs) then
				for i=1,(#spawner.levmods)/2 do
					if (sumLevels >= spawner.levmods[2*i-1]) then
						addstring = spawner.levmods[2*i]
					end
				end
			end
			spawn(spawner.creature .. addstring,spawner.level,spawner.px,spawner.py,spawner.facing)
			local timer = spawn("timer",spawner.level,0,0,1,spawner.sid):
				setTimerInterval(spawner.coolDown):
				addConnector("activate","spawners","doSpawner"):
				addConnector("activate",spawner.sid,"activate"):
				activate()
		end
		spawner.toSpawn = math.max(spawner.toSpawn - 1,0)
	else
		print("spawner does not exist!")
	end
end

function startSpawner(sid)
	if (globalSpawners[sid] ~= nil) then
		globalSpawners[sid].activated = true
		doSpawner(sid)
	end
end

function stopSpawner(sid)
	if (globalSpawners[sid] ~= nil) then
		globalSpawners[sid].activated = false
	end
end

function resetSpawner(sid)
	if (globalSpawners[sid] ~= nil) then
		globalSpawners[sid].toSpawn = globalSpawners[sid].maxSpawn
	end
end
Then, in whatever script you like, you can call

Code: Select all

	local sid = spawners.addSpawner("sp_1","scavenger",1,6,7,2,5,3,true,{20,"_hard",40,"_veryhard"})
	spawners.startSpawner(sid)
to create a spawner; in this example, a spawner called "sp_1", which spawns a scavenger, at level = 1, at x=6 and y=7, facing south; the coolDown is 5 seconds, and it spawns 3 creatures before stopping; since the 'levels' parameter is true, the function calculates the sum of the levels of the champions; if it is >= 20, it spawns "scavenger_hard" monsters (to be defined), and if it is >= 40, then... it is going to be tough! :)

If the first parameter of addSpawner is left to nil, then an id of the type "spawner_xx" will be assigned.

Additional functions: stopSpawner(sid) (sid is the spawner identity), resetSpawner(sid) (which resets the total number of monsters to be spawn).

Hope it helps :)

alois :)

*edit for typos*
User avatar
Damonya
Posts: 134
Joined: Thu Feb 28, 2013 1:16 pm
Location: France
Contact:

Re: Spawner and leveled monsters

Post by Damonya »

What I learned after various tests is that players don't usually like meet the same leveled monsters. It is much preferable to create new monsters. The player has much more satisfaction thereby.
Orwak - MOD - Beta version 1.0
User avatar
Dr.Disaster
Posts: 2876
Joined: Wed Aug 15, 2012 11:48 am

Re: Spawner and leveled monsters

Post by Dr.Disaster »

Komag wrote:- The original monsters were never intended to be leveled up to very high levels. One of the biggest problems is protection - at higher levels you start to not be able to do any damage to them except with special attacks, and this becomes severely unbalanced the higher you go.
Indeed! I experienced exactly this with lvl 30-some Toorum doing his second MQ play-thru in Fighter's Challenge. There sometimes even his special attacks did no damage at all. If there is a thing hinting you are in big trouble it's "Flury of Slashes" doing tripple ZERO damage; just in case ogres one-hitting you with 1200+ damage ain't enough :lol: Was a pretty cool workout winning this :D

It also shows that monsters or spawners dealing only elemental damage can be safely ignored once the characters advanced enough and manage to raise their needed resistance to 100 (reaching immunity). Due to this AH might consider a limit to maximum possible resistances like 95 or so.

Oh btw this is no complain!
If somebody plays any mod incl. scaling with high-lvl chars he's up for a challenge so: please do NOT change MQ!
Ixnatifual

Re: Spawner and leveled monsters

Post by Ixnatifual »

Damonya wrote:What I learned after various tests is that players don't usually like meet the same leveled monsters. It is much preferable to create new monsters. The player has much more satisfaction thereby.
I'm sure us modders would love to accomodate this if you go ahead and supply us new models of the same quality as the Grimrock monsters to use in our dungeons.
User avatar
SpiderFighter
Posts: 789
Joined: Thu Apr 12, 2012 4:15 pm

Re: Spawner and leveled monsters

Post by SpiderFighter »

Ixnatifual wrote:
Damonya wrote:What I learned after various tests is that players don't usually like meet the same leveled monsters. It is much preferable to create new monsters. The player has much more satisfaction thereby.
I'm sure us modders would love to accomodate this if you go ahead and supply us new models of the same quality as the Grimrock monsters to use in our dungeons.
I see what you did there. :D
User avatar
Damonya
Posts: 134
Joined: Thu Feb 28, 2013 1:16 pm
Location: France
Contact:

Re: Spawner and leveled monsters

Post by Damonya »

Ixnatifual wrote:
Damonya wrote:What I learned after various tests is that players don't usually like meet the same leveled monsters. It is much preferable to create new monsters. The player has much more satisfaction thereby.
I'm sure us modders would love to accomodate this if you go ahead and supply us new models of the same quality as the Grimrock monsters to use in our dungeons.
No sorry no new models. :D But new textures and new features on existing models, yes I'm doing it. ;)
What I mean is that the player doesn't like, the feeling not being able to differentiate two monsters with différent features (leveled). New texture and custom characteristic is a better solution. I say this only because the testers gave me this idea. Since I fixes it.
Orwak - MOD - Beta version 1.0
Post Reply