Kingdom Under Fire: Heroes

Kingdom Under Fire: Heroes

Not enough ratings
.stg Guide - Advanced Version - Heroes Edition
By 復活した黒 and 1 collaborators
Talks about Briefing and advanced Troop Block editing.
   
Award
Favorite
Favorited
Unfavorite
Introduction
Welcome to the second part of the Guide Series. For this guide we will need again a Hexeditor, a Hex converter and this time a bit more of our braincells.

Things this Guide takes a look at:
  • Part One - Briefing, adding Unit slots to a Mission.
  • Part Two - Advanced Troop Block editing
Briefing - Adding Units you can take into a Mission
In the Beginner Guide we learned how to add Units. How about we adjust them, so we can fill them with Units from our Barracks?

For this example, we will take 0010, Ellens second Mission. First of all, we need to make 4 new Units, so I copy Ellens Block for that Mission, as we receive a Archer Unit during that Mission, we do not want it to go to 7 Units in a Mission, as they are normally not "controllable". They will appear on the field like normal, but you cannot move one of your other units for some odd reason. If you want to edit the same Mission, it advised to use my Ellen Unlocker and any Starter Mod that gives Gold, so we can buy some Pub Merchs from the beginning. Anyway we copy the Block:


And paste it at the end 4 Times. Next, I look at the last Unit before our new ones for the Unique ID, since we don't want any duplicates.


Okay, so this Troop has a 50, meaning our 4 new will be 51, 52, 53 and 54 for unique ID's. Here is a Tip if you want to find those 4 Troops faster. The first 32 Bytes of a Troop Block can be changed freely to anything you want. So we can find them by just searching for anything you entered there if we want to do some bug fixing. For Example:


Of course, like in our Beginner Guide you can also use those bytes to give the Troop a Special Name it will have througout the Mission. But, well here I just entered some example Text and changed the Unique ID to 51. This however isn't everything. There is a interesting case where Troops with a Leader that has a Animation+Model set still appears, even if you do not choose a troop to fill that Slot. In order to prevent this, we want to 00 that and also remove the Officers (Since we copied Ellen, there are naturally some set). We can however keep the Troop Animation and Troopinfo at whatever we want, since that will be overwritten by the Unit that fills the slot anyway.


This would be a full edit for this one. I set a Unique ID, edited the "Is Hero" Bool, set the Animation and Model for the Leader to 00 and removed all Officers. With this, the Troop will not appear in our Mission if we do not fill the Slot in Briefing. We want to do the same now for our other 3:


And we want to tell the game we got 4 new Blocks:


And with that our preparation is complete. Now we only need to tell the game that we can fill those on the pre-mission screen. We want to open 0010.stg at:
data/Mission/Briefing


The Beginning might look familiar, as Mission and Briefing share the same Header and Info up to a certain Point. The part we want is at the very bottom of the File:


This marked area tells the game to move to the Unit Selection screen and also tells it how many units and which Unique ID's are choosable, which are locked, which are special or have an Icon or if it's a Support Troop. First of all, we want to edit the 01 to 05. We also want to include new Bytes after the 2 FF Bytes:
00000000FFFFFFFF


We want to paste that 3 more times:


Let's talk about what this is for. FE01 is a Act(Action), that tells the game to go to the Selection Screen. Actions pretty much do everything in a Mission - Cutscenes, AI, Text displayed and so much more. It's pretty much the core of the game, that we will talk about in the expert Guide. When in doubt, always look for the FE01 in Briefing, so you know when the Selection Screen starts. The 05 is for Number of Units choosable by the Player. If we left it at 1, we wouldn't be able to select anything, even if we did set Bytes like we did now. Now, what are the new Bytes we pasted for?
Simply put, the Structure is in this Byte Array:
00 00 00 00 FF FF 00 00
00 00 FF FF FF FF 00 00
00 00 FF FF FF FF 00 00
00 00 FF FF FF FF 00 00
00 00 FF FF FF FF 00 00
The last 4 are the ones we pasted+the 00 that is not edited in my screenshot at the very end. The only one that is different is the first one and that is because it's set for the Hero, or rather always has to be set like that. Let's break it down with the Heroes Bytes:
00 - Unique ID - Same as the data/Mission ID
00 - Nothing
00 - Special ID - Can set a special Icon for example or Special Names in Briefing
00 - Special Icon - Sets the Icon for the Special ID
FF - Nothing
FF - Nothing
00 - Is Support (00 - No, 01 - Yes)
00 - Is Locked (00 - Yes, 01 - No)
Since it's a topic that's not really needed, I will leave the Special ID+Icon alone in this Guide. There isn't a Mission that uses this in Heroes anyways, apart from the Hero Unit. Since I want the new Troops Slots to be Infantry and not Support, I will leave those at 00, but I want them unlocked, so we can actually choose something to fill the Slot. So, with this in mind, I do the Following edits:


