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
BTB
Peasant
Peasant
Posts: 93
Joined: 21 Aug 2011
Location: Houston, TX
Contact:

Postby BTB » May 15 2015, 20:38

GrayFace wrote:
BTB wrote:• Making chests simply locked instead of trapped. This one I imagine may not actually be doable, but I figured I'd ask anyway.


BTW, this one is doable with scripts already. But to do it like that all "OpenChest" events must be replaced with a call to custom function that would check if it can be unlocked and either remove the trap or say that it's locked.


Hmm... interesting. Doing it this way, I imagine I could also set a lock value on a per-chest basis rather than by map, since each chest would be its own custom call?
"You don't have to be a vampire to die like one... *****." -Simon Belmont

User avatar
BTB
Peasant
Peasant
Posts: 93
Joined: 21 Aug 2011
Location: Houston, TX
Contact:

Postby BTB » May 16 2015, 14:30

Another question, because I just haven't been bothering you enough :P

What do I need to do in order to add a new transport location to a boatmaster? I want to change Tularea's boat route to Tatalia to Emerald Isle. However, when I edit the "transport locations" table generated by MMExtention accordingly, I simply end up with no route on that day.

Further, I'll need to do something similar with the boatmaster on Emerald Isle.

---

EDIT: also, is there an easy way to get a character's race? I want to edit shrines and barrels to be stronger/weaker depending on the race of the character, but it doesn't look like I can just do a Cmp - Race = "Value" for that.

What I *can* do, it looks like, is determine each player's race by examining their base resistances via an event before leaving Emerald Isle and then flag playerbits which I can use for the purposes of race identification. I just would rather not do something so convoluted if there's a simpler solution.
"You don't have to be a vampire to die like one... *****." -Simon Belmont

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

Postby GrayFace » May 19 2015, 10:31

BTB wrote:Hmm... interesting. Doing it this way, I imagine I could also set a lock value on a per-chest basis rather than by map, since each chest would be its own custom call?

Or you can use the Trapped bit as an indicator that the chest is locked.
if Map.Chests[i].Trapped then

BTB wrote:What do I need to do in order to add a new transport location to a boatmaster? I want to change Tularea's boat route to Tatalia to Emerald Isle. However, when I edit the "transport locations" table generated by MMExtention accordingly, I simply end up with no route on that day.

Further, I'll need to do something similar with the boatmaster on Emerald Isle.

Send me the tables, I'll have a look.

BTB wrote:EDIT: also, is there an easy way to get a character's race? I want to edit shrines and barrels to be stronger/weaker depending on the race of the character, but it doesn't look like I can just do a Cmp - Race = "Value" for that.

Party[i]:GetRace()
evt.Player will give you the current player for event.

BTW, when you need to store some information you can use vars and mapvars, there you can put Lua tables, strings etc. Player bits are still the best place for player-related information, just in case I enable players switching in the patch (AFAIR I disabled it because it was buggy).
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.

User avatar
BTB
Peasant
Peasant
Posts: 93
Joined: 21 Aug 2011
Location: Houston, TX
Contact:

Postby BTB » May 19 2015, 20:37

GrayFace wrote:Or you can use the Trapped bit as an indicator that the chest is locked. if Map.Chests[i].Trapped then


GrayFace wrote:Party[i]:GetRace()
evt.Player will give you the current player for event.

BTW, when you need to store some information you can use vars and mapvars, there you can put Lua tables, strings etc. Player bits are still the best place for player-related information, just in case I enable players switching in the patch (AFAIR I disabled it because it was buggy).


Hmm... both of these suggestions sound like you're directing me to make these changes in LUA via MMExtension, in which case I'm actually quite lost. I was assuming that what I'd need to do is hex-edit the event files directly using MM8 Level Editor, in which case my only guide is the disassemblies you have on your site.

GrayFace wrote:Send me the tables, I'll have a look.


http://btb2.free.fr/temp/cupcakes/Trans ... ations.txt

I haven't updated the coordinates yet (which I suppose may be the problem) just because I wanted to see if it would accept a new destination at all. Also, the underscore in the filename was added just to upload the file to my site - it has the correct filename in my file structure.

For the record, here are all the changes I made to the travel schedule:

