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: Diplomacy internals
Thread: Diplomacy internals This thread is 3 pages long: 1 2 3 · «PREV
New_User
New_User

Tavern Dweller
posted August 27, 2019 01:00 AM

Maurice said:
Do keep in mind that the game starts with X and Y at zero.

Thanks for this comment, Maurice!
I really started with 1 at first.

AlexSpl said:
See this. You go to 6992B8 and write down four bytes (double word) there. Then you use *that* value to compute AdvMgrAddr + 5C.
Yes, MapSize is 36, 72, 108, 144, 180, 216, or 252. Z = 0 for surface, Z = 1 for underground.

Worked like a charm!

Many thanks, AlexSpl!
You guys rock!

Do you think it is worth creating a special FAQ somewhere?
I haven't seen such full instructions on editing creatures' aggression anywhere on the Internet.

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

Tavern Dweller
posted November 17, 2019 06:01 AM

My Goodness!!!!!!!

A TRANSLATOR PLEASE COME!!!

That's insanely frustrating to read all that... and unfortunately not useful a bit =(((((((
Please a normal living and breathing human being translate all that into a normal English language post for all of us!!!!!!!!!!!!!!

I understand that those people have lots and lots of fun writing down all those abbreviations and symbols and ugly math - I saw it in real life how they smile and exuberate joy seeing you're dying of frustration and keep pushing more math on you untill you're ready to cry and die.
But I once had a person explained to me a point of math in plain English - it was better than orgasm!!!

So PLEASE LORD SEND HERE A NORMAL HUMAN BEING!!!
BE SO KIND AND GENEROUS to all of us...

Let my prayer be heard...
Amen
____________

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

Hero of Order
Part of the furniture
posted November 17, 2019 10:53 AM

Iím sorry, but I donít see how you could translate those complex calculations in words, without butchering the result. It simply takes at least some mathematical understanding to figure out how the calculations and considerations in the game code work.
____________
The last Reasonable Steward of Good Game Design and a Responsible Hero of HC. - Verriker

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

Tavern Dweller
posted November 17, 2019 11:30 AM

Maurice said:
Iím sorry, but I donít see how you could translate those complex calculations in words, without butchering the result. It simply takes at least some mathematical understanding to figure out how the calculations and considerations in the game code work.


Maurice said:
Iím sorry, but I donít see how you could translate those complex calculations in words, without butchering the result. It simply takes at least some mathematical understanding to figure out how the calculations and considerations in the game code work.


Let's do it together then, step by step from both sides =)

1.
Diplomacy depends on the strength of your hero and the army of the hero.
The stronger the army - the greater is the chance monsters would join you
But at some point it doesn't matter anymore - like when your army is 2/5/10 times stronger?

2.
There's some random chance that units will join you and some chance that they will never join you even when you are 100 times stronger
Does it change week after week? Cause when you use "Visions" it says will flee... THIS WEEK! So should I wait?
And also it seems that the mood of monsters changes somehow else as well - cause I tested it with Cheats - and I go 20 monsters and all of them flee even when I have 200 Archangels and then suddenly they start offering to join - both free and paid - ON THE SAME DAY - and it looked like the further monsters from my town did that. And then when this shift happend it really started to look like truely random finally - some flee / some join (free / paid). So what is the catch about that?  

3.
Does the level of diplomacy matter in terms of chance of joining or only for the cost?
The same for the artifacts?

4.
The chance of joining also is higher when you have the same units in your army and when you have them more than any other units - all together? or more than any other unit into your army separately? You need just 1 unit more or the more the better, so that it works?

5.
Does the chance depend on your hero's moral and luck from - both from artifacts and from skills?

Did I miss something??

