Tutorial - Hero Abilities
This Tutorial is for M2TW Kingdoms
Files needed
descr_hero_abilities.xml
expanded.txt
descr_strat.txt
campaign_script.txt
battlepage_04.tga
First you need to open descr_hero_abilities.xml it should automatically open in Internet Explorer- this file contains the code for Hero abilities. The code looks like this (you can edit the code by going to File - Edit with XML Editor) - The red text is the explanation for the corresponding text below, the blue are the values that can be used.
Following on from this we will have a look at Richards Lion Heart ability.Code:<hero_ability> Hero Ability Name <name>Sample_Ability</name> Duration in seconds, 0 means instant <duration>30</duration> Number of times the ability can be used, defaults to 1 if not specified <activations>5</activations> Cooldown in seconds for abilities with more than 1 activation <cooldown>60</cooldown> Tooltip labels from expanded.txt - These are the Hero ability title and description <normal_tooltip_label>EMT_HERO_SPECIAL_ABILITY_DEFAULT_NORMAL</normal_tooltip_label> <selected_tooltip_label>EMT_HERO_SPECIAL_ABILITY_DEFAULT_SELECTED</selected_tooltip_label> <disabled_tooltip_label>EMT_HERO_SPECIAL_ABILITY_DEFAULT_DISABLED</disabled_tooltip_label> Sprites from battle.sd - Hero Powers Button Image from the Generals <normal_sprite>SCHILTROM_BUTTON_IMAGE</normal_sprite> <selected_sprite>SCHILTROM_BUTTON_IMAGE_SELECTED</selected_sprite> <disabled_sprite>SCHILTROM_BUTTON_IMAGE_DISABLED</disabled_sprite> Sound effect played when ability begins <sound_effect>DEPLOY_STAKES</sound_effect> Effects that can be used for the hero ability: Possible Values: lock_morale, rally_units, army_morale, army_fatigue, soldier_combat_effectiveness, unit_infighting <hero_ability_effects> <hero_ability_effect> lock_morale: target units' morale will not change (does not affect routing units, units with higher morale will lock at that level instead) <name>lock_morale</name> Armies that will be affected by the effect; Possible Values: enemy_armies, own_army, allied_armies <target>own_army</target> Level that the morale will be locked at; Possible Values: impetuous, high, firm, shaken, wavering <morale_level>high</morale_level> </hero_ability_effect> <hero_ability_effect> rally_units: rallies all routing units at the specified level of morale <name>rally_units</name> <target>own_army</target> Level to which the morale will be set after rallying Possible Values: impetuous, high, firm, shaken, wavering <morale_level>firm</morale_level> Minimum time before the unit will rout again <min_time_before_rout>20</min_time_before_rout> </hero_ability_effect> <hero_ability_effect> army_morale: increases/decreases the morale of target units <name>army_morale</name> <target>enemy_armies</target> positive values increase morale, negative decrease <morale_modifier>-5</morale_modifier> </hero_ability_effect> <hero_ability_effect> army_fatigue: increases/decreases the fatigue of target units <name>army_fatigue</name> <target>own_army</target> negative values decrease fatigue, positive increase <fatigue_modifier>-2000</fatigue_modifier> Whether the fatigue boost is permanent, or will revert to what it was once the effect finishes Possible Values: true, false <permanent>false</permanent> </hero_ability_effect> <hero_ability_effect> soldier_combat_effectiveness: increases/decreases the combat effectiveness of target units <name>soldier_combat_effectiveness</name> <target>own_army</target> kill_chance_modifier: whether target units attack is increased/decreased: 0 = no chance to kill, < 1 = decreased chance, 1 = normal chance, > 1 = increased chance <kill_chance_modifier>2</kill_chance_modifier> </hero_ability_effect> <hero_ability_effect> unit_infighting: has a percentage chance to cause the target units to become inactive for a time <name>unit_infighting</name> <target>enemy_armies</target> The percentage chance per unit <percentage_chance>50</percentage_chance> The minimum time effected units will remain inactive for <min_effect_time>10</min_effect_time> The maximum time effected units will remain inactive for <max_effect_time>20</max_effect_time> </hero_ability_effect> </hero_ability_effects> </hero_ability>
It is quite easy to see that this ability is a morale boost for your own army.Code:<hero_ability> Name <name>The_Heart_of_the_Lion</name> Duration <duration>0</duration> Text descriptions <normal_tooltip_label>EMT_THE_HEART_OF_THE_LION_NORMAL</normal_tooltip_label> <disabled_tooltip_label>EMT_THE_HEART_OF_THE_LION_DISABLED</disabled_tooltip_label> Ability Button Image <normal_sprite>HERO_ABILITY_THE_HEART_OF_THE_LION_BUTTON_IMAGE</normal_sprite> <selected_sprite>HERO_ABILITY_THE_HEART_OF_THE_LION_BUTTON_IMAGE_SELECTED</selected_sprite> <disabled_sprite>HERO_ABILITY_THE_HEART_OF_THE_LION_BUTTON_IMAGE</disabled_sprite> Ability sound effect <sound_effect>The_Heart_Of_The_Lion</sound_effect> Ability effect <hero_ability_effects> <hero_ability_effect> <name>rally_units</name> <target>own_army</target> <morale_level>firm</morale_level> <min_time_before_rout>15</min_time_before_rout> </hero_ability_effect> </hero_ability_effects> </hero_ability>
And so.......to make our own
This ability will increase the combat effectiveness of your own troops.Code:<hero_ability> <name>Ackrite_Almighty</name> <duration>5</duration> <normal_tooltip_label>EMT_ACKRITE_ALMIGHTY_NORMAL</normal_tooltip_label> <normal_tooltip_label>EMT_ACKRITE_ALMIGHTY_SELECTED</normal_tooltip_label> <disabled_tooltip_label>EMT_ACKRITE_ALMIGHTY_DISABLED</disabled_tooltip_label> <normal_sprite>HERO_ABILITY_THE_HEART_OF_THE_LION_BUTTON_IMAGE</normal_sprite> <selected_sprite>HERO_ABILITY_THE_HEART_OF_THE_LION_BUTTON_IMAGE_SELECTED</selected_sprite> <disabled_sprite>HERO_ABILITY_THE_HEART_OF_THE_LION_BUTTON_IMAGE</disabled_sprite> <sound_effect>guglor_starlia</sound_effect> <hero_ability_effects> <hero_ability_effect> <name>soldier_combat_effectiveness</name> <target>own_army</target> <kill_chance_modifier>firm</kill_chance_modifier> <min_time_before_rout>15</min_time_before_rout> </hero_ability_effect> </hero_ability_effects> </hero_ability>
You can add more than one effect to a single ability.
*
The next file we need is expanded.txt - this file holds all the text and descriptions for your Hero ability.
You will need to add the following text -
So, for the ability above 'Ackrite_Almighty' you will need to add the textCode:{EMT_HERO_SPECIAL_ABILITY_DEFAULT_NORMAL} Hero Ability Description {EMT_HERO_SPECIAL_ABILITY_DEFAULT_SELECTED} Hero Ability Title {EMT_HERO_SPECIAL_ABILITY_DEFAULT_DISABLED} Hero Ability Description
*Code:{EMT_ACKRITE_ALMIGHTY_NORMAL}Ackrite Almighty (increases target units combat effectiveness) {EMT_ACKRITE_ALMIGHTY_SELECTED}Ackrite Almighty {EMT_ACKRITE_ALMIGHTY_DISABLED}Ackrite Almighty (increases target units combat effectiveness)
And finally to add the ability to a General you will need descr_strat.txt or campaign_script.txt - below is the code for a starting general in descr_strat.txt (Saladin) the part in red is the code needed for the Hero ability
and here is the code for a spawned general (Richard) in campaign_script.txt the part in red is the code needed for the Hero abilityCode:character Saladin, named character, male, leader, age 36, x 59, y 7, portrait saladin, battle_model Sultan_Saladin, hero_ability Righteousness_of_Faith ;Cairo traits Factionleader 1 , StrategyChivalry 2 , BattleChivalry 2 , Intelligent 2 , ReligionStarter 1 , AssassinMaster 2 , SpyMaster 2 , JihadHistory 2 , IslamHero 1 , GoodDiplomacy 2 , PoliticsSkill 3 , GoodCommander 4 , GoodAmbusher 2 army unit Sultan_Saladin exp 3 armour 0 weapon_lvl 0
and so....to add the 'Ackrite Almighty' ability to a general it would look like thisCode:spawn_army faction jerusalem character Richard, named character, age 33, x 91, y 49, portrait richard, battle_model Norman_King, hero_ability The_Heart_of_the_Lion, direction E traits GoodCommander 2 , BattleChivalry 3 , StrategyChivalry 2 , PublicFaith 1 , Loyal 2 , ContentGeneral 3, Lionheart 1 , ChristianHero 1 , ReligionStarter 1 , LoyaltyStarter 1 , CrusaderHistory 2 unit Richard the Lionheart exp 9 armour 0 weapon_lvl 0 end
Code:character Saladin, named character, male, leader, age 36, x 59, y 7, portrait saladin, battle_model Sultan_Saladin, hero_ability Ackrite_Almighty ;Cairo traits Factionleader 1 , StrategyChivalry 2 , BattleChivalry 2 , Intelligent 2 , ReligionStarter 1 , AssassinMaster 2 , SpyMaster 2 , JihadHistory 2 , IslamHero 1 , GoodDiplomacy 2 , PoliticsSkill 3 , GoodCommander 4 , GoodAmbusher 2 army unit Sultan_Saladin exp 3 armour 0 weapon_lvl 0
Last of all if you are using a mod you will have to add the Hero Ability Button icons into the Culture file locations. The file needed is battlepage_04.tga
example: SEGA\Medieval II Total War\mods\*Your Mod*\data\ui\southern_european\interface
That all folks![]()




Reply With Quote