13: Tatalia -> Erathia (stables) from Tue/Thu/Sat to Mon/Wed/Fri
18 & 19: Erathia no longer has boats to Bracada or Evenmorn
22: Tularean Forest has boat to Emerald Isle (1 day) instead of Tatalia
24: Bracada has boat to Tatalia instead of Erathia (4 days; added a route on Friday)
25: Added Bracada -> Evenmorn on Saturday
26: Evenmorn -> Bracada from Tue/Thu/Sat to Mon/Wed/Fri
"You don't have to be a vampire to die like one... *****." -Simon Belmont

User avatar
BTB
Peasant
Peasant
Posts: 93
Joined: 21 Aug 2011
Location: Houston, TX
Contact:

Postby BTB » May 23 2015, 23:49

Ok, I have another rather significant... well, issue. It would seem that the damage formula uses only the skill of the weapon in the off-hand to determine attack damage, which throws a wrench into balancing things for me since it kills the offensive bonus of spears and (especially) axes, and I'm assuming it also removes the Mace's chance to stun or paralyze.

I *would* say that I'd like it to just use the main hand for damage calculation except that the one case where that's an issue is with daggers. Would it be possible to make it use the off-hand weapon (if present) used for damage only if a sword is in the primary hand?
"You don't have to be a vampire to die like one... *****." -Simon Belmont

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

Postby GrayFace » May 25 2015, 12:16

BTB wrote:Hmm... both of these suggestions sound like you're directing me to make these changes in LUA via MMExtension, in which case I'm actually quite lost.

Sure, that's the point of MMExt.

BTB wrote:I was assuming that what I'd need to do is hex-edit the event files directly using MM8 Level Editor, in which case my only guide is the disassemblies you have on your site.

Does mm8leveleditor actually allow saving changes for events?

BTB wrote:http://btb2.free.fr/temp/cupcakes/Transport_Locations.txt

It's 404.

BTB wrote:I'm assuming it also removes the Mace's chance to stun or paralyze.

AFAIR, it doesn't. It would be possible to do the trick you want once I add the necessary hooks.
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.

User avatar
BTB
Peasant
Peasant
Posts: 93
Joined: 21 Aug 2011
Location: Houston, TX
Contact:

Postby BTB » May 25 2015, 17:15

Oh, derp... wrong URL.

http://btb2.free.fr/cupcakes/Transport_Locations.txt

Sorry 'bout that. And thanks again for all of your ongoing help. You have no idea how much I appreciate it.

GrayFace wrote:Does mm8leveleditor actually allow saving changes for events?


As far as I can tell, it does. But the more important thing is that I actually understand the hex editing because I can figure out what each line is doing from looking at the disassemblies on your site, whereas I don't know how to do the equivalent with MMExtension since I don't really have an example to look at. The colored barrels, for example, I can figure out how to have it check the current player for a playerbit and then increase his/her stats by a different value depending on what it's set to. I do not know how to do the same thing in MMExtension.

I guess is there anywhere where I can actually see some examples of such things being done with MMExtension, just to give me a feel for the commands and syntax? Part of the reason I'm bugging you so much is because I'm totally lost as to how MMExtension is really used, and so I don't think I can really see its true potential as a result.
"You don't have to be a vampire to die like one... *****." -Simon Belmont

User avatar
BTB
Peasant
Peasant
Posts: 93
Joined: 21 Aug 2011
Location: Houston, TX
Contact:

Postby BTB » Jun 11 2015, 11:00

Ok, so for the last few weeks/months, I have been working pretty hard to finalize all of my changes that I am not able to make on my own. I tried my damndest to keep the list of things I need your help with as short as possible, only asking if I felt there was really no good alternative.

This is that list: http://btb2.free.fr/cupcakes/greyface.txt

I tried to limit the things I asked for to things that I imagine are fairly easy to accomplish, i.e. moving pointers around in the code, but I have proven to be a poor judge in the past of what is and isn't easy to accomplish. If there's anything on that list that just isn't happening, please let me know and I'll try to find another way around.

You said you'd be interested to see what I had once I was ready to share, and I've finally reached a point where I feel I have a substantial amount of work to do so: http://www.celestialheavens.com/forums/ ... hp?t=14782

