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
GrayFace
Dragon
Dragon
Posts: 1456
Joined: 29 Nov 2005

Re: MMExtension v2.1 + MMEditor v2.1 Level Editor [Apr 22, 2016]

Postby GrayFace » Feb 20 2017, 10:06

What the script does is really cool! What arrays/structures do you want to make?
Now that MMExt uses LuaJIT (since version 2.0), ffi arrays/structures are also an option. My structures have some benefits like defining methods, help generation and writing actual offsets for fields, which also means not having to define "Unused"/"Padding" fields.
Last edited by GrayFace on Feb 20 2017, 10: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.

User avatar
J. M. Sower
Scout
Scout
Posts: 170
Joined: 25 Jan 2016

Re: MMExtension v2.1 + MMEditor v2.1 Level Editor [Apr 22, 2016]

Postby J. M. Sower » Feb 20 2017, 15:24

That is great! But one thing. How to define type of Spellbook shops (Elemental, Self, Dark, Light)? That must be writed in "House Movies.txt" for their animations?

Edit: Ok, I checked this and it is like I wrote.
Last edited by J. M. Sower on Feb 21 2017, 6:43, edited 5 times in total.

Rodril
Demon
Demon
Posts: 312
Joined: 18 Nov 2016

Re: MMExtension v2.1 + MMEditor v2.1 Level Editor [Apr 22, 2016]

Postby Rodril » Feb 21 2017, 9:46

J. M. Sower wrote:How to define type of Spellbook shops (Elemental, Self, Dark, Light)?
Edit: Ok, I checked this and it is like I wrote.

Yes, it is, type in "House movies.txt" define actual behavior of shop, for spellbook shops rules no need to define shop type.

GrayFace wrote:What arrays/structures do you want to make?

I want to add two structures with fields and arrays inside, first:
https://www.dropbox.com/s/o85ammi5fwr5i ... p.jpg?dl=0
It is not stored in savegame by default. All fields besides main root and shop's roots have positive numbers without floating point inside. All rules are words, they stored in memory one by one without gaps, example:
01 00 17 00 1b 00 19 00 14 00 - rules of "True kettle" weapon shop in Daggerwound Island.
01 00 - quality, rest are item-types. No empty bytes between first, second, third etc rules.
01 00 23 00 23 00 26 00 26 00 01 00 1f 00 1f 00 1f 00 22 00 - rules of armor shop in Daggerwound island.
01 00 - quality of items in upper shelf, then four words - item types, and same block for main shelf (body armor and shields).
Rest shops have just by one word - quality, same - without gaps, start addresses are in header of script.
Standart and special rules stored in diffrent blocks, but have same configuration - just diffrent pointers (all of them are in first lines of script).
Training - same - words without gaps - max level for training.
Transport - four words, each - index of transport location, without gaps.
Tavern - eleven words, twelvth word - empty.
Field "TextId" filled only if limtits removed, otherwise it must stay empty, i have another pointer for it, there are words without gaps, each word - index from NPCtext.txt .

Second:
https://www.dropbox.com/s/v3blznj3y31pb ... p.jpg?dl=0
This things stored in savegame by default.
Upper arrays must have structures inside, but i'm not ready to say how they should look like. We have three pointers - Stanadart assortment, Special assortment and Spellbooks assortment.
Standart and special blocks have same configuration:
Each item in shop is 9 dwords:
1. Item ID from ITEMS.txt
2. Enchantment
3. Power of enchantment
4. ?
5. ?
6. Is it identified
7. ?
8. ?
9. ?
Each shops, despite type, have space for 12 items in memory so we can count offsets for any shop and item in standart or special: (ShopWritePosition*12 + itemPosition)*9*4.
ShopWritePosition = ShopIndexByType + max indexes by type of shops below ("below" means they have lower type index: Weapon - 1, Armor - 2, Magic - 3, Alchemist -4).
Spellbook shop is a bit ecxeption: each shop have 12 blocks by 12 items inside, game generating assortments of all schools of magic for each type of spellbook shop, that why i'm writing it readme, that one rule for spellbook shop can be used at same time by shops of diffrent type. So if we want to find current assortment for guild:
((RuleIndex-1)*12 + MagicSkillType-12)*12 + itemPosition)*9*4.
Unlike other shops, spellbook shops does not have one empty block at start, so we subtracting 1.

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

Re: MMExtension v2.1 + MMEditor v2.1 Level Editor [Apr 22, 2016]

