MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

The role-playing games (I-X) that started it all and the various spin-offs (including Dark Messiah).
Mareneusz002
Leprechaun
Leprechaun
Posts: 36
Joined: 29 Mar 2019

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Unread postby Mareneusz002 » 08 Sep 2022, 01:34

Eksekk wrote: 06 Sep 2022, 11:41 Dumb question, did you save the file after pasting it? Also did you make any other modifications to game files? I used vanilla MM7 with Grayface patch and MMExtension when making this script, nothing else.

How do you determine you've got old critical hit? Remember, only basic dagger damage is multiplied (only "2d2 + 4" stuff, so for example from 7 you get 21), not enchantments or GM bonuses. Second, mobs have physical resistance, which can greatly reduce the damage and make new crit look like old. Make sure you're testing it on mobs without it (I found adventurers on emerald island are a good target, just do "for k, v in Map.Monsters do v.HP = 20000 end" (ctrl + f1, paste, ctrl + enter to execute) so mobs have a ton of hp and don't die immediately). When I did that, every time critical hit message popped up the damage was visibly increased. I didn't notice any old critical hits.

Oh, and to make yourself not die and be able to test easily execute "for _, pl in Party do pl.Skills[const.Skills.Dagger] = JoinSkill(60, const.GM); pl.HP = 20000 end; for i = 1, 20 do evt.GiveItem{Type = const.ItemType.Dagger} end", that will give you daggers, 60GM dagger skill and a ton of HP.


Yeah i saved it and im also using vanilla MM7 with Grayface patch and MMExtension. But you are right, at first i was testing it on Dragons, and now tested on emerald island and yea, most criticals now are great! +125 dmg. :D
but from time to time, but quite rare, theres 1 crit for normal damage. like most of crits are around 170 dmg, so sometimes theres 1 crit for my normal dmg = ~40 dmg
maybe its just some bug, but it doesnt matter :) now its really great! Thank you!!


The only thing i dont like is the strong mobs physical resistance. because on low/normal mobs the critical hit works great, i can see the damage boost.
But on stronger mobs i cant see it really so much (because like you said "mobs have physical resistance, which can greatly reduce the damage and make new crit look like old")
but it looks really crazy. sometimes i can see critical hit for 190, and sometimes for 11 dmg or even 2 dmg Xd

So my probably last question about daggers is:
is it possible to make the +50 / +125 damage to be always done? maybe is it possible to somehow change it to not-physical or something other, like some Pure damage?
i mean, whenever i will make the crit, so there will be always bonus 50 dmg on Master and 125 bonus on GM.
even if i do 1 dmg(because of physical reduction) and theres critical hit so it will be 1+125 = 126

i was thinking maybe it could be changed from physical damage to some magic damage, but im not sure magic damage works right.
because i was testing some script from Grayface site:

Spells Damage
Change damage of spell 2 – Flame Arrow. You can also make damage depend on t.Mastery (skill mastery) and t.HP (monster hit points).
"local function Randoms(min, max, count)
local r = 0
for i = 1, count do
r = r + math.random(min, max)
end
return r
end

function events.CalcSpellDamage(t)
if t.Spell == 2 then -- Flame Arrow
t.Result = 100 + Randoms(1, 100, t.Skill) -- 100 + (1-100) per skill level
end
end"



i tested it on some weak mobs, which have some small fire magic reduction like 5-10% like Troglodyte or Swordsman or Raider

the script says that flame arrow will now hit always 100 dmg + some random dmg based on skill level right?
so with skill level 1 of fire magic hits should be around 100-200

and they are, but sometimes i can see hits like 26 dmg, 54 dmg







Also, i will maybe try to change Thief a bit in future and was trying to put the Thief script from Grayface site:

