Page 1 of 13 1234567891011 ... LastLast
Results 1 to 20 of 248

Thread: Creating a World - Importing units from another mod

  1. #1
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,096
    Blog Entries
    35

    Default Creating a World - Importing units from another mod

    Preparations


    • Make sure you have permissions to use the units if you intent to publish your mod
    • Have a formatted modelDB file for your mod (data\unit_models\battle_models.modelDB)
    • Determine how many free slots are left in your data\export_descr_units file (EDU). This is easiest via the search function of Notepad++. Open the EDU with Notepad++, press CTLR+F to get the search function and enter 'ownership' into the 'Find what:' slot, click 'Count'. The maximum number of entries is 500, if you have those detailed explanations at the top of your EDU then deduct one from the count.


    Finding your unit files and entries


    • If you can't remember the display name of your unit, simply use the custom battle of that mod by setting it to the faction where you know the unit is in the roster and using the 'Period\All' setting. Search for the unit in the roster and write down the correct spelling of the unit's name.
    • Open data\text\export_units.txt and search for that name - it will look like the example underneath. Note that there are three entries for that unit, all of them need to be transferred to your mod's export_units file, simply copy it to the bottom of your mod's file. You can now change the entry outside the curly brackets if yo wish to change the name and\or description of the unit.

    Code:
    {Dismounted_Archers}Dismounted Archers
    {Dismounted_Archers_descr}Despite preferring to fight on horseback...snip
    {Dismounted_Archers_descr_short}These light mounted...snip

    • If you intend to use the unit for a different faction then you will have to change the faction entry in the modeldb file, eg 7 mongols to 3 hre
    • Open the mod's EDU and use the coded name to find your unit's entry. Copy the whole entry to the bottom of your EDU. You have to replace\amend the original faction names if you plan to use the unit for a different faction. The entry in the soldier line and armour_ug_models line are your battle models (see next step).
    • Open the mod's modelDB file (use Notepad or Notepad++) and search for the battle model's entries, copy the whole entry to the end of your mod's modelDB file, preferably before the last entry. An entry starts at the line with the battle model's name and ends with the long line of numbers, example underneath. Do not forget to increase the model count number in the first line of the modelDB by the number of models you add.

    Code:
    22 serialization::archive 3 0 0 0 0 886 0 0
    Code:
    18 dismounted_archers 
    1 4 
    56 unit_models/_Units/AS_Light/dismounted_archers_lod0.mesh 121 
    56 unit_models/_Units/AS_Light/dismounted_archers_lod1.mesh 900 
    56 unit_models/_Units/AS_Light/dismounted_archers_lod2.mesh 2500 
    56 unit_models/_Units/AS_Light/dismounted_archers_lod3.mesh 6400 
    1 
    7 mongols 
    67 unit_models/_Units/AS_Light/textures/AS_Light_Fancy_mongols.texture 
    66 unit_models/_Units/AS_Light/textures/AS_Light_Fancy_normal.texture 
    51 unit_sprites/mongols_Mongol_Foot_Archers_sprite.spr 
    1 
    7 mongols 
    59 unit_models/AttachmentSets/Final Asian_mongols_diff.texture 
    59 unit_models/AttachmentSets/Final Asian_mongols_norm.texture 0  
    1 
    4 None 
    16 MTW2_Fast_Bowman 
    20 MTW2_Non_Shield_Fast 1 
    19 MTW2_Bowman_Primary 1 
    18 MTW2_Sword_Primary 
    16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002
    • Now trace all the listed files (MESH, TEXTURE and SPR) and transfer them to your mod into the correct folders. Create those folders if necessary. Note that the sprite file (SPR) is actually a set of three files - two TEXTURE files and one SPR file with nearly identical names.
    • The last files to transfer are the two unit pictures, you will find them here: ui\units\[faction name]\#coded name and ui\unit_info\[faction name]\coded name_info. Tip: if your unit hasn't got the mercenary_unit ability and all the pictures are the same you may wish to make your life easier (and reduce the size of your mod) by using the unified directory method for unit pictures. Simply add the two marked lines in the example underneath to your EDU entry and create those folders (unified) in the units and unit_info folders and place your pic in there.

    Code:
    ownership        england, slave, france
    era 0            england, france
    era 1            england, france
    era 2            england, france
    ;unit_info        13, 0, 1
    info_pic_dir     unified
    card_pic_dir     unified
    recruit_priority_offset    -12
    • All that is left are the recruitment entries in the export_descr_buildings (EDB) file which is an easy copy\paste operation. You will find those entries by searching for the type entry of your EDU entry, not the coded name entry (dictionary).


    A note about animations and mounts

    You may find that your battle model uses custom animations (see the the bottom part of the modelDB entry) and are left with two options:
    If your mod has no custom animations then simply copy the descr_skeleton file plus the mod's data\animation folder into your mod.
    Else replace the custom animation line with a suitable, already exiting line from your modelDB.

    If you transfer mounts and encounter a custom animation you will have to identify that entry in descr_mounts and copy it, if you do not have a descr_mounts file simply copy the whole file.
    Last edited by Gigantus; July 11, 2020 at 10:53 PM. Reason: note about faction name change in modeldb










  2. #2
    Andytheplatypus's Avatar Domesticus
    Join Date
    Jan 2010
    Location
    . U.S. - MS, Gulf Coast.
    Posts
    2,384

    Default Re: Creating a World - Importing units from another mod

    Nice job buddy + rep

    Always useful to have something like this for people who havent done it before.

    Just a suggestion but might want to add in a small section about changing the name of units also? I remember asking you at least 4-5 times....

  3. #3
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,096
    Blog Entries
    35

    Default Re: Creating a World - Importing units from another mod

    It should be obvious where to change that by looking at the files discussed, but I have added it.










  4. #4

    Default Re: Creating a World - Importing units from another mod

    Thx man, i think so, but afraid to try! Now i'll try this to my small mod. i'll post results soon.
    And here it is:
    Click image for larger version. 