Postby GrayFace » Feb 21 2017, 13:13

So, if I understand correctly, something like this:

Code: Select all

local OldGame = structs.f.GameStructure
function structs.f.GameStructure(define)
   OldGame(define)
   define
   [ADDRESS].array(COUNT).struct(structs.WeaponShopRule)  'WeaponShopRules'
   [ADDRESS2].array(COUNT2).struct(structs.ArmorShopRule)  'ArmorShopRules'
   [ADDRESS3].array(COUNT3).struct(structs.ShopRule)  'ShopRules'
end

function structs.f.ShopRule(define)
   define
   .i2  'Quality'
end

function structs.f.WeaponShopRule(define)
   define
   .i2  'Quality'
   .array(4).i2  'ItemTypes'
end

function structs.f.ArmorShopRule(define)
   define
   .i2  'Quality'
   .array(9).i2  'ItemTypes'
end

The script then should go into Structs folder (don't append index at the start, that's for my MMExt scripts to make them run before the rest).
Shop items are already defined in Game structure, here's an excerpt:

Code: Select all

   [mmv(0x90EC2C, 0xAD45B4, 0xB7CA8C)].array(mmv(1, 0, 0), mmv(47, 52, 52)).array(12).struct(structs.Item)  'ShopItems'
   [mmv(0x9129DC, 0xAD9F24, 0xB823FC)].array(mmv(1, 0, 0), mmv(41, 52, 52)).array(12).struct(structs.Item)  'ShopSpecialItems'
   if mmver == 6 then
      define[0x91663C].array(119, 140).array(12).struct(structs.Item)  'GuildItems'
   elseif mmver == 7 then
      define[0xADF894].array(139, 170).array(12).struct(structs.Item)  'GuildItems'
   else
      define[0xB87D6C].array(139, 172).array(12).array(12).struct(structs.Item)  'GuildItems'
   end
Last edited by GrayFace on Feb 21 2017, 13:18, edited 2 times in total.
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.

Rodril
Demon
Demon
Posts: 312
Joined: 18 Nov 2016

Re: MMExtension v2.1 + MMEditor v2.1 Level Editor [Apr 22, 2016]

Postby Rodril » Feb 22 2017, 8:24

GrayFace wrote:So, if I understand correctly, something like this:

Thanks! Very good. I expanded it a bit and added to script, structures works now.
I missed existance of ShopItems, just correcting pointer and count then.
Here new link: https://www.dropbox.com/s/ukhr1q9f9ria8 ... s.zip?dl=0 .

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

Re: MMExtension v2.1 + MMEditor v2.1 Level Editor [Apr 22, 2016]

Postby theorclair » Mar 3 2017, 5:38

I've tried to change one of the wells in Mist so it can do an endurance increase, but it doesn't do anything. What is wrong about this? Edit: even the lua scripts provided in the recent zip download don't work as is. I get error messages. Either that or the script simply doesn't follow what it should (I took away the reputation decrease from the bones and the candleabra quests and both still do it.)

evt.hint[112] = evt.str[4] -- "Drink from Well."
evt.map[112] = function()

if not evt.Cmp("BaseEndurance", 30) then
if evt.Cmp("MapVar4", 1) then
evt.Subtract("MapVar4", 1)
evt.Add("BaseEndurance", 2)
evt.StatusText(11) -- "+2 Endurance permanent."
evt.Set("AutonotesBits", 12) -- "2 Points of permanent endurance from the fountain west of the Imp Slapper in Mist."
end
end
evt.StatusText(7) -- "Refreshing!"
end
Last edited by theorclair on Mar 3 2017, 17:18, edited 1 time in total.

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

Re: MMExtension v2.1 + MMEditor v2.1 Level Editor [Apr 22, 2016]

Postby theorclair » Mar 3 2017, 23:50

Okay, I got that I have to use the command to remove it from the game. What would you use for the quest scripts? Or for the cookpots/large bags/flour sacks?
Last edited by theorclair on Mar 3 2017, 23:56, edited 1 time in total.

lyeus
Leprechaun
Leprechaun
Posts: 1
Joined: 05 Mar 2017

Re: MMExtension v2.1 + MMEditor v2.1 Level Editor [Apr 22, 2016]

Postby lyeus » Mar 5 2017, 4:37

Hi everyone !

