Kingdom Under Fire: The Crusaders

Kingdom Under Fire: The Crusaders

Not enough ratings
Reworked .stg Guide - Beginner Version
By 復活した黒
Learn how to Edit your Missions in KuF: The Crusaders!
   
Award
Favorite
Favorited
Unfavorite
Requirements
A Hexeditor. Recommended one is HxD, since it's pretty user friendly. This Guide uses the standard 16 Bytes per row, but if it's somehow different for you, you can change it in Tools > Options > View.

Something to convert decimal into hex or the other way around. If you have HxD you can use it's inbuild hex converter. If you use a different Hex Editing software that does not have that feature you can use this Browser converter, since it's pretty reliable. https://cryptii.com/pipes/integer-encoder
If you are new to the whole hex-editing thing, I recommend setting the "Type" to 32-bit unsigned integer and a bit below the Big-Endian into Little-Endian and it should be good to go.
Opening your first Mission File
First, we want to locate our Game Folder. If you already know where it is or how to get to it, you can skip this and follow the path below.

If you are using Steam: Go to your library and right click The Crusaders in it. Hover over "Manage" and click on "Browse Local Files". You will arrive at the location where your .exe is located. From here, we want to open the "data" Folder, then the "Mission" Folder. Here we see Files with the extension ".stg" which is what we are looking for. Please drag H0000.stg into your Hex Editor.

If you are using GoG: Right Click your .exe and click on "open file location". You will arrive at the location where your .exe is located. From here, we want to open the "data" Folder, then the "Mission" Folder. Here we see Files with the extension ".stg" which is what we are looking for. Please drag H0000.stg into your Hex Editor.

Crusaders.exe+data > Mission > H0000.stg
Character Blocks
Once we have our H0000.stg open in HxD, we are greeted with this:

To get to our first Character Block, we have to scroll a bit lower.

The marked Gerald here is out first Character Block, or at least where it starts from. Here is the full Character Block for this Gerald:

It starts from the "G" of Gerald until the "B" from Battaloon, which is the next Character Block.
What's in the Block
Now that we have our Troop Block open, let's talk about it's structure a little bit. You can skip this part if you want to, since I will talk about editing the necessary parts in the next Section. This here is purely for Info.

First we got the internal name of the Unit. The purpose for this is to have a easy to identify name for the developers to find. Please to keep in mind that while some units may have gibberish as their internal name, it may have been written in either Korean or they used a "Special Name". Special names are non-Heroes and non-Hireable Officers (e.g. not from the Pub), that still have their own unique name. For example "King", "Hugh" and "Magic Infantry" are Special Names and don't add anything to the Unit except for the name.

This here is a "unique ID". It has to be unique compared to all other units in this Mission File. It's purpose is to be called by "Actions", that for example give a unit immortality, or give the unit it's AI.

This is a UCD (Unit Category Data). This indicates if the Troop is Local or an AI. Local means Player controlled and is in almost all cases set to 0, while 01 is often Ally and 02 is Enemy. There can be a potential number of 8 UCD's in a Mission and I will make a separate Section for it here.

This is a bool for "is Hero?". Bools for Crusaders are set with 00 = No and everything else = Yes. This indicates if the Player is able to control this Unit's Hero in combat and can be set only once in the whole File. Please note that only the 4 Heroes (Gerald, Lucretia, Regnier and Kendal) have working Button Data.

This is another bool, but this time for "is enabled?". Units can be disabled from the start of the Mission, but can be activated later on in the Mission. 00 = Not enabled, everything else = Enabled.

This is a Float (IEEE 754 single precision floating point) and is for overwriting the Leader's HP for that Mission. If you are confused about the 80BF, we can use HxD to read the Float for us:

While the Leader HP is still marked, when we look to the Right side on the marked "Single (float32)", we can see that 00 00 80 BF reads as -1, which means for the game "No overwrite".

Again a Float, this time it overwrites the Units HP, unless it's set to -1.

Unit Scaling. This is not really used at all, since the Scaling is disabled in the Port.

Interface ID and CharID. This is again not usable since it requires a Debug flag for the Mission.

This is what I'd like to call "EXP Pigs". It increases not only the HP and defensive Stats of a Unit, but also gets a Unit's EXP Value up. This is how we get 7000 capped EXP when we actually fight Regnier in Geralds Mission with the King and makes me believe is a little intended mechanic to reward the Player if they choose to fight the Level 50 Regnier.

This sets your Troops SP in Float. Only really usable for your Hero Troop. Please do note that even if you set an enemies SP value to 0, they will still spam abilities, since their SP Pool is a separate thing.

Unit Position X and Y. This sets the Units starting position on the Map in float. The Z doesn't have to be set, as the game automatically sets it for us.

The direction the Unit faces at the start of the Mission. 00 = Right and then goes counter-clockwise e.g. 01 = Top Right, 02 = Top etc.

The Model our Flag Holder has. They have their own separate Models, more on that in the next section.

The Model for the Flag that they are holding.

Seems like I haven't documented this particular Hex. It doesn't change anything in-game it seems, so it's fine to use any value the unit had you copied it from.