Name:	0012.jpg 
Views:	145 
Size:	295.0 KB 
ID:	303274
    It's just for test, no authors rights violations !
    Good tutorial man, thx!
    Last edited by sale70; March 08, 2014 at 03:30 PM.

  5. #5
    DaDump's Avatar Libertus
    Join Date
    Feb 2014
    Location
    over there!
    Posts
    57

    Icon8 Re: Creating a World - Importing units from another mod

    So, I'm making my own (first) mod...
    I'm trying to import a unit from the "Santa Invasion" mod (Permission pending though, if not granted I'll remove it, or just leave it for myself :p, nevertheless I just wanna import it for the time being, and improve my experience at doing so) called "Snowmen".
    I've managed to import a few units from another mod, and they work fine.

    So, I've tracked down what I believe is all the necessary info, and as a start, pasted the essential stuff (battle_models thingy) into my mod.
    The mod crashes at launch, meaning the problem is with the battle_models.modeldb file (as expected)

    checkmodeldbsyntax.py says there aren't any errors though... (yes, model number is right as well)

    the modeldb file thingy is:

    7 snowmen
    1 1
    35 unit_models/santa/snowmen_lod0.mesh 6400
    2
    8 portugal
    50 unit_models/santa/textures/attachments_red.texture
    51 unit_models/santa/textures/attachments_norm.texture 0
    5 slave
    51 unit_models/santa/textures/attachments_blue.texture
    51 unit_models/santa/textures/attachments_norm.texture 0
    2
    8 portugal
    50 unit_models/santa/textures/attachments_red.texture
    51 unit_models/santa/textures/attachments_norm.texture 0
    5 slave
    51 unit_models/santa/textures/attachments_blue.texture
    51 unit_models/santa/textures/attachments_norm.texture 0
    1
    4 None
    9 MTW2_Mace
    0
    2
    17 MTW2_Mace_Primary
    14 fs_test_shield
    0
    0 -1 0 0 0 0 0 0
    the files '.mesh' and '.texture' are in the proper place...

    after an hour trying to solve this, it's getting too frustrating, so I wrote this here :p
    ...and I don't understand how the hell it works on "Santa Invasion" and not on my mod -.-

    Please help da noob!

    edit: yeah, got to add some sprites once it's working
    Last edited by DaDump; March 09, 2014 at 08:19 AM.

    [Tutorial]
    File/Mod Compression Tutorial!




    If you know how I can change my username, then pls help

  6. #6
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,096
    Blog Entries
    35

    Default Re: Creating a World - Importing units from another mod

    1. Which editor do you use to work on the modeldb file?
    2. Did you leave empty lines in the modeldb?
    3. Does every line have a trailing SPACE?


    The bottom part doesn't look right to me:
    Code:
    14 fs_test_shield
    0
    0 -1 0 0 0 0 0 0 
    Compare to this one, it has got one more zero:
    Code:
    6 fs_dog
    0 0 0 -1 0 0 0 0 0 0 
    You could also use this as the final line:
    Code:
    18 MTW2_Sword_Primary
    16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002










  7. #7
    DaDump's Avatar Libertus
    Join Date
    Feb 2014
    Location
    over there!
    Posts
    57

    Default Re: Creating a World - Importing units from another mod

    thanks for the quick answer

    I was missing 2 trailing spaces, but no difference... (btw, what are the trailing spaces for???)
    I played around with the numbers in the last line by looking at other entries, but didn't solve it

    I also noticed I have a working unit with the last line:
    18 MTW2_Sword_Primary
    0
    0 -1 0 0 0 0 0 0
    so that might not be the issue...

    also, what do those values on the last line of each entry mean??? Sometimes it gets slightly annoying to work with entries were I have no idea what they mean ^_^

    ...could the problem be related to the mesh/texture files and not actually related to the modeldb entry??


    edit: I use a formatted modeldb, and manually edit it... and use the python thingy to check for basic errors
    Last edited by DaDump; March 09, 2014 at 09:12 AM.

    [Tutorial]
    File/Mod Compression Tutorial!




    If you know how I can change my username, then pls help

  8. #8
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,096
    Blog Entries
    35

    Default Re: Creating a World - Importing units from another mod

    Does the python checker give you a correct message like this?:
    Code:
    Unit count at top of file       = 886
    Number of processed unit models = 886
    It is advisable that these two numbers should match.
    Total errors:               0
    String  count errors:       0
    Faction count errors:       0
    If it doesn't give any message at all then it can't read the formatting of the modeldb file.










  9. #9
    DaDump's Avatar Libertus
    Join Date
    Feb 2014
    Location
    over there!
    Posts
    57

    Default Re: Creating a World - Importing units from another mod

    Yep, it does:

    This is the exact output of it:

    Code:
    Unit count at top of file       = 707
    Number of processed unit models = 707
    It is advisable that these two numbers should match.
    Total errors:               0
    String  count errors:       0
    Faction count errors:       0
    Before my first post here, it wasn't, which I found really weird, since it did give proper output for the backups of previous "versions" of my mod. The "Snowmen" didn't work before either. So when they still didn't work after getting the python checker giving proper output, I came to this forum thread :p

    The reason it didn't give proper output was:
    Spoiler Alert, click show to read: 

    7 snowmen
    1
    1
    35 unit_models/santa/snowmen_lod0.mesh 6400
    ...

    instead of:

    7 snowmen
    1 1
    35 unit_models/santa/snowmen_lod0.mesh 6400
    ...


    hmmm, could it be somehow related to the path of the mesh/texture files?
    I've changed the path from unit_models/_Units/Santa... to simply unit_models/Santa...
    I guess it shouldn't though... ,also because it wasn't an issue for other imported units which are working...

    Btw, I remember trying to import another unit a while ago and getting this exact same problem, which I still have no idea how to solve...

    [Tutorial]
    File/Mod Compression Tutorial!




    If you know how I can change my username, then pls help

  10. #10
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,096
    Blog Entries
    35

    Default Re: Creating a World - Importing units from another mod

    If the files are not in the changed path then the missing textures will result in a 'silver surfer' - a missing mesh will result in a crash.










  11. #11
    DaDump's Avatar Libertus
    Join Date
    Feb 2014
    Location
    over there!
    Posts
    57

    Default Re: Creating a World - Importing units from another mod

    lol... I know how to put files in a path...
    and as expecting changing it into the commonly used "_Units/..." did no difference (yes, I changed locations of the files as well)

    ...still no idea why it ain't working? :s

    [Tutorial]
    File/Mod Compression Tutorial!




    If you know how I can change my username, then pls help

  12. #12
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,096
    Blog Entries
    35

    Default Re: Creating a World - Importing units from another mod

    My years helping members here have taught me not to take anything for granted.

    Let me recap: all you did was adding the entry to the modeldb and put the files of the model in the path as in the modeldb entry? No EDU entry, no EDB entry? And the crash is right at the splash screen?
    Then it's most likely a formatting issue (eg UTF instead of ANSI) or the like. Can you attach the modeldb for me to have a look?










  13. #13
    DaDump's Avatar Libertus
    Join Date
    Feb 2014
    Location
    over there!
    Posts
    57

    Default Re: Creating a World - Importing units from another mod

    Your recap is correct.
    I just checked, it is not due to a formatting issue (you'll see why)...

    Is there any incompatibility between modeldb entries? or some way they should be ordered or something?

    Well, I went back to playing around with the modeldb, because taidshauhdgkajfasehbfaknjbcvjbesh pfffft
    So I did the following:

    Lets say snowman is entry [S], and the entry before the snowman is entry [R], and all the other unimportant entries are [0]
    First, I removed all added EDU entries to make it simpler.

    now, the modeldb file tests:
    (I corrected the number of entries accordingly)

    (1)So, like this, it works:
    [0]
    [R]

    (2)But, like this, it does not:
    [0]
    [R]
    [S]

    (3)However, the problem is not due to [S], because this works:
    [0]
    [S]
    ...but WTF??? (1) works as well?????

    (4)similarly to (2), this doesn't work either:
    [0]
    [S]
    [R]

    Needless to say, I'm really confused right now

    Edit: attached the modeldb file here -> battle_models.7z. The entries there have been made without permission from the original mods, since my mod is so far just me playing around and messing up with modding. (with exception of the snowman, I got permission for that one (also asked for it))
    Last edited by DaDump; March 11, 2014 at 10:19 AM.

    [Tutorial]
    File/Mod Compression Tutorial!




    If you know how I can change my username, then pls help

  14. #14
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,096
    Blog Entries
    35

    Default Re: Creating a World - Importing units from another mod

    Try removing the zeros at the end of the model texture lines (25173\6) and then use the entry in line 25166 instead of your line 25190










  15. #15
    DaDump's Avatar Libertus
    Join Date
    Feb 2014
    Location
    over there!
    Posts
    57

    Default Re: Creating a World - Importing units from another mod

    the 0s at the textures made no difference (had tried that already), nor did changing the entry line for those numbers :s

    [Tutorial]
    File/Mod Compression Tutorial!




    If you know how I can change my username, then pls help

  16. #16
    DaDump's Avatar Libertus
    Join Date
    Feb 2014
    Location
    over there!
    Posts
    57

    Default Re: Creating a World - Importing units from another mod

    I'm really confused now, but somehow it's working.

    I've started over porting all units, and after some back and forth trouble, I got it working and the old modeldb with it...
    According to last copy paste, it seems there was a 0 too much...

    Not sure if it is really solved, but it'd be awesome if it is... gonna play around with it some more

    [Tutorial]
    File/Mod Compression Tutorial!




    If you know how I can change my username, then pls help

  17. #17
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,096
    Blog Entries
    35

    Default Re: Creating a World - Importing units from another mod

    Score one for the old modder saying: "If you are really lost, start all over again."










  18. #18

    Default Re: Creating a World - Importing units from another mod

    after first good one, second is bad. try to import halberd_militia_ug1 to english_huscarls and i get silver-surfers.
    Click image for larger version. 

Name:	0026.jpg 
Views:	35 
Size:	306.3 KB 
ID:	304245
    how come? did everything like i did with Theigns ( changed to byzantine_heavy_infantry ), it's same like importing new unit, just using old unit name.
    don't get it...
    16 english_huscarls
    1 4
    66 unit_models/_Units/LN_Peasant_Padded/halberd_militia_ug1_lod0.mesh 121
    66 unit_models/_Units/LN_Peasant_Padded/halberd_militia_ug1_lod1.mesh 900
    66 unit_models/_Units/LN_Peasant_Padded/halberd_militia_ug1_lod2.mesh 2500
    66 unit_models/_Units/LN_Peasant_Padded/halberd_militia_ug1_lod3.mesh 6400
    1
    6 saxons
    71 unit_models/_Units/LN_Peasant_Padded/textures/LN_peasant_poland.texture
    71 unit_models/_Units/LN_Peasant_Padded/textures/LN_peasant_normal.texture
    50 unit_sprites/poland_Halberd_Militia_ug1_sprite.spr
    1
    6 saxons
    67 unit_models/AttachmentSets/Final European Light_poland_diff.texture
    67 unit_models/AttachmentSets/Final European Light_poland_norm.texture 0
    1
    4 None
    20 MTW2_Halberd_Primary
    22 MTW2_Halberd_Secondary 1
    17 MTW2_Pike_primary 1
    17 MTW2_Pike_primary
    16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002

  19. #19
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,096
    Blog Entries
    35

    Default Re: Creating a World - Importing units from another mod

    Do you have the required faction entry in the modelDB? It's unlikely you played the saxons.










  20. #20

    Default Re: Creating a World - Importing units from another mod

    Quote Originally Posted by Gigantus View Post
    Do you have the required faction entry in the modelDB? It's unlikely you played the saxons.
    i'm using saxons for my faction and i did everything by the rule, copy-paste in EDU and in modeldb. i even copy original files and put them in my mod files, but nothing. worked with theigns, they are byz heavy inf now.

Page 1 of 13 1234567891011 ... LastLast

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
  •