Heroes of Might and Magic Community
visiting hero! Register | Today's Posts | Games | Search! | FAQ/Rules | AvatarList | MemberList | Profile


Age of Heroes Headlines:  
5 Oct 2016: Heroes VII development comes to an end.. - read more
6 Aug 2016: Troubled Heroes VII Expansion Release - read more
26 Apr 2016: Heroes VII XPack - Trial by Fire - Coming out in June! - read more
17 Apr 2016: Global Alternative Creatures MOD for H7 after 1.8 Patch! - read more
7 Mar 2016: Romero launches a Piano Sonata Album Kickstarter! - read more
19 Feb 2016: Heroes 5.5 RC6, Heroes VII patch 1.7 are out! - read more
13 Jan 2016: Horn of the Abyss 1.4 Available for Download! - read more
17 Dec 2015: Heroes 5.5 update, 1.6 out for H7 - read more
23 Nov 2015: H7 1.4 & 1.5 patches Released - read more
31 Oct 2015: First H7 patches are out, End of DoC development - read more
5 Oct 2016: Heroes VII development comes to an end.. - read more
[X] Remove Ads
LOGIN:     Username:     Password:         [ Register ]
HOMM1: info forum | HOMM2: info forum | HOMM3: info mods forum | HOMM4: info CTG forum | HOMM5: info mods forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Heroes 3.5 - WoG and Beyond > Thread: How to edit HotA?
Thread: How to edit HotA? This Popular Thread is 111 pages long: 1 10 20 ... 24 25 26 27 28 ... 30 40 50 60 70 80 90 100 110 111 · «PREV / NEXT»
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted October 05, 2017 08:20 PM

Quote:
But even this "simple task" failed

Should have been worked.

c->ebx += ((_Hero_*)c->edi)->level * 2;

Are you sure that a mistake is here?

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Serp
Serp


Known Hero
posted October 05, 2017 08:26 PM

AlexSpl said:
Quote:
But even this "simple task" failed

Should have been worked.

c->ebx += ((_Hero_*)c->edi)->level * 2;

Are you sure that a mistake is here?

yes, please read orignal post I posted at October 05, 2017 06:15 PM.
There I described that it always filled the spell points completely instead of giving herolevel*2 spell points per day. That is what I mean by "does not work".
Again, it would be great if you could read the whole post. Maybe you can answer some questions of it

My main goal is to change mysticism to a % value of total spell points (like getting 10% of total spell points per day).
And change Estates to depend on hero level. The solution from "igrik" is just giving every hero the special ability "Estates" -> 5% per level. But I don't like this solution since it makes heroes with this ability useless and I do't like the formula behind it. So I would like to write my own formula, depending on hero level.

To acchieve these goals, I'm trying to understand the ebx and level*2 stuff I'm talking about

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Serp
Serp


Known Hero
posted October 05, 2017 08:30 PM

edit:
for whatever reason the * 2 worked now ...
So you are right, sorry. Don't know what was wrong previously.

btw. than you for the response about spell description and so one

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
RoseKavalier
RoseKavalier


Admirable
Supreme Hero
posted October 05, 2017 08:43 PM
Edited by RoseKavalier at 14:19, 04 Dec 2017.

Serp said:
but in both codes we are using c->ebx ... so what is this now?
In second code I would guess c->ebx is something where we can get the hero stats.  But in first code there is "c->ebx +=" so it looks like c->ebx is a number where we simply can add the level from the hero...

Hm.. thinking about it also could be a hex number in both cases, storing all the hero stats. And when we do += we do not simply add the hero level, we add another strange number we got with c->edi, so in the end we have a hex number which contains updated spell point regeneration...

Or are all of my thoughts rubbish?


To understand well you need to understand Assembly a little bit.
EBX register is not always hero structure, so you can't place a hook at 0x444444 and write ... (_Hero_*)c->ebx ... and be certain that works. In that spot EBX is 99% something other than a hero structure, you need to inspect that code region first to know what is what.

