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
Baronus
Assassin
Assassin
Posts: 288
Joined: 06 Jun 2015

Re: MMExtension v2.0 + MMEditor v2.0 Level Editor [Sep 21, 2015]

Postby Baronus » Mar 6 2016, 21:09

Script must be named like map with party? eg. out01.lua? Script dont tell where I'm only where to go?
Thanks. I suggest remove this post to new theme. Building new maps is completly breakthrough in MM world.

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

Re: MMExtension v2.0 + MMEditor v2.0 Level Editor [Sep 21, 2015]

Postby J. M. Sower » Mar 6 2016, 22:04

I tested it and to work it must look like below example. When you save it in out01.lua you can travel by north border of out01 to the south area of out02 in 5 days.

Code: Select all

function events.WalkToMap(t)
   if t.LeaveSide == "down" then
      t.EnterMap = "out02.odm"
      t.EnterSide = "up"
      t.Time = 5  -- days
   end
end


I remember that something was wrong with the entries of directions ( eg . "down" ) and except for travel by north there must by twice entered "down", so try this if something doesn't work:

Code: Select all

function events.WalkToMap(t)
   if t.LeaveSide == "down" then
      t.EnterMap = "out02.odm"
      t.EnterSide = "down"
      t.Time = 5  -- days
   end
end


Or maybe:

Code: Select all

function events.WalkToMap(t)
   if t.LeaveSide == "up" then
      t.EnterMap = "out02.odm"
      t.EnterSide = "up"
      t.Time = 5  -- days
   end
end


Sorry but now I don't have access to my computer and I don't remember too well. ;)

neutonm
Leprechaun
Leprechaun
Posts: 12
Joined: 02 Mar 2016

Re: MMExtension v2.0 + MMEditor v2.0 Level Editor [Sep 21, 2015]

Postby neutonm » Mar 6 2016, 22:59

Ok, i figured out the problem #3. It looks like the mapstats.txt can read fixed amount of elements. It loads 76 lines, no more and no less (including empty strings). Adding new lines is not a solution, instead you need to rewrite existing strings. Perhaps, hex editor could help that but i'm not strong at it. I've managed to change starting map only via hex editor. Would be great if someone can get size address.

About new lods, with grayface patch you have "00 patch.bitmaps.lod"/games/events etc. It's easier to use these archives rather than original as they are small.

Baronus wrote:Stables, shops, taverns, trainings etc. are in exe file codded. To add it you must rewrite it.
Yes I agree. Alternatives files system sprites.mod.lod icons.mod.lod are needed.
To add monsters you must write ddl odl etc. And link it to mapstats...
Water bug I think you must do the same ground level?
Good work. I wish you map will be begin new game based on MMVI-VIII!
This editor is a wonderful thing.


Thanks :). I'm not sure about water yet but it shouldn't depend on ground level.
Adding new monsters requires editing Data/Tables/MonList.txt and that's all. If you want custom monsters you need to include monster sprite into sprites.lod and probably include frames into Data/Tables/Sft.txt. Oh, and monster sprites require palette file as well, otherwise they won't load into lod. Here's an live example, i've added wolves from MM8 into MM7.

Image

J. M. Sower wrote:Ps. I asked the GrayFace about the script that allows you to change the walk destination by the border of the map.

Code: Select all

function events.WalkToMap(t)
   if t.LeaveSide == "down" then
      t.EnterMap = "YourMapHere.odm"
      t.EnterSide = "up"
      t.Time = 5  -- days
   end
end

)


Damn, there is no reference to WalkToMap event in grayfaces site and only one line in Core/events.lua.
Anyway, thanks for mentioning this. This explains some things in core lua scripts.

There is good "dump" function (Core/dump.lua). You can trace some functions and tables via debug window (ctrl+f1).

-------------

I got new questions. You can create new map via New button and it will be outdoor map. How do create new indoor map? It's a bit inconvenient but alternative solution is to load internal dungeon map and resave it under your name.

2) Portal problem. It seems i can't connect portals with other rooms. This way player can't see other room (but able to pass trough it). It's alright with internal maps. I've tried editing them and importing as a room and they work fine. But not custom made levels. Can't be sure but i think problem is in PortalList variable that *.blv file(indoor level) possess. In internal maps, two and more rooms with portals have same facet value in PortalList and this is probably why we can see through it. How do you change that? In mm7 editor you can't select portals and edit them.

