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 > Library of Enlightenment > Thread: When does AI actually pick Wisdom? (started by phoenix4ever in March 2024)
When does AI actually pick Wisdom? This thread is 5 pages long: 1 2 3 4 5 · «PREV / NEXT»
BigPig2
BigPig2


Adventuring Hero
posted September 01, 2026 08:19 PM
Edited by BigPig2 at 13:16, 02 Sep 2026.

I believe this should be a simple hex edit. I will have a look tomorrow and see if I can figure it out. If not you need to appeal to a higher power.

Edit: What I definitely do know how to do, and it is a single byte edit, is to make the check occur every lvl up which probably all but guarantees the same outcome.

Edit2: I had a look but I can't see any obvious way to do it. I still believe it is possible but I am not that familiar with C and the process goes through several routines so its a bit hard for me to follow. I will give it another try when I find the time.

Alternatives I can think of:
- give Wisdom a constant, obscenely high value to guarantee it always being in AI "top picks"
- make the "is it time to offer Wisdom" check (even) more frequent, up to every single level up
- if you feel Wisdom is a must have for every hero, might or magic, consider scrapping it entirely? I believe (I might be wrong tho) Olden Era has some level restrictions on casting certain spells, maybe that could be an alternative? This would also prevent the scummy tactic of wearing down an enemy approaching your castle using a horde of fresh lvl 1 heroes for 1 cast of a damage spell each.


 View Profile
bloodsucker
bloodsucker


Legendary Hero
posted September 02, 2026 01:50 PM
Edited by bloodsucker at 16:13, 02 Sep 2026.

BigPig2 said:
- give Wisdom a constant, obscenely high value to guarantee it always being in AI "top picks"
This is what I believe would be the best solution. AI picks Wisdom and Earth every time cause they have the highest values, then the rest will be random enough to give some flavor.
____________

 View Profile
BigPig2
BigPig2


Adventuring Hero
posted September 02, 2026 02:14 PM

The issue with this approach is that a skill being in the top picks doesnt guarantee the AI actually getting it as it needs to roll it on a level up first. And the probability of that happening is 10/112 (SoD) for the most inclined magic heroes. You could however adjust those values as well to reach the point of near-inevitability.

The main source of Wisdom for AI heroes is the "offer Wisdom every 3rd/6th level" for magic/might heroes routine. But the way that works is by setting Wisdom as the alternative to the primary choice rolled according to the probabilities. If the rolled skill is NOT in the "top picks", AI heroes opt for Wisdom. And as the rolled skill needs to be one of the 6/5/4.. etc top picks left out of the remaining 26/25/24 skills for AI to take it, the probability of choosing Wisdom ends up being pretty high. Wisdom's own value does not contribute here other than potentially taking a spot in the top picks and reducing the number of skills preferred by 1 (so 5/4/3.. etc out of 26/25/24..).

 View Profile
bloodsucker
bloodsucker


Legendary Hero
posted September 02, 2026 04:16 PM

I was thinking "and" not "or"...
____________

 View Profile
BigPig2
BigPig2


Adventuring Hero
posted September 02, 2026 06:54 PM

As one of the measures towards the goal, yes, I agree. Overall I dont think guaranteeing AI heroes end up taking Wisdom is difficult to acheive, seeing as even the might heroes almost universally do already. Just a matter of adjusting a couple parameters in the existing code.

 View Profile
Phoenix4ever
Phoenix4ever


Legendary Hero
Heroes is love, Heroes is life
posted September 02, 2026 07:58 PM

BigPig2 said:
seeing as even the might heroes almost universally do already.

That is not my experience.
Did you check Alex's example with Ufretin on page 2?
Ufretin picked all available magic schools but no Wisdom.

 View Profile
BigPig2
BigPig2


Adventuring Hero
posted September 02, 2026 08:14 PM

Yes i saw it, but as mentioned, I have tested it quite extensively with Knights, Rangers, and Alchemists, and as far as I can tell even the might heroes without spellbooks (the first two classes) tend to learn Wisdom by lvl 20+ some 80%+ of the time (in 50+ trials per class). The only explanation I found for these results is the routine offering them the skill every 6th level, and indeed, once this was disabled the rate dropped to less than half (I do not remember exactly as this was some months ago but I think it went down to like 25%ish). I did not control for the effect of map objects over the course of a game, I just made a custom map with 8x lvl 20+ might heroes per player and counted their starting skills.

I tested Necromancers in the same way a few days ago (50+ trials) and every single one of them had Wisdom no later than in the 6th slot and usually no later than 4th. Vidomina had it 2nd some 50% of the time.

Not bulletproof but got me convinced..

 View Profile
Phoenix4ever
Phoenix4ever


Legendary Hero
Heroes is love, Heroes is life
posted September 02, 2026 09:53 PM
Edited by Phoenix4ever at 21:56, 02 Sep 2026.

I am just surprised you say AI might heroes get Wisdom 80% of the time, in my experience it seems to be much less, but I don't have an exact percentage either.

How exactly did you do these tests? Cause you can't really see AI's heroes skills, unless you buy their defeated heroes in a tavern.

 View Profile
BigPig2
BigPig2


Adventuring Hero
posted September 03, 2026 06:54 AM

