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).

Moderator: Moderators

User avatar
theorclair
Peasant
Peasant
Posts: 60
Joined: 18 Jun 2013

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

Postby theorclair » Jan 2 2020, 1:52

Silly question, but how do you save whatever changes you make in mm8leveleditor?

And how do you get that menu to appear when running the MMeditor? I can't get it to come up.
Last edited by theorclair on Jan 5 2020, 17:39, edited 1 time in total.

User avatar
DaveHer
Conscript
Conscript
Posts: 243
Joined: 13 Mar 2019

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

Postby DaveHer » Jan 6 2020, 11:15

theorclair wrote:Silly question, but how do you save whatever changes you make in mm8leveleditor?

And how do you get that menu to appear when running the MMeditor? I can't get it to come up.

You have to be in window mode for the MMeditor to appear. The old GrayFace patch allowed you to edit in full screen mode but the new patch messed that up. So now you have to be in window mode.

User avatar
theorclair
Peasant
Peasant
Posts: 60
Joined: 18 Jun 2013

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

Postby theorclair » Jan 6 2020, 20:49

How do you save the changes to the chests in mm8leveleditor?

User avatar
DaveHer
Conscript
Conscript
Posts: 243
Joined: 13 Mar 2019

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

Postby DaveHer » Jan 7 2020, 4:46

theorclair wrote:How do you save the changes to the chests in mm8leveleditor?

I never use that leveleditor but it might be that the changes are done automatically, like MMAchive.
David

User avatar
tomchen1989
Peasant
Peasant
Posts: 98
Joined: 21 Jun 2008
Location: Europe / China

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

Postby tomchen1989 » Jan 7 2020, 10:47

I don't remember specifically. What I can recall is that it's pretty tricky to save changes using mm8leveleditor

cthscr
Peasant
Peasant
Posts: 59
Joined: 12 Jan 2020

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

Postby cthscr » Jan 21 2020, 6:21

Does MMExtexnsion Localize support translations similar to "%2$s %1$s" in gettext i.e. change the order of arguments?

User avatar
GrayFace
Dragon
Dragon
Posts: 1476
Joined: 29 Nov 2005

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

Postby GrayFace » Jan 31 2020, 12:09

theorclair wrote:With the MM8 editor, can you put random items from a specific group (like weapons) in a chest? What's the code for that? I only can find specific items and random items from a special item group.

There's no way. One option is to make a script that would modify chest items upon entering the map.

cthscr wrote:Does MMExtexnsion Localize support translations similar to "%2$s %1$s" in gettext i.e. change the order of arguments?

What do you mean? What are you localizing?

@all, thanks for bug reports.
Last edited by GrayFace on Jan 31 2020, 12:18, edited 1 time in total.
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.

cthscr
Peasant
Peasant
Posts: 59
Joined: 12 Jan 2020

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

Postby cthscr » Jan 31 2020, 12:49

GrayFace wrote:
cthscr wrote:Does MMExtexnsion Localize support translations similar to "%2$s %1$s" in gettext i.e. change the order of arguments?

What do you mean? What are you localizing?


In russian localization, for example, you often have to workaround adjectives (since in english there might be no difference between noun and adj). For example, "Human Knight" might become "Рыцарь (Человек)" (aka "Knight (Human)"). If we have "%s %s" translated string with separately translated "Human" and "Knight" (combined via string.format("%s %s", RaceName, ClassName)) we have to change the order or %s. In gettext it will be done with "%2$s (%1$s)" in msgstr.

PS. Could you please add an example of proper saving to and _restoring from_ vars.*? events.BeforeSaveGame() is easily understandable, but when to do restore?

User avatar
GrayFace
Dragon
Dragon
Posts: 1476
Joined: 29 Nov 2005

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

Postby GrayFace » Feb 1 2020, 11:08

cthscr wrote:
GrayFace wrote:
cthscr wrote:Does MMExtexnsion Localize support translations similar to "%2$s %1$s" in gettext i.e. change the order of arguments?

What do you mean? What are you localizing?


In russian localization, for example, you often have to workaround adjectives (since in english there might be no difference between noun and adj). For example, "Human Knight" might become "Рыцарь (Человек)" (aka "Knight (Human)"). If we have "%s %s" translated string with separately translated "Human" and "Knight" (combined via string.format("%s %s", RaceName, ClassName)) we have to change the order or %s. In gettext it will be done with "%2$s (%1$s)" in msgstr.

This is not related to MMExt, its localization just saves and loads strings. The answer is no, the game uses standard C sprintf function which doesn't support this AFAIK. Same with string.format of Lua. Buka versions of MM6 and MM7 patches contain mm*text.dll that does a pretty sophisticated job of making words have the right form, but it doesn't seem to support changing their order. It has no effect on Lua obviously. Patch loads it by default if it's present. I can add a way to call the format function of the game to have Buka logic applied.

cthscr wrote:PS. Could you please add an example of proper saving to and _restoring from_ vars.*? events.BeforeSaveGame() is easily understandable, but when to do restore?

Perhaps in BeforeLoadMap with a check that it hasn't been loaded already. What do you need to save and load?
Last edited by GrayFace on Feb 1 2020, 11:12, edited 1 time in total.
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.

cthscr
Peasant
Peasant
Posts: 59
Joined: 12 Jan 2020

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

Postby cthscr » Feb 1 2020, 11:31

GrayFace wrote:
cthscr wrote:PS. Could you please add an example of proper saving to and _restoring from_ vars.*? events.BeforeSaveGame() is easily understandable, but when to do restore?

Perhaps in BeforeLoadMap with a check that it hasn't been loaded already. What do you need to save and load?

Additional attributes for Party.PlayersArray[]. (More specifically - character races in Merge, but I'm not going to limit myself with that only.)

SparrowJacek
Leprechaun
Leprechaun
Posts: 3
Joined: 11 Mar 2017

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

Postby SparrowJacek » Feb 5 2020, 21:06

Hi!

I'm new to M&M modding and disassembling/lua, so keep that in mind if I ask some silly qestions :)

I would like to to remove limits for potions in M&M7 like Rodril did in 8. But that sounds like a tough thing to do, so I started from something easier.
1. I decided to remove limits for stat bonuses, so that anyone can decide number and value of breakpoints for certain bonuses.

Greyface wrote some time ago this:

Code: Select all

local vals = {
   500, 30,
   400, 25,
   350, 20,
   300, 19,
   275, 18,
   250, 17,
   225, 16,
   200, 15,
   175, 14,
   150, 13,
   125, 12,
   100, 11,
   75, 10,
   50, 9,
   40, 8,
   35, 7,
   30, 6,
   25, 5,
   21, 4,
   19, 3,
   17, 2,
   15, 1,
   13, 0,
   11, -1,
   9, -2,
   7, -3,
   5, -4,
   3, -5,
   0, -6
}

for i = 0, #vals - 2, 2 do
   mem.i2[0x4EDEA4 + i] = vals[i + 1]
   mem.i1[0x4EDEE0 + i/2] = vals[i + 2]
end


So I started from here. Found that this part is responsible for calculating which bonus should be used:

Image

And taking some code from "RemoveItemsLimits.lua" I created this code, which I put in /Structs folder:

Code: Select all

local function GenerateStatBonusTable()

   local StatBonusTable = io.open("Data/Tables/Stat bonus settings.txt", "w")

   StatBonusTable:write("Stat value\9Bonus\n")

   io.close(StatBonusTable)

end

local function ProcessStatBonusTable()

   local BonusValueOffset
   local BonusValuePointer
   local StatBonusTablePtr
   local StatBonusTable = io.open("Data/Tables/Stat bonus settings.txt", "r")
   if not StatBonusTable then
      GenerateStatBonusTable()
      StatBonusTable = io.open("Data/Tables/Stat bonus settings.txt", "r")
   end
   
   local Words, StatBonusData = {}, {}
   local LineIt = StatBonusTable:lines()

   LineIt() -- Skip header
   
   for line in LineIt do

      Words = string.split(line, "\9")
      table.insert(StatBonusData, {StatVal = tonumber(Words[1]), Bonus = tonumber(Words[2])})

   end
   
   StatBonusTablePtr = mem.StaticAlloc(table.maxn(StatBonusData)*3)

   for i = 1, table.maxn(StatBonusData) do

      mem.u2[StatBonusTablePtr + (i - 1) * 2] = StatBonusData[i].StatVal

   end
   
   BonusValueOffset = table.maxn(StatBonusData) * 2
   
   for i = 1, table.maxn(StatBonusData) do

      mem.u1[StatBonusTablePtr + (i - 1) + BonusValueOffset] = StatBonusData[i].Bonus

   end   
   
   BonusValuePointer = StatBonusTablePtr + BonusValueOffset
   
   mem.asmpatch(0x48EA34, "movsx eax, byte ptr [eax+" .. BonusValuePointer .. "]")
   
   mem.asmpatch(0x48EA22, "mov cx, [eax*2+" .. StatBonusTablePtr .. "]")
end
      
ProcessStatBonusTable()   


I found out, that when I put some values into newly created file "Stat bonus table.txt" everything works fine BUT for some reason bonus values are moved down by one value. For example with this table:

Stat value Bonus
25 100
20 90
15 70

I would get +90 dmg from 50 str and if I have less than 15str I just get 0 bonus. Could you please tell me where I made a mistake?

2. While reading my fair share of "RemoveItemsLimits.lua" (which can be found here https://www.dropbox.com/s/cot9oz2zhjqy1 ... s.lua?dl=0 ) I found some parts with syntax I just don't understand, can someone tell me please what this code is supposed to do?

Code: Select all

function structs.f.ArmorPicsCoords(define)
   define
   [0x4f5a98].array(1, 1).array(4).struct(structs.EquipCoordinates)  'Armors'
   [0x4f5a98].array(1, 1).array(4).struct(structs.EquipCoordinates)  'Helms'
   [0x4f5a98].array(1, 1).array(4).struct(structs.EquipCoordinates)  'Belts'
   [0x4f5a98].array(1, 1).array(4).struct(structs.EquipCoordinates)  'Boots'
   [0x4f5a98].array(1, 1).array(4).struct(structs.EquipCoordsCloak)  'Cloaks'
end


What is that "define" and what are these lines below it doing? Why the same hex value is used for all of them?

Thank you very much for any help :)

And great work GreyFace and creators of merge mod, I'm really imressed by your work and skills!
Last edited by SparrowJacek on Feb 6 2020, 10:52, edited 2 times in total.

User avatar
GrayFace
Dragon
Dragon
Posts: 1476
Joined: 29 Nov 2005

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

Postby GrayFace » Feb 9 2020, 14:11

It reads like this: at offset/address 0x4f5a98 a declaration EquipCoordinates Armors[1..1][4], where 1..1 means index starts at 1 and ends at 1. All of these define the structure structs.ArmorPicsCoords. It's then instantiated at address 0, so offsets in it become actual addresses.
Last edited by GrayFace on Feb 9 2020, 14:14, edited 4 times in total.
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.

Khorghakh
Leprechaun
Leprechaun
Posts: 7
Joined: 15 Feb 2020

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

Postby Khorghakh » Feb 15 2020, 12:52

Thanks for this great tool Greyface. I have a few things that I want to do, and I'm hoping if i'm set in the right direction i'll be able to figure things out myself, if not I will be back later to bother you people some more :)
In case this information is needed, I am using the mm 6 - 8 merge mod (great mod, cheers Rodril).
I want to make some convenience modification (some may consider cheaty, but meh, it's single player right, so the only person affected will be me).

Town Portal:
I was hoping to add some more cities to the list you can choose to portal to, maybe attach it to a well or better yet, the Tavern. So entering the tavern will be like clicking on the fountain, from then on when you cast town portal (after visiting the tavern) you will appear outside the tavern. How would I do this? I know I would need to add it to the TownPortalSwitch, but what else would I need to edit?

Llloyds Beacon:
Unlimited time, no more expiration timer for beacons set.

Shops:
Is there a way to be able to make them buy anything? Maybe it is in the 2devents or HouseRules but I cannot find anything.

Enchant:
Is there a way to remove the value check? You find things in the shops that are enchanted that you wouldn't be able to enchant because they are "not high enough value". Also is there a table of what enchants you can do? Is it basically the spcitems.txt in the englishtmod.lod? That would mean I can just extract, edit and put my edited version into the DataFiles folder in the main directory and thats that? the Lvl field would be how high the skill would need to be to get that enchantment?

Merchant Skill:
Is there a way to put a cap on the skill. I want a maximum amount you can get for selling an item (maybe 50%) and a mimimum (maybe 100%) for buying?
So no matter what the skill is at you will never be able to sell something for more than half its value or buy anything for less than its value.

Map Overland Travel Times:
I found some (I believe - but this seems to be for the mm6 and mm7 locations) in the outland travels.txt, but I can't find the others. Where are the parts that dictate where you go and how long it takes to travel to another location?

Arena:
Anyway of making the travel back from the arena take less than 4 days? I found something in MiscTweaks that indicated it was there, but it doesn't make sense to me.

Arcomage:
Also debating making the gold reward for winning a game repeatable, but also adding an "entry fee" that will equal the amount you will win (but maybe only after the first win) you would then gain double the reward (your own gold back plus the usual win). So the game will play as normal until yuo win. Each time after that you need to put up the amount of gold to play, that you would get when you win (so if the gold you got for winning was 500, you would need to put 500 into the kitty, but you would win 1000 - your 500 plus the 500 for winning).

Also the vals things:
the
local vals = {
500, 30,
400, 25,
350, 20,
300, 19,
275, 18,
thingy mabob you "Place it into Scripts\General folder and tweak the 'vals' table as you like." but what do you name it? does the name matter? is it a .lua or a .txt file?
The changes do not happen when I put .txt and when I put .lua i get an error message. Also can you add more values? like
450, 27,
etc.

Any help will be appreciated (preferably in simple lay man terms).
Last edited by Khorghakh on Feb 15 2020, 15:36, edited 4 times in total.

User avatar
tomchen1989
Peasant
Peasant
Posts: 98
Joined: 21 Jun 2008
Location: Europe / China

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

Postby tomchen1989 » Feb 18 2020, 21:47

I'm wondering if MMExtension could support IupLua.

For now I'm able to use Iup with FFI binding and Iup.dll for C. But it would be amazing if we can simply put iuplua51.dll and other dll in iup-3.28-Lua51_Win32_bin.zip here into ExeMods folder, and then require iuplua and other library in lua script and use them to make Windows UI in the game.

Khorghakh
Leprechaun
Leprechaun
Posts: 7
Joined: 15 Feb 2020

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

Postby Khorghakh » Feb 18 2020, 22:11

A request/suggestion. I notice that when you r-click on a skill it will show you "Bonus +3" at the end (after what each rank gives you etc), this represents the + from items. Would it be possible to add this to stats/armour class/hit points/damage etc? Maybe even "Item Bonus", "Spell Bonus".

User avatar
DaveHer
Conscript
Conscript
Posts: 243
Joined: 13 Mar 2019

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

Postby DaveHer » Feb 21 2020, 0:02

@GrayFace
I made three quests for MM7Rev4modR1 Redone. But instead of adding the quest topics to the NPCs, ( like in CCR ) They replace an important topic from each of the three NPCs. It seems that MM7 can only have two topics per NPC. I wonder if this can be corrected? I figured out the problem. Problem fixed. I am finished with the mod. I will be uploading the mod to the nexus soon.
David
Last edited by DaveHer on Feb 21 2020, 12:55, edited 1 time in total.

tnevolin
Leprechaun
Leprechaun
Posts: 3
Joined: 19 Oct 2015

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

Postby tnevolin » Feb 26 2020, 22:15

Thank you for great work, GrayFace! Makes modding much easier.
Is there an event to compute what bad things to do to monster? Something like DoBadThingToMonster?

nixosmm678
Leprechaun
Leprechaun
Posts: 5
Joined: 03 Mar 2020

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

Postby nixosmm678 » Mar 3 2020, 4:44

hi there, i am modding MM7 to my liking, i wonder if someone found and knows the values to modify the stat breakpoint in MM8 and MM6

https://drive.google.com/open?id=1n9uZX ... i2lIyo1Bvr

i modified this file, placed in scripts\general works on MM7

i would like to mod the stat point breaks in MM8 and MM6 if someone has the infos... plz post :)

cthscr
Peasant
Peasant
Posts: 59
Joined: 12 Jan 2020

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

Postby cthscr » Mar 3 2020, 11:22

GetStatisticEffect function is located at 0x48E18E in mm8.exe. It looks at 0x4FE0E8.

nixosmm678
Leprechaun
Leprechaun
Posts: 5
Joined: 03 Mar 2020

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

Postby nixosmm678 » Mar 5 2020, 4:19

cthscr wrote:GetStatisticEffect function is located at 0x48E18E in mm8.exe. It looks at 0x4FE0E8.


hi there, any chance you could mod my file, to make it work ? i tried to substitute the value you mentioned but i couldn't make it work...

https://drive.google.com/open?id=1n9uZX ... i2lIyo1Bvr

edit: i tried with

for i = 0, #vals - 2, 2 do
mem.i2[0x4FE0AC + i] = vals[i + 1]
mem.i1[0x4FE0E8 + i/2] = vals[i + 2]
end

but from 18 and more it doesn't work,,, works only in range 8-16

https://drive.google.com/open?id=17xP6h ... vp45jRKywi
Last edited by nixosmm678 on Mar 5 2020, 6:01, edited 2 times in total.


Return to “Might and Magic”

Who is online

Users browsing this forum: No registered users and 8 guests