In game:
Image

In 3d editor:
Image

3) When you edit chests, it says

Code: Select all

-- "{Number = -1}" or short form "-1" means level 1 item. Level 7 is artifact.
-- Properties: Number, Bonus, BonusStrength, Bonus2, Charges, MaxCharges
-- Bits: Identified, Broken, Hardened, Stolen


Ok, adding numbers is fine. But How do correctly set properties and bits for the item?


4) And finally, still having water, setsprite radius and other points mentioned in previous post.

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

Re: MMExtension v2.0 + MMEditor v2.0 Level Editor [Sep 21, 2015]

Postby J. M. Sower » Mar 6 2016, 23:35

Unfortunately, I have not worked with portals in dungeons yet.

Map soundtrack id is entered in column named "red book"(or something like that) in MapStats.txt. You must put the music file with the name such as that id number (eg. 12.mp3) in "Music" folder.

I also tried with the addition of new maps and other things but I found it was impossible. :wall:

You can change the datas saved in MapStats.txt by scripts like this:

Code: Select all

Game.MonstersTxt[1].Name = "Wolf"

See the "structs.MonstersTxtItem" fields at GrayFace site.
https://sites.google.com/site/sergroj/m ... ersTxtItem

User avatar
GrayFace
Round Table Hero
Round Table Hero
Posts: 1521
Joined: 29 Nov 2005

Re: MMExtension v2.0 + MMEditor v2.0 Level Editor [Sep 21, 2015]

Postby GrayFace » Mar 7 2016, 4:13

neutonm wrote:Editor and modding capabilities looks complete, however, the only flaw is documentation. Programmers tend to know every line in their code as well as whole architecture of the product, but not the users :). At least it takes some time to dig trough it. So far, i managed to "get it".

Yes, documentation is very needed, but it's not my thing, I don't have motivation to do it. There is one important bit missing in the Editor, I overlooked NPC ID variable of monsters, so special monsters would lose their NPC IDs after a map is edited with the editor. Last MMExt version has a huge bug (spells don't do any damage in MM7&8) witch I've fixed, but haven't uploaded the fixed version yet.

neutonm wrote:1) Water Bug? If i load test.odm map via "Open" button or via internal the water looks like it should. But if i start game and move into test map, the water looks "icy". Is it bug or there are some thing that need to be tweaked? The edges of the lake are animated, the rest are not

Send me the map to test. Must be me setting something wrong.

neutonm wrote:2) evt.SetSprite radius bug? Again, not sure if this is bug or my flaw. Once the command is executed, sprite is changed but the radius is extended. Trying to implement apple tree (one tree has id #52). Due to extended radius it's hard to drop apple without turning at least 90 degrees away. Before you click on apple tree - the radius thing works fine.

Interesting, I'll look into it.

neutonm wrote:3) Spawn monsters don't work on new map. I've added new line in MAPSTATS.TXT via "TxtEdit.exe" and placed m1 spawn entity and see no monsters (reuploaded into events.lod)

There's 76 maps limit in mapstats.txt, so you'll have to replace one of unused maps for now.

neutonm wrote:4) Is there a way to put fixed amount of gold into chests besides default item numbers(-1, etc)?

I think {gold_number, Bonus2 = 500} should do it, although I don't quite remember my format.

neutonm wrote:5) How about decal/monster/whatever getter function in lua? Like local m = GetMonster(ID). So you can edit it with m.Name = "Derp" etc. That apple sprite could be changed this way.

Map.Monsters[ID], Map.Sprites[ID], Map.Objects[ID]. You can try
Map.Sprites[52].DecName = "tree37"

neutonm wrote:6) New maps, sprites and thing might mess original lod files. IS there way to load alternatives? like "Mymod.Events.lod" - this way it would be easier to distribute mod rather than merge resources with original archives.

That's exactly how it is since patch v2.0. You can see editor.icons.lod and other such lods already. All such lods override original lods and are loaded in order of their names.

neutonm wrote:8) I couldn't find a music command. New map won't play music from mp3 folder. Where should i specify it?

In Mapstats.txt there is a column for that. I'm not sure you can add new music right now.
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.

User avatar
GrayFace
Round Table Hero
Round Table Hero
Posts: 1521
Joined: 29 Nov 2005

Re: MMExtension v2.0 + MMEditor v2.0 Level Editor [Sep 21, 2015]

Postby GrayFace » Mar 7 2016, 4:15

theorclair wrote:What folder would the nwc script go in? I got an error message when I put it in global, and in maps it doesn't have an effect.

In Maps. Are you sure it has no effect? Did you modify it to make it different than the original script from game?
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.

User avatar
GrayFace
Round Table Hero
Round Table Hero
Posts: 1521
Joined: 29 Nov 2005

Re: MMExtension v2.0 + MMEditor v2.0 Level Editor [Sep 21, 2015]

Postby GrayFace » Mar 7 2016, 4:44

neutonm wrote:Perhaps, hex editor could help that but i'm not strong at it. I've managed to change starting map only via hex editor. Would be great if someone can get size address.

Hex editor won't help. Try this for starting map (haven't tested):

Code: Select all

function events.NewGameMap()
   Map.Name = "out05.odm"
   XYZ(Party, 0, 0, 0)
   Party.Angle = 0
   Party.LookAngle = 0
end

[edit] No, here's how you do it:

Code: Select all

Game.NewGameMap = "out05.odm"

Only in MM6 you need to set player position in events.NewGameMap() event like I did (but ignore Map.Name = "out05.odm" line).

neutonm wrote:Adding new monsters requires editing Data/Tables/MonList.txt and that's all. If you want custom monsters you need to include monster sprite into sprites.lod and probably include frames into Data/Tables/Sft.txt. Oh, and monster sprites require palette file as well, otherwise they won't load into lod.

I made a program to add new monsters into sft.txt and monlist.txt back in the day for vladimir-maestro. Also don't forget about monsters.txt :)

neutonm wrote:I got new questions. You can create new map via New button and it will be outdoor map. How do create new indoor map? It's a bit inconvenient but alternative solution is to load internal dungeon map and resave it under your name.

Press "New" while you're in an indoor map.

neutonm wrote:2) Portal problem. It seems i can't connect portals with other rooms. This way player can't see other room (but able to pass trough it). It's alright with internal maps. I've tried editing them and importing as a room and they work fine. But not custom made levels. Can't be sure but i think problem is in PortalList variable that *.blv file(indoor level) possess. In internal maps, two and more rooms with portals have same facet value in PortalList and this is probably why we can see through it. How do you change that? In mm7 editor you can't select portals and edit them.

Did you find that PortalList thing in mm8leveleditor?
Make sure the vertices have exactly the same coordinates for both rooms and the portal and make sure the portal belongs to one of the rooms. The best way normally is not creating a portal at all, unless the map is based on internal one and thus has such portals. The editor can create portals for you, but having the same vertices in both rooms is essential.
Last edited by Anonymous on Mar 7 2016, 17:02, 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.

User avatar
GrayFace
Round Table Hero
Round Table Hero
Posts: 1521
Joined: 29 Nov 2005

Re: MMExtension v2.0 + MMEditor v2.0 Level Editor [Sep 21, 2015]

Postby GrayFace » Mar 7 2016, 4:51

Baronus wrote:Script must be named like map with party? eg. out01.lua? Script dont tell where I'm only where to go?

Yes, on the map special enter sprites are placed, 'Party Start', Party East, Party West etc.

Baronus wrote:I suggest remove this post to new theme. Building new maps is completly breakthrough in MM world.

Maybe, but so far MMEditor and MMExt questions are tied together.
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.

User avatar
GrayFace
Round Table Hero
Round Table Hero
Posts: 1521
Joined: 29 Nov 2005

Re: MMExtension v2.0 + MMEditor v2.0 Level Editor [Sep 21, 2015]

Postby GrayFace » Mar 7 2016, 5:02

J. M. Sower wrote:To find the right sequence you should use the trial and error method. ;) I managed to determine where the date is written in MM8. It is in line 00092340 and in positions B and C.

That's just one of the places. Here's how you'd convert a hex edit change into an MMExt script to be placed in Scripts/General:

Code: Select all

mem.IgnoreProtection(true)  -- at the start of the script, only needed if you change constant data
mem.i2[0x492340] = 1034  -- 'i2' means 'signed 2-byte integer'
mem.IgnoreProtection(false)  -- at script's end, only needed if you change constant data

Notice 0x400000 added to the address. Use mem.u1 to change a single byte.
I'll add the ability to change starting year.
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.

User avatar
GrayFace
Round Table Hero
Round Table Hero
Posts: 1521
Joined: 29 Nov 2005

