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

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: 77
Joined: 21 Aug 2011
Location: Houston, TX
Contact:

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

Postby BTB » Mar 8 2019, 16:44

Hey, all... glad to see everything is going well around here. Hopefully will be able to actually get back around to this now that my other projects are taken care of for the moment.

Rodril wrote:Seems, file host has not handle the video, i've uploaded it to Youtube: https://youtu.be/lipriutf3SI .
I've forgot to mention, this script works only with MM8.
Script generates few new tables in "...Data\Tables folder", one of them is "Potion settings.txt", something can be edit there.
Also there is new array in game - evt.PotionEffects . It consist of functions, indexed according to "Pot Id" column of TXT file. How it works: when player uses potion (drink it or uses on other item), if evt.PotionEffects have function at index of this potion, function will be executed, if function returns "true" original behaivor of potion is bypassed.
Here is example, effect is senseless, just to see it in action:

Code: Select all

-- According to "Potion settings.txt", 1 is item 221 - catalyst potion
evt.PotionEffects[1] = function(IsDrunk, Target, Power)
 -- IsDrunk - true if player drinks potion, false - if potion used on item
 -- Target - Player structure if IsDrunk == true, otherwise Item structure
 -- Power - number - power of potion
   if IsDrunk then
      Target.HP = Target.HP/2
   else
      Item.Broken = true -- note, first you have to allow potion to be used on items in "Potion settings.txt"
   end
   
   return true -- don't execute usual effect
end

More detailed explanation is in video, i'm sure it is possible to watch it now.


So... just for example, let's say that I wanted to swap the effects of Blue and Green potions so that Blue is awaken and Green is restore magic. From what I see in this video, it looks like what I'd need to do is just add two new ones? Or is there something more obvious that I'm missing?
"You don't have to be a vampire to die like one... *****." -Simon Belmont

Rodril
Conscript
Conscript
Posts: 235
Joined: 18 Nov 2016

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

Postby Rodril » Mar 8 2019, 17:18

MrHarmondale1184 wrote:The thing is, I would like to know how (if possible) can I make the summoned 'monster' to stand passively around, just like the Castle Harmondale guards for example. As the default behavior is that the summoned 'monster' moves around.

Yes, use:

Code: Select all

mon.AIType = 3
mon.MoveType = 3

But in outdoor maps it works weird, if you start shout at friendly monster.

BTB wrote:So... just for example, let's say that I wanted to swap the effects of Blue and Green potions so that Blue is awaken and Green is restore magic. From what I see in this video, it looks like what I'd need to do is just add two new ones? Or is there something more obvious that I'm missing?

Not necessary to add new potions, you can rescript effects of existing ones. Example:

Code: Select all

evt.PotionEffects[3] = function(IsDrunk, Target, Power) -- Magic Potion
   if IsDrunk then
      -- Remove asleep condition
      Target.Conditions[const.Condition.Asleep] = 0
      return true -- don't execute original behaivor
   end
end

evt.PotionEffects[7] = function(IsDrunk, Target, Power) -- Awaken
   if IsDrunk then
      -- Add 10 + potion's power SP
      Target.SP = math.min(Target:GetFullSP(), Target.SP + Power + 10)
      return true -- don't execute original behaivor
   end
end

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

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

Postby BTB » Mar 8 2019, 18:23

Sweeeeeeeeeeeeet. You seem to have a really good idea of what you're doing and I hope you don't mind if I pump you for more information. I have a lot I want to do, but as long as I have some basic examples to learn from, I shouldn't need too much in the way of guidance.

The potion example makes perfect sense only thing I can't figure out is which PotionEffects.evt corresponds to which potion. Is there a reference you can point me toward where I can find this? Nothing in the MME GitHub seems to tell me.

I remember you mentioning last year that you haven't managed to suss out how to change skill levels for spells and/or their effects (i.e. setting Charm from expert level to basic or turning Stun into a Mind spell instead of Earth)... I'm guessing that much is still true?

The other major ticket items I have at the moment are editing the base recovery rates for weapons and armor and skill level bonuses.
Last edited by BTB on Mar 8 2019, 18:29, edited 1 time in total.
"You don't have to be a vampire to die like one... *****." -Simon Belmont

Rodril
Conscript
Conscript
Posts: 235
Joined: 18 Nov 2016

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

Postby Rodril » Mar 9 2019, 10:45

BTB wrote:The potion example makes perfect sense only thing I can't figure out is which PotionEffects.evt corresponds to which potion. Is there a reference you can point me toward where I can find this? Nothing in the MME GitHub seems to tell me.

Check "Potion settings.txt" in "...Data\Tables" folder, "RemoveItemLimits.lua" will generate it.
BTB wrote:I remember you mentioning last year that you haven't managed to suss out how to change skill levels for spells and/or their effects (i.e. setting Charm from expert level to basic or turning Stun into a Mind spell instead of Earth)... I'm guessing that much is still true?

Yes.
BTB wrote:The other major ticket items I have at the moment are editing the base recovery rates for weapons and armor and skill level bonuses.

As far as i know, there is no convenient way to change these values yet. For weapon delays you can use template:

Code: Select all