NumLeaders. Seems like it was a planned thing to have 2 Leaders (I don't mean Officers) at the same time. It doesn't do anything at all now tho.

Leader Animation ID. In this case, since we have Gerald as example, we could only set him or other Heroes as Animation ID, unless we don't want to control the Leader.

Leader Model ID. If a Officer is a Leader of a Troop, we could set the Model he uses here.

Leader Worldmap ID. DO NOT TOUCH. This is a after-Mission thing, where your Leader of Worldmap ID 00 for example gets given a name and set into the Barracks. It's really crash prone and requires an annoying setup to create new Worldmap ID's.

Leader Level. Please do note that it will auto correct itself after a Mission with your skills if the expected level is lower than the skills.

Skill ID 1 for your Leader.

Skill Level for Skill ID 1.

It repeats skill in this pattern 4 Times for 4 Skills and 4 Levels for them. Skill ID - Skill Level.

NumOfficers. This sets how many Officers this Troop has. It cannot go over 2.

This is your first Officer in that Troop. It follows the same structure like your Leader, meaning it starts with AnimationID, then ModelID, WorldmapID, Level and Skills again.

Same thing for your second Officer in your Troop.

This is for your Units Animation ID, the 25 people that follow your Leader.

The Model ID the Unit uses.

Unit X and Unit Y. This sets how many Units are in your Troop on the X and Y Axis. Just calculate it like X times Y and you got the number of units in your Troop.

This sets the TroopInfo, or in other words the Troops Job.

Troop Formation. For example, while Infantry is always in Square formation, Archers use a different Formation. This here sets what formation they use, since it's not job bound.
Editing your first Block

Let's start with a simple edit to Gerald himself. I want him changed to Regnier, have his level at 99 and give him 3 Magic Spells, those being Curatio, Meteor and Vines.

Just like that. Gerald Animation ID of 20 was changed to 22 for Regnier, the Level was changed from 03 to 63, which is 99 in decimal. And for the last part I changed his Melee Level to 99, changed his Scout Skill to Fire Level 99 and gave him Holy and Earth also at 99 each. If we go in-game with this edit we have this:

As we can see, we are Regnier level 99, with Meteor and Vines as spells. But where is our Curatio? Curatio is disabled for the First Mission, but don't worry if you can see the other Spells then the edit definitely worked. We can do the same edit to our Officers and while im at it, let's edit the Troop as well.

Let's go through each edit.
At Offset 2C0, I changed 00 00 00 03 to 00 01 01 03. Meaning I changed my Human Flag Bearer with the Hironeiden Flag into an Orc with an Hexter Flag.
I changed the First Officer to be Leinhart, Level 1, his skills are Melee, Archery and Curse at Level 99.
I changed the second Officer to be Urukubarr, Level 1, his skill is Melee at 99.
At offset 400, I changed my Troop to be AnimationID 1D, which is Orc Axemen and their model to 05. I also changed their Unit X and Y to 6 each, so I have 36 Units in my Troop.
And finally at 430 I changed the Job to be Orc Axemen and the Formation to Axemen.
If we go in-game with this edit it will look like this:
Creating a new Unit
Remember the 05 Hex that is before the "G" from Gerald?

This is our ticket to create new Units in a Mission. We want to first set this number from 05 to 06, then we want to copy the whole Block:

And insert it between the last Troop Block and this 16 here. Do not overwrite but Insert it.


Just like that. We have the previous TroopBlock and the 16 intact and inserted our Gerald TroopBlock between them.

Now we can edit the description however we want, but it isn't needed. Here is a tip in HxD, if you select the Byte over "Decoded text", you can just write the letters with your keyboard.
Now we want to edit the units unique ID and the "is hero" bool

Since the last Unit was unique ID 06, we can use 07 for this new one and we set the is hero to 0.

With this we can now edit our Leader and edit out our Officers. We also have to FF our Worldmap ID's, else the game will crash after the Mission.

And we can change our Leader and Unit to whatever we want:

With this we have edited our new unit to use a new unique ID, which is in my case a Orc Rider as Leader, without Officer, without Worldmap ID's and with Heavy Orc Riders as Troop. I did forget to edit the Skills to include Riding, however, since we FF'ed the Skills, the game automatically uses one of those and gives them a Riding skill for the Mission. This Riding Skill scales with my Troops level and caps at the Skills Max Level, meaning Riding has a max level of 50 as Skill, since we are level 99, it will give my Riders a Riding Skill of 50.

And after saving our edits, we can watch our new Unit in-game.
Reading UCD and UAD
This section is for reading UCD (Unit Category Data) and UAD (Unit Allegiance Data)
While still being in H0000, we got those UCD:

In Crusaders, each UCD takes 4 Bytes each (1 Byte in Heroes). First let me give out their category:
00 = Not Used
01 = Local - This is for the Player and their Units
02 = Remote - This would be used by the Multiplayer
03 = AI - This includes normal AI and Enemy AI
04 = AI Friendly - Don't mistake it with your Blue Allies, these here are Purple Units.
05 = AI Neutral - This is never used
In our Screenshot we have 3 UCD set, first being 01 = Local, second being 03 = AI and the last is also 03 = AI. With this we know that we got 1 Player UCD and 2 AI UCD.

Now we have the UAD. The way they work is relative to the other UADs. If a AI UCD also uses a UAD of 0(same as player), this means they are Friendly to us. UAD only have 3 possible values, which are (assuming the Player UAD is also 0):
00 = Ally
01 = Enemy
02 = of everyone
If we read our Missions UCD and UAD we got:
01, 00 = Player
03, 00 = AI Friendly
03, 01 = AI Enemy
00, 00 = Not Used for the rest.
Another way to look at it is that every UAD, that is not the players, is an Enemy to us and the enemies are also an enemy against each other. The only exception is AI Friendly, which is not attackable, unless we specify so in another separate Block.
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

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

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

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

Formation:
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