"function events.CalcStatBonusBySkills(t)
if t.Result ~= 0 and t.Stat == const.Stats.MeleeDamageBase then -- t.Result ~= 0 is for speedup
local sk, mas = SplitSkill(t.Player.Skills[const.Skills.Dagger])
if mas >= const.GM then
local it = t.Player:GetActiveItem(const.ItemSlot.MainHand)
if it and it:T().Skill == const.Skills.Dagger then
t.Result = t.Result + sk
end
end
end
end"


but like you said before, it wasnt working because of something
is there way to make it work?
i was trying to copy it to yours Buffdaggers.lua, but sadly didnt work


thanks!!

Eksekk
Assassin
Assassin
Posts: 259
Joined: 19 Jul 2016

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Unread postby Eksekk » 08 Sep 2022, 17:17

Yes, all things are possible. No need to change damage element, the damage increase should happen after resistance reductions. Flame arrow will do 100-200 base damage, but as always resistances can kill the numbers. In addition, it's not constant reduction, so sometimes you may get full damage, and sometimes 8 damage out of 100-200. And second script is trivial to fix, I just need to know if you want it to add damage ONLY if dagger is in mainhand (current behavior, if it did work) or if it is either main hand or offhand.

I will do these changes soon.
Unfinished mod by me: MM7 Rev4 mod, MMMerge version.

Mareneusz002
Leprechaun
Leprechaun
Posts: 36
Joined: 29 Mar 2019

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Unread postby Mareneusz002 » 09 Sep 2022, 21:35

that would be great!

i think the second option = " if it is either main hand or offhand"

thanks!!

Eksekk
Assassin
Assassin
Posts: 259
Joined: 19 Jul 2016

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Unread postby Eksekk » 12 Sep 2022, 19:15

Script was updated, redownload it. There are three configuration lines:

Code: Select all

local critsIgnoreResistances = true
local enableDoubleDamage = true
local enableCrits = true
I think the names are self-explanatory. By default they're all enabled, to disable a feature replace corresponding "true" with "false". I've also (finally) made rank descriptions reflect the changes.
Unfinished mod by me: MM7 Rev4 mod, MMMerge version.

rotalihinna
Leprechaun
Leprechaun
Posts: 36
Joined: 18 Dec 2018

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Unread postby rotalihinna » 13 Sep 2022, 13:30

Hey all, here's a few things I'd like to be able to do in MMExtension for MM6 (and MM7). I definitely don't need anybody to do it for me, just need to know if it's possible before I jump into it (and maybe a link to a script if any of those have been done before).

