Results 1 to 9 of 9

Thread: Little help with battle_models.modeldb

  1. #1
    leo.civil.uefs's Avatar É nóis que vôa bruxão!
    Join Date
    Sep 2010
    Location
    Brazil
    Posts
    3,135

    Default Little help with battle_models.modeldb

    I want to make a unit to have a javelin throw as primary unit.

    Here is its original entry in battle_models.modeldb:

    Code:
    1
    4 None 
    20 MTW2_Troll_Slow_Mace 0  
    2 
    23 MTW2_Troll_Mace_Primary 
    14 fs_test_shield 0 
    16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002
    The entry I'm using as basis to modify my new unit comes from another unit which has this feature already working.
    Here it is:

    Code:
    1 
    4 None 
    17 MTW2_Legion_Pilum 
    16 MTW2_Fast_Legion 2 
    20 MTW2_Javelin_primary 
    14 fs_test_shield 2 
    18 MTW2_Sword_Primary 
    14 fs_test_shield 
    16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002
    I copied this last and pasted over the correspondent secion of my new unit, cause I want this new unit to be able to throw javelins too.
    After some editing I have this:

    Code:
    1 
    4 None 
    17 MTW2_Legion_Pilum 
    16 MTW2_Fast_Legion 2 
    20 MTW2_Javelin_primary 
    14 fs_test_shield 2 
    23 MTW2_Troll_Mace_Primary 
    14 fs_test_shield 
    16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002

    And its working ingame!

    Now, I don't have much idea of what I'm really doing here since I don't master battle_models.modeldb. As you can see the only line I managed to change is the one in red. I tried changing the other lines but got CTDs when I started Med2.

    To put it simple, I need the new unit to keep its original animations (idle, attacking etc.) but also add the new animations for the javelin throw.

    What should be the resulting code?

    PS: export_descr_unit is already edited and working well, no need to guide me about this file.

    Another question:

    As much as it works ingame, the models get deformed because they are trolls and the original animations comes from a man (far smaller).

    Do I need to resize the animations or something like this?
    Last edited by leo.civil.uefs; April 25, 2018 at 06:12 PM.

  2. #2
    Medusa0's Avatar Artifex
    Join Date
    Apr 2009
    Location
    Nowhere
    Posts
    379

    Default Re: Little help with battle_models.modeldb

    Try this:
    Code:
    1 
    4 None 
    17 MTW2_Legion_Pilum 
    20 MTW2_Troll_Slow_Mace 2 
    20 MTW2_Javelin_primary 
    14 fs_test_shield 2 
    23 MTW2_Troll_Mace_Primary 
    14 fs_test_shield 
    16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002
    The way infantry skeletons are referenced in the battle_models.modeldb file is the skeleton used by the soldier itself followed by the "weapon" skeleton, where the latter is mainly used for movable weapons like how javelins rotate in the units' hand before throwing and has little bearings on how the unit itself animate. For here you would want the troll skeleton to be the secondary weapon, following the pilum.

    You will need to scale the MTW2_Legion_Pilum skeleton in descr_skeleton.txt (and somehow regenerate the four idx/dat files in the animations folder) using the "scale" modifier:
    Code:
    type		MTW2_Giant_Base;Example, the scale modifier precedes parent/strike_distances/locomotion_table!
    scale		1.5;Change this to whatever 
    It might be better to copy MTW2_Legion_Pilum to not affect other units that uses it.

    Do mind that trolls in Third Age have a different limb/body proportion to humans, so a direct scale change may have unintended effects! (Slender trolls anyone?)

  3. #3
    leo.civil.uefs's Avatar É nóis que vôa bruxão!
    Join Date
    Sep 2010
    Location
    Brazil
    Posts
    3,135

    Default Re: Little help with battle_models.modeldb

    Quote Originally Posted by Medusa0 View Post
    Try this:
    Code:
    1 
    4 None 
    17 MTW2_Legion_Pilum 
    20 MTW2_Troll_Slow_Mace 2 
    20 MTW2_Javelin_primary 
    14 fs_test_shield 2 
    23 MTW2_Troll_Mace_Primary 
    14 fs_test_shield 
    16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002
    OK it works.

    Quote Originally Posted by Medusa0 View Post
    You will need to scale the MTW2_Legion_Pilum skeleton in descr_skeleton.txt using the "scale" modifier:
    Code:
    type        MTW2_Giant_Base;Example, the scale modifier precedes parent/strike_distances/locomotion_table!
    scale        1.5;Change this to whatever 
    Quote Originally Posted by Medusa0 View Post
    Do mind that trolls in Third Age have a different limb/body proportion to humans, so a direct scale change may have unintended effects! (Slender trolls anyone?)
    They use humam animations in third age total war. I think the creator of the mod just rescaled the original anims.

    Quote Originally Posted by Medusa0 View Post
    (and somehow regenerate the four idx/dat files in the animations folder)
    I think this is the way: http://www.twcenter.net/forums/showt...nimation-packs
    Last edited by leo.civil.uefs; April 25, 2018 at 11:17 PM.

  4. #4
    Medusa0's Avatar Artifex
    Join Date
    Apr 2009
    Location
    Nowhere
    Posts
    379

    Default Re: Little help with battle_models.modeldb

    Try this unpacker: http://www.twcenter.net/forums/showt...-On-12-06-2014
    To get the .idx and .dat files to regenerate, you will need ALL the animation .cas and sound reference .evt files referenced in your mod's descr_skeleton.txt. I believe the .evt files may be extracted using the XIDX tool here: http://www.twcenter.net/forums/showt...dates-for-M2TW

    Once you have them in the correct directories (vanilla M2TW have all the animation .cas and sound events .evt in Medieval 2: Total War/data/animations folder, some mods use different directories, like pointing to a mod directory instead, create those folders and relocate the .cas and .evt to them as needed), it is a matter of simply a matter of moving the original four idx/dat files in your mod's animations folder somewhere else (do not delete!) to get the game to regenerate the new set.

    Best of luck!

  5. #5
    leo.civil.uefs's Avatar É nóis que vôa bruxão!
    Join Date
    Sep 2010
    Location
    Brazil
    Posts
    3,135

    Default Re: Little help with battle_models.modeldb

    OK I will try that.

    By the way let me show how things are in text files:

    descr_projectile.txt. Here I added a new catapult entry:

    Code:
    projectile tcatapult
    
    
    effect             boulder_medium_set
    end_effect                ground_impact_medium_set
    end_man_effect            man_impact_catapult_set
    end_package_effect        wall_impact_medium_set
    end_shatter_effect        ground_impact_medium_set
    end_shatter_man_effect        man_impact_catapult_set
    end_shatter_package_effect    wall_impact_medium_set
    
    
    
    
    area_effect                ae_mortar_shot
    damage            110
    damage_to_troops 30
    radius            0.3
    mass            2.4
    area            2.0
    accuracy_vs_units    0.03
    accuracy_vs_buildings    0.04
    accuracy_vs_towers      0.025
    min_angle        -15
    max_angle        60
    ;prefer_high
    velocity        75    ;61
    ground_shatter
    body_piercing
    ;bounce            0.5 0.6 0.5 0.4
    display            aimed
    effect_only
    ; Stuck model not used at the mo, shatter effect is better, but adding some shatter debris for ground impact would be good?
    ;stuck
    ;model            data/models_missile/onager_rock.CAS,  max
    ;model            data/models_missile/Big_Boulder_high.CAS, 40.0
    ;model            data/models_missile/Big_Boulder_med.CAS,  80.0
    ;model            data/models_missile/Big_Boulder_low.CAS,  max
    In export_descr_unit.txt I used the entry I just created in descr_projectile.txt and have everything else ready.

    Code:
    type             Cave Trolls
    dictionary       Cave_Trolls      ; Cave Trolls
    category         infantry
    class            heavy
    voice_type       Heavy
    banner faction   main_infantry
    banner holy      crusade
    soldier          mountain_trolls, 5, 0, 70.0
    mount_effect     elephant -2
    attributes       sea_faring, can_withdraw, hardy, frighten_foot, free_upkeep_unit
    move_speed_mod   0.9
    formation        4.0, 4.0, 7.0, 7.0, 1, horde
    stat_health      5, 3
    stat_pri         60, 3, tcatapult, 250, 2, siege_missile, artillery_mechanical, blunt, none, 25, 1
    stat_pri_attr    ap, bp, area, thrown
    stat_sec         32, 12, no, 0, 0, melee, melee_blade, blunt, mace, 0, 1
    stat_sec_attr    area, launching
    stat_pri_armour  7, 24, 0, flesh
    stat_sec_armour  0, 0, flesh
    stat_heat        2
    stat_ground      0, -1, -2, -1
    stat_mental      18, impetuous, trained, lock_morale
    stat_charge_dist 45
    stat_fire_delay  0
    stat_food        60, 300
    stat_cost        1, 1300, 550, 100, 100, 1300, 1, 400
    armour_ug_levels 1, 2
    armour_ug_models cave_trolls, cave_trolls_upg
    ownership        hre, portugal
    era 0            hre, portugal
    era 1            hre, portugal
    era 2            hre, portugal
    recruit_priority_offset    10
    In descr_skeleton.txt I created a new entry, which is a copy of MTW2_Legion_Pilum.

    Code:
    type        MTW2_troll_Pilum
    scale        2.0
    reference_points        siege_engines/UnitModelsRefPoints/Javelin_Ref_Point.modelReferencePoints
    parent        MTW2_Legion_Javelin
    locomotion_table soldier
    anim        default                                                data/animations/MTW2_Spear/MTW2_Spear_basepose.cas
    
    
    anim        ready                                        data/animations/MTW2_Legion/MTW2_Javelin_ready_fast_modified.cas        -fr                                    
    anim        attack_missile_ready                        data/animations/MTW2_Legion/MTW2_Javelin_ready_fast_modified.cas            -fr
    anim        attack_missile_hold                            data/animations/MTW2_Legion/MTW2_Javelin_ready_fast_modified.cas            -fr
    ;anim        attack_missile_release                        data/animations/MTW2_Legion/MTW2_Javelin_attack_missile_release_fast_modified.cas        -fr    -id:0.0, 1.5, 1.0, -if:25        -evt:data/animations/MTW2_Javelin/MTW2_Javelin_attack_missile_release.evt
    anim        attack_missile_release                        data/animations/MTW2_Legion/MTW2_Javelin_attack_missile_release_modified.cas        -fr    -id:0.0, 1.5, 1.0, -if:34
    In battle_models.modeldb the entry is like this:

    Code:
    1 
    4 None 
    16 MTW2_troll_Pilum 
    20 MTW2_Troll_Slow_Mace 2 
    20 MTW2_Javelin_primary 
    14 fs_test_shield 2 
    23 MTW2_Troll_Mace_Primary 
    14 fs_test_shield 
    16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002
    Now I will try the animation packs thing.
    Last edited by leo.civil.uefs; April 26, 2018 at 11:58 PM.

  6. #6
    Medusa0's Avatar Artifex
    Join Date
    Apr 2009
    Location
    Nowhere
    Posts
    379

    Default Re: Little help with battle_models.modeldb

    That should do it, I remember from past experiments that scaling do not apply to the inherited animations from parent, so if you get tiny, human sized trolls that suddenly puffs up once the throwing animation kicks in, that is what is causing it. Of course, we can worry about that once you have successfully extracted/packed your animation files.

    On the side note, those boulders looks like they could one-shot any units as they do the full 30 hp damage on impact (siege_missile in EDU means applying damage_to_troops fully, and hp maxes out at 15 in M2TW).

  7. #7
    leo.civil.uefs's Avatar É nóis que vôa bruxão!
    Join Date
    Sep 2010
    Location
    Brazil
    Posts
    3,135

    Default Re: Little help with battle_models.modeldb

    Quote Originally Posted by Medusa0 View Post
    That should do it, I remember from past experiments that scaling do not apply to the inherited animations from parent, so if you get tiny, human sized trolls that suddenly puffs up once the throwing animation kicks in, that is what is causing it. Of course, we can worry about that once you have successfully extracted/packed your animation files.
    What do you mean?

    If I try to track a type that does not come from a parent it seems the search never ends.

    MTW2_Legion_Pilum has parent MTW2_Legion_Javelin... MTW2_Legion_Javelin has parent MTW2_Javelin... and so on.

  8. #8

    Default Re: Little help with battle_models.modeldb

    If you have a different sized model to the parent, you need a new animation. That doesn't literally mean a new animation in it's entirety, rather a separate entry in the descr_skeleton with the scale parameter applied to it.

  9. #9
    leo.civil.uefs's Avatar É nóis que vôa bruxão!
    Join Date
    Sep 2010
    Location
    Brazil
    Posts
    3,135

    Default Re: Little help with battle_models.modeldb

    Quote Originally Posted by QuintusSertorius View Post
    ...you need a new animation. That doesn't literally mean a new animation in it's entirety, rather a separate entry in the descr_skeleton with the scale parameter applied to it.

    I did this in post #5. Shoul I keep it like how it is now and remove the parent line?

Posting Permissions

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