Leaders in herodata.lbx and save game

Information, How-to's, and discussion about mod'ing Master of Orion II.
User avatar
Lord Brazen
Site Admin
Posts:162
Joined:Mon Jul 18, 2005 10:16 pm
Location:Toronto, Canada
Contact:
Leaders in herodata.lbx and save game

Postby Lord Brazen » Sun Sep 04, 2005 9:50 pm

Here is the info stored in herodata.lbx for those that would like to modify the heros. There are 67 heros in total. The format of the hero data is also the same in the save game but at a different offset. The values in herodata.lbx represent starting values and the ones in the save game are current values.

Code: Select all

At file offset 0x804 in herodata.lbx is an array of hero data. Each hero element is 0x3B bytes long and in the following stucture (all offsets in hex): offset value 00-0E Leaders Name (null terminated string) 0F-22 Leaders Title (null terminated string) 23 Leader type (0 = Ship Officer, 1 = Colony Leader) 24-25 Experience (lo/hi) 26-29 Common Skills flags(same for both ship officers and colony leaders) Assasin (bit 0) Assasin* (bit 1) Commando (bit 2) Commando* (bit 3) Diplomat (bit 4) Diplomat* (bit 5) Famous (bit 6) Famous* (bit 7) Megawealth (bit 8) Megawealth* (bit 9) Operations (bit 10) Operations* (bit 11) Researcher (bit 12) Researcher* (bit 13) Spy Master (bit 14) Spy Master* (bit 15) Telepath (bit 16) Telepath* (bit 17) Trader (bit 18) Trader* (bit 19) 2A-2D Special Skills (different for ship officers and colony leaders) For Ship Officer ---------------- Engineer (bit 0) Engineer* (bit 1) Fighter Pilot (bit 2) Fighter Pilot* (bit 3) Galactic Lore (bit 4) Galactic Lore* (bit 5) Helmsman (bit 6) Helmsman* (bit 7) Navigator (bit 8) Navigator* (bit 9) Ordinance (bit 10) Ordinance* (bit 11) Security (bit 12) Security* (bit 13) Weaponry (bit 14) Weaponry* (bit 15) For Colony leader ----------------- Environmentalist (bit 0) Environmentalist* (bit 1) Farming Leader (bit 2) Farming Leader* (bit 3) Financial Leader (bit 4) Financial Leader* (bit 5) Instructor (bit 6) Instructor* (bit 7) Labor Leader (bit 8) Labor Leader* (bit 9) Medicine (bit 10) Medicine* (bit 11) Science Leader (bit 12) Science Leader* (bit 13) Spiritual Leader (bit 14) Spiritual Leader* (bit 15) Tactics (bit 16) Tactics* (bit 17) 2E-30 Array of tech numbers (up to 3 free techs, 0=none) 31 Picture number 32-3C unknown The same array appears in the save game at offset 0x19A9B. For 67 leaders in total.
Also, for the leader technologies use the values in the Technology table
Last edited by Lord Brazen on Sat Sep 30, 2006 11:04 am, edited 1 time in total.
"Stars are holes in the sky from which the light of the Infinite shine through." - Confucius.

User avatar
siron
Posts:504
Joined:Fri Jul 22, 2005 12:35 pm
Location:Hamburg
Contact:

Postby siron » Mon Sep 05, 2005 7:04 am

Thanks for all your posts in this area here.

Especially this thread is interesting for me. I guess I will power up the useless Cyr a bit in the next mod.

ChefKoch
Posts:12
Joined:Tue Nov 15, 2005 8:58 am
Location:Wiesbaden / Germany
Contact:

Postby ChefKoch » Thu Nov 17, 2005 5:23 am

Ok, this sounds not very difficult to change values.

So I only need a hex editor to make modifications on the leaders?
And how do I set the skill flags? I don't think I get that right... :?

owenja
Posts:1
Joined:Tue May 02, 2006 4:23 pm
Contact:

Postby owenja » Tue May 02, 2006 5:25 pm

Nice work on the three technology bytes near the end, that was the only part I wasn't able to figure out.

For the rest, I got slightly different results in some parts. Perhaps we are using different versions of the game? I have version 1.31 of the PC game.

What you would call bit 20 in the common abilities seems to be the flag to generate a set of random non-admin (ie, ship officer) abilities, and bit 18 of the colony leader abilities is the random admin flag. I don't know why they're in such different places.