First of all, since I never had the opportunity, I'd like to thank you GreyFace for all the amazing work you've done for this amazing games that are the Might and Magic series ! I'm amazed at the fact that I'm not the only one still in love with that good old pixel soup game. (At least that's what the yougests says.)

I'm a newbie moder, I like to tweak things a bit so things feels fresh still in the games I love the most when I go back to them for the 64th time. But man, MM6 ain't no joke :canthear:

I've been trying all day to figure out where I could find the files to edit. (My dreams were crushed when I realised .Lod files were only boxes to plenty other unreadable files. :wall: ). I kept on searching though, but I can't figure out the structure of if all, so I don't even know what file I have to find out how to open and edit. Still not sure how MMExtension is supposed to work, but hey, now I know how to make my own map ! :oex: (At least I was able to do the first step.)

Short and simple, for now I'm looking for a way to edit the mace skill, I'd like the master level to be somewhat usefull as I've been testing, the stun effect doesn't work.(Maybe staff too, but I mean, one at a time.) Say, chance to paralyze or slow, if that works ? Or simply Adding twice the level to damage ? (One for expert, two for master.) Doesn't really matter, I just want more weapon diversity on a might focused team.

I was hoping this could be a first step into modding more complexe stuff, but I got drowned by the complexity. I think I should be looking into Constants, right ? But I don't even know what and were it is. No lod file, no folder (That would be too easy right), no txt file on those you shared...

I think I could use a hand :)

Rodril
Demon
Demon
Posts: 312
Joined: 18 Nov 2016

Re: MMExtension v2.1 + MMEditor v2.1 Level Editor [Apr 22, 2016]

Postby Rodril » Mar 10 2017, 19:04

HouseRules script for mm7 and a lot of fixes in mm8 version:
https://www.dropbox.com/s/ukhr1q9f9ria8 ... s.zip?dl=0

What would you use for the quest scripts? Or for the cookpots/large bags/flour sacks?

You can download quest examples from MMExt site:
https://dl.dropboxusercontent.com/u/447 ... Quests.rar
Also there is sheet of available commands and few other examples. What exactly do you want to do with large bags? Simple chests can be set through map editor and event replacement (check decompiled original scripts).

edit the mace skill

I don't think skills are editable right now.
Last edited by Rodril on Mar 10 2017, 19:36, edited 1 time in total.

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

Re: MMExtension v2.1 + MMEditor v2.1 Level Editor [Apr 22, 2016]

Postby theorclair » Mar 10 2017, 20:47

I just got this image as an error. The game then crashed.

Image

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

Re: MMExtension v2.1 + MMEditor v2.1 Level Editor [Apr 22, 2016]

Postby GrayFace » Mar 11 2017, 13:03

Your screenshot is corrupt (downscaled).
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.

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

Re: MMExtension v2.1 + MMEditor v2.1 Level Editor [Apr 22, 2016]

Postby theorclair » Mar 11 2017, 17:01

Image

tomchen1989
Peasant
Peasant
Posts: 62
Joined: 21 Jun 2008
Location: Shanghai

Re: MMExtension v2.1 + MMEditor v2.1 Level Editor [Apr 22, 2016]

Postby tomchen1989 » Mar 11 2017, 20:30

Hi I've just tested MMExtension, I use MM6 orginal English version's CD copy + GrayFace 2.0 + MMExtension v2.1, without any modification, and I've got almost exactly the same error as theorclair posted here, when my character gets some type of hit by monster

Code: Select all

C:\Users\Chen\game\mm6en/Scripts/Core/events.lua:653: array index (-10399.047445255) out of bounds [0, 136]

stack traceback:
   [C]: in function 'error'
   Scripts/Core/RSMem.lua:1336: in function '__index'
   C:\Users\Chen\game\mm6en/Scripts/Core/events.lua:653: in function 'GetMonster'
   C:\Users\Chen\game\mm6en/Scripts/Core/events.lua:755: in function 'f'
   Scripts/Core/RSMem.lua:1998: in function <Scripts/Core/RSMem.lua:1996>
   [C]: in function 'pcall'
   Scripts/Core/Common.lua:103: in function 'pcall2'
   Scripts/Core/RSMem.lua:1641: in function <Scripts/Core/RSMem.lua:1639>

arguments of 'GetMonster':
   p = 2

local variables of 'GetMonster':
   i = -10399.047445255
   (*temporary) = -10399.047445255
   (*temporary) = (table: 0x02beaa28)
   (*temporary) = 7.0242795882278e-295
----------------------------------------------------------------------------------