Re: MMExtension v2.0 + MMEditor v2.0 Level Editor [Sep 21, 2015]

Postby GrayFace » Mar 7 2016, 5:06

J. M. Sower wrote:How to change the home position after the death of the team on current map?

Code: Select all

function events.DeathMap(t)
  t.Name = "out05.odm"
  XYZ(Party, 0, 0, 0)
  Party.Angle = 0
  Party.LookAngle = 0
end
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.

User avatar
GrayFace
Round Table Hero
Round Table Hero
Posts: 1521
Joined: 29 Nov 2005

Re: MMExtension v2.0 + MMEditor v2.0 Level Editor [Sep 21, 2015]

Postby GrayFace » Mar 7 2016, 5:12

BTW, note that I can render outdoor maps like these in Blender and raster editor:
ImageImage
These aren't final quality though. I'll share the process when it's needed. For now it involves Corel Photo-Paint, but I want to make it require just GIMP instead.
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.

User avatar
Baronus
Assassin
Assassin
Posts: 288
Joined: 06 Jun 2015

Re: MMExtension v2.0 + MMEditor v2.0 Level Editor [Sep 21, 2015]

Postby Baronus » Mar 7 2016, 9:51

There is no easy way ad new monster see:
http://www.celestialheavens.com/forum/10/15964
Other important question...
How to synchronize added in new map buildings with 3Devents table?
How to add shops stables and other special buildings?
You can add shop animation but no buy only sell.
How to programmed special building functions?
If we will know it we can build new game!
Ok we can write in this topic but if it will be 50 pages it will be hard find something.
Better thing is topic ,,Mapmaking". In this MMExt questions.

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

Re: MMExtension v2.0 + MMEditor v2.0 Level Editor [Sep 21, 2015]

Postby theorclair » Mar 7 2016, 16:16

GrayFace wrote:
theorclair wrote:What folder would the nwc script go in? I got an error message when I put it in global, and in maps it doesn't have an effect.

In Maps. Are you sure it has no effect? Did you modify it to make it different than the original script from game?


I get an error message:

..gram Files\Might and Magic VI\Scripts\Global\nwc.lua:22: attempt to index field 'map' (a nil value)

stack traceback:
(tail call): ?
...gram Files\Might and Magic VI\Scripts\Global\nwc.lua:22: in main chunk

local variables:
(*temporary) = nil
(*temporary) = (function: 0155E900)
(*temporary) = "attempt to index field 'map' (a nil value)"

I changed some of the item numbers to different ones. However, when I changed them back I still get this.

User avatar
GrayFace
Round Table Hero
Round Table Hero
Posts: 1521
Joined: 29 Nov 2005

Re: MMExtension v2.0 + MMEditor v2.0 Level Editor [Sep 21, 2015]

Postby GrayFace » Mar 7 2016, 16:59

theorclair wrote:I get an error message:

No you don't. In Maps.
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: 60
Joined: 18 Jun 2013

Re: MMExtension v2.0 + MMEditor v2.0 Level Editor [Sep 21, 2015]

Postby theorclair » Mar 7 2016, 17:04

I've done that, and there's no more error message, but when I try to change the items there's no effect.

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

Re: MMExtension v2.0 + MMEditor v2.0 Level Editor [Sep 21, 2015]

Postby J. M. Sower » Mar 7 2016, 17:07

Script for respawn should look like this example (Party.Direction instead Party.Angle):

Code: Select all

function events.DeathMap(t)
  t.Name = "out01.odm"
  XYZ(Party, 3850, 5620, 704)
  Party.Direction = 516
  Party.LookAngle = 0
end


Otherwise I checked and it is working correctly script for travel to south area of out02 (by the northern border of current map):

Code: Select all

function events.WalkToMap(t)
  if t.LeaveSide == "down" then
    t.EnterMap = "out02.odm"
    t.EnterSide = "down"
    t.Time = 5  -- days
  end
end


I typed it in the Scripts/General/moded.lua and the game crashes when I click on a new game. :disagree:

Code: Select all

mem.IgnoreProtection(true)
mem.i2[0x492340] = 1158
mem.IgnoreProtection(false)


I did the minimap in Photoshop using renders from Blender and I achieved such an effect:
Image

User avatar
Baronus
Assassin
Assassin
Posts: 288
Joined: 06 Jun 2015