I found the experience short to be after the colony bool, bytes 0x24 (lo) and 0x25 (high). As a result, the common abilities start at byte 0x26. I found a null (always 0) byte at the end of the common abilities, 0x29; another null at the end of the type-specific abilities, 0x2D.

The tech numbers were bytes 0x2E - 0x30 for me. They were followed by the hero id / picture number (0x31), as for you, but after that I found 3 nulls, 2 -1's (ie, 11111111b), 2 nulls, and 2 -1's. The pair pattern, combined with the fact that the number of heroes at the start of the file is two bytes, leads me to believe that the hero ID / picture number is two bytes, not one.

Here's my notes for what I found, all in all. I have a more cleaned up version on my website.

Code: Select all

Hero Entry (59 bytes per hero) ------------------------------ 0-E 15 name (null terminated) F-22 20 title (null terminated) 23 01 colony leader (bool; false = ship leader, true = colony leader) 24-25 02 starting experience 26 01 beginning of abilities &1 Assassin +2 &2 Spy Master &4 Commando +2 &8 Commando* +3 &16 Diplomat &32 Diplomat* &64 Famous -60 &128 Famous* -90 27 01 more abilities... &1 Megawealth &2 Megawealth*? nobody matches &4 Operations +2 &8 Operations* +3 &16 Researcher +5 &32 Researcher* +7.5 &64 Spy Master +2 &128 Spy Master* +3 28 01 more abilities... &1 Telepath +2 &2 Telepath* +3 &4 Trader +10 &8 Trader* +15 &16 Random Non-Admin abilities &32 nothing? nobody matches &64 nothing? nobody matches &128 nothing? nobody matches 29 01 null 2A 01 abilities, specific to captains & governors Captain Governor &1 Engineer +2 Environmentalist -10 &2 Engineer* +3 Environmentalist* -15 &4 Fighter Pilot +5 Farming Leader +10 &8 Fighter Pilot +7.5 Farming Leader +15 &16 Galactic Lore +5(?) Financial +10 &32 Galactic Lore* +7.5 Financial +15 &64 Helmsman +5 Instructor +1 &128 Helmsman +7.5 Instructor +1.5 2B 01 ... &1 Navigator +1 Labor +10 &2 Navigator* +1 (?) Labor +15 &4 Ordnance +5 Medicine +10 (?) &8 Ordnance* +7.5 Medicine* +15 &16 Security +2 Science +10 &32 Security* +3 Science* +15 &64 Weapons +5 Spiritual +10 &128 Weapons* +7.5 Spiritual* +15 2C 01 ... &1 nothing Tactics +6 &2 nothing Tactics* +9 &4 nothing Random Admin Abilities &8 nothing nothing &16 nothing nothing &32 nothing nothing &64 nothing nothing &128 nothing nothing 2D 01 null 2E-30 03 Free techs 1, 2, and 3 31-32 02 Hero ID 33-34 02 null 35-36 02 -1 (11111111b) 37-38 02 null 39-3A 02 -1 (11111111b)

User avatar
Grig de Griz
Posts:48
Joined:Mon Sep 26, 2005 12:23 am
Location:Russia

Postby Grig de Griz » Wed May 03, 2006 2:12 am

Lord Brazen's post include a little errors. I give a part from my manual from MoO2 Workshop (see here), copy as is. It work on all MoO2 version.

Leaders Information Files Format

Introduction

File with information about the leaders is packed in archive "HERODATA.LBX". About packing data in LBX archives see section "Format of LBX Archives".

Code: Select all

--------------------------------------------------------------------- ! All lengths are indicated in bytes. ---------------------------------------------------------------------
File Header of Leaders Information

Code: Select all

--------------------------------------------------------------------- Offset | Length | Value --------------------------------------------------------------------- 00h: | 2 | Number of records with the information on specified | leader. 02h: | 2 | Size of leader record. 59 bytes (3Bh). 04h: | 59 | First record with information on leader. ---------------------------------------------------------------------
Leaders Information Record Format

Code: Select all

--------------------------------------------------------------------- ! Offsets are counted from a beginning of record, instead of from a beginning of file. ---------------------------------------------------------------------

Code: Select all

