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 4 - Lands of Axeoth > Thread: RoseKavalier's creature ability plugin
Thread: RoseKavalier's creature ability plugin
NimoStar
NimoStar


Responsible
Supreme Hero
Modding the Unmoddable
posted April 01, 2021 11:18 AM
Edited by NimoStar at 13:50, 05 Apr 2021.

RoseKavalier's creature ability plugin

Since there is no dedicated thread for this and it deserves it, I will make one.

(Mods, please mark this as "Project" so first post can be editable. Thanks)

Find it here:
https://github.com/RoseKavalier/H4MS/releases

More info here:
http://heroescommunity.com/viewthread.php3?TID=46056&pagenumber=1

This plugin is intended to patch your H4 file with a creature ability list of your choice. It can let you add 4 abilities to each creature by editing this file inside "Plugins" folder.

__________________________

However, take this into account:


I have been trying to use RoseKavalier's extension with my mod lately (https://www.moddb.com/mods/greatest-mod/downloads/greatest-mod-alpha-019a-testable), but with no sucess.

There are at least two problems:

- The asking of the file name is pretty pointless, since if the file name has spaces and isn't "heroes4.exe", the command prompt will just shut down with "can't open file".

- Worked on default heroes4.exe, but when trying to use with my mod's exe, it says "the provided file is not valid for patching"

But why not?

The adress of creatures abilities is the exact same.

This doesn't just affect my mod however; the same happened when trying to patch the original Equilibris 355 exe.

As many H4 players use Equilibris too, and modders like me use it as a base to add features since they have more artifacts and add mass spells to creatures, this makes the patch quite limited in only working with base, unmodded H4.

I will also add a bug report on github.


Another bug:

In the default list, creature abilities are displaced by one.:

Quote:
   "Waspwort": [
       "Undead",
       "Tougness"
   ],
   "Water Elemental": [
       "Ranged",
       "Weakness"
   ],
   "White Tiger": [
       "Elementals",
       "Spellcaster",
       "Cold Resistance",
       "Cold Attack"
   ],
   "Wolves": [
       "First Strike"
   ],
   "Zombie": [
       "Strikes Twice"
   ]




Any H4 player can see what's wrong there, waspworts are ranged and weakness, water elementals are the elemental spellcasters, white tigers first strike and wolves strike twice. Zombies are the undead and toughness (which lacks an "h")

_ _

Other problems:

Some abilities work and aren't listed by name. There is no way to use them with the plugin even if you can use them by hex editing. These abilities don't have an ingame icon (appear as empty icon) but work mechanically ingame.

- There is a tested working hex code for "extra shooting attack" (separate and cumulative with Elf one, in fact in my mod elves triple-shoot)

- "extra melee attack" is another one of these alt-abilities that work. They are listed in abilitie's hex lists but there is no way to automatically add them here.