Code: Select all

C:\Users\Chen\game\mm6en/Scripts/Core/events.lua:653: array index (-10345.691605839) out of bounds [0, 394]

stack traceback:
   [C]: in function 'error'
   Scripts/Core/RSMem.lua:1336: in function '__index'
   C:\Users\Chen\game\mm6en/Scripts/Core/events.lua:653: in function 'GetMonster'
   C:\Users\Chen\game\mm6en/Scripts/Core/events.lua:755: in function 'f'
   Scripts/Core/RSMem.lua:1998: in function <Scripts/Core/RSMem.lua:1996>
   [C]: in function 'pcall'
   Scripts/Core/Common.lua:103: in function 'pcall2'
   Scripts/Core/RSMem.lua:1641: in function <Scripts/Core/RSMem.lua:1639>

arguments of 'GetMonster':
   p = 29241

local variables of 'GetMonster':
   i = -10345.691605839
   (*temporary) = -10345.691605839
   (*temporary) = (table: 0x02d59928)
   (*temporary) = 6.4670520448223e-304
----------------------------------------------------------------------------------

When I remove all the files from MMExtension, the error disappear.
Ask me for a save file if you need to but can't reproduce the error.
Last edited by tomchen1989 on Mar 11 2017, 20:34, edited 2 times in total.

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

Re: MMExtension v2.1 + MMEditor v2.1 Level Editor [Apr 22, 2016]

Postby GrayFace » Mar 15 2017, 6:12

Yes, it's a bug of released version.
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.

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

Re: MMExtension v2.1 + MMEditor v2.1 Level Editor [Apr 22, 2016]

Postby theorclair » Mar 15 2017, 22:39

How do you edit a level? I tried the commands in game but it didn't work.

edit: Does editing the level just change it for that one game or universally? And how do you change the text for a well?
Last edited by theorclair on Mar 15 2017, 23:03, edited 1 time in total.

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

Re: MMExtension v2.1 + MMEditor v2.1 Level Editor [Apr 22, 2016]

Postby theorclair » Mar 16 2017, 22:53

Yet another question - how would you change the spell the desk in the NWC dungeon casts? I tried this but it doesn't cast anything.

Game.MapEvtLines:RemoveEvent(73)
evt.hint[73] = evt.str[12] -- "Desk"
evt.map[73] = function()
evt.CastSpell{Spell = 85, Mastery = const.Master, Skill = 64, FromX = 0, FromY = 0, FromZ = 0, ToX = 0, ToY = 0, ToZ = 0} -- "Day of the Gods"
end

User avatar
Phobos
Demon
Demon
Posts: 306
Joined: 17 Jan 2006
Location: Finland

Re: MMExtension v2.1 + MMEditor v2.1 Level Editor [Apr 22, 2016]

Postby Phobos » Mar 17 2017, 7:27

The download link for MMExtension on GrayFace's site seems to be down. Could it be reuploaded? :)

User avatar
J. M. Sower
Scout
Scout
Posts: 170
Joined: 25 Jan 2016

Re: MMExtension v2.1 + MMEditor v2.1 Level Editor [Apr 22, 2016]

Postby J. M. Sower » Mar 17 2017, 23:29

theorclair wrote:Yet another question - how would you change the spell the desk in the NWC dungeon casts? I tried this but it doesn't cast anything.

Game.MapEvtLines:RemoveEvent(73)
evt.hint[73] = evt.str[12] -- "Desk"
evt.map[73] = function()
evt.CastSpell{Spell = 85, Mastery = const.Master, Skill = 64, FromX = 0, FromY = 0, FromZ = 0, ToX = 0, ToY = 0, ToZ = 0} -- "Day of the Gods"
end

I had the same problem. I noticed that in last version is a new way to write script for CastSpell. Look for the last decompiled scipts sent by GrayFace.

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

Re: MMExtension v2.1 + MMEditor v2.1 Level Editor [Apr 22, 2016]

Postby theorclair » Mar 18 2017, 0:07

That is from the most recent scripts.

Do you know how to get the editor to work?

I can see the text for the fountain in MMarchive, but can't do anything to it.

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

Re: MMExtension v2.1 + MMEditor v2.1 Level Editor [Apr 22, 2016]

Postby theorclair » Mar 19 2017, 22:26

I can't download any of the files on the MMExtension site anymore. I get a 404.


Return to “Might and Magic”

Who is online

Users browsing this forum: No registered users and 7 guests