1. Display true damage of bows and melee weapons (including the bonus damage, maybe like "Roderick does 25 + 12 damage to monster". Currently it's just the physical damage)
2. Display true damage of double arrows (on Master level you shoot two arrows but the damage only displays one of them)
3. Display recovery time for spells.
4. Have Speed and other factors impact recovery time for spells.
5. This might be impossible to do, but I'd also like to display _total_ damage for area effect things, so if I shoot a fireball and it damages 4 monsters I'd love to be able to see total damage as opposed to just one.
6. I'd also love to see types of damage, resisted (dice drop) times, etc.

Thanks for help on any of those!

Tomsod
Demon
Demon
Posts: 344
Joined: 31 Jul 2020

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Unread postby Tomsod » 13 Sep 2022, 14:44

I'm pretty sure the statusline already displays the combined damage for weapons that have bonus elemental damage, at least it does so in MM7. As for the total damage for double arrows and multi-target spells, you'll probably need assembly hooks. I have done that in my MM7 mod, but it's written in C without using MMExt, so if you want to port it to Lua you'd have to do a bit of work. And if you want that in MM6 you'll have to study the game's disassembly yourself, as the addresses are all different. I've also successfully added an artifact that reduces spell recovery, although it's a flat 25% decrease independent of Speed. Still, you could modify that hook to get the result you want.

rotalihinna
Leprechaun
Leprechaun
Posts: 36
Joined: 18 Dec 2018

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Unread postby rotalihinna » 13 Sep 2022, 14:54

Got it, so these are impossible to do with MMExtension and I'd need to go way deeper. Thank you!

(BTW MM6 doesn't add bonus damage, but I think you're right and MM7 does)

Mareneusz002
Leprechaun
Leprechaun
Posts: 36
Joined: 29 Mar 2019

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Unread postby Mareneusz002 » 14 Sep 2022, 03:33

Eksekk wrote: 12 Sep 2022, 19:15 Script was updated, redownload it. There are three configuration lines:

Code: Select all

local critsIgnoreResistances = true
local enableDoubleDamage = true
local enableCrits = true
I think the names are self-explanatory. By default they're all enabled, to disable a feature replace corresponding "true" with "false". I've also (finally) made rank descriptions reflect the changes.

Thanks!!

everything works really awesome now!
and the rank descriptions are also great and helpful!!
thank you again for your help!!!

i really wanted to change Thief profession to be stronger because in my opinion Knight is really too strong. probably best melee dps + tank at once...
so from now i will make the Thief to be best melee dps but weak in defence :D



i have probably last question if possible please:

is it possible to make script that ban some spells for some profession?


for example i would like to make Cleric being able to use ONLY 1 or 2 spells from Light magic, for example "Hour of Power" or "Divine Intervention", but he wouldnt be able to learn other spells from this magic
so he would have banned all spells from Light magic except for example "Hour of Power" and "Divine Intervention"

so Cleric would have Body,Mind,Spirit magic and 2 spells from Light magic


for example Druid would be able to Learn only "Fire ball" spell from Fire magic, but Mage not. Mage would be able to Learn all spells from Fire magic except "Fire ball" or "Torch" spell

these are just examples


would it be possible to make that script which would be customisable?
i mean, that i could make professions to being able to learn only some spells from some magic by changing the script, like coping there the name of spell or something

im sure you have better things to do, so if this script is hard or much time consuming so we can forget about it ^^
im really thankful because now Thief will be another profession i will enjoy to play with!

thanks!!

Eksekk
Assassin
Assassin
Posts: 259
Joined: 19 Jul 2016

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Unread postby Eksekk » 14 Sep 2022, 22:06

I've done it. Can you script requirements on your own? If not, I'll do it, you just have to write exact requirements. The file provides event CanPlayerLearnSpell(t) with fields t.Player, t.Spell (use spell names from here) and t.CanLearn. The last one contains result of default game logic. If you set t.CanLearn to true the player can always learn the spell (unless he already knows it), and if it's false he can never learn.
Unfinished mod by me: MM7 Rev4 mod, MMMerge version.

Mareneusz002
Leprechaun
Leprechaun
Posts: 36
Joined: 29 Mar 2019

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Unread postby Mareneusz002 » 15 Sep 2022, 07:09

Eksekk wrote: 14 Sep 2022, 22:06 I've done it. Can you script requirements on your own? If not, I'll do it, you just have to write exact requirements. The file provides event CanPlayerLearnSpell(t) with fields t.Player, t.Spell (use spell names from here) and t.CanLearn. The last one contains result of default game logic. If you set t.CanLearn to true the player can always learn the spell (unless he already knows it), and if it's false he can never learn.

hmm i dont really know what should i change in this script xd

im not really good in modding ;l

and theres also something with "player" t.player. does it mean player 1,2,3,4 (characters) or profesions? there are 9 profesions

maybe could you make some short script for example for Druid?

Druid that can learn only 2 spells from Fire magic. lets say Fire ball and Haste
other spells from Fire magic he wouldnt be able to learn
but other magics stay the same like it was. so he would still be able to use Water, Air, etc magic


so maybe from that script i could just change profesion and copy spell names from the site to be banned


my goal is to make Cleric to have some spells banned from Light magic and some other profession will be able to learn some of these spells.
for example i will change Druid in "Class skills.txt" that he can use Light magic. and he will be able to learn some spells which Cleric cant


Eksekk wrote: 14 Sep 2022, 22:06 Can you script requirements on your own? If not, I'll do it, you just have to write exact requirements.

not really
i can just read and maybe change some things in script
but making script from 0, not really ;l its dark magic for me xd


do you mean requirements to use spell?

like for example Druid to be able to use Divine intervention spell?
i dont need to add any requirements i think
i will just change the "Class skills.txt" and give him Light magic
i want to give him GM Light magic, and he would be able to learn only 2-3 spells from Light magic, for example Divine intervention, Hour of power and Sunray. and other spells from Light magic he wouldnt be able to learn


thanks!!

Eksekk
Assassin
Assassin
Posts: 259
Joined: 19 Jul 2016

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Unread postby Eksekk » 15 Sep 2022, 10:25

I don't think just copying will be enough. Give me exact requirements and I will do the script.
Unfinished mod by me: MM7 Rev4 mod, MMMerge version.

Mareneusz002
Leprechaun
Leprechaun
Posts: 36
Joined: 29 Mar 2019

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Unread postby Mareneusz002 » 18 Sep 2022, 22:47

Eksekk wrote: 15 Sep 2022, 10:25 I don't think just copying will be enough. Give me exact requirements and I will do the script.

umm i dont exactly understand what means "requirements"

do you mean some requirements to use the spell? like Master , Grandmaster?

but anyway if its not easy to Customise the script (if coping name of the spell is not enough) so probably it might be not worth to even make it,
because i was thinking to make all profesions to being able to learn some spells/have banned some spells (and maybe change them from time to time)

but i will be also very happy only with 1 script if you can help please:

Cleric being able to learn all spells from Light magic except Divine intervention, Hour of power, Day of protection
and Mage being able to learn Only Divine intervention, Hour of power, Day of protection from Light magic


thank you for all help from your side!!

Eksekk
Assassin
Assassin
Posts: 259
Joined: 19 Jul 2016

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Unread postby Eksekk » 19 Sep 2022, 21:39

I meant requirements for learning specific spells. I made a script which implements last two points, download here (put it into Scripts/Global). Note: previous script still needs to be in Scripts/General.

Yeah, if you want to change the requirements occasionally it'd be best to learn at least basic scripting.
Unfinished mod by me: MM7 Rev4 mod, MMMerge version.

User avatar
raekuul
Marksman
Marksman
Posts: 424
Joined: 05 Jul 2019

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Unread postby raekuul » 21 Sep 2022, 15:41

One thing that we want to add to Skill Emphasis (and by extension my lua-based Monster Randomizer) is adaptive monster stats; we're doing this on-the-fly by iterating across every monster on the map.

We have HP/AC/Damage/Level working, and presumably treasure is working as well (I need to sit down and audit this), but the EXP awarded per monster seems to still be based on the generic form from Game.MonstersTxt instead of the active version on Map.Monsters (read: a level 20 Goblin King still awards experience like it was level 10); is this something we'll need an ASM hijack for, or am I just misunderstanding how Map.Monsters is organised (again)?

Eksekk
Assassin
Assassin
Posts: 259
Joined: 19 Jul 2016

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Unread postby Eksekk » 21 Sep 2022, 15:59

Experience isn't based on level (meaning: it doesn't scale with it by default), it needs to be set explicitly. Also I just checked: hovering mouse over peasant in MM6 and executing