Simply put, this is my vision, and I hope that it catches your interest enough to help me make it a reality. I'm willing to do/learn whatever need be on my end; all I ask is that you point me toward the resources I'll need to learn (have I mentioned I'm not very good at LUA?).

I realize I'm asking a lot, and it should go without saying that I fully intend to give credit where it's deserved.

-BTB
"You don't have to be a vampire to die like one... *****." -Simon Belmont

User avatar
BTB
Peasant
Peasant
Posts: 93
Joined: 21 Aug 2011
Location: Houston, TX
Contact:

Re: MMExtension v1.5.2 + MMEditor v1.2 Level Editor [July 5]

Postby BTB » Jul 24 2015, 17:07

Guessing that Grayface hasn't been around in awhile. Hoping that all is well with him and that he'll see this when he has the time. No rush or anything.
"You don't have to be a vampire to die like one... *****." -Simon Belmont

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

Re: MMExtension v1.5.2 + MMEditor v1.2 Level Editor [July 5]

Postby theorclair » Aug 22 2015, 1:23

I'm right now trying to do one thing: change the treasure you can get in the NWC dungeon in the book case. This is the code I have so far. Since it doesn't work, I assume I'm doing something wrong, but I'm not sure what. I sort of have the basics of the language down, but I'm still lost as to how to take the scripts and rewrite them into the language.

evt.map[60] = function()
if not evt.cmp(evt.MapVar0, 4)
return evt.StatusText(4)
add (evt.Mapvar0, 1)
evt.GiveItem(31)
end
evt.GiveItem(115)
end
evt.GiveItem(230)
end
evt.GiveItem(230)
end
evt.GiveItem(330)
end
evt.GiveItem(332)
end

return evt.StatusText(5)
end

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

Re: MMExtension v1.5.2 + MMEditor v1.2 Level Editor [July 5]

Postby GrayFace » Sep 4 2015, 4:28

Straight-forward translation to Lua:

Code: Select all

Game.MapEvtLines:RemoveEvent(60)  -- remove original quest
evt.map[60] = function()
   if evt.Cmp("MapVar0", 4) then
      return evt.StatusText(5)  -- "Nothing here"
   end
   evt.Add("MapVar0", 1)
   evt.StatusText(4)  -- "You found something!"
   local i = math.random(1, 6)
   if i == 1 then
      evt.Add("Inventory", 1)  -- "Longsword"
   elseif i == 2 then
      evt.Add("Inventory", 15)  -- "Dagger"
   elseif i == 3 then
      evt.Add("Inventory", 58)  -- "Club"
   elseif i == 4 then
      evt.Add("Inventory", 161)  -- "Phirna Root"
   elseif i == 5 then
      evt.Add("Inventory", 309)  -- "Inferno"
   else
      evt.Add("Inventory", 94)  -- "Cloth Hat"
   end
end

Smarter translation:

Code: Select all

local items = {1, 15, 58, 161, 309, 94}
Game.MapEvtLines:RemoveEvent(60)  -- remove original quest
evt.map[60] = function()
   if evt.Cmp("MapVar0", 4) then
      return evt.StatusText(5)  -- "Nothing here"
   end
   evt.Add("MapVar0", 1)
   evt.StatusText(4)  -- "You found something!"
   local i = math.random(1, #items)
   evt.Add("Inventory", items[i])
end

Replace evt.Add("Inventory", items[i]) with evt.GiveItem{Id = items[i]} to let items have enchantments. Enchanted items would be unidentified.
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.

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

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

Postby GrayFace » Sep 21 2015, 6:28

Version 2.0 is here

Now the editor does everything, both indoor and outdoor. MMExtension now runs on LuaJIT instead of plain Lua and received many other improvements.
BTB, some hooks needed for your ideas implementation are done.
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.

User avatar
BTB
Peasant
Peasant
Posts: 93
Joined: 21 Aug 2011
Location: Houston, TX
Contact:

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

Postby BTB » Sep 28 2015, 0:41

Oh, sweet. Glad to see you around, Grayface. I'll definitely have to look into this.

I'm still pretty green when it comes to LUA, though... may need some help figuring things out and getting started.
"You don't have to be a vampire to die like one... *****." -Simon Belmont

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

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

Postby GrayFace » Oct 3 2015, 22:28

Sure. Even if you weren't green, the only these new events could be learned on your own is by looking at my Core/events.lua code. Writing code for people is easier than writing documentation. :)
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.0 + MMEditor v2.0 Level Editor [Sep 21, 2015]

Postby theorclair » Oct 4 2015, 3:47

Thanks a lot!

What code would you use to change the properties of a fountain?

event 100
Hint = str[4] -- "Drink from Well."
0: Cmp {"LuckBonus", Value = 20, jump = 5}
1: Set {"LuckBonus", Value = 20}
2: StatusText {Str = 11} -- "+20 Luck temporary."
3: Set {"AutonotesBits", Value = 12}
4: Exit {}

5: StatusText {Str = 7} -- "Refreshing!"
6: Exit {}
end

What would be the way to rewrite this?

evt.Global(296)
evt.Player = evt.Players.All if not evt.Cmp(evt.VarNum.Inventory, 449) then
return evt.SetMessage(306) -- "Did the curse frighten you away as well? I can understand. Baa is patient, however. Should you work up the courage to find the candelabra, I’m still prepared to compensate you for it."
end
evt.Subtract(vt.VarNum.Inventory, 449) --
return evt.SetMessage(37) -- ""Excellent! Baa be praised! I see you were not frightened of the curse after all. Here is your reward and thank you again for your assistance."
add (evt.Value.Gold, 1000)
add(evt.Value.ReputationIs, 200)
evt.Player = evt.Players.All subtract(evt.qbit, 126)
Set.NPCTopic(1) evt.Index (1)
Set.NPCTopic(1) evt.Index (1)

end

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

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

Postby theorclair » Oct 4 2015, 18:30

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.

This is the 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)"
--------------------------------------------------------------------------------
>

RobMM8
Leprechaun
Leprechaun
Posts: 21
Joined: 07 Oct 2013

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

Postby RobMM8 » Oct 18 2015, 14:01

Really good news to see this get released! I made a new outside map that I'd like to travel to from say Ravenshore, similar to how you can travel to Shadowspire. Any help is appreciated.

neutonm
Leprechaun
Leprechaun
Posts: 12
Joined: 02 Mar 2016

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

Postby neutonm » Mar 2 2016, 12:35

Totally glad to see such a powerful modding tool. I always wanted to see spiritual continuation of MM6-8. There are, of course... MM9, in my opinion, is unfinished crap and the new MM10 doesn't possess that good'ole might and magic spirit. This tool grants possibility to extend our favorite games in different direction without loosing special thrill. Most of players already passed these games zillion times and most likely got bored of same quests, locations and stuff. Can't say about others, but personally i would want to replay MM once more in different world...

---
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". Here's some questions though:

Prerequisites - I've started a new map and included it as "test.odm/test.ddm" into games.lod. Using mm7 from gog.com with latest GrayFace patch and editor/ext. There is test.lua in the Script/Maps folder with rewritten events. In Emerald Island (out01.odm) the first house leads to the new level via MoveToMap. In sprites.lod, i've taken Erathia's minimap and reuploaded it under test.bmp (that's why you see it in following screenshots). Other tools: MMArchive, Txt Tables Editor and MM8Editor.

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
Image

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.

