Log in

View Full Version : Editing Vices & Virtues



Sinner
08-10-2004, 13:15
Perhaps a little late considering that RTW will (hopefully) be here soon, but I finally got curious about the common problem of favored generals and royalty suddenly becoming inbred and perverts, a cruel outcome for a carefully groomed general.

So with a little bit of mental judo, a hex editor & too much time on my hands I've discovered how to edit V & Vs. So far my method is a bit of a kludge, having to manually search for the hex values of the general's/royalty's V & Vs, then making a change to see that I've found the correct guy.

The hex values for each V & V are fairly easy to work out, starting with Great Warrior with a value of 0100h, Natural Leader is 0400h, Killer Instinct is 0800h, etc. I did it the hard & boring way, editing a single unit again & again until I had the full list, although I believe it follows the same order as the list of V & V descriptions in events.txt.

The first V & V for each general/royalty will generally start at hex address nnn2h, where nnn is the rest of the address, eg. 442h or 1A6D2h. There is a quirk where a prince will instead have his V & Vs start at nnn4h - in these cases I suspect that the value that is at nnn2h is linked to tracking the prince's place in the royal family tree, ie. so the system knows when to make the prince a normal general after a nephew becomes king, dropping the prince from the royal line. There is then space for about a dozen V & Vs, but only the first 10 will be displayed when you view the general, although the others will still have an effect. As an example, if you wanted to go way over the top & have a Legendary Leader/Specialist Attacker/Field Defense Specialist/Specialist Sieger/Unbribable Jedi Master, you'd overwrite the current values with 0700 3600 3900 3C00 8400 starting at address nnn2h.

There is another quirk that I haven't worked out yet where the values 0010h, 0020h or 0030h are added to the hex value of a V & V but it still works correctly, eg. Brave Beyond Belief is normally 2101h, but can occasionally be 2111h, 2121h, etc. I haven't fully investigated, but I would speculate this tracks something like marriage status or maybe the increased/decreased likelyhood of the V & V progressing up the chain, ie. Natural Leader to Legendary Leader - I'm just guessing really, trying to think of possible reasons.

Another oddity is that in the space to add V & Vs, instead of the usual null value of 0000h, you'll occasionally see 0004h. I'm not 100% sure about these values, but I'm beginning to suspect that they're markers for the system to add 'random' vices to that general as some form of 'game balance' when certain triggers are reached in the campaign - of course it could just be that I'm suspicious & paranoid.

As far as I can tell editing V & Vs has immediate effects on most, maybe all, traits except for the definite exception of valour, which is tracked independantly for each warrior in the unit. Command, Piety, Accumen, etc definitely change, but I haven't investigated Happiness, trade income, etc.

I also found how to edit valour & unit type, but it's now lunchtime so that explanation will have to wait... besides that, my boss does expect me to do some work today, which is most inconsiderate of him!

Sinner
08-10-2004, 13:25
Ooops, my bad, I forgot one potentially important bit of information: the file I'm editing. It's maybe obvious, but the file to edit is your campaign savefile.

Oh well, at least I get to say sorry like a proper noob. Should I LOL now????/

cutepuppy
08-10-2004, 15:20
*reading thread*
~:confused: ~:confused: ~:confused: ~:confused: ~:confused:

moderators, can't you promote this guy so he can post in the dungeon??? I think he deserves it.

edit: oh, and welcome to the org.

Sinner
08-10-2004, 20:42
Thanks for the welcome cutepuppy ~:)

OK, just worked out how to edit Loyalty/Influence, Piety, Dread, Command & Accumen, although again it's a real pain to describe, but I'll try my best...

