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
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 » Dec 23 2016, 10:17

theorclair wrote:Two things - how do you modify the contents of a chest? And how would you change the properties of a fountain?

Chests are editable at the map editor.

Fountains are models with assigned events. Look at assigned number of event in editor and next look at decompiled original scripts (You can download them from GrayFace site) for current map. You can add completly new event or delete the old one and add new in its place.

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 » Dec 23 2016, 15:55

How would a script look if I wanted to modify, say, this fountain: event 106
Hint = str[3] -- "Drink from Fountain"
0: Cmp {"PlayerBits", Value = 1, jump = 7}
1: Set {"PlayerBits", Value = 1}
2: Add {"BaseMight", Value = 5}
3: Set {"Dead", Value = 0}
4: StatusText {Str = 8} -- "+5 Might permanent."
5: Set {"AutonotesBits", Value = 36}
6: Exit {}

7: Set {"Dead", Value = 0}
end

What would the chest script look like?

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 » Dec 23 2016, 16:36

theorclair wrote:How would a script look if I wanted to modify, say, this fountain: event 106
Hint = str[3] -- "Drink from Fountain"
0: Cmp {"PlayerBits", Value = 1, jump = 7}
1: Set {"PlayerBits", Value = 1}
2: Add {"BaseMight", Value = 5}
3: Set {"Dead", Value = 0}
4: StatusText {Str = 8} -- "+5 Might permanent."
5: Set {"AutonotesBits", Value = 36}
6: Exit {}

7: Set {"Dead", Value = 0}
end

In my opinion it should look something like this, but don't know how works "PlayerBits", "BaseMight" and "Dead" so I don't know if it is written completely correctly.

Code: Select all

Game.MapEvtLines:RemoveEvent(106)
evt.hint[106] = evt.str[3] -- but you can write: evt.hint[106] = "Drink from Fountain"
evt.map[106] = function()
   if evt.Cmp("PlayerBits", 1) then
      evt.Set("Dead", 0)
   else
      evt.Set("PlayerBits", 1)
      evt.Add("BaseMight", 5)
      evt.Set("Dead", 0)
      evt.StatusText(8) -- "+5 Might permanent."
      evt.Set("AutonotesBits", 36)
   end
end
Last edited by J. M. Sower on Dec 23 2016, 16:37, edited 2 times 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 » Dec 27 2016, 15:38

Would you use the quest script to modify the reward for something you can continually bring back, like bones and gongs?

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 » Dec 28 2016, 11:03

theorclair wrote:Would you use the quest script to modify the reward for something you can continually bring back, like bones and gongs?

Original quests can be only replaced by new ones written in scripts.
Last edited by J. M. Sower on Dec 28 2016, 11:04, edited 1 time in total.

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 » Dec 28 2016, 16:12

I found a way how to change sky texture on current map, but it isn't to simple. For first you must add chosen sky texture somewhere in current map (on one of the invisible and untouchable facets) and set its "Id" (you can also use "Event" - replace Id to Event in script below) for some unique number. Next you must type this number in place of dots in this script and save it in appropriate place. Not fully tested yet. ;P I tested it and it works fully correctly. :D It must be loaded at each entry to map.

Code: Select all

modelcount = Map.Models.Count - 1
for model=0,modelcount,1 do
   facetcount = Map.Models[model].Facets.Count - 1
   for facet=0,facetcount,1 do
      if Map.Models[model].Facets[facet].Id == ... then -- dots are place for your chosen facet Id
         skybitmap = Map.Models[model].Facets[facet].BitmapId
      end
   end
end
Map.LoadedSkyBitmap = skybitmap

GrayFace, there is possibility to change sounds that are assigned to tilesets? I was able to set correct sound for snow in MM8 (my new tileset) only because of sound of walking on mud assigned to two unused tilesets (I swapped sound files of mud to snow).

