Results 1 to 19 of 19

Thread: Using ESFviaXML to Unpack Startpos and Save Games into Text Files

  1. #1

    Default Using ESFviaXML to Unpack Startpos and Save Games into Text Files

    This tutorial will explain how to convert *.esf files (startpos, save games) to xml files. The purpose of this method is to open up editing options of *.esf files and allow for more access to the structure and/or content. I didn't create any of the tools here, I am simply explaining how to go about installation and usage of them. Warning - this tutorial assumes some modding knowledge and is mainly for advanced users.

    Reasons to use XML conversion
    For most of your basic startpos editing, you can simply use EditSF without any issue. The XML method allows for access to the content in text documents. Some reasons you would want to use this method include:
    1. Converting a save game file into a startpos.
    2. Mass editing of specific content, such as unit sizes, unit ID entries, etc.
    3. Insertion of content/structures not present in the esf file. For example, a Chapter Mission Array in a Faction Array. Or, missing Victory Conditions (back when that was a problem in the assembly kit)
    4. Easier editing/insertion of content in general.

    Installation of ESF via XML
    1. Download the following file - https://github.com/taw/etwng
    2. Create a new folder directory named d:\modding\ESFviaXML and unzip the etwng-master folder into that directory.
    3. Install Jruby - http://jruby.org/. Make sure to check that jruby is active through the cmd prompt (Type jruby -version). You may need to restart your computer after this to have it fully in effect.
    4. Install the nokogiri gem by using the following command - "jgem install nokogiri --pre". Once again, you may need to restart your computer.
    5. Create 2 new text documents in the following folder - D:\modding\ESFviaXML\etwng-master\esfxml
    6. The first text document will be named UnpackESF.ps1 (make sure that is its file name, no .txt). Put the following in that file:
    Code:
    $esfdir = "d:\modding\ESFviaXML"
    $esfname = "\startpos.esf"
    $esfxmldir = "d:\modding\ESFviaXML\etwng-master\esfxml"
    $tempdir = "d:\modding\ESFviaXML\startpos"
    
    $currpwd = pwd
    cd $esfxmldir
    
    jruby --server $esfxmldir\esf2xml $esfdir$esfname $tempdir\xml
    .\lzma d $tempdir\xml\compressed_data.esf.xz $tempdir\xml\compressed_data.esf
    rm $tempdir\xml\compressed_data.esf.xz
    jruby --server .\esf2xml $tempdir\xml\compressed_data.esf $tempdir\xml\compressed_data
    rm $tempdir\xml\compressed_data.esf
    
    cd $currpwd
    *Change the drive number or directory structure if you did not install ESFviaXML to d:\modding

    7. The second text document will be named PackESF.ps1. Put the following in this file:
    Code:
    $esfdir = "d:\modding\ESFviaXML"
    $esfname = "\startposnew.esf"
    $esfxmldir = "d:\modding\ESFviaXML\etwng-master\esfxml"
    $tempdir = "d:\modding\ESFviaXML\startpos"
    
    $currpwd = pwd
    cd $esfxmldir
    
    cp -r $tempdir\xml $tempdir\packdir
    jruby --server .\xml2esf $tempdir\packdir\compressed_data $tempdir\packdir\compressed_data.esf
    rm -r $tempdir\packdir\compressed_data\
    .\lzma e $tempdir\packdir\compressed_data.esf $tempdir\packdir\compressed_data.esf.xz 
    rm $tempdir\packdir\compressed_data.esf
    jruby --server .\xml2esf $tempdir\packdir $esfdir$esfname
    rm -r $tempdir\packdir
    
    cd $currpwd
    *Change the drive number or directory structure if you did not install ESFviaXML to d:\modding


    Using ESFviaXML
    *For the purposes of this tutorial, I will assume you have installed the tool into D:\modding\ESFviaXML\etwng-master\. If your directory structure is different, then use that structure instead of the one I will be listing.
    1. Find the startpos or save game you want to edit. Copy that over to D:\modding\ESFviaXML.
    2. Make sure your script files (UnpackESF.ps1) are referencing that startpos name. Change it if the file is named differently. To be clear, here is what the script entries are referring to:
    $esfdir = The base directory you unzipped the etwng-master folder into
    $esfname = The name of the startpos or save file that you placed into that directory
    $esfxmldir = The name of the directory that the esfviaxml tool itself is in
    $tempdir = The temporary directory that will house the unpacked esf files to edit
    3. Open Windows Powershell as an administrator.
    4. First, type set-executionpolicy unrestricted. This will allow for the running of scripts.
    5. Navigate to your ESFviaXML directory by typing d: . Then, type cd D:\modding\ESFviaXML\etwng-master\esfxml
    4. Now that you are in the folder D:\modding\ESFviaXML\etwng-master\esfxml, type ./unpackesf.ps1 to run the unpack script.
    5. The script should take some time to unpack, it will list a few errors but should work properly. If you see red text, then something has gone wrong. Common problems are mispelled directories/files or improper installation of jruby and nokogiri.
    6. Once the unpack script runs, go to D:\modding\ESFviaXML\startpos . Here you will find your unpacked startpos to edit. Most of the data can be found under /xml/compressed_data.
    7. After you are done editing the text files, go back to the same location in Powershell. Type ./packesf.ps1 to run the repack script. This should repack your startpos into a new one named "startposnew.esf" or whatever name you chose in the script.
    8. Make sure to type set-executionpolicy restricted once you are done. This will make sure you don't open your computer up to security risk.


    Various Uses and Random Tips
    - You can use this method to turn a save game into a startpos. This is how I created most of my early scenario/startpos mods before there was an assembly kit. To do this, you simply have to unpack the save file and a basic startpos. Then, copy over the save_game_header and preopen_map_info folders. Then, repack it as a startpos. It should function properly. Some problems may arise, however, from this method.
    - Inserting chapter mission or other startpos structure entries into factions or areas that don't have them in an existing startpos. The easiest way to do this is to have an unpacked vanilla startpos to use. You can simply find the entry you want and carefully place it in the corresponding area of the missing entry.
    - Making changes to these files can cause problems when re-packing. If you get a smaller startpos (by a lot, not a few bytes), there has been a problem. Make sure you always look for what you are replacing or inserting and check the <rec></rec> or other tags.
    - Mass editing of some entries is the most useful thing this tool can accomplish. For example, if you want to change all units that are 120 in size to 160. Simply open all the /army/ text files and do a mass search for <u>120</u>. Find/replace all with <u>160</u>.
    - Notepad ++ is by far the best way to edit these files.


    Special Thanks
    I learned this method from many modders coming together right after Rome 2's release in efforts to figure out how to change region ownership. Before the assembly kit, it was a major problem. Styrry really helped in that regard (and many others) as can be seen in this thread - http://www.twcenter.net/forums/showt...rovinces/page7

    ----> Website -- Patreon -- Steam -- Forums -- Youtube -- Facebook <----

  2. #2

    Default Re: Using ESFviaXML to Unpack Startpos and Save Games into Text Files

    Hey Dresden,

    I am trying to make changes to the startpos.esf file.
    I was able to unpack the file to xml well enough, however, I am having difficulty converting/ packing it back to an esf file.

    This is the feedback if it helps

    jruby - version test
    Code:
    jruby 1.5.3 (ruby 1.8.7 patchlevel 249) (2010-09-28 7ca06d7) (Java HotSpot(TM) Client VM 1.6.0_16) [x86-java]
    -e:1: undefined local variable or method `rsion' for main:Object (NameError)
    jgem install nokogiri --pre test
    Code:
    JRuby limited openssl loaded. http://jruby.org/openssl
    gem install jruby-openssl for full support.
    null:-2:in `arraycopy': java.lang.ArrayIndexOutOfBoundsException
    from DefaultResolver.java:111:in `makeTime'
    from DefaultResolver.java:277:in `create'
    from DefaultResolver.java:317:in `handleScalar'
    from DefaultResolver.java:435:in `orgHandler'
    from DefaultResolver.java:455:in `node_import'
    from org/yecht/ruby/DefaultResolver$s_method_1_0$RUBYINVOKER$node_import.gen:65535:in `call'
    from CachingCallSite.java:146:in `call'
    from RubyLoadHandler.java:40:in `handle'
    from Parser.java:300:in `addNode'
    from DefaultYAMLParser.java:676:in `yyparse'
    from Parser.java:290:in `yechtparse'
    from Parser.java:284:in `parse'
    from YParser.java:152:in `load'
    from org/yecht/ruby/YParser$s_method_0_1$RUBYINVOKER$load.gen:65535:in `call'
    from JavaMethod.java:630:in `call'
    from DynamicMethod.java:186:in `call'
    from CachingCallSite.java:309:in `cacheAndCall'
    from CachingCallSite.java:148:in `call'
    from CallOneArgNode.java:57:in `interpret'
    from LocalAsgnNode.java:123:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from InterpretedMethod.java:180:in `call'
    from DefaultMethod.java:172:in `call'
    from CachingCallSite.java:309:in `cacheAndCall'
    from CachingCallSite.java:148:in `call'
    from CallOneArgNode.java:57:in `interpret'
    from LocalAsgnNode.java:123:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from InterpretedMethod.java:180:in `call'
    from DefaultMethod.java:172:in `call'
    from CachingCallSite.java:309:in `cacheAndCall'
    from CachingCallSite.java:148:in `call'
    from CallOneArgNode.java:57:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from RescueNode.java:199:in `executeBody'
    from RescueNode.java:118:in `interpretWithJavaExceptions'
    from RescueNode.java:110:in `interpret'
    from InterpretedMethod.java:180:in `call'
    from DefaultMethod.java:172:in `call'
    from CachingCallSite.java:309:in `cacheAndCall'
    from CachingCallSite.java:148:in `call'
    from FCallOneArgNode.java:36:in `interpret'
    from InstAsgnNode.java:95:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from EnsureNode.java:96:in `interpret'
    from BeginNode.java:83:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from WhenOneArgNode.java:36:in `whenSlowTest'
    from WhenOneArgNode.java:46:in `when'
    from CaseNode.java:133:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from InterpretedBlock.java:373:in `evalBlockBody'
    from InterpretedBlock.java:346:in `yield'
    from InterpretedBlock.java:303:in `yield'
    from Block.java:194:in `yield'
    from YieldNode.java:112:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from InterpretedBlock.java:373:in `evalBlockBody'
    from InterpretedBlock.java:346:in `yield'
    from InterpretedBlock.java:303:in `yield'
    from Block.java:194:in `yield'
    from RubyKernel.java:1251:in `loop_1_9'
    from org/jruby/RubyKernel$s_method_0_0$RUBYFRAMEDINVOKER$loop_1_9.gen:65535:in `call'
    from CachingCallSite.java:299:in `cacheAndCall'
    from CachingCallSite.java:117:in `callBlock'
    from CachingCallSite.java:132:in `callIter'
    from FCallNoArgBlockNode.java:32:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from InterpretedMethod.java:160:in `call'
    from DefaultMethod.java:164:in `call'
    from CachingCallSite.java:299:in `cacheAndCall'
    from CachingCallSite.java:117:in `callBlock'
    from CachingCallSite.java:122:in `call'
    from CallNoArgBlockNode.java:64:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from InterpretedMethod.java:242:in `call'
    from DefaultMethod.java:196:in `call'
    from CachingCallSite.java:339:in `cacheAndCall'
    from CachingCallSite.java:197:in `callBlock'
    from CachingCallSite.java:202:in `call'
    from RubyClass.java:815:in `call'
    from DynamicMethod.java:194:in `call'
    from WrapperMethod.java:62:in `call'
    from CachingCallSite.java:329:in `cacheAndCall'
    from CachingCallSite.java:188:in `call'
    from FCallTwoArgNode.java:38:in `interpret'
    from LocalAsgnNode.java:123:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from EnsureNode.java:96:in `interpret'
    from InterpretedMethod.java:242:in `call'
    from DefaultMethod.java:196:in `call'
    from CachingCallSite.java:339:in `cacheAndCall'
    from CachingCallSite.java:197:in `callBlock'
    from CachingCallSite.java:202:in `call'
    from CallTwoArgBlockPassNode.java:62:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from InterpretedMethod.java:283:in `call'
    from DefaultMethod.java:212:in `call'
    from CachingCallSite.java:359:in `cacheAndCall'
    from CachingCallSite.java:237:in `callBlock'
    from CachingCallSite.java:252:in `callIter'
    from CallThreeArgBlockNode.java:64:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from InterpretedMethod.java:262:in `call'
    from DefaultMethod.java:204:in `call'
    from CachingCallSite.java:349:in `cacheAndCall'
    from CachingCallSite.java:228:in `call'
    from FCallThreeArgNode.java:40:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from InterpretedBlock.java:373:in `evalBlockBody'
    from InterpretedBlock.java:346:in `yield'
    from InterpretedBlock.java:303:in `yield'
    from Block.java:194:in `yield'
    from RubyIO.java:1107:in `open'
    from RubyKernel.java:283:in `open'
    from org/jruby/RubyKernel$s_method_0_2$RUBYFRAMEDINVOKER$open.gen:65535:in `call'
    from DynamicMethod.java:198:in `call'
    from CachingCallSite.java:339:in `cacheAndCall'
    from CachingCallSite.java:197:in `callBlock'
    from CachingCallSite.java:212:in `callIter'
    from FCallTwoArgBlockNode.java:34:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from IfNode.java:119:in `interpret'
    from IfNode.java:119:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from InterpretedMethod.java:221:in `call'
    from DefaultMethod.java:188:in `call'
    from CachingCallSite.java:329:in `cacheAndCall'
    from CachingCallSite.java:188:in `call'
    from CallTwoArgNode.java:59:in `interpret'
    from InstAsgnNode.java:95:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from RescueNode.java:199:in `executeBody'
    from RescueNode.java:118:in `interpretWithJavaExceptions'
    from RescueNode.java:110:in `interpret'
    from BeginNode.java:83:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from InterpretedMethod.java:242:in `call'
    from DefaultMethod.java:196:in `call'
    from CachingCallSite.java:339:in `cacheAndCall'
    from CachingCallSite.java:197:in `callBlock'
    from CachingCallSite.java:202:in `call'
    from RubyClass.java:815:in `call'
    from DynamicMethod.java:194:in `call'
    from CachingCallSite.java:329:in `cacheAndCall'
    from CachingCallSite.java:188:in `call'
    from CallTwoArgNode.java:59:in `interpret'
    from DAsgnNode.java:110:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from InterpretedBlock.java:373:in `evalBlockBody'
    from InterpretedBlock.java:346:in `yield'
    from InterpretedBlock.java:303:in `yield'
    from Block.java:194:in `yield'
    from RubyArray.java:1630:in `eachCommon'
    from RubyArray.java:1637:in `each'
    from org/jruby/RubyArray$i_method_0_0$RUBYFRAMEDINVOKER$each.gen:65535:in `call'
    from CachingCallSite.java:299:in `cacheAndCall'
    from CachingCallSite.java:117:in `callBlock'
    from CachingCallSite.java:122:in `call'
    from CallNoArgBlockNode.java:64:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from InterpretedMethod.java:221:in `call'
    from DefaultMethod.java:188:in `call'
    from CachingCallSite.java:329:in `cacheAndCall'
    from CachingCallSite.java:188:in `call'
    from CallTwoArgNode.java:59:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from RescueNode.java:199:in `executeBody'
    from RescueNode.java:118:in `interpretWithJavaExceptions'
    from RescueNode.java:110:in `interpret'
    from BeginNode.java:83:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from InterpretedBlock.java:373:in `evalBlockBody'
    from InterpretedBlock.java:346:in `yield'
    from InterpretedBlock.java:303:in `yield'
    from Block.java:194:in `yield'
    from RubyArray.java:1630:in `eachCommon'
    from RubyArray.java:1637:in `each'
    from org/jruby/RubyArray$i_method_0_0$RUBYFRAMEDINVOKER$each.gen:65535:in `call'
    from CachingCallSite.java:299:in `cacheAndCall'
    from CachingCallSite.java:117:in `callBlock'
    from CachingCallSite.java:122:in `call'
    from CallNoArgBlockNode.java:64:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from InterpretedMethod.java:139:in `call'
    from DefaultMethod.java:156:in `call'
    from CachingCallSite.java:289:in `cacheAndCall'
    from CachingCallSite.java:108:in `call'
    from VCallNode.java:85:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from IfNode.java:119:in `interpret'
    from IfNode.java:119:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from InterpretedMethod.java:221:in `call'
    from DefaultMethod.java:188:in `call'
    from CachingCallSite.java:329:in `cacheAndCall'
    from CachingCallSite.java:188:in `call'
    from CallSpecialArgNode.java:69:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from CaseNode.java:138:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from InterpretedMethod.java:180:in `call'
    from DefaultMethod.java:172:in `call'
    from CachingCallSite.java:309:in `cacheAndCall'
    from CachingCallSite.java:148:in `call'
    from FCallOneArgNode.java:36:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from RescueNode.java:199:in `executeBody'
    from RescueNode.java:118:in `interpretWithJavaExceptions'
    from RescueNode.java:110:in `interpret'
    from InterpretedMethod.java:180:in `call'
    from DefaultMethod.java:172:in `call'
    from CachingCallSite.java:309:in `cacheAndCall'
    from CachingCallSite.java:148:in `call'
    from CallOneArgNode.java:57:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from InterpretedMethod.java:180:in `call'
    from DefaultMethod.java:172:in `call'
    from CachingCallSite.java:309:in `cacheAndCall'
    from CachingCallSite.java:148:in `call'
    from jgem:21:in `rescue_1$RUBY$__rescue___0'
    from jgem:20:in `__file__'
    from jgem:-1:in `load'
    from Ruby.java:686:in `runScript'
    from Ruby.java:569:in `runNormally'
    from Ruby.java:415:in `runFromMain'
    from Main.java:286:in `run'
    from Main.java:128:in `run'
    from Main.java:97:in `main'
    Pack run Error
    Code:
    PS C:\modding\ESFviaXML\etwng-master\esfxml> ./packesf.ps1
    c:/jruby-1.5.3/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require': no such file to load -- nokogiri (Load
    Error)
    from c:/jruby-1.5.3/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from .\xml2esf:5
    rm : Cannot find path 'C:\modding\ESFviaXML\startpos\packdir\compressed_data\' because it does not exist.
    At C:\modding\ESFviaXML\etwng-master\esfxml\PackESF.ps1:11 char:1
    + rm -r $tempdir\packdir\compressed_data\
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (C:\modding\ESFv...ompressed_data\:String) [Remove-Item], ItemNotFoundEx
    ception
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand
    
    
    LZMA 9.22 beta : Igor Pavlov : Public domain : 2011-04-18
    
    Error: can not open input file c:\modding\ESFviaXML\startpos\packdir\compressed_data.esf
    rm : Cannot find path 'C:\modding\ESFviaXML\startpos\packdir\compressed_data.esf' because it does not exist.
    At C:\modding\ESFviaXML\etwng-master\esfxml\PackESF.ps1:13 char:1
    + rm $tempdir\packdir\compressed_data.esf
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (C:\modding\ESFv...ressed_data.esf:String) [Remove-Item], ItemNotFoundEx
    ception
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand
    
    c:/jruby-1.5.3/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require': no such file to load -- nokogiri (Load
    Error)
    from c:/jruby-1.5.3/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from .\xml2esf:5
    I would greatly appreciate any help you could give.

  3. #3

    Default Re: Using ESFviaXML to Unpack Startpos and Save Games into Text Files

    It looks like you may need to change the location directory in the pack script - it can't find the compressed data file. Either that or it didn't properly unpack.

    Go into packesf.ps1 and find where the directory for the unpacked files is specified. You should be able to change it there - make sure its whatever directory you unpacked to.

    ----> Website -- Patreon -- Steam -- Forums -- Youtube -- Facebook <----

  4. #4

    Default Re: Using ESFviaXML to Unpack Startpos and Save Games into Text Files

    I tried a number of different things. I even renamed the xmlfolder to packdir and I have no idea how. I ended up deleting the xmlfolder along with the files I modded. Anyway, it allowed me to re-run the unpack command. Below is the results. It did create an xml folder and the files were placed in it. In the directions, it stated it would in a folder called "compressed data." Earlier I tried to create an extended path creating the "compressed data" folder but didn't work either.

    Code:
    PS C:\modding\ESFviaXML\etwng-master\esfxml> ./unpackesf.ps1
    
    LZMA 9.22 beta : Igor Pavlov : Public domain : 2011-04-18
    
    Error: can not open input file c:\modding\ESFviaXML\startpos\xml\compressed_data.esf.xz
    rm : Cannot find path 'C:\modding\ESFviaXML\startpos\xml\compressed_data.esf.xz' because it does not exist.
    At C:\modding\ESFviaXML\etwng-master\esfxml\UnpackESF.ps1:11 char:1
    + rm $tempdir\xml\compressed_data.esf.xz
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (C:\modding\ESFv...sed_data.esf.xz:String) [Remove-Item], ItemNotFoundEx
    ception
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand
    
    .\esf2xml:24:in `initialize': No such file or directory - c:\modding\ESFviaXML\startpos\xml\compressed_data.esf (Errno::
    ENOENT)
    from .\esf2xml:24:in `open'
    from .\esf2xml:24
    rm : Cannot find path 'C:\modding\ESFviaXML\startpos\xml\compressed_data.esf' because it does not exist.
    At C:\modding\ESFviaXML\etwng-master\esfxml\UnpackESF.ps1:13 char:1
    + rm $tempdir\xml\compressed_data.esf
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (C:\modding\ESFv...ressed_data.esf:String) [Remove-Item], ItemNotFoundEx
    ception
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand
    I am not sure what to do. I already tried the Total ESF editor conversion as well. Same issue, I can unpack, but I cannot unpack. Except there two of the files I needed unpacked blank.

  5. #5

    Default Re: Using ESFviaXML to Unpack Startpos and Save Games into Text Files

    It looks like you changed the settings to look for a file called compressed data.esf.xz? It should be looking for your esf file (a startpos or a save)

    Maybe try redoing the scripts and only change those entries to your directory structure and to look for your specific startpos file. Also make sure you have execution policy turned to unrestricted and are running powershell as an admin.

    ----> Website -- Patreon -- Steam -- Forums -- Youtube -- Facebook <----

  6. #6

    Default Re: Using ESFviaXML to Unpack Startpos and Save Games into Text Files

    If you list for me your startpos name you want to unpack, the directory its located in and the directory where you installed esfxml I can post a unpack script to test.

    ----> Website -- Patreon -- Steam -- Forums -- Youtube -- Facebook <----

  7. #7

    Default Re: Using ESFviaXML to Unpack Startpos and Save Games into Text Files

    I am trying to add slots to a city using HusselTW tutorial. I used his names for the files; CAISET.esf and CAIBUL.esf
    Thank you in advance...

  8. #8

    Default

    hi
    I unpacked the startpos file but when I want to pack it again any startposnew file is created! where is the prob?

    this is powershel unpack scripts:

    Spoiler Alert, click show to read: 
    PS D:\modding\ESFviaXML\etwng-master\esfxml> ./unpackesf.ps1
    Warning: Semantic conversion failures (low level conversion performed instead)
    (this is OK if converting ESFs for game newer than Empire):
    * CAMPAIGN_LOCALISATION: (1351 records, 1351 failures, 0 quiet failures)
    * MAPS: (1 records, 1 failures, 0 quiet failures)
    * REGION_OWNERSHIPS_BY_THEATRE: (1 records, 1 failures, 0 quiet failures)

    LZMA 9.22 beta : Igor Pavlov : Public domain : 2011-04-18
    Warning: Semantic conversion failures (low level conversion performed instead)
    (this is OK if converting ESFs for game newer than Empire):
    * ANCILLARY_UNIQUENESS_MONITOR: (120 records, 120 failures, 0 quiet failures)
    * CAI_REGION_HLCI: (1717 records, 1717 failures, 0 quiet failures)
    * CAI_SITUATED: (597 records, 597 failures, 0 quiet failures)
    * CAI_TECHNOLOGY_TREE: (118 records, 118 failures, 0 quiet failures)
    * CAMPAIGN_LOCALISATION: (16781 records, 16781 failures, 0 quiet failures)
    * COMMANDER_DETAILS: (1951 records, 1951 failures, 0 quiet failures)
    * FACTION_FLAG_AND_COLOURS: (424 records, 424 failures, 0 quiet failures)
    * MAPS: (1 records, 1 failures, 0 quiet failures)
    * POPULATION CLASSES: (558 records, 558 failures, 0 quiet failures)
    * REGION_OWNERSHIPS_BY_THEATRE: (1 records, 1 failures, 0 quiet failures)
    * RELIGION_BREAKDOWN: (186 records, 186 failures, 0 quiet failures)
    * TRAITS: (785 records, 75 failures, 0 quiet failures)
    * UNIT_HISTORY: (1951 records, 1951 failures, 0 quiet failures)
    * UNIT_RECORD_KEY: (1951 records, 1951 failures, 0 quiet failures)
    and pack scripts:

    PS D:\modding\ESFviaXML\etwng-master\esfxml> ./packesf.ps1
    c:/jruby-1.5.3/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require': no such file to load -- nokogiri (Load
    Error)
    from c:/jruby-1.5.3/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from .\xml2esf:5

    LZMA 9.22 beta : Igor Pavlov : Public domain : 2011-04-18
    c:/jruby-1.5.3/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require': no such file to load -- nokogiri (Load
    Error)
    from c:/jruby-1.5.3/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from .\xml2esf:5


    where is the prob? pls help

    I could pack the esf to startposnew certainly but it has only 1 mb volume! without any compressed_data!????
    why? pls help!

    this is the script when it is packed:

    Spoiler Alert, click show to read: 
    PS D:\modding\ESFviaXML\etwng-master\esfxml> ./packesf.ps1
    RuntimeError: Unknown tag open "i1"
    block in XmlTagHandlers at .\xml2esf:1388
    default at org/jruby/RubyHash.java:711
    [] at org/jruby/RubyHash.java:1100
    start_element_namespace at .\xml2esf:1418
    parse_with at nokogiri/XmlSaxParserContext.java:252
    parse_file at C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/nokogiri-1.8.0-java/lib/nokogiri/xml/sax/pars
    er.rb:104
    parse_file at .\xml2esf:1447
    on_empty_node_xml_include at .\xml2esf:1101
    end_element_namespace at .\xml2esf:1424
    parse_with at nokogiri/XmlSaxParserContext.java:252
    parse_file at C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/nokogiri-1.8.0-java/lib/nokogiri/xml/sax/pars
    er.rb:104
    parse_file at .\xml2esf:1447
    on_empty_node_xml_include at .\xml2esf:1101
    end_element_namespace at .\xml2esf:1424
    parse_with at nokogiri/XmlSaxParserContext.java:252
    parse_file at C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/nokogiri-1.8.0-java/lib/nokogiri/xml/sax/pars
    er.rb:104
    parse_file at .\xml2esf:1447
    on_empty_node_xml_include at .\xml2esf:1101
    end_element_namespace at .\xml2esf:1424
    parse_with at nokogiri/XmlSaxParserContext.java:252
    parse_file at C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/nokogiri-1.8.0-java/lib/nokogiri/xml/sax/pars
    er.rb:104
    parse_file at .\xml2esf:1447
    on_empty_node_xml_include at .\xml2esf:1101
    end_element_namespace at .\xml2esf:1424
    parse_with at nokogiri/XmlSaxParserContext.java:252
    parse_file at C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/nokogiri-1.8.0-java/lib/nokogiri/xml/sax/pars
    er.rb:104
    parse_file at .\xml2esf:1447
    on_empty_node_xml_include at .\xml2esf:1101
    end_element_namespace at .\xml2esf:1424
    parse_with at nokogiri/XmlSaxParserContext.java:252
    parse_file at C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/nokogiri-1.8.0-java/lib/nokogiri/xml/sax/pars
    er.rb:104
    parse_file at .\xml2esf:1447
    initialize at .\xml2esf:1455
    parse at .\xml2esf:1440
    <main> at .\xml2esf:1473

    LZMA 9.22 beta : Igor Pavlov : Public domain : 2011-04-18


    it has error for runtime: unknown tag open, is this the prob or not?!
    Last edited by Frunk; August 29, 2017 at 04:39 AM. Reason: Double posts merged; spoilers added for easier viewing.

  9. #9

    Default Re: Using ESFviaXML to Unpack Startpos and Save Games into Text Files

    there isnt anybody to answer me?!!hmm

  10. #10
    Daruwind's Avatar Citizen
    Join Date
    Oct 2013
    Location
    Prague
    Posts
    2,898

    Default Re: Using ESFviaXML to Unpack Startpos and Save Games into Text Files

    +1
    DMR: (R2) (Attila) (ToB) (Wh1/2) (3K) (Troy)

  11. #11
    Daruwind's Avatar Citizen
    Join Date
    Oct 2013
    Location
    Prague
    Posts
    2,898

    Default Re: Using ESFviaXML to Unpack Startpos and Save Games into Text Files

    I asked author and he was kind enough and updated code for WH1/2. Just follow Dredenīs post step by step. Working on win10 as charm. :-)
    Last edited by Daruwind; July 27, 2018 at 02:23 PM.
    DMR: (R2) (Attila) (ToB) (Wh1/2) (3K) (Troy)

  12. #12
    Battlefield's Avatar Civis
    Join Date
    Mar 2014
    Location
    United States
    Posts
    173

    Default Re: Using ESFviaXML to Unpack Startpos and Save Games into Text Files

    I tried to use this to delete a unit from an army by deleting everything under "<rec type="UNITS_ARRAY">". But the game crashed when loading the startpos. Does anyone know how to do this?
    Rome Total War mods
    INVASIO BARBARORVM | Roma Surrectum | Rome Total Realism
    Medieval 2 Total War mods
    Stainless Steel | Europa Barbarorum II | Broken Crescent

    "It is the mark of an educated mind to be able to entertain a thought without accepting it." - Aristotle
    "Everything we hear is an opinion, not a fact. Everything we see is a perspective, not the truth." - Marcus Aurelius

  13. #13
    Daruwind's Avatar Citizen
    Join Date
    Oct 2013
    Location
    Prague
    Posts
    2,898

    Default Re: Using ESFviaXML to Unpack Startpos and Save Games into Text Files

    It is not so easy usually. I donīt play with units, but typically each info is stored in multiple areas which are linked together via specific ID numbers, usually more different IDs ..... Assembly kit is able to rewrite all internat IDs but this method not. You will have to manually found all connections and correct/remove them...
    DMR: (R2) (Attila) (ToB) (Wh1/2) (3K) (Troy)

  14. #14
    Battlefield's Avatar Civis
    Join Date
    Mar 2014
    Location
    United States
    Posts
    173

    Default Re: Using ESFviaXML to Unpack Startpos and Save Games into Text Files

    Oh I see. Well this is too difficult and time consuming for me. Anyway thanks for the help.
    Rome Total War mods
    INVASIO BARBARORVM | Roma Surrectum | Rome Total Realism
    Medieval 2 Total War mods
    Stainless Steel | Europa Barbarorum II | Broken Crescent

    "It is the mark of an educated mind to be able to entertain a thought without accepting it." - Aristotle
    "Everything we hear is an opinion, not a fact. Everything we see is a perspective, not the truth." - Marcus Aurelius

  15. #15
    Daruwind's Avatar Citizen
    Join Date
    Oct 2013
    Location
    Prague
    Posts
    2,898

    Default Re: Using ESFviaXML to Unpack Startpos and Save Games into Text Files

    I got a few problems with recent java/jruby update.

    1) if cmd jruby -version is showing version but also stating NameError: undefined local variable or method 'rsion' for main:Object...it doesnīt matter. I found some hints it is also due to variables..
    2) nokogiri command is for cmd! Not jruby console...command is still working
    3) if after java update cmd jruby -version saying that JAVA_HOME path is wrong, it is due this path/variable being not used by java itself, check system enviroment for this variable. Mine was pointing to old folder/java version which was unistalled.
    JAVA_HOME -> C:\program files\java\jre1.8.0_201 for now...it was pointing to \jre1.8.0_181
    DMR: (R2) (Attila) (ToB) (Wh1/2) (3K) (Troy)

  16. #16
    Daruwind's Avatar Citizen
    Join Date
    Oct 2013
    Location
    Prague
    Posts
    2,898

    Default Re: Using ESFviaXML to Unpack Startpos and Save Games into Text Files

    Just quick note. So far the method is very well working for R2/Attila/ToB/Wh1+2. Havenīt yet opportunity and time to try 3K. :-)
    DMR: (R2) (Attila) (ToB) (Wh1/2) (3K) (Troy)

  17. #17

    Default Re: Using ESFviaXML to Unpack Startpos and Save Games into Text Files

    I haven't been able to get this to work on 3 Kingdoms... @Daruwind, have you?

  18. #18

    Default Re: Using ESFviaXML to Unpack Startpos and Save Games into Text Files

    Quote Originally Posted by Palaiogos View Post
    I haven't been able to get this to work on 3 Kingdoms... @Daruwind, have you?
    I raised an issue with the developer of esfxml and it has been fixed in this commit:
    https://github.com/taw/etwng/commit/...b65d037f877d02


    More recently, a few savegame editing scripts have also been added into the repo under /esfxml/tw3k_scripts

  19. #19

    Default Re: Using ESFviaXML to Unpack Startpos and Save Games into Text Files

    Does this method works for map_data.esf unpack? Regards.

Posting Permissions

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