And that's it! We don't have to set anything else and can save this and test it ingame.



This concludes Part 1.
Advanced Troop Block Editing - Intro
Alright, so now that we got that down, we can work a bit more on Troop Blocks. Those of you who played The Crusaders probably remember how tanky Hugh and Regnier were during their clash, or during Ellen's first Mission, the Orc Troop seemed alot faster than usual. Maybe even during Ellen's second Mission where the Archers on the hill had unusually high range. You might even remember that you receive the Max possible amount of EXP when you "kill" Regnier during Geralds campaign or how certain units seem to shred you with some huge amount of damage.

This will be the topic for this one. It will also include: SP the Hero has, positional data on the map and Equipment.

We will need a float converter, especially since the game stores this data as Little Endian.

For some quick conversion, I recommend this one (cant convert entered decimal into float however): https://www.scadacore.com/tools/programming-calculators/online-hex-converter/

Or take this chance and learn a little bit of Python (not hard if you only learn how to do some simple conversions on console)

Let's start with Hero SP and Enemy EXP.
Advanced Troop Block Editing - SP, EXP and Enemy/Ally
Let's start with SP. Due to a change in Heroes, this will be mostly useless, as Barracks SP will override the stg SP. However, if you make a Mission from scratch, it will be helpful to know how to change it, because if it's set to -1 you will have 0 SP. (If you have this Mission replace the first Mission of any campaign that is.)

Since SP changes are only reflected in the first Mission of any Campaign and wont get carried over to the Barracks, we will take 0000.stg for this example.


For better representation I changed the SP to -1 (00 00 80 BF in float = -1). This is were SP will be set for Ellen. Since Ellen does not have any form of Barracks entry yet, as it is her first Mission, her SP will default to 0 in this Mission. Since only the Hero Unit will benefit of this change, the SP you want to change will always be at that offset, unless you make a Mission from scratch and put the Hero at another place. For a test, let's change her default 00 00 CD 43 (410) to 00 00 CD 45 (6560).


Save that and let's check her in the game:


There we go.



Next up is the EXP of a Troop. For some representation again, I will edit Ellens Block first, then the Orc Troops Block, as it will be easier to follow.


Here we have the EXP of Ellen. You will notice right away, that below that is the 00 00 CD 45 we just made for SP. And if we look at the Troop below Ellen:


You will see that I marked the 80BF block before another 80BF. Remember when I said that only Heroes can uitilize SP? That's why any Unit apart from the Hero will have it's SP at -1 float.

But before I continue, let's talk about why I know this is the Enemy Orc Unit in the first Place.


Here we are at the marked spot we had in the Beginner Guide. The first line at 0x0460 is from Ellen with the 80BF. The new Troop starts at 0x0470 with its SpecialNames.sox entry or just a description with 32 Bytes. Then the marked spot starts with the Unique ID that takes 4 Bytes. After that:
02 - Enemy
00 - Is Hero?
00 - Is Enabled?
00 - Dunno
But wait, there are Missions, like Custom, that have all Enemy with a 01. Or even wider variations, so how do we know that this is the correct thing? Well, Vanilla will mostly have the 3 standard things:
00 - Player Unit (Always 00)
01 - Ally (In Custom Enemy, as Allies are disabled there normally)
02 - Enemy
This will be true for almost any Mission, except for the Mission that have:
Neutral (Violet, like Rithrin or the Orc Cav Rider)
Infighting of Enemy, also called Enemy of All.

Of course it is possible to change settings to suit your needs, but this is something we will learn at the Expert Guide, especially since that one will feature on how to create a Mission.

Back to topic, just keep the 3 standards in mind. On missions where you usually meet the non-standard things like Neutral and Enemy of All, the things can be shuffled around. But the Player, Ally and Enemy do not change except for one mission and Unknown/Custom.

Since we know that this is an Enemy, how about we change it's EXP?