BTW, there is possibility to restore raining snow from MM6 in MM8?
Last edited by J. M. Sower on Dec 28 2016, 22:15, edited 10 times 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 » Dec 28 2016, 17:24

If you wanted to re-write this to take away the reputation loss, how would it look?

event 114 -- "Bones"
0: Set {"AutonotesBits", Value = 99}
1: Player = 0
2: Cmp {"Inventory", Value = 465, jump = 4}
3: GoTo {jump = 9}

4: Subtract {"Inventory", Value = 465}
5: Add {"Gold", Value = 1000}
6: Subtract {"ReputationIs", Value = 50}
7: SetMessage {Str = 193} -- "Hmm... A leg bone of a human? This will do nicely. This bone is certainly worth 1000 gold. "
8: Exit {}

9: Player = 1
10: Cmp {"Inventory", Value = 465, jump = 12}
11: GoTo {jump = 17}

12: Subtract {"Inventory", Value = 465}
13: Add {"Gold", Value = 1000}
14: Subtract {"ReputationIs", Value = 50}
15: SetMessage {Str = 193} -- "Hmm... A leg bone of a human? This will do nicely. This bone is certainly worth 1000 gold. "
16: Exit {}

17: Player = 2
18: Cmp {"Inventory", Value = 465, jump = 20}
19: GoTo {jump = 25}

20: Subtract {"Inventory", Value = 465}
21: Add {"Gold", Value = 1000}
22: Subtract {"ReputationIs", Value = 50}
23: SetMessage {Str = 193} -- "Hmm... A leg bone of a human? This will do nicely. This bone is certainly worth 1000 gold. "
24: Exit {}

25: Player = 3
26: Cmp {"Inventory", Value = 465, jump = 28}
27: GoTo {jump = 33}

28: Subtract {"Inventory", Value = 465}
29: Add {"Gold", Value = 1000}
30: Subtract {"ReputationIs", Value = 50}
31: SetMessage {Str = 193} -- "Hmm... A leg bone of a human? This will do nicely. This bone is certainly worth 1000 gold. "
32: Exit {}

33: SetMessage {Str = 192} -- "I'm looking for bones to use in my rituals. I prefer bones from humans or humanoids, but I suppose I can make do with whatever you find. I'm willing to pay up to 1000 gold for bones that I can use."
34: Exit {}
end

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 » Dec 28 2016, 17:47

theorclair wrote:If you wanted to re-write this to take away the reputation loss, how would it look?

event 114 -- "Bones"
0: Set {"AutonotesBits", Value = 99}
1: Player = 0
2: Cmp {"Inventory", Value = 465, jump = 4}
3: GoTo {jump = 9}

4: Subtract {"Inventory", Value = 465}
5: Add {"Gold", Value = 1000}
6: Subtract {"ReputationIs", Value = 50}
7: SetMessage {Str = 193} -- "Hmm... A leg bone of a human? This will do nicely. This bone is certainly worth 1000 gold. "
8: Exit {}

9: Player = 1
10: Cmp {"Inventory", Value = 465, jump = 12}
11: GoTo {jump = 17}

12: Subtract {"Inventory", Value = 465}
13: Add {"Gold", Value = 1000}
14: Subtract {"ReputationIs", Value = 50}
15: SetMessage {Str = 193} -- "Hmm... A leg bone of a human? This will do nicely. This bone is certainly worth 1000 gold. "
16: Exit {}

17: Player = 2
18: Cmp {"Inventory", Value = 465, jump = 20}
19: GoTo {jump = 25}

20: Subtract {"Inventory", Value = 465}
21: Add {"Gold", Value = 1000}
22: Subtract {"ReputationIs", Value = 50}
23: SetMessage {Str = 193} -- "Hmm... A leg bone of a human? This will do nicely. This bone is certainly worth 1000 gold. "
24: Exit {}

25: Player = 3
26: Cmp {"Inventory", Value = 465, jump = 28}
27: GoTo {jump = 33}