mem.u4[0x4fdf88] = 100 -- Staff
mem.u2[0x4fdf88+2] = 90 -- Sword
mem.u2[0x4fdf88+4] = 60 -- Dagger
mem.u2[0x4fdf88+6] = 100 -- Axe
mem.u2[0x4fdf88+8] = 80 -- Spear
mem.u2[0x4fdf88+10] = 100 -- Bow
mem.u2[0x4fdf88+12] = 80 -- Mace
mem.u2[0x4fdf88+14] = 30 -- Blaster

For rest - i don't know.

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

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

Postby BTB » Mar 9 2019, 13:54

Editing skill bonuses is definitely possible - at least if you're using existing bonuses. I just recall Greyface telling me awhile back that he hadn't added hooks yet. Guess I'll have to defer to him.

Something you may be able to tell me, though... artifacts and relics. I see examples on GitHub of how to ADD effects to them, but how would I go about removing them do you know?

(Thank you, by the way. You've been a great help.)
Last edited by BTB on Mar 9 2019, 13:55, edited 1 time in total.
"You don't have to be a vampire to die like one... *****." -Simon Belmont

Rodril
Conscript
Conscript
Posts: 235
Joined: 18 Nov 2016

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

Postby Rodril » Mar 10 2019, 17:14

BTB wrote:Something you may be able to tell me, though... artifacts and relics. I see examples on GitHub of how to ADD effects to them, but how would I go about removing them do you know?

These effects are hardcoded, only way to remove them is editing .exe file. If you familiar with disassembly, you can use these functions https://grayface.github.io/mm/ext/ref/#Core-RSMem.lua to change game code upon game launching. Most of mechanics are binded to item index, searching for constants equal to item index will probably lead you to needed algorythms.
Last edited by Rodril on Mar 10 2019, 17:14, edited 1 time in total.

MrHarmondale1184
Leprechaun
Leprechaun
Posts: 2
Joined: 05 Mar 2019

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

Postby MrHarmondale1184 » Mar 10 2019, 18:42

Thank you Rodril!

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

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

Postby BTB » Mar 22 2019, 6:40

Rodril wrote:
BTB wrote:Something you may be able to tell me, though... artifacts and relics. I see examples on GitHub of how to ADD effects to them, but how would I go about removing them do you know?

These effects are hardcoded, only way to remove them is editing .exe file. If you familiar with disassembly, you can use these functions https://grayface.github.io/mm/ext/ref/#Core-RSMem.lua to change game code upon game launching. Most of mechanics are binded to item index, searching for constants equal to item index will probably lead you to needed algorythms.


I'm sensing that I'm likely going to have to learn some coding to really dig into what I'm after with a few things like this and changing spell effects. And I think I'm getting a little ahead of myself because I'm still not familiar with some of the basics.

So let me make sure I understand this...

I place the Potions.lua you provided in my scripts folder and that will generate a text file which I can use to customize potions with code that looks like this:

Code: Select all

evt.PotionEffects[3] = function(IsDrunk, Target, Power) -- Magic Potion
   if IsDrunk then
      -- Remove asleep condition
      Target.Conditions[const.Condition.Asleep] = 0
      return true -- don't execute original behaivor
   end
end


So, where exactly does that code GO? I'm assuming based on my past experience here that I create a new .lua file with just that code in it and place it in the scripts folder? Or do I append it to the Potions.lua script you gave me?
"You don't have to be a vampire to die like one... *****." -Simon Belmont

Queegon
Leprechaun
Leprechaun
Posts: 2
Joined: 20 Mar 2019

Re:

Postby Queegon » Mar 22 2019, 9:35

GrayFace wrote:Untested script to change stats effect breakpoints table in MM7 (for MM6 and MM8 other addresses would be needed):

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

Place it into Scripts\General folder and tweak the 'vals' table as you like.


Hey there, any chance to share the addresses for MM8? Or where can I find them myself? Thanks in advance.

Rodril
Conscript
Conscript
Posts: 235
Joined: 18 Nov 2016

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

Postby Rodril » Mar 23 2019, 9:33

BTB wrote:I place the Potions.lua you provided in my scripts folder and that will generate a text file which I can use to customize potions with code that looks like this:

Not exactly. Script "RemoveItemsLimits.lua" have to be placed into "...Scripts\Structs" folder. It will generate text table with basic properties for reagents and potions in "...Data\Tables" folder ("Potion settings.txt" and "Reagent settings.txt"). Then you have to create your own lua scripts in "...Scripts\Global" folder, where you can change effects of potions using "evt.PotionEffects" list.
To make example work, all actions you have to do are:
1. Put "RemoveItemsLimits.lua" into "...Scripts\Structs" folder.
2. Create "Example.lua" in "...Scripts\Global", open it with any text editor and paste code there.

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

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

Postby BTB » Mar 24 2019, 0:51

Ok, so possibly stupid follow-up question, then... is the Potions.lua file in the structs folder required beyond that point, or does it exist solely to generate the text table?

...ok, yeah, that is a stupid question. There's no way that Potions.lua isn't required.
Last edited by BTB on Mar 24 2019, 0:54, edited 1 time in total.
"You don't have to be a vampire to die like one... *****." -Simon Belmont


Return to “Might and Magic”

Who is online

Users browsing this forum: No registered users and 13 guests