What I learned about preset monsters

Post here about all aspects of D2 mod making whether it's information, problems or whatever. Please specify whether your post is relating to Classic D2 or the Expansion.

Moderator: Nizari

Post Reply
Posts: 3
Joined: Sun Mar 05, 2023 2:18 am

What I learned about preset monsters

Post by Karyoplasma » Tue Jan 30, 2024 6:13 pm

my current project is writing a tool that changes alvl, Exp and drops akin to what D2R did with the introduction of Terror Zones. Naturally, there were some problems and bugs that I had to iron out, but the thing that seemed to be unfixable was preset monsters. Yesterday, in about the 20th attempt to fix them, I ran a lot of tests and I might have uncovered some stuff that I don't think is common knowledge, so here is what I found.

Preset monsters placed by calls to the MonPreset.txt entries that refer to a group of monsters like place_fallen or place_fallenshaman work like this:
First, the game gets the entry of the zone where it should be placed from Levels.txt. Then it reads the MonLvl1Ex (the expansion normal difficulty column), and does so regardless of the difficulty actually being played. Then, it finds the base id of the first monster of that group in monstats.txt (not sure if the index it searches is hard-coded, I did not move anything around). If the Level column (for normal difficulty) is lower than or equal to the read alvl + 1, it checks the NextInClass and walks up to the group until it finds a suitable monster. In case all levels are less than alvl+1, it will spawn the last monster in the chain. It will not keep track of the highest level monster in any way, so if set the alvl to 45 and your fallenshaman4 is 46, it will still spawn shaman8 even tho it's a lower level (40).

The problem I had was that when terrorizing Andariel, it always spawned fallenshaman8 in the room before here instead of the regular fallenshaman4's.

There are 3 ways to fix the behavior.
1) Make the monster it should spawn the last in the chain (ugly and has a lot of side-effects, but if you only run 1 zone, it's ok).
2) Set the level of the monster pointed at by NextInChain to alvl+2.
3) Don't touch the MonLvl1Ex and Level column.
[4) Change the MonPreset.txt function to the id of the monster you want to spawn, e.g. place_fallen -> fallen4. You can force every monster to spawn this way from the preset, but it's very ugly for obvious reasons. Don't do this.]

Hopefully, my findings will help.

Post Reply

Return to “General Mod Making”