Code: Select all

Map.Monsters[Mouse:GetTarget().Index].Experience
returned 24, and executing

Code: Select all

Map.Monsters[Mouse:GetTarget().Index].Experience = 50000
worked correctly (when killed, monster gave 50000 exp split between party members). You can check the amount of experience monster has after modification by your script the same way.
Unfinished mod by me: MM7 Rev4 mod, MMMerge version.

User avatar
raekuul
Marksman
Marksman
Posts: 424
Joined: 05 Jul 2019

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Unread postby raekuul » 21 Sep 2022, 17:34

Well yeah I'm doing that; the full function is

Code: Select all

function applyAdaptiveMonsterOverrides(monsterID, monsterArray, adaptive_level)

	genericForm = Game.MonstersTxt[monsterArray["Id"]]

	oldLevel = math.max(genericForm["Level"],1)
	offset = calculateTierLevelOffset(genericForm)
	newLevel = math.max(1, adaptive_level + offset)
	monsterArray["Level"] = newLevel
	
	levelMultiplier = (newLevel) / (oldLevel)
	
	local damageMultiplier, rankMultiplier = calculateMonsterDamageMultipliers(monsterArray, easy_flag)
	applyMonsterDamageMultipliers(monsterArray, damageMultiplier, rankMultiplier, easy_flag)

	monsterArray["FullHP"] = genericForm["FullHP"] * levelMultiplier

	monsterArray["HP"] = monsterArray["FullHP"]

	monsterArray["ArmorClass"] = genericForm["ArmorClass"] * levelMultiplier

	monsterArray["Experience"] = genericForm["Experience"] * levelMultiplier
	monsterArray["TreasureDiceCount"] = genericForm["TreasureDiceCount"] * levelMultiplier
	
	if (adaptive_level > genericForm["Level"])
	then
		for k,_ in pairs(resistanceTypes)
		do
			if not (k == "Energy")
			then
				key = k .. "Resistance"
				value = monsterArray[key]
				value = value * (adaptive_level + 100)/(genericForm["Level"] + 100) + (adaptive_level - genericForm["Level"])/2
				monsterArray[key] = value
			end
		end
	end

	for k,v in pairs(monsterArray) do
		if not (type(monsterArray[k]) == table)
		then
			Map.Monsters[monsterID][k] = v
		else
			Map.Monsters[monsterID][k] = traverseTable(v)
		end
	end