It might be easier if I use a simple example, so here I have a Joms Viking unit with 2 men (created like this as a starting unit in my test campaign's startpos file) at Valour 9 (including Command effects), with the leader having a Loyalty of 3, Piety of 8, Dread of 4, Command of 7 and Acumen of 5 plus the V & Vs of Skilled Risky Attacker (4600h).

Opening up my campaign savefile & searching for the hex value of 4600 - it tends to be easier the more V & Vs you search for or if looking for odd ones like Secret Incest - I find my general & his single subordinate, highlighting the virtue here in bold...

(Address in hex: Data in hex)

C00: FFFF 0700 FE60 0000 00B6 0258 31D3 01B8
C10: B36E 0300 0000 0001 0000 0000 0000 FFFF
C20: FFFF 5E00 0000 0000 0000 FFFF FFFF 0000
C30: 0903 0100 1101 0000 E700 0000 002A 5F00
C40: 0000 5E00 0000 0000 0000 6100 0000 8000
C50: 0603 0300 5408 0000 E700 0140 002A FFFF
C60: FFFF 4600 0004 0000 0000 0000 0000 0000

OK, here we go... ~:)

I want my general to be more loyal, so I want to up his Loyalty from 3 to 6. The loyalty is held at the address 10h less than the start of the general's V & Vs, in this case here...

C50: 0603 0300 5408 0000 E700 0140 002A FFFF

To give him the required loyalty I change the 3 to a 6...

C50: 0603 0600 5408 0000 E700 0140 002A FFFF

I also want my general to be a more imposing, less pious thug, although I'm happy with his smarts. Acumen, Dread & Piety are held as a composite value with the format of AD0Ph where A, D & P are the appropriate traits, so for my general with Piety of 8, Dread of 4 and Acumen of 5 the value is 5408h...

C50: 0603 0600 5408 0000 E700 0140 002A FFFF

I think I prefer a Piety of 3 & a Dread of 7, so my edited file now reads...

C50: 0603 0600 5703 0000 E700 0140 002A FFFF

Next, I want to give him Command 8, so that I have the maximum bonus but still have something to aim for during play. Command is held as the number of victorious battles, with 32 wins (hex 20h) for Command 6, 64 wins (hex 40h) for Command 7, etc. My general has won 64 battles so far & I need to change that to 128 (hex 80h).

C50: 0603 0600 5703 0000 E700 0140 002A FFFF becomes...

C50: 0603 0600 5703 0000 E700 0180 002A FFFF

OK, now on to Valour, which is similar to Command, but tracks kills instead of victories - so Valour 4 requires 8 kills (hex 8h). Valour is normally a real pain since every warrior has it tracked seperately, but since I only have a 2-man unit in my example it's not difficult to demonstrate...

C00: FFFF 0700 FE60 0000 00B6 0258 31D3 01B8
C10: B36E 0300 0000 0001 0000 0000 0000 FFFF
C20: FFFF 5E00 0000 0000 0000 FFFF FFFF 0000
C30: 0903 0100 1101 0000 E700 0000 002A 5F00
C40: 0000 5E00 0000 0000 0000 6100 0000 8000
C50: 0603 0600 5703 0000 E700 0180 002A FFFF
C60: FFFF 4600 0004 0000 0000 0000 0000 0000

In this case the subordinate has 0 kills & the general has 128 kills, giving an average of 64 kills or Valour 7. Adding in the Command bonus Valour this gives the unit a Valour of 10, although it only displays as 9 on the campaign map. Feeling moderately evil, I decide that I want both a Jedi general and his Padawan, so I'll edit them to Valour 16 & 10 respectively (32768 & 512 kills), giving an average unit Valour of 15 before Command effects.

C00: FFFF 0700 FE60 0000 00B6 0258 31D3 01B8
C10: B36E 0300 0000 0001 0000 0000 0000 FFFF
C20: FFFF 5E00 0000 0000 0000 FFFF FFFF 0002
C30: 0903 0100 1101 0000 E700 0000 002A 5F00
C40: 0000 5E00 0000 0000 0000 6100 0000 0080
C50: 0603 0600 5703 0000 E700 0180 002A FFFF
C60: FFFF 4600 0004 0000 0000 0000 0000 0000

Next on to V & Vs, where this all started...