--------------------------------------------------------------------- Offset | Length | Value --------------------------------------------------------------------- 00h: | 15 | Name of leader. Null-termination string. --------------------------------------------------------------------- 0Fh: | 19 | "History" of leader. Null-termination string. --------------------------------------------------------------------- 23h: | 1 | Type of leader: | | 00h - Ship Officer | | 01h - Colony Leader --------------------------------------------------------------------- 24h: | 2 | Initial experience of leader. --------------------------------------------------------------------- 26h: | 1 | Specifies a set of bit flags that determine the | | leader skills: | | 00000001b Assassin | | 00000010b Assassin* | | 00000100b Commando | | 00001000b Commando* | | 00010000b Diplomat | | 00100000b Diplomat* | | 01000000b Famous | | 10000000b Famous* --------------------------------------------------------------------- 27h: | 1 | Specifies a set of bit flags that determine the | | leader skills: | | 00000001b Megawealth | | 00000010b Megawealth* | | 00000100b Operations | | 00001000b Operations* | | 00010000b Researcher | | 00100000b Researcher* | | 01000000b Spy Master | | 10000000b Spy Master* --------------------------------------------------------------------- 28h: | 1 | Specifies a set of bit flags that determine the | | leader skills: | | 00000001b Telepath | | 00000010b Telepath* | | 00000100b Trader | | 00001000b Trader* | | 00010000b Random skill for Ship Officer | | 00100000b no used | | 01000000b no used | | 10000000b no used --------------------------------------------------------------------- 29h: | 1 | No used. Must be zero. --------------------------------------------------------------------- 2Ah: | 1 | Specifies a set of bit flags that determine the | | leader skills: | | Ship Officer Colony Leader | | 00000001b Engineer Environmentalist | | 00000010b Engineer* Environmentalist* | | 00000100b Fighter Pilot Farming Leader | | 00001000b Fighter Pilot* Farming Leader* | | 00010000b Galactic Lore Financial | | 00100000b Galactic Lore* Financial* | | 01000000b Helmsman Instructor | | 10000000b Helmsman* Instructor* --------------------------------------------------------------------- 2Bh: | 1 | Specifies a set of bit flags that determine the | | leader skills: | | Ship Officer Colony Leader | | 00000001b Navigator Labor Leader | | 00000010b Navigator* Labor Leader* | | 00000100b Ordnance Medicine | | 00001000b Ordnance* Medicine* | | 00010000b Security Science Leader | | 00100000b Security* Science Leader* | | 01000000b Weaponry Spiritual Leader | | 10000000b Weaponry* Spiritual Leader* --------------------------------------------------------------------- 2Ch: | 1 | Specifies a set of bit flags that determine the | | leader skills: | | Ship Officer Colony Leader | | 00000001b no used Tactics | | 00000010b no used Tactics* | | 00000100b no used Random skill for Colony Leader | | 00001000b no used no used | | 00010000b no used no used | | 00100000b no used no used | | 01000000b no used no used | | 10000000b no used no used --------------------------------------------------------------------- 2Dh: | 1 | No used. Must be zero. --------------------------------------------------------------------- 2Eh: | 1 | Code of the first technology, which brought by | | leader. --------------------------------------------------------------------- 2Fh: | 1 | Code of the second technology, which brought by | | leader. --------------------------------------------------------------------- 30h: | 1 | Code of thirds of technology, which brought by | | leader. --------------------------------------------------------------------- 31h: | 2 | Identifier of the leader. Coincides with order | number of leader record. --------------------------------------------------------------------- 33h: | 8 | (00 00 FF FF 00 00 FF FF) | | Constant. Probably end mark of record. ---------------------------------------------------------------------
Comment

About Codes of Technologies. See section "Codes of Technologies".

Ranks and Leaders Skills Values

The values of skills (SkillValue) are not constants and are calculated depending on a leaders level of experience (ExpLevel) and specified skill.

Code: Select all