Re: MMExtension v2.0 + MMEditor v2.0 Level Editor [Sep 21, 2015]

Postby Baronus » Mar 7 2016, 18:32

Good work! I see all new map! I wish you make new M&M game :-)
I think that it should be:

function events.WalkToMap(t)
if t.LeaveSide == "down" then
t.EnterMap = "out01.odm"
t.EnterSide = "up"
t.Time = 5 -- days
end
function events.WalkToMap(t)
if t.LeaveSide == "down" then
t.EnterMap = "out02.odm"
t.EnterSide = "up"
t.Time = 5 -- days
end
function events.WalkToMap(t)
if t.LeaveSide == "left" then
t.EnterMap = "out03.odm"
t.EnterSide = "right"
t.Time = 5 -- days
end
function events.WalkToMap(t)
if t.LeaveSide == "right" then
t.EnterMap = "out04.odm"
t.EnterSide = "left"
t.Time = 5 -- days
end
end

For 4 sides of world.
If you go down from map you go UP to new map! And reverse. If left you enter right side new map.

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

Re: MMExtension v2.0 + MMEditor v2.0 Level Editor [Sep 21, 2015]

Postby J. M. Sower » Mar 7 2016, 18:47

Baronus wrote:For 4 sides of world.
If you go down from map you go UP to new map! And reverse. If left you enter right side new map.

But it works well when you write like me. :tongue: I do not know why, but you must enter twice "down" to travel by north border to south area, and adequately to this you must write twice "up" to travel by south border to north area e.t.c. I tested it and it worked properly only then. :|

Ps. You can see more of my work on this Polish forum:
http://www.forum.acidcave.net/topic.php?TID=2969&page=1
Last edited by Anonymous on Mar 25 2016, 11:02, edited 1 time in total.

User avatar
Baronus
Assassin
Assassin
Posts: 288
Joined: 06 Jun 2015

Re: MMExtension v2.0 + MMEditor v2.0 Level Editor [Sep 21, 2015]

Postby Baronus » Mar 7 2016, 19:11

function events.WalkToMap(t)
if t.LeaveSide == "up" then
t.EnterMap = "out01.odm"
t.EnterSide = "up"
t.Time = 5 -- days
end
function events.WalkToMap(t)
if t.LeaveSide == "down" then
t.EnterMap = "out02.odm"
t.EnterSide = "down"
t.Time = 5 -- days
end
function events.WalkToMap(t)
if t.LeaveSide == "right" then
t.EnterMap = "out03.odm"
t.EnterSide = "right"
t.Time = 5 -- days
end
function events.WalkToMap(t)
if t.LeaveSide == "left" then
t.EnterMap = "out04.odm"
t.EnterSide = "left"
t.Time = 5 -- days
end
end

Edited.

In your buildings you have shops stables and people?

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

Re: MMExtension v2.0 + MMEditor v2.0 Level Editor [Sep 21, 2015]

Postby J. M. Sower » Mar 7 2016, 20:18

Yes, but I just replace the original map out 01 so I only use the buildings from the original map. Download the decompiled scripts from this page and open out01.txt. There is full list of events are responsible for visiting the buildings, or just showing their names (when you move the cursor on it). In MMEditor you must select some facets of building model (eg. the facets with textures of doors), click "Edit" button (or "E" key), change "Event" value from "0" to chosen, and click Ctrl+Enter to approve. Also, if you want the door to be fully functional you must change "TriggerByClick" equal to "true". Normal walls of buildings leave with "TriggerByClick = false". Just add them right event.

So it is not necessary, but you may add completly new events for buildings.

Code: Select all

evt.hint[250] = "Ewan's house" -- event 250 for walls of Ewan's house - only show text when cursor on it
evt.house[251] = 500 -- assigning event 251 to idhouse 500
Game.Houses[500].Name = "Ewan's house entrance" -- assigning text showed when cursor on doors

Also you can use that:

Code: Select all

evt.str[120] = "Ewan's house"
evt.hint[250] = evt.str[120] -- event 250 show text from str120 when cursor on it

From what I determined, it is not possible to add completly new stores/stables/taverns and other special buildings.

Ps. This is script to move NPC to chosen house

Code: Select all

evt.MoveNPC(43, 107)
Last edited by Anonymous on Mar 7 2016, 21:10, edited 1 time in total.


Return to “Might and Magic”

Who is online

Users browsing this forum: No registered users and 7 guests