Please don't let me go insane... I just need to understand it, I am tired, I can't sleep and eat properly being that frustrated!!!! ((

Please make your step towards me using these 5 points I wrote...
Will be very grateful!
____________

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

Tavern Dweller
posted January 18, 2020 01:06 PM

AlexSpl said:
Let me rather describe how to change that value in memory. You, then, can always save a game...


@AlexSpl and Maurice,
Sorry for making a post in this thread - I will move to another one if it exists.
Can you please provide some instructions or a link to existing instructions on how to edit (in memory) the magic that appears on every mage guild level for those levels that are not yet built?
E.g. if I have a level 1 mage guild but want to edit what magic is going to be available on level 4 and 5 for the given castle.
Thanks in advance!

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

Hero of Order
Part of the furniture
posted January 18, 2020 10:21 PM

New_User said:
AlexSpl said:
Let me rather describe how to change that value in memory. You, then, can always save a game...


@AlexSpl and Maurice,
Sorry for making a post in this thread - I will move to another one if it exists.
Can you please provide some instructions or a link to existing instructions on how to edit (in memory) the magic that appears on every mage guild level for those levels that are not yet built?
E.g. if I have a level 1 mage guild but want to edit what magic is going to be available on level 4 and 5 for the given castle.
Thanks in advance!


I only know how to edit savegames, Iíve never really messed with changing stuff in memory during runtime. That being said, I will need to look into my notes to tell you the exact locations you need to look at. Will probably not be today.
____________
The last Reasonable Steward of Good Game Design and a Responsible Hero of HC. - Verriker

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


Legendary Hero
posted January 19, 2020 04:56 PM

Meh, if you are playing MP that is considered a cheat, if not just save and systematically build and press end-turn until you see what is there, then reload. People often complicate simple things...
____________
The only reason i argue with you people is because i don't want the bullsnow you all spout to be so easily spread to the impressionable without another sane voice challenging you.  -  Fred79

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

Hero of Order
Part of the furniture
posted January 20, 2020 05:42 PM
Edited by Maurice at 17:58, 20 Jan 2020.

bloodsucker said:
Meh, if you are playing MP that is considered a cheat, if not just save and systematically build and press end-turn until you see what is there, then reload. People often complicate simple things...


I don't ever play MP games in Heroes, but aren't MP games always encrypted?

And besides, you can already reveal it in SP through cheats anyway; just use NWCZION to build a Town, NWCNEBUCHADNEZZAR on a Hero to visit every Town on the map on day 1, possibly NWCWHATISTHEMATRIX to see the entire map, and NWCTHEREISNOSPOON to get access to the Fly spell to be able to travel anywhere ... but that's such a time-consuming hassle to do; parsing a save game is much easier.

Edit:
Keep in mind that savegames are simply zip files, so you need to unzip them first. But once you do and you open a savegame, it should be fairly easy to find the names of the Towns, as they're written into the savegame file in plain text.

Counting from the last byte of the Town name, you need to count a number of bytes ahead:
+84: this byte indicates how many spell slots exist at Tier 1 of the Mage Guild;
+85: Likewise, but for Tier 2;
+86: Likewise, but for Tier 3;
+87: Likewise, but for Tier 4;
+88: Likewise, but as you might guess, for Tier 5;

+113 - +136: The Spells held at Tier 1 (4 bytes per Spell ... Spell 6 is present in all Guilds, but only accessible for Tower Towns with a Library built)
+137 - +160: Likewise for Tier 2, with the note that Spell 5 is only available in Towers with a Library built and the slot of Spell 6 is garbage data that should be ignored;
+161 - +184: Likewise for Tier 3, with the note that Spell 4 is only available in Towers with a Library built and the slots of Spells 5 and 6 are garbage data that should be ignored;
+185 - +208: Likewise for Tier 4, but then Spell 3 only for Towers with a Library and Spells 4, 5 and 6 are garbage data;
+209 - +216: Only 2 Spells at this Tier, with the 2nd one only available for Towers with a Library;
____________
The last Reasonable Steward of Good Game Design and a Responsible Hero of HC. - Verriker

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


Legendary Hero
posted January 20, 2020 08:05 PM

Maurice said:
I don't ever play MP games in Heroes, but aren't MP games always encrypted?

I think so. And I still find my solution easier, I mean if you have the resources ahead.
____________
The only reason i argue with you people is because i don't want the bullsnow you all spout to be so easily spread to the impressionable without another sane voice challenging you.  -  Fred79

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


Responsible
Supreme Hero
posted January 21, 2020 08:51 PM
Edited by AlexSpl at 23:41, 21 Jan 2020.

Quote:
Can you please provide some instructions or a link to existing instructions on how to edit (in memory) the magic that appears on every mage guild level for those levels that are not yet built?

For SoD 3.2 / HD mod:

Let GameMgrAddr = DwordAt(0x699538);

TownAddr = DwordAt(GameMgrAddr + 0x21614) + Town_ID * 0x168;
Spell_ID = IntAt(TownAddr + (0x11 + 6 * Level + Slot) * 4);

Town_ID, Level, Slot - all starting from 0.

Number of towns owned by Player_ID = ByteAt(GameMgrAddr  + 0x20B0E + Player_ID * 0x168).

List of Town_IDs owned by Player_ID starts at GameMgrAddr + 0x20B10 + Player_ID * 0x168, one byte for each town, the first byte being Town_ID of the topmost town on the game screen.

* DwordAt(), IntAt() - like in the previous example, 4 bytes @ 0x{given_address};
ByteAt() - 1 byte @ 0x{given_address}.

* * *
Note

There are no simple ways to obtain town's ID just by its coordinates. You have to look up through the whole list of town structures. Yet, there are two shortcuts. First, you can use LMOracle (or another program that shows Town_ID). Second, you can search for hexadecimal sequence of town's coordinates in memory (for example, x = 30, y = 30, z = 0 => search for hexadecimal string 1E 1E 00), then subtract from the address, you found, 5. There will be town's ID. You will significantly reduce the number of addresses to check by adding town's type (for example, Conflux at x = 30, y = 30, z = 0 => search for hexadecimal string 08 1E 1E 00).

Here is the example of a successful search:



02 - Town_ID, 00 - Owner_ID (Player_ID), 08 - Conflux, 0D 05 00 - town's coordinates, FF FF - no boat, etc. You will easily recognize a town structure after some practice Of course, this is not the way you should search for Town_ID in your programs/plugins, but it's fast for humans.

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

Tavern Dweller
posted February 17, 2020 09:49 PM

AlexSpl said:

For SoD 3.2 / HD mod:
Let GameMgrAddr = DwordAt(0x699538)...

Maurice said:
Counting from the last byte of the Town name, you need to count a number of bytes ahead:
+84: this byte indicates how many spell slots exist at Tier 1 of the Mage Guild...

Thanks, AlexSpl and Maurice!
That helped a lot.

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


Known Hero
posted May 17, 2020 05:10 AM
Edited by BTB at 05:12, 17 May 2020.

So, thank you to Alex for sitting down with me the other day and taking the time to explain the diplomacy process. I've added it to my hacking guide since it's relevant information with regards to modding. As this has required me to convert it into a much more human-friendly/layman's terms format (which appears to have been requested earlier in this thread), I'll post it here in hopes that someone might find it helpful.

(I also have one question for Alex at the very bottom)

---

I'll preface the rest of this section with two points aimed toward anyone who's decided to simply trash
the Diplomacy skill altogether. One, creatures will offer to join for "greater glory" but never for gold
unless either Diplomacy is in play *OR* the difficulty level is set to Easy, in which case the player is
given a +1 bonus to their Diplomacy skill - even if that skill is 0. Bearing this in mind, you may wish
to zero out the basic Diplomacy bonus at 23EA3C. Alternatively, if you just want to nuke the mechanic of
random join offers entirely, set 017237 from 02 to 00 and 017246, 0A75A9, and 0A755D all from 7F to EB.

Whenever a hero encounters a wild stack of creatures, the game first calculates the relative strength of
both armies as a ratio by dividing one by the other. This includes a multiplier for the hero's army that
accounts for their attack and defense attributes - for reference, this multiplier is 1.5 for a hero with
5 in each stat and 2 for a hero with 10 in each stat. What happens next differs depending on the result;
if it's greater than or equal to 1 (i.e. the hero's army is stronger than or equal to the enemy stack),
we subtract 1, multiply by 2, and then round down to the nearest whole number. If the hero's army is
weaker than the wandering stack, we get -1, -2, or -3, depending on the severity of the divide.

Next, the game adds any bonuses for Diplomacy and "sympathy". Sympathy is a +1 bonus if the hero's army
contains at least one creature from the wandering stack (base or upgraded verions both qualify) or +2 if
that creature makes up the majority of the hero's army; Diplomacy is a value between 0 (no skill) and 3
(expert). This final value is then compared to the wandering stack's hidden "aggression" value, which is
a number between 1 and 10(*) that's randomly determined when the map is loaded. If the aggression value
is higher, the wandering stack fights; if it's equal to or lower than our other value, we continue.

(*This value is somewhat controllable in the map editor; I'll explain later)

The next thing we do is set the army strength comparison value to 1 (so, just: 1 + Diplomacy + Sympathy)
and check against aggression again. If our number is greater than or equal to aggression, the wandering
stack joins for free, else we run the check a third time with the diplomacy bonus doubled. If the third
check passes, the stack offers to join for gold, else they'll flee. This shows us: A) why most wandering
stacks will just run away if all you do is stack Archangels on your hero and clean house; B) why offers
to join for money don't happen without the Diplomacy skill, and C) just how overpowered Diplomacy is.

The reason I explained all of this in detail is because you have two options for modifying this mechanic
that can be used either individually or together. The first converts all creatures who offer to join you
"for greater glory" (i.e. for free) to paid hires; the second one skips the additional check with double
Diplomacy, effectively causing any creature who would offer to join for money before to flee. If you've
trashed Diplomacy and edited it to remove the Easy-mode bonus, then obviously the second one doesn't do
anything and you only need to consider the first. If, however, you've left Diplomacy in the game, then
I'd strongly suggest either using it or cutting the Diplomacy skill level bonuses (at 23EA38) in half;
both approaches nerf Diplomacy by the same amount, with the former just causing it to make free joiners
more likely and the latter splitting its function so that some of those new joiners will still charge.

----------------------
FREE JOINERS COST GOLD
----------------------
017237 > 03 (was 02)
0A755D > EB (was 7F)

---------------------
PAID JOINERS RUN AWAY
---------------------
017246 > EB (was 7F)
0A75A5 > 11 (was 4A)

Finally, I mentioned earlier that the aggression value for wandering stacks was controllable in the map
editor. When creating a map, each stack has five generic aggression settings, each with its own range of
possible integer values when the map is loaded:

Compliant -4 (static)
Friendly 1..7
Aggressive 1..10!
Hostile 4..10!
Savage 10 (static)

As you can see, anything stack set as "Compliant" will always join since the lowest possible comparison
value we can have -3. This also shows us exactly how unlikely it is for a typical stack to join without
the benefit of either of either Diplomacy or Sympathy - the "!" for aggressive and hostile stack values
denotes a factorial array wherein the higher results are successively more likely to be chosen. In this
case, an "Aggressive" stack has a mere 1/55 chance of rolling an aggression value of 1, which is what we
would need in order for them to join us with no Diplomacy skill or sympathy bonus.

(For Alex - is my interpretation of "1..10!" correct?

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


Responsible
Supreme Hero
posted May 17, 2020 08:47 AM
Edited by AlexSpl at 08:49, 17 May 2020.

Quote:
For Alex - is my interpretation of "1..10!" correct?

Well, here "!" is just an exclamation mark to show that even if you set monsters to be Aggressive or Hostile, there is a small chance (1/10 for Aggressive, and 1/7 for Hostile) that they will never join you, as if they were set to be Savage. All random values from 1..10, and 4..10 are equally probable.


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


Known Hero
posted May 17, 2020 08:52 AM

Aw, damn.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread » This thread is 3 pages long: 1 2 3 · «PREV
Post New Poll †† Post New Topic †† Post New Reply

Page compiled in 0.0704 seconds