28: Subtract {"Inventory", Value = 465}
29: Add {"Gold", Value = 1000}
30: Subtract {"ReputationIs", Value = 50}
31: SetMessage {Str = 193} -- "Hmm... A leg bone of a human? This will do nicely. This bone is certainly worth 1000 gold. "
32: Exit {}

33: SetMessage {Str = 192} -- "I'm looking for bones to use in my rituals. I prefer bones from humans or humanoids, but I suppose I can make do with whatever you find. I'm willing to pay up to 1000 gold for bones that I can use."
34: Exit {}
end

I think it will be good:

Code: Select all

Game.GlobalEvtLines:RemoveEvent(114)
evt.Global[114] = function()
   evt.Set("AutonotesBits", 99)
   evt.Player = evt.Players.All
   if evt.Cmp("Inventory", 465) then
      evt.Subtract("Inventory", 465)
      evt.Player = 0
      evt.Add("Gold", 1000)
      evt.SetMessage  {Str = 193} -- "Hmm... A leg bone of a human? This will do nicely. This bone is certainly worth 1000 gold. "
   else
      evt.SetMessage  {Str = 192} -- "I'm looking for bones to use in my rituals. I prefer bones from humans or humanoids, but I suppose I can make do with whatever you find. I'm willing to pay up to 1000 gold for bones that I can use."
   end
end
Last edited by J. M. Sower on Dec 28 2016, 17:50, edited 1 time in total.

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 » Dec 29 2016, 11:34

Grayface, I added casting Regeneration to the Trolls(monsters) but this spell can't be casted on monsters so it doesn't work. Is there any way to add possibility to cast this on them?

User avatar
Anubis
Conscript
Conscript
Posts: 242
Joined: 08 Sep 2011
Location: Canada

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

Postby Anubis » Dec 29 2016, 13:42

This is my first time using MMExt/MMEditor.

Goal: Changing Q's Finger of Death spell to Prismatic Light spell

What I did:

Loaded MMEditor > Internal Map > T8.blv > Went to Q's location, clicked on him, pressed E to open his file.

What I see in this text file is that 95 is Finger of Death. I want to change this value to 84 for Prismatic Light. I don't want this to be a permanent change. I want to be able to have playthroughs where this is or isn't included. Kind of like...that Solo Party lua script GrayFace has. How do I do this?

I'm assuming that this change can be done in a LUA script. If that's the case, do I have to download LUA? Also, looking at GrayFace's MMExtension page, I see that the Spell value is located in structs.MonstersTxtItem and structs.MapMonster. Am I onto something here?
Last edited by Anubis on Dec 29 2016, 13:52, edited 1 time in total.

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 » Dec 29 2016, 15:36

Anubis wrote:This is my first time using MMExt/MMEditor.

Goal: Changing Q's Finger of Death spell to Prismatic Light spell

What I did:

Loaded MMEditor > Internal Map > T8.blv > Went to Q's location, clicked on him, pressed E to open his file.

What I see in this text file is that 95 is Finger of Death. I want to change this value to 84 for Prismatic Light. I don't want this to be a permanent change. I want to be able to have playthroughs where this is or isn't included. Kind of like...that Solo Party lua script GrayFace has. How do I do this?

I'm assuming that this change can be done in a LUA script. If that's the case, do I have to download LUA? Also, looking at GrayFace's MMExtension page, I see that the Spell value is located in structs.MonstersTxtItem and structs.MapMonster. Am I onto something here?

You can edit lua files with Notepad++.

Below is script witch modifies spell for monster with id 103. There is also a list of values for "SpellSkill".

Code: Select all

--[[Game.MonstersTxt[].SpellSkill
N - Novice; E - Expert; M - Master; GM - GrandMaster
2   N 2
3   N 3
4   N 4
65   E 1
66   E 2
67   E 3
68   E 4
69  ?   E 5
70   E 6
71   E 7
72   E 8
73   E 9
136   M 8
138   M 10
140   M 12
266   G 10
268   G 12
271   G 15
272   G 16
]]--
Game.MonstersTxt[103].Spell = 84 -- Prismatic Light
Game.MonstersTxt[103].SpellChance = 15 -- chance to cast spell
Game.MonstersTxt[103].SpellSkill = 73 -- E 9