(the first ability is used by a bow relic artifact, the second I am not sure, maybe another artifact or the hero's double melee attack from the skill)

- "Melee giant slayer" and "ranged giant slayer" abilities. (added to heroes by artifacts, usable in creatures too like th others)

* Spelling is inconsistent. Sometimes it says "Resistence" and anothers "Resistance". While this is more minor, it bears mention since it can affect workflow when writing abilities into the file.

Anyone is welcome to help log these into the github or ask RoseKavalier to pass commits.


_____________________

Also, as a reminder to people using this or that would like to use it, I write the following guide:
Quote:

the next abilities do nothing actually, either they are hardcoded in some other place or literally inert.

I write the names as RoseKavalier did:

- "Taxpayer" (the script only counts peasants, even if you put the ability in other creatures)
- "Tougness"
- "Strenght" (seems to make creature weaker, not stronger)

- "Magic Resistence" (the resistance is hardcoded elsewhere; note that "Magic Immunity" does work)

Abilities which "are spells". Spells and spell points and magic power for creatures are actually stored elsewhere, these abilities are just an icon and description:
- "Spellcaster"
- "Terror"
- "Bloodlust"
- "Resurrection"
- "Fortune"
- "Mirth"
Etc. if appliable
Note that this concerns only spells cast by spellbook with creature spell points. Abilities of spells cast by attack (such as Curse, Weakness, Aging, Hypnotize etc.) do work as one would expect.


____________
https://www.moddb.com/mods/greatest-mod

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

Tavern Dweller
posted April 01, 2021 12:43 PM

Resistence is a typo, incorrect language.

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


Responsible
Supreme Hero
Modding the Unmoddable
posted April 01, 2021 01:04 PM
Edited by NimoStar at 14:46, 01 Apr 2021.

I know, just pointing it out. I can't correct it in the file as that would make the ability stop working, if has to be corrected in source code.

There is also the typo of "hafling" instead of halfling
____________
https://www.moddb.com/mods/greatest-mod

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

Tavern Dweller
posted April 01, 2021 01:55 PM

I see. Yes, programmers tend to be sloppy with their language.

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


Responsible
Supreme Hero
Modding the Unmoddable
posted April 01, 2021 02:49 PM
Edited by NimoStar at 14:50, 01 Apr 2021.

The source code is public, so in theory anyone could fix it in a fork even without RoseKavalier's intervention, but that would unnecessarily divide the project; and also, I am not a programmer and there are no instructions to compile so I can rerelease.

Taking that into account, we must hope RoseKavalier can see this.

I am NimoStar in github too, so if I could have permission in the project, I could make these fixes directly.
____________
https://www.moddb.com/mods/greatest-mod

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


Admirable
Supreme Hero
posted April 01, 2021 03:53 PM
Edited by RoseKavalier at 15:54, 01 Apr 2021.

Disclaimer:
I'm not a heroes4 players.
I did not spend more than 5 minutes reverse engineering the executable when doing this initially, mostly to grab alloc/free addresses.
I do not have plans to further reverse engineer the executable.

Let me address the raised issues:

NimoStar said:
- The asking of the file name is pretty pointless, since if the file name has spaces and isn't "heroes4.exe", the command prompt will just shut down with "can't open file".

Usually it's not a bad idea not to have spaces in filenames, but this is very simple to fix.

NimoStar said:

- Worked on default heroes4.exe, but when trying to use with my mod's exe, it says "the provided file is not valid for patching"

But why not?

Because heroes4 modders developed a bad habit of adding patches in the exe itself. Additionally, there are several base executables as you cite - not good for a unified modding platform. I wrote in some checks to ensure that patching the exe doesn't suddenly break something and that the specified executable matched the one I used originally. So if you get an invalid exe warning, that's why.

At some point I will complete the current WIP I made 2 months ago and then there will absolutely be no excuse to be hex editing heroes4.

NimoStar said:

In the default list, creature abilities are displaced by one.:

Quote:
   "Waspwort": [
       "Undead",
       "Tougness"
   ],
   "Water Elemental": [
       "Ranged",
       "Weakness"
   ],
   "White Tiger": [
       "Elementals",
       "Spellcaster",
       "Cold Resistance",
       "Cold Attack"
   ],
   "Wolves": [
       "First Strike"
   ],
   "Zombie": [
       "Strikes Twice"
   ]


Any H4 player can see what's wrong there, waspworts are ranged and weakness, water elementals are the elemental spellcasters, white tigers first strike and wolves strike twice. Zombies are the undead and toughness (which lacks an "h")


I asked for fixed creature abilities yet nobody ever really corrected. When everything is sorted out, I don't mind updating the release.

NimoStar said:
Some abilities work and aren't listed by name. There is no way to use them with the plugin even if you can use them by hex editing. These abilities don't have an ingame icon (appear as empty icon) but work mechanically ingame.
There is a tested working hex code for "extra shooting attack" (separate and cumulative with Elf one, in fact in my mod elves triple-shoot)
"extra melee attack" is another one of these alt-abilities that work. They are listed in abilitie's hex lists but there is no way to automatically add them here."Melee giant slayer" and "ranged giant slayer" abilities. (added to heroes by artifacts, usable in creatures too like th others)

As you can imagine, not all abilities are created equally. Hence you have some of them being set to creatures in one place, and others set in specific routines of the code. The creature abilities plugin simply removed the need of hex editing the data that exists in a single function as that was the available information when I made the plugin.

NimoStar said:
Spelling is inconsistent. Sometimes it says "Resistence" and anothers "Resistance". While this is more minor, it bears mention since it can affect workflow when writing abilities into the file.

You can thank other H4 posters for all typos, all the data/names/... were simply copy-pasted.

NimoStar said:
Anyone is welcome to help log these into the github or ask RoseKavalier to pass commits.


Git has a pull request functionality that lets you indirectly pass commits, anyone is welcome to use it - I made this base for the community but no one went anywhere with it.
You can even fork (clone) the repository and develop it as your own.

That's the current state of things... essentially I created a base and left it in the community's hands to develop further. I can provide technical guidance but I don't have enough time on my hands to dedicate myself to this specifically.
____________
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
NimoStar
NimoStar


Responsible
Supreme Hero
Modding the Unmoddable
posted April 01, 2021 04:32 PM
Edited by NimoStar at 17:02, 01 Apr 2021.

Quote:
I asked for fixed creature abilities yet nobody ever really corrected. When everything is sorted out, I don't mind updating the release.


That's factually false since at the time you respond, I have already corrected it... so?

Quote:

Usually it's not a bad idea not to have spaces in filenames, but this is very simple to fix.


Many games and other applications come with spaces in .exe by default...


Quote:
As you can imagine, not all abilities are created equally. Hence you have some of them being set to creatures in one place, and others set in specific routines of the code. The creature abilities plugin simply removed the need of hex editing the data that exists in a single function as that was the available information when I made the plugin.


The abilities I mentioned are available by hex editing. They require no special routine or anything else. They are a two-byte code just as the rest of them. I can provide the two-byte code of these abilities if you are interested in adding them.

Since H4 has a relatively limited ability assortment every new ability counts.

Quote:
Because heroes4 modders developed a bad habit of adding patches in the exe itself. Additionally, there are several base executables as you cite - not good for a unified modding platform. I wrote in some checks to ensure that patching the exe doesn't suddenly break something and that the specified executable matched the one I used originally. So if you get an invalid exe warning, that's why.

At some point I will complete the current WIP I made 2 months ago and then there will absolutely be no excuse to be hex editing heroes4.


Hex editing is already done. It cannot be reversed. Mods depend on such features. It's not about only more creatures abilities. It is also aboput:

- Extended spells for creatures (h4 spells on creatures aren't ruled by abilities, see my edit on first post)
- More game objects (with functionality, equilibris 3.55 adds many unique treasure lairs, which can't be added without exe edit/hex dll hack)
- More artifacts (3 more in equi 3.51 and 3 additional to those in equi 3.55)
- Expanded game logics (menu for choosing summoning and necromancy creatures)

Thus unless your project adresses all those, there absolutely is excuse to continue using exe hacks.

Which of these would the project adress, if any?

Could not the "check" be disabled, for example with an alternate patcher?

There is a very good probability that the patch will work even in the changed exes.

And your patch also alters the .exe directly, so your hate for this method is not coherent?

Quote:
Git has a pull request functionality that lets you indirectly pass commits, anyone is welcome to use it - I made this base for the community but no one went anywhere with it.
You can even fork (clone) the repository and develop it as your own.


I already said this, but at the time I didn't know if you would be active.

And I am going somewhere with it now, am I not? I was not very active in modding at the time you created it. My last release is from september 2018, but now I am active again.

Thus from the release of the file until now, I never had the chance to revise it, as I am doing in the present.

I look forward to a productive exchange that hopefully isn't very taxing for you, since the fixes I proposed including the new abilities whose two-byte hex codes I can send you are fairly innocous.

_________________

PS: Another thing. The plugin is spamming my system with 1 kb text files that only say "acquiring patcher", a new one made every time it is launched.

I would believe that if that is the only content of a log, the file can be auto-deleted for the end user, or otherwise not created.


____________
https://www.moddb.com/mods/greatest-mod

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


Responsible
Supreme Hero
Modding the Unmoddable
posted April 01, 2021 05:42 PM
Edited by NimoStar at 14:04, 05 Apr 2021.

PS2:

I "patched" my hex edited Exe manually (with hex edit, ho ho ho) so it accepts the plugin, by doing a revision of differences and applying them. There was no superposition. As far as I can tell, this is working (not enough test to say if bug free, my mod and 3.55 aren't 100% stable by themselves either).

So, I was right and the "check" is just being an unnecesary hurdle in regard to all three versions of gameplay edited exes (equi 3.51, equi 3.55 and Greatest Mod).



Of course there could still be a warning "failed validation", etc. etc. but without stopping the process. The new .exe is already just a copy anyways, so it won't break your game in any case.

It would also be rather possible to make different exe files access differently named "plugin" folders, so as to allow the mods to keep their modular nature, but I do understand that unlike the rest of things that I mentioned which are bugfixes and completion, this is an "extra thing" to ask for the program (feature request).

PS3: On second testing, while in the adventure map and even combat it works, there is something about post-combat processing that seems to crash when all enemies are defeated. so , I will stick to evil "hex editing" for my main mod since there are 15 new creatures with spells, at least for now and unless editing spells for creatures is added.


PS4:

We can put more than 4 abilities in a creature.

Although such abilities work fine, it will crash the game when in the recruit screen, since it has a different ability interface where icons can't overflow:



The screen that crashes. Note the abilities are just 2x2, while in other screns they can be potentially 4x2 and 5x2.

Is that code could be foxed we could have actual usable five+ creature abilities.

As it stands the only one that could be used this way in vanilla H4 are Mermaids and Sea Monsters since they don't have an object to recruit them in either map or town.

____________________________

Also, I found the extra abilities are already added... they just aren't listed with the standard download, only with the source code. This list should be adjuct to the release package and not only source, since it's what permits users to make their custom stuff.
____________
https://www.moddb.com/mods/greatest-mod

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


Responsible
Famous Hero
posted April 09, 2021 09:12 PM

NimoStar said:
PS2:


The screen that crashes. Note the abilities are just 2x2, while in other screns they can be potentially 4x2 and 5x2.

Is that code could be foxed we could have actual usable five+ creature abilities.

As it stands the only one that could be used this way in vanilla H4 are Mermaids and Sea Monsters since they don't have an object to recruit them in either map or town.



So theoretically, you suggest that simply expending the interface to contain an additional 2 boxes should do the trick of avoiding crashes?
____________

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


Promising
Known Hero
posted April 09, 2021 10:29 PM

karmakeld said:
So theoretically, you suggest that simply expending the interface to contain an additional 2 boxes should do the trick of avoiding crashes?


Is that the cause of the crash though?

RoseKavalier said:


It looks funny, but it seems to work


Seems to be fine there so maybe something else is causing the crash?

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


Responsible
Supreme Hero
Modding the Unmoddable
posted April 10, 2021 12:32 AM

iliveinabox05 said:
karmakeld said:
So theoretically, you suggest that simply expending the interface to contain an additional 2 boxes should do the trick of avoiding crashes?


Seems to be fine there so maybe something else is causing the crash?


Different thing though.

Those are two rows of icons, each row is 4 icons wide. The second is "invisible" but it's there.

When there are two rows of two icons already occupied, the game can't go to "third row" because it isn't programmable, thus the crash.


That's my explanation but I have been right before

A way of knowing would be putting in nine abilities.

If I am correct, that should cause the 4x2 interface to crash as well.
____________
https://www.moddb.com/mods/greatest-mod

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


Promising
Known Hero
posted April 10, 2021 12:39 AM

Well yes, of course they are different interfaces, but it looks 4x1 to me with the additional abilities wrapping around? Maybe I'm tired or missing something.

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


Responsible
Supreme Hero
Modding the Unmoddable
posted April 10, 2021 12:44 AM
Edited by NimoStar at 01:17, 10 Apr 2021.

That you can see 4 doesn't mean that more rows aren't scripted. In other words, the coding is different.

However I did test 9 abilities and they wrap to a third



So perhaps the "wrapping" isn't written for the recruit dialog, and instead it gives "coordinates" for the four squares (and no more).

I know it is GUI related because this only happens when YOU want to recruit the creatures. The AI can recruit the creatures just fine, since their dialog never appears on any screen. And as mentioned the creatures work just as expected in and out of combat, just so long you don't try to open any recruit dialog for them.

Thus, it is no at functional crash, it is a graphic rendering crash.

PS: Also, see this here:


Do you notice how there is more space between the first and second icon than between the second and the third, even on the first row?

It gives credence this spacing is done manually in the code. In the full image, you can see why this was probably a "fix" to cover the entire bar, which is a bit more wide than four icons on default spacing. Not sure how this would help, but it's good to have in mind.
____________
https://www.moddb.com/mods/greatest-mod

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


Responsible
Famous Hero
posted April 10, 2021 10:29 AM
Edited by Karmakeld at 10:36, 10 Apr 2021.

I got no clue how the interface is connected with the code, but bear in mind OldGreyWolf proved you could change the interface using only graphical changes like in Gimp or Photoshop, no change of code - that was for the world map interface.

Equilibris added an additional icon for the magic resistance. So it might give a clue of you look at what they did, not saying that the recruitment interface couldn't be coded differently.

https://images.app.goo.gl/CZDutawhps4NHqzi8

https://images.app.goo.gl/ukBDjX8RqDV5fRUS7
____________

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


Responsible
Supreme Hero
Modding the Unmoddable
posted April 11, 2021 11:09 PM
Edited by NimoStar at 23:10, 11 Apr 2021.

That's just changing one image for another.

Completely different than changing interface code that generates game crashes.

Analogy:

On thing is like painting the wall of your house differently. Another thing is building a new house (or at least, a new wall).

You can paint your wall color any way you want, but preventing the house from falling requires structure.
____________
https://www.moddb.com/mods/greatest-mod

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread »
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.1043 seconds