Results 1 to 6 of 6

Thread: Hero Abilities...TUTORIAL and RESOURCE...2nd post contains battle.sd.xml / battlepage_04 (huge: 500 x 510 pxl) ,edited as placeholders for battle-ui customization

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Hero Abilities...TUTORIAL and RESOURCE...2nd post contains battle.sd.xml / battlepage_04 (huge: 500 x 510 pxl) ,edited as placeholders for battle-ui customization

    This is a tutorial about "hero abilities"

    (advice : download and install notepad++ ,it's a freeware alternative to windows notepad and will make your life EASY ,while reading/editing files)

    ...the second post is going to be about battle.sd(.xml) and battlepage_04and it's going to contain a resource ....
    in order to help you customise all kinds of battle-ui round buttons

    (not only hero abilities ones ,but also the normal ones that till now were loaded from battlepage_02 etc.. like skirmish ,fire at will ,shield wall etc..)

    this way one will be able to customise the visual elements in a 100% way if he wants too...having to just overlap the ones in my battlepage_04...
    kinna like placeholders ,since all positions are fixed and in only one file (battlepage_04)


    *regarding hero_abilities ,even though they're perfect for fantasy mods ,they 're good for historical mods too...all that it takes is think a bit out of the box...if you continue reading you'll see how one can simulate a "sprint effect" or a "momentum hold" (as in temporary confusion) or other pseudo-realistic effects ,in order to achieve more strategically-fun gameplay...

    keep in mind that the buttons-sprites /tooltips and eventual sfx are mood-setters and so you can carefully make everything more "realistic" and believable !


    the whole thing involves 4 files and the battlepage(s) which is a tga (picture) file

    -in descr_hero_abilities.xml for the effects
    ..... (data folder)

    introduction to the "code" used
    Spoiler Alert, click show to read: 

    Spoiler Alert, click show to read: 
    normal ,refers to "action-availiable"
    selected ,refers to "action-on"
    disabled ,refers to "action-off" or "action-NOT-availiable"

    you should also take a look at " descr_hero_abilities.xml " in data folder..to see how the whole file looks
    right click and "open with" notepad (cause being an xml file ,if you just double click it it will open in internet)


    here's an example..
    it's just for making a point...and introducing you to the descr_hero_abilities.xml code
    in red ,the editable parts
    in green explaining comments

    let's see how the actual file (descr_hero_abilities.xml) looks...

    Spoiler Alert, click show to read: 
    Code:
    <?xml version="1.0"?>
    <root>
        <hero_abilities>
            <hero_ability>
                <!-- Hero ability name, used when creating a character ,in descr_strat or campaign_script  -->
                <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 -->
                <normal_tooltip_label>EMT_HERO_MY_ABILITY_DEFAULT_NORMAL</normal_tooltip_label>
                <selected_tooltip_label>EMT_HERO_MY_ABILITY_DEFAULT_SELECTED</selected_tooltip_label>
                <disabled_tooltip_label>EMT_HERO_MY_ABILITY_DEFAULT_DISABLED</disabled_tooltip_label>
                <!-- Sprites from battle.sd -->it can be anyone...
                <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 used by this hero ability -->
    i've wrapped up this part as i'll extensively cover it again in the end of this post...
    Spoiler Alert, click show to read: 
    <!-- 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 --> <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 --> <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> <!-- 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> <!-- Percentage chance per unit --> <percentage_chance>50</percentage_chance> <!-- Minimum time effected units will remain inactive for --> <min_effect_time>10</min_effect_time> <!-- Maximum time effected units will remain inactive for --> <max_effect_time>20</max_effect_time> </hero_ability_effect> </hero_ability_effects> </hero_ability> .....BLAH.........BLAH.............BLAH............... </hero_abilities> </root>


    let's see an actual hero_ability, used in the TA mod..(without all the colored annoying explanations ..i've only colored the start/stop parts of the code )
    Spoiler Alert, click show to read: 
    Code:
            <hero_ability>    
                <name>Terror_of_the_Witch_King</name>
                <duration>30</duration>
                <activations>2</activations>
                <cooldown>60</cooldown>
                <normal_tooltip_label>EMT_TERROR_OF_THE_WITCH_KING_NORMAL</normal_tooltip_label>
                <selected_tooltip_label>EMT_TERROR_OF_THE_WITCH_KING_SELECTED</selected_tooltip_label>
                <disabled_tooltip_label>EMT_TERROR_OF_THE_WITCH_KING_DISABLED</disabled_tooltip_label>
                <normal_sprite>HERO_ABILITY_BYZANTINE_POLITICS_BUTTON_IMAGE_DISABLED</normal_sprite>   
                <selected_sprite>HERO_ABILITY_BYZANTINE_POLITICS_BUTTON_IMAGE</selected_sprite>                 
                <disabled_sprite>HERO_ABILITY_BYZANTINE_POLITICS_BUTTON_IMAGE_DISABLED</disabled_sprite> 
                <sound_effect>terfura</sound_effect>                                                                                                    
                <hero_ability_effects>                                                                                                  
                    <hero_ability_effect>                                                                                                
                        <name>army_morale</name>                                                                             
                        <target>enemy_armies</target>                                                                        
                        <morale_modifier>-8</morale_modifier>                                                              
                    </hero_ability_effect>                                                                                               
                    <hero_ability_effect>                                                                                              
                        <name>soldier_combat_effectiveness</name>
                        <target>enemy_armies</target>
                        <kill_chance_modifier>0.5</kill_chance_modifier>
                    </hero_ability_effect>
                </hero_ability_effects>
            </hero_ability>



    -in expanded.txt the entries for the tooltips (meaning the text that appears when you hover your cursor on a button in the battle-control panel)
    ...(data>text folder)
    Spoiler Alert, click show to read: 

    in order to make the new tooltips appear you'll have to delete the expanded.strings.bin file,right underneath the expanded.txt file
    ...if your installation is correct it should regenerate on its own upon starting the game...
    i've had problems with this when my installation was divided between main installation path and visual store folder (i'm using win 7 and hadn't disabled UserAcountControl at the time...if you haven't too here's a link http://www.twcenter.net/forums/showt...59#post8287059 try fix #3)


    -in battlepage_04.tga the sprites for the buttons and then an entry in battle.sd.xml (in data>ui folder) for the buttons-sprites assignment
    ,battlepage(s)_04 is(are) a bit more in deep,in every one of the cultures subfolders in ui ,like
    southern european ,northern european ,eastern european ,middle eastern ,greek and so on..)
    make sure you replace it in every interface folder ..with your new -culture specific- or all culture-generic one..


    -in (data > worlds > maps > campaign >imperial campaign ) one can "distribute" the abilities assigning them according to his liking through
    - descr_strat.txt (for starting generals) and/or
    - campaign_script.txt ( for scripted to spawn ,like aragorn in gondor..)
    Spoiler Alert, click show to read: 
    by just adding

    ",spacehero_abilityspacethe_Namespace" in the first line of the general's entry *

    the ability's name must be exactly the same as the one used in descr_hero_abilties.xml and put as others are put...just see an other general's entry, with a hero_ability ....example (scroll to the right >>>>)


    Code:
    character    Gandalf, named character, male, age 22, x 117, y 248, battle_model gandalf, portrait Gandalf, hero_ability Light_of_the_Faith
    traits Gandalf 1 , LoyaltyStarter 1 , GoodCommander 2 , ReligionStarter 1   , GoodAttacker 1 , Loyal 1 , Just 2 , StrategyChivalry 1
    (so attention to spaces " " ,underscores "_" and commas ","
    also small-capital letters matter too... keep it in mind....so
    just copy paste the name-title from descr_hero_abilities.xml into descr_strat )



    *if you're going to make your own-new abilities... personaly,i suggest for simplicity and in order to avoid silly mistakes ,to use ONLY capital letters ,for the abilities names in both descr_hero_abilties.xml and descr_strat ,since all other entries about your abilties are gonna be in capital letters too...
    (i've done that in my files, except for the "terror of the nazgul" and "terror of the witch king" cause they are already included in the campaign_script of various submods as such and it would mean unecessary/stressful searching-editing..)
    you should use small letters only in the edited tooltips for the ingame titles and descriptions...


    ..i hope you get a better understanding of what i'm talking about...
    let's see an example on how not to mesh up...watching the entries in the files to edit


    an entry's start in descr_hero_abilties.xml...
    (scroll to the right >>>)
    Spoiler Alert, click show to read: 

    Code:
                <name>Light_of_the_Faith</name>       see how the original title is ? that's how you should
                <duration>60</duration>                        put it in descr_strat...BUT...see how most of the 
                <activations>2</activations>                  other entries are...all capital letters...
                <cooldown>10</cooldown>
                <normal_tooltip_label>EMT_LIGHT_OF_THE_FAITH_NORMAL</normal_tooltip_label>                   ability's name entry in capital letters  
                <selected_tooltip_label>EMT_LIGHT_OF_THE_FAITH_SELECTED</selected_tooltip_label>           it points to what tooltip entry the game  
                <disabled_tooltip_label>EMT_LIGHT_OF_THE_FAITH_DISABLED</disabled_tooltip_label>            should look in expanded.txt
                <normal_sprite>HERO_ABILITY_LIGHT_OF_THE_FAITH_BUTTON_IMAGE</normal_sprite>                               ability's name in capital letters
                <selected_sprite>HERO_ABILITY_LIGHT_OF_THE_FAITH_BUTTON_IMAGE_SELECTED</selected_sprite>        pointing  to what sprite the game 
                <disabled_sprite>HERO_ABILITY_LIGHT_OF_THE_FAITH_BUTTON_IMAGE_DISABLED</disabled_sprite>         should look in battle.sd.xml
                <sound_effect>guglor_starlia</sound_effect>
    the ability's entry in expanded.txt...
    (scroll to the right >>>)
    Code:
    {EMT_LIGHT_OF_THE_FAITH_NORMAL}  editable part Here I Can write whatever i want in anyway i want...
    {EMT_LIGHT_OF_THE_FAITH_SELECTED} editable part  cause as long as i don't mess with the part in the curly brackets...that HAS to be in all capital letters and have the "hardware" name-defined by the name used in descr_hero_abilties.xml...it's all fine
    {EMT_LIGHT_OF_THE_FAITH_DISABLED}  editable part so..this is the part that's gonna appear in game...
    usually, the abilities tooltip entries are located at the bottom of expanded.txt...if not then just insert your new entries right underneath the last existing ability's one...
    (and remember to delete expanded.tx.strings.bin file ,right underneath expanded.txt in the text folder)



    and the ability's buttons entries in battle.sd.xml
    (scroll to the right >>>)
    Code:
                <sprite index="157" name="HERO_ABILITY_LIGHT_OF_THE_FAITH_BUTTON_IMAGE" page="4" left="35" right="70" top="72" bottom="107" x_offset="0" y_offset="0" alpha="1" cursor="0"/>
                <sprite index="158" name="HERO_ABILITY_LIGHT_OF_THE_FAITH_BUTTON_IMAGE_SELECTED" page="4" left="70" right="104" top="72" bottom="107" x_offset="0" y_offset="0" alpha="1" cursor="0"/>
                <sprite index="159" name="HERO_ABILITY_LIGHT_OF_THE_FAITH_BUTTON_IMAGE_DISABLED"  page="4" left="105" right="139" top="72" bottom="107" x_offset="0"  y_offset="0" alpha="1" cursor="0"/>
    and finaly the ability put in descr_strat or campaign_script (scroll to the right>>>)
    Code:
    character    Gandalf, named character, male, age 22, x 117, y 248, battle_model gandalf, portrait Gandalf, hero_ability Light_of_the_Faith
    traits Gandalf 1 , LoyaltyStarter 1 , GoodCommander 2 , ReligionStarter 1  , GoodAttacker 1 , Loyal 1 , Just 2 , StrategyChivalry 1
    so why bother and possibly make a mistake ? just use capital letters all the way (easy for just copy-pasting too) ..and do something like this..

    in descr_hero_abilities.xml
    ...blah blah...<name>LIGHT_OF_THE_FAITH</name>....blah blah... ,

    and in descr_strat or campaign_script
    ..........blah......... battle_model gandalf, portrait Gandalf, hero_ability LIGHT_OF_THE_FAITH ...(blah)....

    got it ? maybe i'm insisting on something obvious ..maybe i'm saving you from unecessary trouble...

    one other handy thing to do would be using short names for your abilities, preferably one word only.. (let's say "LIGHT" or "GANDALF" for the previous example)
    this way you will never screw up cause of a missing underscore "_" or space.. afteral the ingame ,ability's name (the one you actually get to see) is the full customizable one in expanded.txt (on the right of the curly brackets {} as in the previous example-spoiler)

    and a last advice...personaly i look to use as much as possible the same short name for every ability entry and its sprites in battle.sd.xml (makes all the copy-pasting easier)



    unfortunately changes in

    - descr_strat and campaign_script..aren't save-game compatible as also in
    -expanded.txt since ,given the fact that the game reads only the expanded.strings.bin file ,generated every time you start a game..so as i said before,
    every time you include a new tootlip in expanded.txt ,in order to see the change ingame ,you'll have to delete the strings.bin file right underneath it and start a new campaign (cause the game will still load the old strings.bin data ,form the old saved games)

    ..fortunately

    - co-ordinates entries in battle.sd.xml are ....as also whatever change of the battlepages.tga files
    so instead of breaking your @@ with coordinates in battle.sd.xml ,i suggest you just moved/edited a bit the spirtes in the battlepage_04
    (i'll be providing a perfectly edited "couple" of battle.sd and battlepage_04 ,to use as "canvas"...coordinates are spot on and there is enough space between
    sprites in the tga ,for you to move em and achieve the perfect smooth-fit)

    - as also effects in descr_hero_abilties.xml (so you can edit the abilities after having started a new campaign)



    (abilties can possibly have even sound fx ,which seems to be the most "complicated" issue about it..but also one of the coolest...i never made it :/ )


    IMPORTANT !!!
    (a view on how abilties work..)

    WHATEVER SPOILER YOU OPEN ...SCROLL IT ALL THE WAY TO THE RIGHT AS I'VE INCLUDED INSTRUCTIONS/INFO RIGHT NEXT TO THE CODE PARTS
    Spoiler Alert, click show to read: 

    in general i can tell you that

    -every starting or scripted playable, General can have a hero_ability..with its specific buttons-sfx and effects
    without interfering with his BG units ,special formation one (like deployment-stakes or ,in battle-sciltrom / shield wall etc..) even though there is "an order of command" in which all kinds of special uses buttons overide,in terms of availiability each other...

    Spoiler Alert, click show to read: 

    general's hero ability >
    (and when all of its uses are done you get the eventual others..)

    rally horn >
    (if more than one generals are on the battlefield then the highest in command gets that one and he will never be able to use his units special formation,if the unit had one..example would be saruman with orthanc guard..he will never use the sciltrom as he will always get the horn..

    on the other hand, after just editing the first army unit >bg unit< in descr_strat ,let's say for denethor ,giving him a fountain guard i got to keep the spear wall...so i'm not really sure how this works.. )

    units' special formations >
    (like sciltrom ,spearwall ,shieldwall ,fire arrows)

    units' special abilties
    (like druid chant and warcry)


    a...every ability (as in activation button) can contain several default effects that can "target"
    .........own_army.........allied_armies..........enemy_armies
    and can be comibined in various ways
    Spoiler Alert, click show to read: 


    -rally (routing) troops
    (at a locked morale level and min. time in seconds, before rerout)
    morale values can be :wavering / shaken / firm / high / impetuous(may charge without orders)

    Spoiler Alert, click show to read: 
    Code:
                    <hero_ability_effect>                      
                        <name>rally_units</name>
                        <target>own_army</target>
                        <morale_level>firm</morale_level>
                        <min_time_before_rout>120</min_time_before_rout>
                    </hero_ability_effect>                                                
    


    -lock_morale (overrides morale effects.."locking" the morale ,for the ability's duration...so you either use this or the next one for morale tweaks)
    (doesn't affect routing units..if pre-ability morale is higher it will lock to the effect's-established one...
    possible values are :
    ..impetuous (may charge without orders)
    ..high
    ..firm
    ..shaken
    ..wavering

    Spoiler Alert, click show to read: 
    Code:
                    <hero_ability_effect>
                        <name>lock_morale</name>
                        <target>enemy_armies</target>
                        <morale_level>shaken</morale_level>
                    </hero_ability_effect>


    -army_morale
    (with regulated +/- values...relates to various entries in EDU like mental value or disciplined/trained/untrained etc..)
    (also ,units lacking the "can_withdraw" EDU attribute seem to be immune to - morale effects)

    Spoiler Alert, click show to read: 
    Code:
                    <hero_ability_effect>
                        <name>army_morale</name>                                            in this example..i 've put
                        <target>own_army</target>                                   three entries, one for every 
                        <morale_modifier>15</morale_modifier>                     type of possible target...
                    </hero_ability_effect>                                                       just for helping you understand
                    <hero_ability_effect>                                                          ............................................ 
                        <name>lock_morale</name>                                     you could combinate them in 
                        <target>allied_armies</target>                                   whatever way...one army 
                        <morale_level>firm</morale_level>                     could have lock_morale ,instead.. 
                    </hero_ability_effect>
                    <hero_ability_effect>
                        <name>army_morale</name>
                        <target>enemy_armies</target>
                        <morale_modifier>-10</morale_modifier>
                    </hero_ability_effect>


    -soldier_combat_effectiveness
    (as in kill chance modifier..it can be set to 0 kill chance, reduced (-kill) ,or increased (+kill)....)

    ...0 kill is of course the lowest...
    ...0 to 1 is decreased ...
    ...1 is normal...
    ...larger than 1 is increased..don't really know what the max. is..if there is any)

    Spoiler Alert, click show to read: 
    Code:
                    <hero_ability_effect>
                        <name>soldier_combat_effectiveness</name>                                    in this example ,your kill chance rises
                        <target>own_army</target>                                                                while your enemy's falls..
                        <kill_chance_modifier>2.5</kill_chance_modifier>
                    </hero_ability_effect>
                    <hero_ability_effect>
                        <name>soldier_combat_effectiveness</name>
                        <target>enemy_armies</target>
                        <kill_chance_modifier>0.5</kill_chance_modifier>
                    </hero_ability_effect>


    -fatigue
    (true or false, meaning persistent after ability or not...)

    values between evident stamina levels ,like from fresh to warmed up are +/- 1000...so if a unit is exhausted it would need a -6000 fatigue in order to become fresh instantly ,whereas if on its own ,it depends on its EDU entry attribute hardy/very_hardy that translate ingame as good stamina/very good stamina.. and i guess also on the climate effects..

    * "sprint effect" -not default- an "effect" i came up with ,in order to add realism
    by combining two contrary fatigue effetcs...
    stamina will rise during the ability BUT will fall under the pre-ability stamina lvl after ,leaving the troops more tired than before...
    example..
    unit is tired..you press the ability and unit is fresh..ability's over ? unit will not be tired but very tired or exhausted..

    important : in order to get this to work ,you'll have to put the "true fatigue" effect first and then the "false fatigue" effect
    here's the code
    Spoiler Alert, click show to read: 
    Code:
                    <hero_ability_effect>
                        <name>army_fatigue</name>
                        <target>own_army</target>
                        <fatigue_modifier>1000</fatigue_modifier>
                        <permanent>true</permanent>
                    </hero_ability_effect>
                    <hero_ability_effect>
                        <name>army_fatigue</name>
                        <target>own_army</target>
                        <fatigue_modifier>-2000</fatigue_modifier>
                        <permanent>false</permanent>
                        </hero_ability_effect>
    by perfectly balancing the difference between true loss and false gain ,you can regulate the extent of the 'srpint effect'...it also has to do with the starting
    point..meaning ,that activating such an ability while all units are warmed up they will better tolerate it than while already very tired...BUT also on the other hand, when army is already exhausted what do you got to loose ? either way ,some units that have an "innate" good or very good stamina and/or are maybe stationary, won't get that much affected


    -unit_infighting
    (no damage ,they just go inactive, "arguing" among themselves..BUT..if you attack them they "wake up"..) works with :

    .. a % set-chance ,for each separate unit
    (efficiency seems to relate to the mental and discipline EDU values..some units are anyway immune ,like generals BG for example)

    ..and its own timer...that is independent from the abilty's duration



    * "momentum-hold" -not default- an "effect" i came up with ,in order to add realism
    by setting a high infighting% but really low time interval...
    acts as a "spam-break" as it kinna ruins the momentum for some ,overpowered or most likely to be spammed ,abilties..


    Spoiler Alert, click show to read: 
    Code:
                    <hero_ability_effect>
                        <name>unit_infighting</name>
                        <target>own_army</target>
                        <percentage_chance>100</percentage_chance>
                        <min_effect_time>1</min_effect_time>
                        <max_effect_time>1</max_effect_time>
                    </hero_ability_effect>


    this way one can simulate ,some stunning effect...kinna like adding a "momentum hold" to
    a stamina gain ( water drinking or as in a short inactivity or loss of discipline for own army) ,as in searching in their backpacks for water or booze or food,medicine etc
    since the time interval is really short (just a few secs) one will just experience the momentum stun / break formations effect..and won't even realise they're supposed to be infighting (well sort of...but it's still acceptable)

    by targeting an enemy army (and possibly combining it with an enemy morale penalty too) one could simulate a short "shock value" of his charge..

    * "swiftness"...... another pseudo effect i came up with ,by combining the default ones..it could be used to disengage,here's it's code...
    AGAIN..scroll all the way to the right and to the bottom ,to read info-comments
    Spoiler Alert, click show to read: 
    Code:
                    <hero_ability_effect>                                                                           a short (5secs)
                        <name>unit_infighting</name>                                                      unit_infighting for 
                        <target>enemy_armies</target>                                                    enemies
                        <percentage_chance>100</percentage_chance>  
                        <min_effect_time>5</min_effect_time>
                        <max_effect_time>5</max_effect_time>
                    </hero_ability_effect>
                    <hero_ability_effect>                                                                        added to a full fatigue 
                        <name>army_fatigue</name>                                                      loss (-6000) for own 
                        <target>own_army</target>                                                        army
                        <fatigue_modifier>-6000</fatigue_modifier>
                        <permanent>false</permanent>                                                   AND
                    </hero_ability_effect>                                                                   full stamina loss (+6000 fatigue) for enemies
                    <hero_ability_effect>                                                                     creating the illusion
                        <name>army_fatigue</name>                                      of a temporary "swiftness" for 
                        <target>enemy_armies</target>                                 only my army (bullet time :))
                        <fatigue_modifier>6000</fatigue_modifier>
                        <permanent>false</permanent>
                    </hero_ability_effect>
                    <hero_ability_effect>
                        <name>soldier_combat_effectiveness</name>              BUT with a 0 kill chance for me and allies
                        <target>own_army</target>                                           so that i got to use it for 
                        <kill_chance_modifier>0</kill_chance_modifier>              manouvring only and not
                    </hero_ability_effect>                                                          for cheating
                    <hero_ability_effect>
                        <name>soldier_combat_effectiveness</name>
                        <target>allied_armies</target>
                        <kill_chance_modifier>0</kill_chance_modifier>
                    </hero_ability_effect>
                    <hero_ability_effect>
                        <name>soldier_combat_effectiveness</name>              also ,by reducing just a bit the 
                        <target>enemy_armies</target>                                    enemy's kill chance i "make up"
                        <kill_chance_modifier>0.8</kill_chance_modifier>          for my advantage ,while still
                    </hero_ability_effect>                                                         having a break 
                                                                                     
    the whole multi-effect is supposed to have a really short duration...lets say 30 secs x 4 ,with 5 secs cooldown...so one can/should use it only for safe disengaging maybe after having pushed the withdraw button for the units he cares to disengage...since attacking the "momentarily-infighting- stunned" enemies or shooting them with archers will awake em....(so after having halted or changed target for missile units too)you can either try to rout your units or reform the line

    another "multi-effect" could be "whiping"...
    Spoiler Alert, click show to read: 

    multiple activations of short duration with brief cooldown ,let's say 4 x 30 secs ,with 10 secs cooldown that could have

    a sprint effect combined to a +++kill but lock own morale to wavering...
    so even though it may give you a temporarily edge it could also threaten you with routing of own units

    ...a cool sound fx and according tooltip/buttons to set the mood could make this really believable and fitting to any type of mod (historical or fantasy)

    just think out of the box and try variating/combinations

    other example...one could combine to the grape shot , a lock enemy morale to shaken and terrify for example the natives in an americas campaign...
    or just use the "mood-setting" effect of buttons/sfx/tooltips and call it a deafening loud horn or warcry or whatever...



    ..KEEP IN MIND THAT..all effects are default and their values have pre-established ranges-limits ,into which one can variate them..

    it's combinations of effects that do the abilities and not the other way round


    so there can't be any "let's make archers fire longer or more accurate" or "breaking down gates" or "firebolts" etc..

    b...all the effects

    -kick in simultaneously..

    -there is no area effect..they apply to the whole "targeted" army or armies (own - allied - enemy)

    (even though morale effects get influenced by ingame hard-coded area-morale-effects...
    example
    units near a general or some other unit with a + morale-local area-effect will be less sensitive to morale attacks...
    units far from a general etc will be more sensitive to morale "attacks"

    -abilities (containing the effects) can be instant or have a certain duration...
    ....if you want to make em instant just leave the duration as 0
    ....if you skip the activation and cooldown parts it's gonna be 1 use only...but why skip em?
    don't be lazy and include em yourself...later on it may come handy for whoever tries to further mod
    your files! it may even "save" you from occasional bugs...


    -if with duration,it's gonna be the same for all effects
    (infinghting has it's own timer of sorts though..haven't really tried if it can exceed the ability's duration.. but i know for sure that it can be shorter...so i guess it works the other way too..)

    -could be activated more than one times (and cooldown between activations can also be
    regulated)

    -values of all these effects are anyway related to values in EDU as they modify them
    (one example would be the army_morale effect ,that depends on the mental value in edu)

    Spoiler Alert, click show to read: 
    BY THE WAY..I STRONGLY SUGGEST YOU TAKE A LOOK HERE...OPENING POST contains an add-on for med2TW files !
    IT'S AN AWESOME TOOL FOR EDITING FILES
    http://www.twcenter.net/forums/showt...50#post9732550




    conclusion: you just right-click/open with notepad (as i said ,using notepad++ will greatly help you in reading/editing files), descr_hero_abilties.xml and by copy pasting and editing the editable parts you form your own abilities
    attention to include every "start" and "stop" part of the code ,meaning the <hero_abilities> and </hero_abilities> at the top and bottom of the file...
    and the <hero_ability> and </hero_ability>
    at the top and bottom of every ability
    when you open it and take a look at it you'll just get it...i'm just stating this cause ,some times ,while copy-pasting you may f-up cause of leaving these parts
    out ...so just leave the "Super_Banana_Bomb" ability you'll find in the bottom of the file as it is,even though you may not use it (it's a grape shot projectile for cannons) in order to not accidentaly mess up the end of the file's code...
    Last edited by Noobio; October 26, 2011 at 02:38 PM.


  2. #2

    Default Re: Hero Abilities......TUTORIAL and RESOURCE

    REGARDING THE 2-D "art" PART

    the game reads battle.sd
    that gets generated* by the battle.sd.xml
    humans read/edit battle.sd.xml ONLY

    * "generated" as in auto-edited...so don't delete battle.sd

    -also, make sure that the various battlepages (_01, _02, _03, _04 and possibly eventual others you may add)
    have the correct size, as mentioned in the top of the battle.sd.xml
    (it's higly unprobable if not extremely rare that someone will have changed these pic-files sizes but you never know...
    just make sure that you place a copy of a same-sized battlepage_04 in every culture's inteface subfolder)


    Spoiler Alert, click show to read: 

    (the game reads battle.sd that gets generated-edited from the battle.sd.xml
    ...unfortunately the whole thing can be really frustrating at times cause of some ,not so clear ,limitations...

    if you're going to also edit the battle.sd.xml ,by adding more battlepages ...
    it shouldn't be necessary ,but since this is a "tutorial" ...
    Spoiler Alert, click show to read: 
    seems like the "problem" is battlepage_04 size..........
    - max size is 510 x 510 ,larger than that will give you crashes...if you want to expand over this ,you could add more pages...

    IMPORTANT: remember to edit ,correctly the pages count/size-entry in the top of the battle.sd.xml file and to also edit correctly the sprites count ,right underneath if you're gonna add even more buttons or pages than i did

    here's the coming with installation file....
    Spoiler Alert, click show to read: 
    Code:
    <?xml version="1.0"?>
        <root>
            <version>6</version>
            <enumeration_name>BATTLE_SPRITES</enumeration_name>
            <texture_pages count="5">
                <page file="battlepage_01.tga" width="512" height="512" force32bit="0"/>
                <page file="battlepage_02.tga" width="256" height="256" force32bit="0"/>
                <page file="battlepage_03.tga" width="141" height="143" force32bit="0"/>
                <page file="editor_battle01.tga" width="256" height="256" force32bit="0"/>
                <page file="battlepage_04.tga" width="141" height="143" force32bit="0"/>
            </texture_pages>
            <sprites count="164">
    sprites start from "0" so even though your last sprite in the file is gonna actually be "163" ,the sprites count is "164"...so every time you add a sprite entry ,you should add +1 to the "sprites count" entry


    and here's mine
    Spoiler Alert, click show to read: 
    Code:
            <texture_pages count="5">
                <page file="battlepage_01.tga" width="512" height="512" force32bit="0"/>
                <page file="battlepage_02.tga" width="256" height="256" force32bit="0"/>
                <page file="battlepage_03.tga" width="141" height="143" force32bit="0"/>
                <page file="editor_battle01.tga" width="256" height="256" force32bit="0"/>
                <page file="battlepage_04.tga" width="500" height="510" force32bit="0"/>
            </texture_pages>
            <sprites count="293">


    here's a last one ,with more pages...

    Spoiler Alert, click show to read: 
    Code:
            <texture_pages count="6">
                <page file="battlepage_01.tga" width="512" height="512" force32bit="0"/>
                <page file="battlepage_02.tga" width="256" height="256" force32bit="0"/>
                <page file="battlepage_03.tga" width="141" height="143" force32bit="0"/>
                <page file="editor_battle01.tga" width="256" height="256" force32bit="0"/>
                <page file="battlepage_04.tga" width="500" height="510" force32bit="0"/>
                 <page file="battlepage_05.tga" width="141" height="143" force32bit="0"/>
            </texture_pages>



    - not so sure bout this one, but i have reasons to believe that if a certain battlepage isn't included in the mod folder ,like battlepage_02 for TA ,the mod is gonna "draw" its sprites from med2TW files..in fact the "halt" or "run/walk" buttons are nowhere to be seen in the TA files, yet they still work correctly..)



    since most kinds of buttons-functions come in triplets ,as in
    normal---action availiable
    selected-----action on
    disabled-----action not availiable or off
    all placeholding coordinates are edited in this fashion (triplets) ,to corrispond to their functions
    (with just a few exceptions ,like for example the "withdraw" flag or the "druidic_chant" that only have two actions..on and off)

    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    at the bottom of this post you'll find three attached rar files...

    they'll be containing

    >>>two "duets" of battle.sd.xml and battlepage_04 and

    >>>the third one will be a package of ausiliary buttons and layers to use, that will help you while making your own custom buttons
    Spoiler Alert, click show to read: 

    you can use the "button" as base layer (changing its hue etc will give all kinds of backround layers-for your buttons) and/or
    "empty button" and "ring" layer-crops to achieve that "anamorph" feel buttons should have..the rest is up to your style


    so all you have to do ,is overlap my buttons in the tga.file with yours...and you're good to go!
    (after ,of course having also re-titled the entries in battle.sd.xml ,in order to corrispond to your new hero abilities names, in descr_hero_abilities.xml)
    (regarding the battle-control round buttons you just have to overlap my sprites, in the bottom line of sprite-triplets in the tga.file(s)...just read ahead for more info)
    my fixed positions (sprites slots) have a 5 pixels minimum space between em ,so you can achieve a perfect-smooth fit ,in battle-ui ,by just moving your sprites in the tga (without having to re-edit the battle.sd.xml) ,if you have to make adjustments (for custom ui's)

    (whatever porgram you use...i like paint.net more than gimp cause it's simpler...)
    ALL sprites (the round ones are usually 35x35 pixels) and battlepages MUST BE IN TGA.FORM AND 32bits


    first zip......the first one "clean" battle.sd.xml will still load it's non-hero abilities battle-control buttons from previous pages (like battlepage_02 for example)
    so that's ,if you don't care to also customise ,the various battle-control round buttons...

    in both cases i've edited the battle.sd.xml ,so that similar functions entries are listed one after the other and not in a casual way as in the vanilla file...

    second zip......the second one "dirty" battle.sd.xml ,will load most battle-control buttons ,from it's place holding ,fixed positions in my custom battlepage_04...
    what i did was :take all coordinates from the last line of hero_ability triplets and replace the clean coordinates of the following buttons functions
    (that till now were loaded from other pages)
    Spoiler Alert, click show to read: 

    list of "deviated" buttons in my "dirty" file (i've also attached some thumbnails of the results..)
    -rally
    -autofire (fire at will)
    -skirmish
    -walk / run
    -withdraw (flag)
    -halt (hand)
    -shield_wall
    -warcry
    -screeching_women
    -druidic_chant
    -cow_carcass (i've changed the sprite into beheaded prisoner )

    ...one could also change the tooltips, through "battle.txt" and "shared.txt", in text folder, as explained for abilities (in expanded.txt) previously...
    (remember that for changes to appear ingame ,one has to delete the respective strings.bin. files ,in the text folder)

    §§ for sfx ,there are other tutorials §§

    one could in the same way assign more positions to other round (or even not) battle-interface buttons ...and easily customise them ...even though i don't think there's much to customise for sprites as tight/loose or wedge formation...anyway, at least now it's more easy to do!

    ....maybe one could
    -use "theme-backround-colours" for every button of each culture...
    -or if he uses other animals that go amok and can be killed in order to stop ,also customise the "kill elephant" triplet
    (after assigning it a triplet slot from my fixed positions)

    major advantage : you'll just have one file to work with..the battlepage_04

    example
    Spoiler Alert, click show to read: 

    this way..

    even though battle.sd.xml contains every single of these coordinates two times
    (one for the place holders and one for the reassigned sprite-loading positions

    it all works fine ,because the placeholding sprite names ,aren't being used (if they were ,the game would most probably crash)
    and so ,the game is searching the usual sprite-names (let's say "skirmish button") and what it "finds" is actually the sprite i'm assiging to that name

    Spoiler Alert, click show to read: 

    my place holder's entry...(i've named them in a hero ability fashion-alphabetical order..so that can easily reassign/recycle them, if i want to)
    Code:
                <sprite index="263" name="HERO_ABILITY_C_SKIRMISH_BUTTON_IMAGE" page="4" left="90" right="125" top="385" bottom="420" x_offset="0" y_offset="0" alpha="1" cursor="0"/>
    and the actual button's entry (with my "deviated" coordinate in it...which is my placeholder's one)
    Code:
                <sprite index="67" name="SKIRMISH_BUTTON_IMAGE" page="4" left="90" right="125" top="385" bottom="420" x_offset="0" y_offset="0" alpha="1" cursor="0"/>


    while the coming with installation/clean one's , coordinates-entry would be
    Spoiler Alert, click show to read: 
    Code:
                <sprite index="9" name="SKIRMISH_BUTTON_IMAGE" page="1" left="140" right="174" top="105" bottom="139" x_offset="0" y_offset="0" alpha="1" cursor="0"/>



    TIP : since battlepage_04 goes to the interface subfolder ,of every culture folder in the ui
    one could/should use the same ability (let's say a generic defensive one) and/or button position for different (culture specific) sprites...


    and i think that's about it...if i think of anything else ,useful ,i'll repost....

    ps..
    i found some mouseover tga files too in my drive ,i think they were included in an "alpaca"'s upload
    (maybe they could be of help to somebody ,for 2-d stuff ,so i've attached those too)

    ps2..

    i've randomly chose two of the culture specific battlepage_04 i made (gondor and orcs) to include in the zips...
    as i said you just have to overlap these buttons with your own...

    if you like any of the buttons and want to re-use em do as you will
    there are also others ,for the rest of the TA culture-races...maybe the middle-eastern/rhun harad could fit other mods too...so feel free to ask...even though
    it would be better if you just made your own (for variety/"uniqueness"'s sake ) but still no problem
    ++++++++++++attached files++++++++++++++++

    the thumbnails are .jpg samples of customised battle-control buttons

    +++++++++++++++++++++++++++++++++++++++++++++++++++
    Last edited by Noobio; November 01, 2011 at 02:03 PM.


  3. #3

    Default Re: Hero Abilities......TUTORIAL and RESOURCE

    TROUBLESHOOTING (most common silly troubles, to easily resolve )

    1............ability works BUT i get a visual bug in the right part of my battle control ui...kinna like the upper frame translocates a bit lower and if i pause or quit the battle the ability's button seems to enlarge and come towards the screen
    Spoiler Alert, click show to read: 

    >>>> you're most probably missing an entry for sprites in the descr_hero_abilities.xml....
    this happens when ,by mistake or by hasty copy-pasting you skipped a sprite's entry for one of the three abilities functions (normal /selected/disabled) BECAUSE ,since some abilties were instant in the original Med2TW-kingdoms file , they may not have all three functions sprite-entries and IF you gave that ability a duration ,the game doesn't have the needed data...i suggest you just fill in the missing entry/edit the ability's structure to "whole" ,even if you don't want to use it ,just in case someone else does or you change your mind in the future..
    here's an example

    "The_Heart_of_the_Lion"
    ,original ability (in kingdoms) is instant ...so it doesn't really need the
    "selected-function" entries ...as also (for the same reason) it doesn't have the "duration" and "cooldown" entries...BUT..since
    you're gonna start making your file by copy-pasting the included abilities ,in order to have the ability's basic structure (entries about name/duration/cooldown and normal-selected-disabled functions for tooltips and sprites...

    why "multiply" the absense of elements when they just don't harm at all AND could be eventually used ? in the spoiler ,you'll see in red the entries that could be missing (if the abilities were originally instant) ,in the file that you found in your mod...

    Spoiler Alert, click show to read: 
    Code:
            <hero_ability>    
                <name>The_Heart_of_the_Lion</name>
                <duration>0</duration>
                <activations>1</activations>        just put the missing entries...afterall you can still keep it
                <cooldown>0</cooldown>            instant and with only 1 use ,by regulating the values
                <normal_tooltip_label>EMT_THE_HEART_OF_THE_LION_NORMAL</normal_tooltip_label>
                <selected_sprite>HERO_ABILITY_THE_HEART_OF_THE_LION_BUTTON_IMAGE_SELECTED</selected_sprite>
                <disabled_tooltip_label>EMT_THE_HEART_OF_THE_LION_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>The_Heart_Of_The_Lion</sound_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>




    2............ability works BUT i get old tooltips or i don't get em at al
    Spoiler Alert, click show to read: 

    a........you either forgot to delete the expanded.txt.strings.bin file ,after you edited your expanded.txt OR
    b...............you either forgot to start a new campaign OR
    c............you loaded a saved game that makes reference to a previous version of expanded.txt
    d...........your ability's structure is missing one or all tooltip entries ...see case 1


    3..........everything's fine BUT my abilities just don't work
    Spoiler Alert, click show to read: 

    >>>>>> you messed up your descr_hero_abilities.xml OR
    there's inconsistency between your various files....most probably between decsr_strat and descr_hero_abiltites.xml...

    even one little mistyping can f-up the whole thing...that's why you ,should carefuly copy paste and use notepad++ that wil make your life easier

    if you're pretty sure that you did everything ok ,then maybe you just forgot to start a new campaign as changes in descr_strat aren't save game compatible..and you most probably forgot that you added this general's entry some hour/day ago...or maybe you just f'ed-up his entry insertion in descr strat


    4.........everything works perfect BUT my game crashed upon starting a battle while it worked just fine till the previous ones AND with me using the exact same generals..WTF ????
    Spoiler Alert, click show to read: 

    >>>>> most probably you've assigned a hero ability to an AI sripted to spawn general or included in some garisson script or something...most probably it has to do with campaign script...

    i don't know much about this...i'm still trying to understand this...it hapened to me only when the character was controlled by the AI and cause of an event-like script...after adding an ability to treebeard's campaign script entry in TA mod...

    right after taking fangorn as isengard and the ents-march event i attacked him and right after the deployment fase ,my game crashed..still searching about that, cause i gave the scripted to resurect-balrog in moria an ability too,through his campaign_script entry and the game continued just fine even though i don't think the ability worked...anyone any clues ???

    still aragorn's yes/no event at gondor (as also the additional -scripted nazguls,that are for both human player and AI) do have abilities and work just fine...



    5..............my game crashes during battles ,ONLY upon selecting certain units or hero generals
    and my error log doesn't hint me anything...WTF??????
    Spoiler Alert, click show to read: 
    there's something really wrong with your edited battle.sd.xml...
    in fact,, if you open battle.sd with notepad++ (the only program that opens it,even though you still won't be able to "read" the symbols) you'll see that even though it has generated new entries it's all messed up and disordinate...

    most probably you've

    a...
    Spoiler Alert, click show to read: 
    exceeded the battlepage's size ...max seems to be 512 x 512 pixels...
    if you need more space,then you'll have to add more battlepages..


    b...
    Spoiler Alert, click show to read: 
    added new sprites or pages but forgot to "correct" the pages or sprites count...
    remember that if your last sprite's number in battle.sd.xml is ,let's say 231 your srpite count MUST be 231+1 = 232 ,because enumeration starts from 0 ...


    c....
    Spoiler Alert, click show to read: 
    you have skipped a number or messed up enumeration
    (numbers on the left must be in linear order and start from 0...1..2..3....AND NOT ...2...10...5...3...)



    d....
    Spoiler Alert, click show to read: 
    you've included the same entry more than one times..i'm talking about the sprites name or number

    ...coordinates can be repeated ,since this is at the base of the place-holding/deviated button loading concept...


    e....whatever else typos or ups


    6. 've been trying out some "multi-effects" combinations and i have reasons to believe that the descr_hero_abilities.xml code is "flawed"...

    if you include (in the same ability of course) effects about both "own_army" and "allied_armies" ,without any allied armies in battle ,the effects assigned to allies, seem to apply to own army..

    happened with "fatigue" and "infighting" ... (had 3 kind of entries for each,for own/allied/enemy armies)

    if i get how this works/overcome (other than not include the "allied-targeted" effects) then i'll re-post
    Last edited by Noobio; August 07, 2011 at 06:38 AM.


  4. #4

    Default Re: Hero Abilities......TUTORIAL and RESOURCE

    done! hope it turns useful to someone....

    if you happen to come up with some other "multi-effect" like "swiftness" or "sprint" described in 1° post ,or have anything relative to add like

    -how Super_Banana_Bomb works (as in a mini tutorial)..
    here's a post i came upon , http://www.twcenter.net/forums/showt...1#post10059261

    --how can someone use hero_abilties in custom battles (if he can) and to what extent can the AI use hero abilties etc
    http://www.twcenter.net/forums/showt...4#post10046724

    please post here and complete this tutorial !

    thanks
    Last edited by Noobio; August 07, 2011 at 04:03 AM.


  5. #5

    Default Re: Hero Abilities...TUTORIAL and RESOURCE...2nd post contains battle.sd.xml / battlepage_04 (huge: 500 x 510 pxl) ,edited as placeholders for battle-ui customization

    Here's a tutorial on how to add SFX

    http://www.twcenter.net/forums/showthread.php?t=488870


  6. #6
    Incredible Bulk's Avatar Vicarius
    Join Date
    Dec 2011
    Location
    San Diego, CA
    Posts
    2,615

    Default Re: Hero Abilities...TUTORIAL and RESOURCE...2nd post contains battle.sd.xml / battlepage_04 (huge: 500 x 510 pxl) ,edited as placeholders for battle-ui customization

    Nice stuff here

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •