Congratz on solving your first problem
Hmm... I only have ini files from patch 1.03 at hand, but I think I should be able to help you a bit.
Im starting with your last question. The others I may edit in or post later.
* And how can I add an other power in the last empty skill button but be an earlier level than the Hour of the WK, level 7 for example?
And generally how can I make powers to be awarded to other levels than the original?
I'm going to use the level 6 Screech power of the WK as an example to answer this question.
I'm getting carried away, but I figured as a starting modder you wouldn't mind the extra info
So, we're starting at a piece of code from data\ini\experiencelevels.ini:
ExperienceLevel WitchKingLevel6
TargetNames = WITCHKING
RequiredExperience = WITCHKING_LVL6_EXP_NEEDED
ExperienceAward = WITCHKING_LVL6_EXP_AWARD
AttributeModifiers = HeroLevelUpDamage5
Rank = 6
LevelUpFx = FX:GandalfLevelUp1FX
Upgrades = Upgrade_Screech
SelectionDecal
Texture = decal_hero_good
Style = SHADOW_ALPHA_DECAL
OpacityMin = 50%
OpacityMax = 100%
MinRadius = 40
MaxRadius = 200
MaxSelectedUnits = 40
End
End
This codeblock is used to state the events that happen when the WK reaches level 6.
Relevant to your questions is the Upgrade line, which points to and awards the "Upgrade_Screech" upgrade to the WK.
To add another power which the WK is to get at level 7, go to the WithKingLevel7 block. You will find that block doesn't have an Upgrades line yet. You can add one and state the upgrade which is linked to the level 7 power you gave to the level 7 WK.
To change the levels at which powers are awarded, you simply need to look for the block where the power is awarded and either remove the upgrade name from the list of upgrades if multiple upgrades are awarded at the same level, or remove the entire line if it's the only one. The next step is to enter the upgrade in the code block of the level you want the power to be given. Add the complete Upgrades line if it isn't already present.
Note: The TargetNames line refers to lists of objects which are defined at the top of the experiencelevels file, not to individual objects.
Note: If ; or // is placed before a line, the game will ignore the line. You probably already know this, but that assumption has taken it's victims before.
Now the above action isn't the complete story to give a new ability to a hero...
I've assumed you have an ability in the hero's ini file, got it linked to an upgrade, specialpower, commandbutton and have the commandbutton linked to the commandset of the hero.
If you don't have all that done already, read on for some more basic info on how to set up a new ability...
Before you start working with abilities it is important to know that each button, upgrade, commandset, etc. needs to have an unique name. You can use behavior names multiple times in a mod, as long as you use them only once per object.
In the experience file we worked with upgrades, so I'll continue from there.
All upgrades for normal objects are listed in data\ini\upgrade.ini:
Upgrade Upgrade_Screech
Type = OBJECT
End
As you see, there hardly is any code. This code is mainly used to simply tell the game the upgrade exists. The Type line states that when the upgrade is awarded, it only applies to the object getting the award. The alternative input is PLAYER, which means the upgrade is applied to all objects in the game.
Good, but that still doesn't tell us what an upgrade does...
The effects of an upgrade are defined in the object ini's. Objects being either units, hordes, buildings, heroes, etc. One upgrade can have multiple effects inside one object, and the same upgrade may have completly different effects with other objects.
Since there is a limit to the number of upgrades, it can be useful to use those properties.
Now here is the example of the Screech upgrade, which of course can be found in data\ini\object\evilfaction\units\mordor\witchking.ini:
;---------SCREECH------------------------------------------------------------------------
Behavior = UnpauseSpecialPowerUpgrade ModuleTag_ScreechUnPause
SpecialPowerTemplate = SpecialAbilityScreech
TriggeredBy = Upgrade_Screech
ObeyRechageOnTrigger = Yes
End
Behavior = SpecialPowerModule ModuleTag_Screech
SpecialPowerTemplate = SpecialAbilityScreech
UpdateModuleStartsAttack = Yes
StartsPaused = Yes
End
Behavior = SpecialAbilityUpdate ModuleTag_ScreechUpdate
SpecialPowerTemplate = SpecialAbilityScreech
UnpackTime = 0
TriggerSound = WitchKingScreechMS
Instant = Yes
EffectRange = 180
End
Behavior = AutoAbilityBehavior ModuleTag_AutoAbilityBehavior
End
The Screech ability is a dormant power. In the middle behavior modules, the StartsPaused line is set to Yes, which means certain (a) condition(s) need to be fullfilled before it becomes available to the player.
This requirement is listed in the TriggeredBy line of the first module. When the WK is rewarded with the Upgrade_Screech upgrade, which happens at level 6, the power is enabled for the first time.
Some of the specifics of the ability are listed in the other two behaviors. These behaviors can differ greatly depending on the sort of power involved. This is also why I won't go into explaining the workings of abilities. This small guide is only to explain how a generic ability needs to be linked to certain files in order to get it available ingame.
The central code that links these behaviors is the SpecialPowerTemplate, SpecialAbilityScreech.
These templates can be found in data\ini\specialpowers.ini:
SpecialPower SpecialAbilityScreech
Enum = SPECIAL_SCREECH
ReloadTime = 180000; in milliseconds
End
The Screech template is the simpelest form of template, stating only it's Enum and reloadtime. If you scroll through the file you'll see some templates trigger sounds or set limits to abilities.
When working with abilities, it is crucial to heed the warning from EA, which can be found at the top of the file:
; Please note that the Enum must one-for-one correspond with the power within a unit. Too many
; places in the code have accidentally crossed the distinction of instance and type, such
; that units can't handle having two powers of the same type.
With "type", they refer to the Enum present in each specialpower template. Simply said, an object can't be linked to two templates with the same Enum, or the game won't start. Or if it does start, an error will pop up while playing, which is worse, since then you get no indication of what caused the error.
Like the behaviors inside the object ini file, the commandbutton is linked by the specialpowertemplate. Here is the Screech power button from data\ini\commandbutton.ini:
CommandButton Command_SpecialAbilityScreech
Command = SPECIAL_POWER
SpecialPower = SpecialAbilityScreech
TextLabel = CONTROLBAR:Screech
ButtonImage = HSNazgulScreech
ButtonBorderType = ACTION
DescriptLabel = CONTROLBAR:TooltipScreech
InPalantir = Yes
AutoAbility = Yes
PresetRange = 150
End
Most things here are pretty obvious, but I'll go over them anyway.
The first line states the name of the button.
- The Command line states the type of command, with abilities this generally is SPECIAL_POWER. Look at other buttons to get an idea what other types there are.
- The SpecialPower is of course our link.
- ButtonImage is the button visible in the ability menu. Note: Using custom images involves asset.dat
- ButtonBorderType... hmm... can't recall the effects of this one. Pretty much everything is Action, so keep it at that
- InPalantir, setting this to yes means it shows up in the palantir... surprising really...
- AutoAbility, setting this to yes allows you to let the AI decide when to use the ability.
- PresetRange... hmm... not often used I'd say, my guess is that it could have something to do with autoability... If you're really interested, you'll have to ask someone else about this
Concerning the labels... the labelnames refer to an entry of the same name in a file called lotr.str... at least I think that was the str file is named. (I don't have the file at hand.) The structure of the file is really easy and you shouldn't have any problems on that part. What you do need to keep in mind is which lotr.str you decide to edit. The original file is located at English.BIG, but with each patch the file got updated, so you need to unpack and edit the lotr.str you find in the language BIG that came with the latest patch.
Last step is linking the button to the unit's commandset. Here is the WK's commandset from data\ini\commandset.ini:
CommandSet MordorWitchKingCommandSet
1 = Command_ToggleStance
2 = Command_WitchKingToggleMounted
3 = Command_WitchKingDreadVisage
4 = Command_SpecialAbilityScreechWitchKing
5 = Command_HourOfTheWitchKing
12 = Command_CaptureBuilding
13 = Command_AttackMove
14 = Command_Stop
End
The link here is simply the name of the button. If you want to add a level 7 ability, and you have the button ready, you can put it between the Screech and HotWK ability by moving the HotWK command to number 6 and putting the new abilty at number 5.
The result would be something like this:
CommandSet MordorWitchKingCommandSet
1 = Command_ToggleStance
2 = Command_WitchKingToggleMounted
3 = Command_WitchKingDreadVisage
4 = Command_SpecialAbilityScreechWitchKing
5 = Command_NEW_LEVEL_7_ABILITY
6 = Command_HourOfTheWitchKing
12 = Command_CaptureBuilding
13 = Command_AttackMove
14 = Command_Stop
End
That should be it.
You should note that the WK uses more than one object and therefor has two ini files. One for the on foot form, and one for the fellbeast form. If you want him to have your new ability in both conditions, you will need to make sure you edit both files and also that you edit all his commandsets.
Hope it helped, and like I said, Ill see if I edit the answers to the other questions in here.
Solinx