I don't want the Skilled Risky Attacker so that can go, being replaced with Legendary Leader (which will raise his loyalty from 6 to 9), Expert Sieger, Unbribable & Charismatic Leader, or 0700h, 3C00h, 8400h & 2101h respectively (Note: In my first post I said the value for Brave Beyond Belief was 2101h, but I'd mis-remembered, it's actually 2A01h)

I need to edit this...

C60: FFFF 4600 0004 0000 0000 0000 0000 0000

to this...

C60: FFFF 0700 3C00 8400 2101 0000 0000 0000

Note that I overwrote both the Skilled Risky Attacker and that odd value of 0004h that I mentioned in my first post. There doesn't seem to be any effect in doing this & since I'm paranoid I want it gone.

Finally ("At last!" you gasp) I'm going to change the unit from Joms Vikings to Viking Huscarles. The value can easily be found from the unit production file for the campaign, being the row number: Joms Vikings are on the 182nd row (hex B6h) & Viking Huscarles are the 177th row (hex B1h).

Before change...

C00: FFFF 0700 FE60 0000 00B6 0258 31D3 01B8

After change...

C00: FFFF 0700 FE60 0000 00B1 0258 31D3 01B8

So my final data looks like this, with all changes highlighted...

C00: FFFF 0700 FE60 0000 00B1 0258 31D3 01B8
C10: B36E 0300 0000 0001 0000 0000 0000 FFFF
C20: FFFF 5E00 0000 0000 0000 FFFF FFFF 0002
C30: 0903 0100 1101 0000 E700 0000 002A 5F00
C40: 0000 5E00 0000 0000 0000 6100 0000 0080
C50: 0603 0600 5703 0000 E700 0180 002A FFFF
C60: FFFF 0700 3C00 8400 2101 0000 0000 0000

The end result giving me a unit of 2 Viking Huscarles with a battlefield Valour of 19 (displays 9 on the campaign map), led by a general with Loyalty 9, Piety 3, Dread 7, Command 8 & Acumen 5 including all V & V effects, with the virtues of Legendary Leader, Expert Sieger, Unbribable & Charismatic Leader - he also knits socks in his spare time. ~:)

A King's stats work in a slightly similar way, but their details aren't held with bodyguard unit, just to make life more exciting. The lines of data with the king's Influence, Piety, Valour, etc are also seperate from his V & Vs. For example the Viking king's stats are held as follows in my test campaign:

120h: 0000 2100 0000 0000 0000 2000 0000 0400 (Valour 3)
130h: F702 0400 3102 0000 E700 0301 002A FFFF (
Influence 4, Acumen 3, Dread 1, Piety 2, Command 1)

440h: FFFF 9900 0000 0000 0000 0000 0000 0000 (Magnificent Steward)

You can come out from behind the couch now, I've finished. ~:p

Sinner
08-10-2004, 23:58
A last addition for the day: Attack, Armour & Morale bonuses from buildings...

Using my previous example again, I've highlighted the appropriate field:

C00: FFFF 0700 FE60 0000 00B1 0258 31D3 01B8
C10: B36E 0300 0000 0001 0000 0000 0000 FFFF
C20: FFFF 5E00 0000 0000 0000 FFFF FFFF 0002
C30: 0903 0100 1101 0000 E700 0000 002A 5F00
C40: 0000 5E00 0000 0000 0000 6100 0000 0080
C50: 0603 0600 5703 0000 E700 0180 002A FFFF
C60: FFFF 0700 3C00 8400 2101 0000 0000 0000

The Armour values run from 01h to 04h for a +1 to +4 bonus.
The Attack values are 08h, 10h, 18h & 24h for a +1 to +4 bonus.
The Morale values are 40h, 80h & C0h for a +1 to +3 bonus.

To work out the value for a particular combination of bonuses, simply add them together, so +3 Armour, +1 Attack & +2 Morale would be 03h + 08h + 80h giving 8Bh...