Save this in Scripts/Global folder if you want to set it for all the game, or save it in Scripts/Maps folder in file with chosen map name as its name. Then write this to load that setting only on that map:

Code: Select all

function events.LoadMap()
   Game.MonstersTxt[103].Spell = 84 -- Prismatic Light
   Game.MonstersTxt[103].SpellChance = 15 -- chance to cast spell
   Game.MonstersTxt[103].SpellSkill = 73 -- E 9
end
function events.LeaveMap()
   Game.MonstersTxt[103].Spell = 0
   Game.MonstersTxt[103].SpellChance = 0
   Game.MonstersTxt[103].SpellSkill = 0
end
Last edited by J. M. Sower on Dec 29 2016, 15:38, 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 » Dec 29 2016, 17:14

J. M. Sower wrote:I found a way how to change sky texture on current map, but it isn't to simple.

This function will help you do it without extra hassle:

Code: Select all

function Editor.LoadBitmap(name)
   local i = Game.BitmapsLod:LoadBitmap(name or "pending")
   if i >= 0 then
      Game.BitmapsLod.Bitmaps[i]:LoadBitmapPalette()
   end
   return i
end


J. M. Sower wrote:GrayFace, there is possibility to change sounds that are assigned to tilesets? I was able to set correct sound for snow in MM8 (my new tileset) only because of sound of walking on mud assigned to two unused tilesets (I swapped sound files of mud to snow).

Not yet.

J. M. Sower wrote:BTW, there is possibility to restore raining snow from MM6 in MM8?

The effect is only implemented in Software mode. I wanted to make the effect in D3D by showing premade frames in a way similar to Prismatic Light effect though.

J. M. Sower wrote:Grayface, I added casting Regeneration to the Trolls(monsters) but this spell can't be casted on monsters so it doesn't work. Is there any way to add possibility to cast this on them?

No. You can regenerate them with a timer.
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.1 + MMEditor v2.1 Level Editor [Apr 22, 2016]

Postby GrayFace » Dec 29 2016, 17:20

Anubis wrote:I'm assuming that this change can be done in a LUA script. If that's the case, do I have to download LUA? Also, looking at GrayFace's MMExtension page, I see that the Spell value is located in structs.MonstersTxtItem and structs.MapMonster. Am I onto something here?

Yes, it's structs.MapMonster: (save it as Maps\T8.lua)

Code: Select all

Map.Monsters[monster_index].Spell = 84

The uploaded version of MMEditor can't display monster index, so you'll need to find it like this (in Ctrl+F1 console):

Code: Select all

for i, a in Map.Monsters do
  if a.Spell == 95 then
    return i
  end
end

However, I doubt Prismatic Light would work, because not all spells can be cast by monsters. Would be interesting to find out.
Last edited by GrayFace on Dec 29 2016, 17:32, 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
GrayFace
Dragon
Dragon
Posts: 1456
Joined: 29 Nov 2005

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

Postby GrayFace » Dec 29 2016, 17:23

J. M. Sower wrote:Then write this to load that setting only on that map:

For this I made LocalMonstersTxt() function that you'd just call before making any changes. It will restore the table on map leave. LocalFile(Game.MonstersTxt) would have the same effect, you can pass any such table to it.
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.1 + MMEditor v2.1 Level Editor [Apr 22, 2016]

Postby GrayFace » Dec 29 2016, 17:30

New version has a pretty sophisticated evt->lua decompiler. Here are current decompiled scripts (would change on release - would include new fixes to bugs by my patches and maybe different version of Rev4 mod): https://dl.dropboxusercontent.com/u/447 ... cripts.rar
Last edited by GrayFace on Dec 29 2016, 17:44, 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
Anubis
Conscript
Conscript
Posts: 242
Joined: 08 Sep 2011
Location: Canada

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