end
and this is fired for index=0, Map.Monsters.high during events.LoadMap() so it should be adjusting the experience values based on the ratio of new to old level (that is to say, a Level 20 Goblin King should yield twice as much EXP as a level 10 Goblin King). When I check it in the debug window it shows Map.Monsters[index].Experience as having the expected amount, but when I actually kill said monster it awards what's in Game.MonstersTxt[Map.Monsters[index].Id] instead.

Tomsod
Demon
Demon
Posts: 344
Joined: 31 Jul 2020

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Unread postby Tomsod » 21 Sep 2022, 20:05

I'm not sure about MM6 specifically, but the MM7 code indeed only checks MapMonster.Experience for not being zero, and the actually awarded amount is taken from MonstersTxt. Which game are you talking about again?

User avatar
raekuul
Marksman
Marksman
Posts: 424
Joined: 05 Jul 2019

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Unread postby raekuul » 22 Sep 2022, 01:26

Might and Magic 6 (though now that I know 7 does that I'll have to put together a solution for the eventual MM7 version of Monster Randomizer Lua)

Tomsod
Demon
Demon
Posts: 344
Joined: 31 Jul 2020

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Unread postby Tomsod » 22 Sep 2022, 02:55

Okay. That's interesting, because Eksekk somehow got it to work in MM6, BUT I've just re-checked his example code, and neither a peasant nor a random goblin gave me those 50000 exp. My MM6 install has the patch v2.5.5 and MMExt v2.2, it's possible GrayFace has done something to this lately, or Eksekk has other mods? Try also updating everything, maybe it's former.

As for the MM7 code, I can directly point you to the "party gets exp for murder" function at 0x42694b. It's called from four different places, and you'll need to patch the code directly preceding these calls (it's rather uniform) if you're to fix this.
EDIT: or just use the fact that the monster pointer is in esi for all four calls and patch the function itself.

Eksekk
Assassin
Assassin
Posts: 259
Joined: 19 Jul 2016

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Unread postby Eksekk » 22 Sep 2022, 13:06

Oh fuck I'm sorry, I forgot that this was game-in-progress and my party already has ALMOST EXACTLY 12500 experience. I will try to issue asm patch for this instead.
Unfinished mod by me: MM7 Rev4 mod, MMMerge version.


Return to “Might and Magic”

Who is online

Users browsing this forum: No registered users and 16 guests