I created a map where each player started with 8 fully levelled heroes of one class, started the game as the player who got the class I wanted to test and then restarted the game over and over and checked the heroes' skills after each reatart. Then repeated with next player etc. No map interaction just freshly rolled levels each time.

 View Profile
Phoenix4ever
Phoenix4ever


Legendary Hero
Heroes is love, Heroes is life
posted September 03, 2026 07:49 AM

Yeah but is that the same way AI would go about choosing it's skills?, maybe it is, but I am not sure.
Also on a real map it would find Witch Huts, Universities, Adventure Map Scholars etc...

 View Profile
Phoenix4ever
Phoenix4ever


Legendary Hero
Heroes is love, Heroes is life
posted September 03, 2026 08:06 AM
Edited by Phoenix4ever at 08:08, 03 Sep 2026.

I just had a revelation regarding spell specialists:
I think I am gonna start them all in level 2, with their appropriate magic school.
All other heroes could also start in level 2, the problem is they might get a skill you are not interested in.
Instead they would start with 999 XP, then they only need 1 XP to level 2 and can freely choose their skill then.

 View Profile
BigPig2
BigPig2


Adventuring Hero
posted September 03, 2026 09:37 AM

I have admittedly not investigated it thoroughly but I assume it is the same routine for AI hero lvl ups.

If you think you will want Wisdom for might heroes as well in the long run consider scrapping the skill. Its likely a matter of nop-ing out the checks for mage guilds, eagle eye/scholar (a buff for both) and shrines etc, and it does free up a skill slot, which seems in line with your broader aims?

 View Profile
phoenix4ever
phoenix4ever


Legendary Hero
Heroes is love, Heroes is life
posted September 03, 2026 09:54 AM

BigPig2 said:

If you think you will want Wisdom for might heroes as well in the long run consider scrapping the skill. Its likely a matter of nop-ing out the checks for mage guilds, eagle eye/scholar (a buff for both) and shrines etc, and it does free up a skill slot, which seems in line with your broader aims?

Yeah I have considered that too, but if even might heroes can cast level 5 spells right out of the gate, it might be a bit too much.
It will also mess with skill probabilities, since not all classes have the same chance to learn Wisdom, so it might not be a good idea.

 View Profile
BigPig2
BigPig2


Adventuring Hero
posted September 03, 2026 10:45 AM

Yes, there is downsides. It could be level restricted? Hero level needs to be equal or greater than the spell level, and maybe 2*spell level for might heroes? Its more code but probably still doable in hex.

 View Profile
phoenix4ever
phoenix4ever


Legendary Hero
Heroes is love, Heroes is life
posted September 03, 2026 10:55 AM

Well that it is an interesting idea, with some level requirements, but I don't know how to do that unfortunately.

 View Profile
BigPig2
BigPig2


Adventuring Hero
posted September 03, 2026 11:48 AM

If you just want to use the hero level as is, its probably just a matter of switching up what value the existing checks fetch, which in principle could be very simple.

I was gonna say it gets more complicated if you want to check hero class and modify the values according to might vs magic BUT that code actually already exists and is only used for the "offer Wisdom every n levels" function (really needs a shorthand) which becomes entirely redundant if you remove Wisdom as a skill. So you could repurpose it without too much hassle probably.

I cant offer you a ready hex edit right now but I could probably figure it out at some point in the future. Trivial for the pros I would assume.

 View Profile
phoenix4ever
phoenix4ever


Legendary Hero
Heroes is love, Heroes is life
posted September 03, 2026 12:01 PM

BigPig2 said:

I cant offer you a ready hex edit right now but I could probably figure it out at some point in the future. Trivial for the pros I would assume.

Only if you want to yourself, cause I think I am currently pretty satisfied with spell specialists getting magic schools and the ohter heroes starting with 999 XP.

 View Profile
BigPig2
BigPig2


Adventuring Hero
posted September 03, 2026 01:11 PM

I can do it as an exercise at some point. But my first priority will be rewriting spellcasting to modify spell duration, allow more spell specialties, and rebalance spell damage and scaling. And hopefully making Eagle Eye work instantly rather than after the battle (SoD) and "teaching" AI to cast quicksand and land mine.

 View Profile
phoenix4ever
phoenix4ever


Legendary Hero
Heroes is love, Heroes is life
posted September 03, 2026 02:03 PM

BigPig2 said:
"teaching" AI to cast quicksand and land mine.

I would like this too + Fire Wall, Force Field and Remove Obstacle.

 View Profile
BigPig2
BigPig2


Adventuring Hero
posted September 03, 2026 02:31 PM
Edited by BigPig2 at 14:36, 03 Sep 2026.

The main difference between Q/LM and the rest is that these two do not require targetting. So all it takes to make AI use them somewhat sensibly is to find a formula to calculate their usefulness or hijack one from another spell, maybe Slow? The best I can come up with for fire wall or force field is maybe to cast it mindlessly in front of shooters? But even then I feel it has the potential to do as much harm as good.. Remove obstacle would likewise require battlefield analysis I cant even formulate algorithmically, not to mention code.

 View Profile
Jump To: « Prev Thread . . . Next Thread » This thread is 5 pages long: 1 2 3 4 5 · «PREV / NEXT»
Post New Poll   Post New Topic   Post New Reply

Page compiled in 0.0458 seconds