Here we go, we set the EXP to 10000000 with this. Once we defeat the Enemy we will have some really good EXP. But one problem with this is the Cap. You see, each Troop has a Max Cap that gets increased/decreased by the Level Gap. If you really want the full amount of EXP, it is a good idea to:
a) Change the Level of the Unit to a higher one than your Hero. Best is a 20 Level gap.
b) If it's a EXP pig (not to kill you, just to give you or the player EXP), then also give the Troop a low melee skill.


With this edit we are guarenteed that Ellen will receive 7000 EXP by just killing 1 Orc unit in the Troop. The only problem with this is that the Orc Unit will have the HP of a level 50 Unit. It wont do much damage at all, but will be tanky as hell. Since we edited the EXP, we will talk about some Extra stats that will kill the unit faster in the next Section.
Advanced Troop Block Editing - Extra Stats
Before we go into this topic, I've made a structure overview for this:

struct TroopExtraStat { float Movementspeed; float Rotationrate; float MoveAcceleration; float MoveDeceleration; float SightRange; // How far the Character can look float AttackRangeMax; float AttackRangeMin; float AttackFrontalRange; // Axe Orcs, Spearman, Riders, Storm Riders float DirectDamage; // If too high will cause passive damage (not hitting = they still get damaged) float IndirectDamage; // Ranged/Frontal float Defense; // Does not seem to work correctly float Width; float MeleeRes; float RangedRes; float ExplosionRes; float FrontalRes; float FireRes; float LightningRes; float IceRes; float HolyRes; float PoisonRes; float CurseRes; };

Now then, what are those "Extra Stats"? Each Troop Block will have 22 bytes of those at the end, just like Ellen here:


A nice thing to know is that those changes we make here do not carry over. Meaning even if we give our Ellen 5000 Extra damage, she wont have that on her next Mission.

Normally, every stat from above will be loaded in with default stats from the TroopInfo.sox, however, .stg can alter them to make a unit much more tanky or squishy for example. If you remember the fight between Regnier and Hugh, this is where the devs set the stats to make them tanky. Anyway, there is some stuff to know for each of these:
Resistances - Have a base of 1.0, which is 0 resist. Going to 2.0 would make the res go into minus, while 0 would make it go into plus. So basicly:
1.0 = 0 Resistance
2.0 = -100 Resistance
0 = 100 Resistance
Knowing this, we can for example set every resistance like this for Ellen:

Which would make all of her resistances 100.

Moving on, we can even make Ellen really speedy like the first Orc Troop she goes against in the first Mission, which is the first 80BF:

With this you should now see a pattern from the structure I posted above and the changes I've made. The order of the structure above and the 80BF's are the same, so if you are looking for a specific stat, just start counting.

Knowing all of this, there is still the question as to how a low level Hugh can go even with Regnier, as Regnier doesn't have any changes made to his skills in that Mission. The answer to that lies in the damage. Even with 100 Resistance, you still receive damage from a level 1 Unit, even if you were level 99. The reason for that is that there is no 0 damage in the game. If a unit hits you, the minimum amount it will do is always over 0 (like 0.1). So if a Regnier with 0 damage and a Hugh with 0 damage clash, they both deal over 0 damage to each other. With no differences it comes down to attack speed, which the Heavy Infantry will win over the Heavy Orcs both have. It will be a close battle where Hugh will eventually come out as winner, even with the HP differences.
Advanced Troop Block Editing - Positional Data
TBA
Reference Byte List
Animations:
00 Empty
01 Human Sword and Shield
02 Human 1 Hand (Archers in Melee, Ballista, Catapult)
03 Human Sappers
04 Human Archers
05 Human Spearman
06 Human Calvary
07 Human Pyro Technician
08 Human Ballista
09 Unused Job Animation - Javelineer
0A Human 2H Sword
0B Battaloon
0C Mortars
0D Paladin
0E Storm Riders
0F Bomber Wing
10 Catapult
11 Dark Elves Archers
12 Dark Elves Infantry
13 Dark Elves Calvary
14 Dark Elves Calvary Archers
15 Dirigible
16 Wyvern
17 Ghouls
18 Bone Dragon
19 Orc Infantry
1A Ogre (Urukubarr is also in this Group)
1B Orc Sappers
1C Orc Riders
1D Orc Axemen
1E Scorpion
1F Mammoth
20 Gerald
21 Ellen
22 Regnier
23 Morene
24 Rupert
25 Kendal
26 Cirith
27 Encablossa Monster
28 Invisible (Wall Archers)
29 Crash (Fake Catapult for Cutscenes)
2A Crash (Fake Ballista for Cutscenes)
2B Lucretia
2C Leinhart
2D Human Elf
2E Thomas
2F Duane
30 Human Wizard
31 Dark Elves Male
32 Human Banners
33 Orc Banners
34 Dark Elves Banners
35 Dwarves
36 Lich
37 Encablossa Fliers
38 Human Officer
39 Orc Officer
3A Dark Elves Officer
3B Human Knight Officer
3C Dark Elves Castle Archers
3D Encablossa Heart
3E Encablossa Main Body
3F Encablossa Infest
40 Earth Golem
41 Ice Maiden
42 Thunder Rhino
43 Flame Wraith
44 Walter

Skills:
00 Melee
01 Range
02 Frontal
03 Riding
04 Teamwork
05 Scouting
06 Gunpowder
07 Taming
08 Fire
09 Lightning
0A Ice
0B Holy
0C Earth
0D Curse

TroopInfo:
00 - Archer
01 - Longbow
02 - Infantry
03 - Speakman
04 - H.Infantry
05 - Knight
06 - Paladin
07 - Cavalry
08 - Heavy Calvary
09 - Storm Rider
0A - Sappers
0B - Pyrotech
0C - Bomber Wing
0D - Mortars
0E - Ballista
0F - Ballista
10 - Catapult
11 - Battaloon
12 - Dark Archers
13 - Calvary Archers
14 - Dark Fighter
15 - Dark Knight
16 - Dark Calvary
17 - Orc Infantry
18 - Orc Riders
19 - Orc Heavy Rider
1A - Orc Axemen
1B - Orc Heavy Infantry
1C - Orc Sapper
1D - Scorpion
1E - Swamp Mammoth
1F - Dirigible
20 - Wyvern
21 - Ghoul
22 - Bone Dragon
23 - Wall Guards
24 - Scout
25 - Exploding Ghoul
26 - Encablossa
27 - Encablossa Flier
28 - Encablossa Spitter
29 - Dark Wall Guard
2A - Encablossa
2B - Earth Golem (Human)
2C - Ice Maiden (Human)
2D - Thunder Rhino (Human)
2E - Flame Wraith (Human)
2F - Earth Golem (Orcs)
30 - Ice Maiden (Orcs)
31 - Thunder Rhino (Orcs)
32 - Flame Wraiths (Orcs)
33 - Earth Golem (Dark Elves)
34 - Ice Maiden (Dark Elves)
35 - Thunder Rhino (Dark Elves)
36 - Flame Wraiths (Dark Elves)
37 - Enca.Infested

Flag Bearer/Flags
00 - Human
01 - Orc
02 - Dark Elves

00 - Hironeiden
01 - Hexter
02 - Vellond
03 - Ecclesia

Team Colours
00 - Model Default
01 - Blue
02 - Brown
03 - Red
04 - Green
05 - Purple
06 - Orange

Formation:
Unlike TroopInfo, you can use these however you want. You could for example use a Infantry Formation on an Archer Troop.
00 - Infantry
01 - Archer
02 - Spear
03 - Rider
04 - Flying
05 - Siege
06 - Axe
07 - Bomber
08 - Wall Archer
09 - Mortar
0A - Cavalry Archer
0B - Sapper
0C - Self-Destruction
0D - Dark Elves Archer
0E - Paladin
0F - Scorpion
10 - DUMMY_0
11 - DUMMY_1
12 - DUMMY_2
13 - DUMMY_3
14 - DUMMY_4
15 - DUMMY_5
16 - DUMMY_6
17 - DUMMY_7
18 - DUMMY_8
19 - DUMMY_9
1A - DUMMY_10
1B - DUMMY_11
1C - DUMMY_12
1D - DUMMY_13
1E - DUMMY_14
1F - DUMMY_15
20 - Battaloon
21 - Ballista
22 - Scout
23 - Swampmammoth
24 - Encablossa Ranged
25 - Dark Elves Wall Archer
26 - Encablossa Heart
27 - Encablossa Main Body
28 - Elemental
1 Comments
jsha15034 Aug 23, 2020 @ 1:35am 
Dude, you're going the extra mile with these mods and their specifications. The community cannot thank you enough. On that note, is there a maximum number of slots we can open for each mission? I'd love to stuff all the units I can get into one so that I can see the onslaught of soldiers. But I'm assuming there's a maximum of battalions we can send in each mission, even with modding.