Structure is like the shelf, an organized "array" of objects with (usually) varying lengths. In previous example, (_Hero_*)c->ebx points to the start of this structure so when you know that you can modify anything in this hero's structure.
(Technically _Hero_ is a class... it's basically a structure but it also contains some functions that you can use on itself.)

EDIT:
Repository of (most) files I use at the moment.
____________
My Let's Plays: Metataxer's Revenge - The Empire of The World 2

 Send Instant Message | Send E-Mail | View Profile | PP | Quote Reply | Link
Serp
Serp


Known Hero
posted October 05, 2017 10:17 PM

@RoseKavalier:
thank you. So I guess I will stop trying to understand and instead will hope someone of you have time to write the code partly =/
Thank you very much for your help.

And you are right (of course), I tried to use same structure for Estates, but it was not the level. Instead it was a very big number.
Quote:
int __stdcall newBaseEstate(LoHook* h, HookContext* c)
{
  c->ebx += ((_Hero_*)c->edi)->level;
  return EXEC_DEFAULT;
}
_PI->WriteLoHook(0x63EA18 + 4, newBaseEstate);

(by the way, it is not +1,2,3, it is +4+8+12 ... ?)
Could you please tell me how to get the hero level here?

And about mysticism:
Please tell me how to get the heroes max spell points in:
_PI->WriteLoHook(0x63E9C8 + 4, newBaseMysticism);
(so first getting the hero object and then max spell points. "spell_points" is in homm3.h, but what is max spell points?)


About homm3.h repository:
"igrik" added some merchant stuff to the homm3.h file, but also replaced a line for it.
So I'm not sure if the replacement will cause issues with other plugins?
See this plugin (and code):
http://handbookhmm.ru/forum/viewtopic.php?p=16695#p16695

And your "LearnSecondarySkill" is not included yet

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted October 05, 2017 10:43 PM
Edited by AlexSpl at 22:47, 05 Oct 2017.

Quote:
"spell_points" is in homm3.h, but what is max spell points?

You can get max spell points by calling the following heroes function:

short maxSpellPoints = (short)(10 * hero->knowledge * CALL_1(float, __thiscall, 0x4E4B20, hero));

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
zmudziak22
zmudziak22


Supreme Hero
Heroes 3 Fan
posted October 05, 2017 10:51 PM

Can someone do acumulate creatures in dwellings to hire and guards as seperate plugin?

Also I recommend that EE and Scholar should allow us to learn level 5 spells so that make sense to both Expert Wisdom + EE/Scholar.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted October 05, 2017 10:59 PM
Edited by AlexSpl at 23:08, 05 Oct 2017.

Quote:
Also I recommend that EE and Scholar should allow us to learn level 5 spells so that make sense to both Expert Wisdom + EE/Scholar.

All you have to do, regarding the first part of your proposal, is to remove the following line from the source code of the newEagleEye plugin:

// if ( iSpell->level <= hero->second_skill[HSS_EAGLE_EYE] + 1 )

* Hmm, then you will be able to learn spells regardless of EE level.

Well, you may replace it with

if ( iSpell->level <= hero->second_skill[HSS_EAGLE_EYE] + 2 )

Then you will be able to learn level 1-3 spells on Basic, 1-4 on Advanced, and 1-5 on Expert.

Also, if you want to learn adventure spells as well, replace

for (_Spell_* iSpell = o_Spell + SPL_QUICKSAND; iSpell <= o_Spell + SPL_AIR_ELEMENTAL; ++iSpell)

with

for (_Spell_* iSpell = o_Spell; iSpell <= o_Spell + SPL_AIR_ELEMENTAL; ++iSpell)

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted October 05, 2017 11:22 PM
Edited by AlexSpl at 00:01, 06 Oct 2017.

For those of you, who don't want to mess with all this C++ stuff, I've compiled two plugins:

Learn up to level 3/4/5 spells on Basic/Advanced/Expert Eagle Eye:

newEagleEye5

Learn up to level 3/4/5 spells, including adventure spells, on Basic/Advanced/Expert Eagle Eye:

newEagleEye5Adv

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
RoseKavalier
RoseKavalier


Admirable
Supreme Hero
posted October 05, 2017 11:24 PM
Edited by RoseKavalier at 23:31, 05 Oct 2017.

Serp said:

Quote:
int __stdcall newBaseEstate(LoHook* h, HookContext* c)
{
  c->ebx += ((_Hero_*)c->edi)->level;
  return EXEC_DEFAULT;
}
_PI->WriteLoHook(0x63EA18 + 4, newBaseEstate);

(by the way, it is not +1,2,3, it is +4+8+12 ... ?)
Could you please tell me how to get the hero level here?


I meant +1/2/3 DWORD so yes 4/8/12.

Also, you don't want to write a LoHook @ 0x63EA18, that's a data area - not code.

Estates function starts at 0x4E4600.
You can get _Hero_ for most of the function from ESI.


What are you trying to do exactly?

Serp said:

About homm3.h repository:
"igrik" added some merchant stuff to the homm3.h file, but also replaced a line for it.
So I'm not sure if the replacement will cause issues with other plugins?
See this plugin (and code):
http://handbookhmm.ru/forum/viewtopic.php?p=16695#p16695

And your "LearnSecondarySkill" is not included yet

The fun thing about github is anyone can add stuff and propose changes. Stuff gets approved then the database is updated. Then everyone can have the updated versions with new stuff. Of course if nobody wants to add to it then it will become outdated quickly.
I could even turn the repository into a plugin "central" based on author so you could download the whole thing and re-compile/change whatever you like.
EDIT: repository updated.
____________
My Let's Plays: Metataxer's Revenge - The Empire of The World 2

 Send Instant Message | Send E-Mail | View Profile | PP | Quote Reply | Link
phoenix4ever
phoenix4ever


Legendary Hero
Heroes is love, Heroes is life
posted October 06, 2017 12:02 AM
Edited by phoenix4ever at 00:04, 06 Oct 2017.

AlexSpl said:

Learn up to level 3/4/5 spells, including adventure spells, on Basic/Advanced/Expert Eagle Eye:

newEagleEye5Adv

I never thought I would say this, but that might make Eagle Eye OP or at least very good.
I'm not complaining though and it's nice you made two more plug-ins Alex.
Hopefully you guys will update the handbook with more nice plug-ins in the future.
I wish I could contribute, but I don't know anything about C++ and don't really feel like learning it, I have lots of ideas though.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted October 06, 2017 12:13 AM

I've just updated my post.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Serp
Serp


Known Hero
posted October 06, 2017 12:13 AM

@AlexSpl:
What if another plugin changes max spell calculation (eg instead of only knowledge, also use spellpower or whatever)? It would be better to directly get max spell points. Isnt this possible? Or a something like a pointer to the calculation itself? So in case calculation is changed, we automatically use the new calculation method?

Changing the eagle eye to also lvl 5 and adventure map spells was something I did yesterday That was one of few tasks I was able to do on my own without asking here

RoseKavalier said:
Serp said:

Quote:
int __stdcall newBaseEstate(LoHook* h, HookContext* c)
{
  c->ebx += ((_Hero_*)c->edi)->level;
  return EXEC_DEFAULT;
}
_PI->WriteLoHook(0x63EA18 + 4, newBaseEstate);

(by the way, it is not +1,2,3, it is +4+8+12 ... ?)
Could you please tell me how to get the hero level here?


I meant +1/2/3 DWORD so yes 4/8/12.

Also, you don't want to write a LoHook @ 0x63EA18, that's a data area - not code.

Estates function starts at 0x4E4600.
You can get _Hero_ for most of the function from ESI.

What are you trying to do exactly?



I thought estates is at 0x63EA18? I was not aware that this is also "DWORD" and to add code I need to change 0x4E4600 O.o ?

I simply want something like:
Estates gives skill_level*hero_level*100 gold per day.

Similiar for mysticism:
Gives skill_level*max_spell_points*0.05 per day.


@phoenix4ever:
I have no problem with learning C++. But I don't like assembly/Hex and all that stuff. Also that ESI,EBX and such cryptographical stuff is not mine.
So if you know this, but not C++ we could work together


@All:
If someone is lacking plugin ideas, I think one can start to port nearly every WOG feature and ERA mod to HD-plugin There are already plenty of good ideas.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
RoseKavalier
RoseKavalier


Admirable
Supreme Hero
posted October 06, 2017 12:28 AM

Serp said:
I thought estates is at 0x63EA18? I was not aware that this is also "DWORD" and to add code I need to change 0x4E4600 O.o ?

I simply want something like:
Estates gives skill_level*hero_level*100 gold per day.

Similiar for mysticism:
Gives skill_level*max_spell_points*0.05 per day.

@All:
If someone is lacking plugin ideas, I think one can start to port nearly every WOG feature and ERA mod to HD-plugin There are already plenty of good ideas.

The values of Estates... 0 / 125 / 250 / 500 are at 0x63EA18 + ...

Estates
*Place the hook at 0x4E461B
*your code
*c->return_address = 0x4E4622
*return NO_EXEC

Mysticism
_Hero_ is EDI
*hook at 0x4E41C5
*your code
*c->return_address = 0x4E41CC
*return NO_EXEC

I very much doubt ideas are a problem but usually programmers with time (as you can easily find by searching this forum for number of abandoned projects).
I don't mind giving a helping hand but I have my own stuff to work on too
____________
My Let's Plays: Metataxer's Revenge - The Empire of The World 2

 Send Instant Message | Send E-Mail | View Profile | PP | Quote Reply | Link
Zmudziak22
Zmudziak22


Supreme Hero
Heroes 3 Fan
posted October 06, 2017 12:49 AM

Thanks AlexsPL for Eagle Eye buff, now map from Eternal Love seems passable or A Wizards Tale map.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Serp
Serp


Known Hero
posted October 06, 2017 12:51 AM

@RoseKavalier:
Thank you very much

In case the code is correct, I only don't know where to put the result?
Quote:
int __stdcall newEstate(LoHook* h, HookContext* c)
{
   _Hero_ *hero = (_Hero_*)c->esi; // grab current hero structure
   int skill_level = hero->second_skill[HSS_ESTATES]; // current skill level
int hero_level = hero->level;
int gold = skill_level*hero_level*100
// what to do with gold now?
   c->return_address = 0x4E4622
   return NO_EXEC
}


code for mysticism will look basically the same, but with "edi" and of course different start and return hex address.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted October 06, 2017 01:09 AM

Try this:

int __stdcall newEstate(LoHook* h, HookContext* c)
{
   _Hero_* hero = (_Hero_*)c->esi;
   c->eax = hero->second_skill[HSS_ESTATES] * hero->level * 100;

   return EXEC_DEFAULT;
}

...

_PI->WriteLoHook(0x4E4622, newEstate);

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Serp
Serp


Known Hero
posted October 06, 2017 02:57 AM

AlexSpl said:
Try this:

int __stdcall newEstate(LoHook* h, HookContext* c)
{
   _Hero_* hero = (_Hero_*)c->esi;
   c->eax = hero->second_skill[HSS_ESTATES] * hero->level * 100;

   return EXEC_DEFAULT;
}

...

_PI->WriteLoHook(0x4E4622, newEstate);


thanks, worked

For mysticism same structure does not work (does not change anything)
Quote:
int __stdcall NewMysticism(LoHook* h, HookContext* c)
{
c->eax = 5;
return EXEC_DEFAULT;
}
_PI->WriteLoHook(0x4E41CC, NewMysticism);


I guess eax is wrong here? I tried it with ebx and saw that spell point generation changed, but this was also true for heroes without mysticism...

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
RoseKavalier
RoseKavalier


Admirable
Supreme Hero
posted October 06, 2017 03:25 AM
Edited by RoseKavalier at 03:38, 06 Oct 2017.

This is actually something you should be able to do by yourself if you took a look

MOV EBX, ....
means
EBX = ....



So store result in EBX.

Heroes without Mysticism will get whatever value you store in EBX, plus mana artifacts.
____________
My Let's Plays: Metataxer's Revenge - The Empire of The World 2

 Send Instant Message | Send E-Mail | View Profile | PP | Quote Reply | Link
Serp
Serp


Known Hero
posted October 06, 2017 02:04 PM

RoseKavalier said:
This is actually something you should be able to do by yourself if you took a look

MOV EBX, ....
means
EBX = ....

So store result in EBX.

Heroes without Mysticism will get whatever value you store in EBX, plus mana artifacts.

I tried EBX, but with the wrong hook address. I was confused by the two different ways.  AlexSpl hooked for estates into the address you mentioned as "return address". That's why I tried the same for mysticism. I tried alot of combinations, but not your solution plus ebx.
So yes, it worked. thank you

Uploaded the plugins at http://handbookhmm.ru/forum/viewtopic.php?p=16699#p16699

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread » This Popular Thread is 111 pages long: 1 10 20 ... 24 25 26 27 28 ... 30 40 50 60 70 80 90 100 110 111 · «PREV / NEXT»
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.1738 seconds