21 januari 2007:
This guide is both useable for all patches of the original game, and at least the original version of the RotWK expansion.
==================
Create a Hero: Customising the attribute limits
==================
This guide has two parts, the first part will teach you to change the maximum attribute points you can spend at the creation of your personal hero and it will show you how to change the attribute restrictions within the range of 1 to 20 for each specific class and for each specific attribute.
The second part will teach you to expand these limits. Because the graphics won't adjust with the code, this has never been tested by me. I simply write down the links that I have seen and leave the choice to you whether you use it or not.
In this guide I assume you have basic knowledge of modding BFME 2 and know you're way around with ini's
If not, check out the beginner tutorials on the T3A site
Part 1: Turning hero's into legends
What files do we need?
...\data\ini\createaherosystem <CaH Class Name> .inc
Each Create a Hero class has it's own file to list their subclasses, with this example, I am going to use the MotW.
Each new subclass is noted with a line like this
SubClass // Captain Of Gondor
Our first step is to increase the amount of attribute points the Captain of Gondor has to spend at creation.
SpendableAttributePoints = 30You will find this line in each subclass, just increase, or decrease the number to whatever you like. The maximum useful value for the first part of the guide is 100, which will maximize all 5 attributes to 20.
Ok, that was easy. The next part is no more difficult. Scroll down, past the Blingupgrades, untill you come across this codeblock:
Attribute GroupName = CreateAHero_ArmorAttribute MinValueUpgrade = Upgrade_ArmorAttribute05 MaxValueUpgrade = Upgrade_ArmorAttribute20 DefaultValueUpgrade = Upgrade_ArmorAttribute16 EndThe names speak for themselves, but here is a description anyway...
This block is one of the five blocks in a row that determen the minimum, maximum and default attribute value for each of the 5 attributes. This first block is for the Armor attribute, the second for damage, also called power, third for health, fourth regeneration, and the last for the vision range.
You should never modify the groupname unless you really know what you are doing, changing the name of the group won't benefit the game, it can only break it. The other three entries you can modify. For each value you change the numbers at the end of the upgrades from 01 to 20. Keep in mind that you always keep the minimum value below or equal to the maximum and the default within the min-max range you have set.
That's it for part 1. You can now edit the amount of attribute points you can spend and the range in which you can spend them for each specific attribute and each specific subclass.
Part 2: From legend to god
Ok, so you want to go beyond the basic enhancement?
We need to do more than in part one, and we need more files for that too:
- ...\data\ini\createaheroupgrades.inc
- ...\data\ini\object\createahero\createaheroattributemodifiers.inc
- ...\data\ini\attributemodifier.ini
- ...\data\ini\createaherogamedata.inc
This guide is specifically about increasing the possible ranges of the attributes. After the guide you will need to follow the steps from part 1 to actually use the increased ranges.
In this guide I will go no further than increasing the armor attribute from 20 to 21, since increasing the limit any futher wouldn't add any value to the example. You can increase the range following the same steps to any value you like. Note, it could be that there is a limit at 99, because the engine could be written to only recieve an input of two digits.
Alright, we start with opening ...\data\ini\createaheroupgrades.inc
Do a search for "Upgrade_ArmorAttribute01" and you will find this code block:
Upgrade Upgrade_ArmorAttribute01 Type = OBJECT GroupName = CreateAHero_ArmorAttribute GroupOrder = 0 EndThis code block is followed by many more of these blocks, counting upwart to
Upgrade Upgrade_ArmorAttribute20 Type = OBJECT GroupName = CreateAHero_ArmorAttribute GroupOrder = 19 EndDuring this, two enties remain constant and both the upgrade name and GroupOrder are increased by one for each block. The Type is set to Object, instead of Player, which makes this upgrade apply to the specific object that get's it, in this case the CaH, only. Our first step to increase our range will be to add our own entry in this file:
Upgrade Upgrade_ArmorAttribute21 Type = OBJECT GroupName = CreateAHero_ArmorAttribute GroupOrder = 20 EndNow we have defined our upgrade, we need to link it to some code that actually does something. Open ...\data\ini\object\createahero\createaheroattributemodifiers.inc
CaH attributes work like a leadership, they influence the statistics of the unit through a very basic attribute modifier module. Find the following code by searching for 'Upgrade_ArmorAttribute20', our link from the last code we modified.
Behavior = AttributeModifierUpgrade ModuleTag_ArmorAttribute20 TriggeredBy = Upgrade_ArmorAttribute20 AttributeModifier = ArmorAttribute20 EndIf you look around this code block, you will see that there is a while list of them, each following number in the range has it's own block and that for each separate attribute.
Our additional code will look like this:
Behavior = AttributeModifierUpgrade ModuleTag_ArmorAttribute21 TriggeredBy = Upgrade_ArmorAttribute21 AttributeModifier = ArmorAttribute21 EndEach module needs an unique name or you will get an error, either at the start of the game, or when you want to use the specific code.
The TriggeredBy entry contains our own upgrade, which we defined in ...\data\ini\createaheroupgrades.inc
The last entry is the link to our next step, the actual attribute modifier, again, the name is unique and incremental to the last value, to make coding this a lot easier.
We have now linked the upgrade to the actual attribute modifier, only that modifier doesn't exist yet. Out next and last step will be to create the modifier.
Open up ...\data\ini\attributemodifier.ini and do a search for 'ArmorAttribute20'. You will find this code
ModifierList ArmorAttribute20 Category = INNATE_ARMOR Modifier = ARMOR #MULTIPLY( CREATE_A_HERO_ATTRIBUTE_MULTIPLIER 0.80 ) // FX = Duration = 0 ReplaceInCategoryIfLongest = Yes EndThis is the current maximum attribute modifier for armor. Above this codeblock you will find all the lower modifiers for the armor attribute. They are all sorted in the Category INNATE_ARMOR.
The next line is the core of the modifier, namely the effect. "ARMOR" states that the modifier will affect the amor statistic of the object. At the top of the ini file there is a list with possible statistics that can be changed with a modifier.
Then comes the actual input of the change. EA used a multiply format for the attributes, multiplying a macro that is set to equal 1 (You can find this in ...\data\ini\createaherogamedata.inc) with a numeric value.
From ArmorAttribute01 to ArmorAttribute20 this value has increased from 0.25 to 0.80 with steps of .05, 0.02, 0.03 and again with steps of 0.05. For ArmorAttribute21 I will add another 0.05, making it 0.85.
There are a few more lines left to the code block. The first is the FX. This line is commented out, which means the engine will skipp the line. The effect is innate, so it won't show a visible effect.
The second line is the duration, which is set to 0. My best guess is that this will make the effect last permanent.
The last line, ReplaceInCategoryIfLongest = yes, makes sure that during the creation of you hero, if you switch between attribute values, the modifier with the highest effect is chosen.
So, the code for my 21st attribute modifier will look like this:
ModifierList ArmorAttribute21 Category = INNATE_ARMOR Modifier = ARMOR #MULTIPLY( CREATE_A_HERO_ATTRIBUTE_MULTIPLIER 0.85 ) // FX = Duration = 0 ReplaceInCategoryIfLongest = Yes End
Now when you have been looking at ...\data\ini\createaherogamedata.inc, you may have noticed that there is more to be found than just the multiply constant that is used for the modifiers. You will also find the base values for health and vision. The base damage can be found at the weapon code, and the armor base would be in the armor code. Teaching how to modifying these two would be the start of another guide.
So, to sum up, these are the codes for increasing the maximum value of the armor attribute range from 20 to 21:
- ...\data\ini\createaheroupgrades.inc
Upgrade Upgrade_ArmorAttribute21 Type = OBJECT GroupName = CreateAHero_ArmorAttribute GroupOrder = 20 End
- ...\data\ini\object\createahero\createaheroattributemodifiers.inc
Upgrade Upgrade_ArmorAttribute21 Type = OBJECT GroupName = CreateAHero_ArmorAttribute GroupOrder = 20 End
- ...\data\ini\attributemodifier.ini
ModifierList ArmorAttribute21 Category = INNATE_ARMOR Modifier = ARMOR #MULTIPLY( CREATE_A_HERO_ATTRIBUTE_MULTIPLIER 0.85 ) // FX = Duration = 0 ReplaceInCategoryIfLongest = Yes End
Doesn't look to much does it? Nor difficult. The problem lies not with increasing one of the five ranges with one step. You will need to do these basic changes for every category and for every step, that is what makes this beyond basic coding. And then there is the graphical issue. Like I said, I haven't tested this, because I don't expect the graphical part to act nice and adjust to the situation.
In addition, you will need to watch the number of upgrades you use. Grimm discovered that there is an upgrade limit with BFME 2, you can only use that many of them. You can remove useless upgrades on other places, to increase the number of upgrades available to you. If you want to do that, I expect you to know enough to find out which you can remove and which you can't.
And this concludes this guide about Create a Hero Attributes. If you have any issues, please send me a PM (private message), since I can't promise to be checking the board every day.
Edited by Solinx, 21 January 2007 - 04:12 PM.