---------------------------------------------------------------- Level of Exp. | Experience | Ship Officer | Colony Leader ---------------------------------------------------------------- 1 | from 0 to 60 | Commander | Administrator 2 | from 60 to 150 | Captain | Director 3 | from 150 to 300 | Commodore | Magistrate 4 | from 300 to 1000 | Rear Admiral | Commissioner 5 | from 1000 to 2000 | Admiral | Governor 6 | from 2000 and up | Lord Admiral | Lord ---------------------------------------------------------------- ------------------------------------------------------------------------ Skill | Example on Pascal; Description ------------------------------------------------------------------------ Instructor | SkillValue := Round(0.7 * ExpLevel); Navigator | The rounded off product 0.7 and level of experience. ------------------------------------------------------------------------ Instructor* | SkillValue := Round(1.1 * ExpLevel); Navigator* | The rounded off product 1.1 and level of experience. ------------------------------------------------------------------------ Assassin | SkillValue := 2 * ExpLevel; Commando | Product 2 and level of experience. Engineer | Operations | Security | Spy Master | Telepath | ------------------------------------------------------------------------ Assassin* | SkillValue := 3 * ExpLevel; Commando* | Product 3 and level of experience. Engineer* | Operations* | Security* | Spy Master* | Telepath* | ------------------------------------------------------------------------ Fighter Pilot | SkillValue := 5 * ExpLevel; Galactic Lore | Product 5 and level of experience. Helmsman | Ordnance | Researcher | Weaponry | ------------------------------------------------------------------------ Tactics | SkillValue := 6 * ExpLevel; | Product 6 and level of experience. ------------------------------------------------------------------------ Fighter Pilot* | SkillValue := Int(7.5 * ExpLevel); Galactic Lore* | Only whole part product 7.5 and level of experience. Helmsman* | Ordnance* | Researcher* | Weaponry* | ------------------------------------------------------------------------ Tactics* | SkillValue := 9 * ExpLevel; | Product 9 and level of experience. ------------------------------------------------------------------------ Diplomat | SkillValue := 10 * ExpLevel; Environmentalist | Product 10 and level of experience. Farming Leader | Financial Leader | Labor Leader | Medicine | Megawealth | Science Leader | Spiritual Leader | Trader | ------------------------------------------------------------------------ Diplomat* | SkillValue := 15 * ExpLevel; Environmentalist* | Product 15 and level of experience. Farming Leader* | Financial Leader* | Labor Leader* | Medicine* | Megawealth* | Science Leader* | Spiritual Leader* | Trader* | ------------------------------------------------------------------------ Famous | SkillValue := 60 * ExpLevel; | Product 60 and level of experience. ------------------------------------------------------------------------ Famous* | SkillValue := 90 * ExpLevel; | Product 90 and level of experience. ------------------------------------------------------------------------

User avatar
Lord Brazen
Site Admin
Posts:162
Joined:Mon Jul 18, 2005 10:16 pm
Location:Toronto, Canada
Contact:

Postby Lord Brazen » Thu May 18, 2006 4:20 pm

Lord Brazen's post include a little errors.
You guys are right. Mine is how the leaders are stored in memory. I think this is actually how it is stored in the save game also. It is definately not the same as in the herodata.lbx file.
"Stars are holes in the sky from which the light of the Infinite shine through." - Confucius.

User avatar
Zieman
Posts:29
Joined:Thu Jul 13, 2006 6:00 am
Location:Finland

Postby Zieman » Mon Aug 07, 2006 3:01 am

The bit flags are 8 bit bytes, hex editors show usually their hexadecimal and ascii values.

Code: Select all

00000001b = 01h 00000010b = 02h 00000100b = 04h 00001000b = 08h 00010000b = 10h 00100000b = 20h 01000000b = 40h 10000000b = 80h
The logic stays the same, and combining properties is simple adding of hex values.
i.e.

Code: Select all

01010110b = 56h 10101001b = A9h
etc.
No skill, no knowledge - but lots of LUCK!!!

User avatar
Danakin Turner
Posts:2
Joined:Sat Sep 30, 2006 12:25 am
Location:Kholden
Contact:

Postby Danakin Turner » Sun Oct 01, 2006 11:08 am

Looking at my old files... the two offsets stored in the savegame and obviously in memory are marked for me as ship/planet id and player. So if you want a leader in the officer pool set it to zero (for save game editing).

I know that isn't much help here but I figured it might be good to get a full set of offsets. It was about 3 or more years ago I did this work so I am just going from my UGE descriptions.

EDIT:
Actually looking at this a bit more the second last variable offset is used for the time in the officer pool I think, (if they aren't currently purchased) and then the last one is who's officer pool they are waiting in. I think a few offsets before that is where the location of the officer is stored. I never figured that one out for sure though... sorry. (Also note this is only for savegame editing, it most likely isn't in the lbx data.)


Return to “Game Modifications”

Who is online

Users browsing this forum: No registered users and 35 guests