Postby Anubis » Dec 29 2016, 21:03

I'm not at home right now, so I haven't played around with the Q fix yet. Thanks for the speedy reply, though. I'm @ another house and I've been playing around with MMEditor/MMArchive some more, and I noticed something. Whenever I change something in Monsters.TXT, such as renaming Great Wyrm to Greater Wyrm, the changes are applied to Great Wyrms in indoor dungeons [Caves of the Dragon Riders] but the change doesn't affect Great Wyrms in Dragonsand. I went on to figure out that none of the changes I made in Monsters.TXT are applied to outdoor enemies. How come? Is this an issue that can be solved with MMExtension?
Last edited by Anubis on Dec 29 2016, 21:06, edited 2 times in total.

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 » Dec 29 2016, 23:04

Anubis wrote:I'm not at home right now, so I haven't played around with the Q fix yet. Thanks for the speedy reply, though. I'm @ another house and I've been playing around with MMEditor/MMArchive some more, and I noticed something. Whenever I change something in Monsters.TXT, such as renaming Great Wyrm to Greater Wyrm, the changes are applied to Great Wyrms in indoor dungeons [Caves of the Dragon Riders] but the change doesn't affect Great Wyrms in Dragonsand. I went on to figure out that none of the changes I made in Monsters.TXT are applied to outdoor enemies. How come? Is this an issue that can be solved with MMExtension?

Maybe the Great Wyrms in Dragonsand are placed without using spawn (there are three monsters spawns for each map with assigned monsters types in MapStats.txt). If they are placed manually (in editor, from the list of all monsters) the changes will be not loaded.

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 » Dec 29 2016, 23:18

GrayFace wrote:This function will help you do it without extra hassle:

Code: Select all

function Editor.LoadBitmap(name)
   local i = Game.BitmapsLod:LoadBitmap(name or "pending")
   if i >= 0 then
      Game.BitmapsLod.Bitmaps[i]:LoadBitmapPalette()
   end
   return i
end

I will try it.

GrayFace wrote:
J. M. Sower wrote:GrayFace, there is possibility to change sounds that are assigned to tilesets? I was able to set correct sound for snow in MM8 (my new tileset) only because of sound of walking on mud assigned to two unused tilesets (I swapped sound files of mud to snow).

Not yet.

:(

GrayFace wrote:
J. M. Sower wrote:Grayface, I added casting Regeneration to the Trolls(monsters) but this spell can't be casted on monsters so it doesn't work. Is there any way to add possibility to cast this on them?

No. You can regenerate them with a timer.

At this time I set them casting Heal, but idea with timer seems good. :)

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 » Dec 29 2016, 23:22

GrayFace wrote:
J. M. Sower wrote:Then write this to load that setting only on that map:

For this I made LocalMonstersTxt() function that you'd just call before making any changes. It will restore the table on map leave. LocalFile(Game.MonstersTxt) would have the same effect, you can pass any such table to it.

Yeah, it will be more professional solution.

BTW, last time I added some monster and I noticed that I can't change monsters hostile. I changed sets in Hostile.txt in many ways, but I saw that all the monsters have their standard hostile unchangeable. I think I was changing this in the past corretc, but now it doesn't work. :/
Last edited by J. M. Sower on Dec 29 2016, 23:33, 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 » Dec 30 2016, 9:38

Anubis wrote:Whenever I change something in Monsters.TXT, such as renaming Great Wyrm to Greater Wyrm, the changes are applied to Great Wyrms in indoor dungeons [Caves of the Dragon Riders] but the change doesn't affect Great Wyrms in Dragonsand.

Maybe you aren't starting a new game after making changes.
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.


Return to “Might and Magic”

Who is online

Users browsing this forum: No registered users and 9 guests