Code: Select all

evt.str[250] = "You received an apple"
evt.hint[250] = "Fruit Tree"
evt.map[250] = function()
   if not evt.Cmp("MapVar20", 1) then
      evt.Add("Inventory", 630)
      evt.SetSprite(52,1,"tree37")
      evt.Set("MapVar20", 1)
      evt.StatusText(250)
   end
end

Image

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)

Code: Select all

77   The Great Test   test.odm   0   0   2   672   7   1   2   1   1   10   100   0   0   Goblin   Goblin   3   2-5   0   0   0   1-3   0   0   0   0   4   FOREST   0   MyMap       x

PS: It looks like the line is not executed it at all. There's no map name(The Great Test) in map view screen.

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

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.

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.

7) I'm also interested in travel points RobMM8 mentioned about. Quick guess is to make invisible wall with traveling event.

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

That's it for now... thanks in advance :)

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 2 2016, 15:31

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.

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

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

Postby J. M. Sower » Mar 6 2016, 19:27

Hi,
I work with the MMEditor for some time and I discovered something. Unfortunately, it was impossible to do in scripts. If someone wants to change the start year (Game.Year eg. 1172 in MM8) that you should to open .exe file in the HexEditor (eg. Cygnus Hex Editor) and find such sequences:
8D 04 - 1165 in MM6
90 04 - 1168 in MM7
94 04 - 1172 in MM8 (read below)
Notice that they are stored in pairs in the reverse order, eg. 1172 in decimal system is equal to 494 in hexadecimal. Date is divided into pairs (so we have 04 94) and it was reversed, resulting in 94 04.

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 is results of change. :D
Image

Ps. I asked 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

Save it in Scripts\Maps as ChosenMapName.lua (eg. out01.lua).

Enjoy with modding! :D

Ps2. Sorry for my bad English. ;)
Last edited by Anonymous on Mar 6 2016, 23:02, edited 1 time in total.


Return to “Might and Magic”

Who is online

Users browsing this forum: MSN [Bot] and 9 guests