C00: FFFF 078B FE60 0000 00B1 0258 31D3 01B8
C10: B36E 0300 0000 0001 0000 0000 0000 FFFF
C20: FFFF 5E00 0000 0000 0000 FFFF FFFF 0002
C30: 0903 0100 1101 0000 E700 0000 002A 5F00
C40: 0000 5E00 0000 0000 0000 6100 0000 0080
C50: 0603 0600 5703 0000 E700 0180 002A FFFF
C60: FFFF 0700 3C00 8400 2101 0000 0000 0000

HicRic
08-11-2004, 10:37
That really is rather impressive. Great job, it must have taken an age of trial and error to work out which values where what! (Unless there's a more cunning tactic?)

Very nice work. Now anyone wishing to create the ultimate unit in SP can frolic in hex to their heart's content. ~D

Perhaps we can put this somewhere as a guide/sticky, dear moderators?

Sinner
08-11-2004, 15:27
No cunning trick I'm afraid, just a systematic & tedious process of making single changes & observing the effects on a modified Viking campaign with no starting buildings, agents or heirs, placing only the Viking king and my experimental unit, leaving the savefile as clutterfree as possible. The heroes file was the key to cracking the problem, making it easy to make traceable changes.

Sinner
08-15-2004, 16:36
The Attack values are 08h, 10h, 18h & 24h for a +1 to +4 bonus.


Oops, my bad, spotted a mistake... that should be 08h, 10h, 18h & 20h for +1 to +4 attack respectively. ~:0

Spartiate
08-15-2004, 21:09
You can't see it from where you are but i'm actually saluting you.Excellent work.I tried the hex edit thing at one stage(with no success) but i never thought of modifying the game to be clutter free.All the great ideas...............

Seven.the.Hun
08-17-2004, 12:17
wow, definetly tedious stuff, 'brain cracks open...spilling the cereal'
great stuff
congrats

~:cheers:

Sinner
08-17-2004, 15:12
Glad you're enjoying it. ~:)

As a further addition, it does get more (!!!!) complex as a campaign progresses or when using units larger than just 2 men. I've come across one false assumption I initially had: a general's Loyalty, Acumen, Dread, etc doesn't always appear the line before his Vices & Virtues, so it can make it more difficult to edit a particular unit.

You can search seperately for a general's V & Vs and the composite Acumen, Dread & Piety value, although this can also be a problem: you must take into account the effects of any V & Vs on those stats plus even though it may appear the general has a value of 9 in any particular trait, he may actually have a value of 10 (or hex A), so you sometimes have to search for a few different values. With no V & Vs to worry about, for a general that apparently has 9 in all 3 traits, you'd have to look for 9909h, 990Ah, 9A09h, 9A0Ah, A909h, A90Ah, AA09h & AA0Ah to be certain of finding his stats. Add in V & Vs and it only gets worse. I haven't come across a value of 11 yet (hex B), but it might occur.

I also found the value that holds the general's/royal's age:

C50: 0603 0600 5703 0000 E700 0180 002A FFFF

306h is 774, the year my test hero general was born.

130: F702 0400 3102 0000 E700 0301 002A FFFF

My example king was born in 759 (hex 2F7h).

Surprisingly enough, age is then calculated from there! ~:)

I vaguely recall from similar hex editing on STW how a unit is linked together, since it's possible that they might all be scattered individually through the 'misc chunk' section of the savefile. As I recall each soldier had an address that pointed either at the next one in the unit, or a unit header or the leader... one of those three, but it's been too long to be certain now. I'll do some tinkering this week & see what I find.

I found the field that holds the general's name but I haven't determined quite how that works yet and I'm similarly stuck on ships' captains - I can edit a ship type, even giving them stats beyond what they should have, but I can't yet edit the Command rating.

Hopefully I'll soon have enough worked out to be able to develop an editor & remove the grunt work, but once RTW comes out then MTW will be quickly forgotten I'm afraid.