power crystals' XML patcher and data exporter (now under old management)

Pyro
Sergeant First-Class
Posts: 102
Joined: Mon 1 Sep 2014 23:56
Contact:

Re: power crystals' XML patcher and data exporter (now under old management)

Postby Pyro » Fri 3 Feb 2017 09:48

The W:AB Noob wrote:I know Sireyn and I had run across times where we had many ndfpatch commands that were pretty much the same but gave weird errors...


I've come across some weird errors that I thought were to do with the use of many ndfpatch commands in the one xml file, but it turns out it was my xml that was at fault. I'm including this as an example for others on what to watch out for.

Sample code that fails - can you see why?

Code: Select all

   <ndfpatch ndf="pc\ndf\patchable\gfx\everything.ndfbin" table="TUniteAuSolDescriptor" name="CHALLENGER 1 Mk.1 L-23 early TUniteAuSolDescriptor">
      <matchconditions>
         <matchcondition type="property" property="AliasName">CHALLENGER 1 Mk.1 L-23 early</matchcondition>
      </matchconditions>
      <changes>
         <change operation="set" property="Modules" key="MouvementHandler" type="ObjectReference">
            <reference table="TModuleSelector">
               <matchconditions>
                  <matchcondition type="references" table="TMouvementHandlerLandVehicleDescriptor">
                     <matchconditions>
                        <!-- Tracked non-amphib 18.52-19.99 HP/tonne -->
                        <matchcondition type="property" property="Maxspeed">2380</matchcondition>
                        <matchcondition type="property" property="UnitMovingType">5</matchcondition>
                        <matchcondition type="property" property="TempsDemiTour">1.0</matchcondition>
                        <matchcondition type="property" property="MaxAcceleration">880</matchcondition>
                     </matchconditions>
                  </matchcondition>
               </matchconditions>
            </reference>
         </change>
      </changes>
   </ndfpatch>


What I have done before running this code is to create new instances of TMouvementHandlerLandVehicleDescriptor, and a corresponding TModuleSelector to point to the new instance of TMouvementHandlerLandVehicleDescriptor. Now I am at the stage of linking my new units (in this case a CHALLENGER 1 Mk.1 L-23 early - ignore the stupid name, it is only used internally) and getting their MouvementHandler module pointing to the TModuleSelector that in turn points to the TMouvementHandlerLandVehicleDescriptor.

I identify the correct TModuleSelector by using <matchcondition type="references" ...>. This allows me to identify the specific TModuleSelector that I want, the one that points to a unique instance of TMouvementHandlerLandVehicleDescriptor. I identify this uniqueness by specifying four properties - MaxSpeed, UnitMovingType, TempsDemiTour and MaxAcceleration.

A long winded explanation but hopefully provides some guidance to newbies.

The problem is that I specified "1.0" for TempsDemiTour. This property is a Float32 so "1.0" is perfectly valid. However, it fails to match. To get around this you have to change the code so that it says this for the matchconditions:

Code: Select all

   
<!-- Don't put a decimal point if it is an integer, even for Float32 types -->
<matchcondition type="property" property="TempsDemiTour">1</matchcondition>


The error code indicated that the problem lay with the next matchcondition, which was MaxAcceleration; however, this was misleading, it was really the TempsDemiTour property that was the issue. It pays to look at previous properties for problems, not the one necessarily indicated by the error message.

So I hope this helps anybody else faced with a similarly difficult problem.

Pyro
Sergeant First-Class
Posts: 102
Joined: Mon 1 Sep 2014 23:56
Contact:

Re: power crystals' XML patcher and data exporter (now under old management)

Postby Pyro » Sat 11 Feb 2017 02:15

A request for power crystals if he looks to upgrade the WGPatcher:-

Support for modifying property type="Vector"

Example location: pc\ndf\patchable\ui\components.ndfbin
Example table: TTFSCommand_UISymbol
Example xml string (just an example, there may be other ways of doing this):

Code: Select all

<change operation="set" property="BBMin" type="Vector">0,-0.800000011920929,0</change>
<change operation="set" property="BBMax" type="Vector">1,0.200000002980232,0</change>


Updated: one more request along similar lines:

Support for modifying property type="EugFloat2"

Example location: pc\ndf\patchable\gfx\everything.ndfbin
Example table: TModernWarfareCommonDamageDescriptor
Example xml string (just an example, there may be other ways of doing this):

Code: Select all

<change operation="append" property="SuppressDamagesRegenRatio" type="EugFloat2">Float pair: 1 : 0.2</change>
<change operation="append" property="SuppressDamagesRegenRatio" type="EugFloat2">Float pair: 10 : 0.5</change>


TIA

vipermaus
Specialist
Posts: 11
Joined: Thu 26 Jun 2014 18:25
Contact:

Re: power crystals' XML patcher and data exporter (now under old management)

Postby vipermaus » Wed 24 Mar 2021 19:59

Oh mighty Power crystals, please, please send the exports to ResidentMario after the new South Africa Nation Pack update.

I make a database with it to speed up all of my modding.

(Here is the github page for residentmario: https://github.com/ResidentMario/wargame-data/)

Please shower us with your good fortune!

power crystals
Corporal
Posts: 44
Joined: Tue 8 Apr 2014 00:18
Contact:

Re: power crystals' XML patcher and data exporter (now under old management)

Postby power crystals » Thu 25 Mar 2021 03:08

I have nothing to do with that github project, other than they apparently use my tools for something. Unless this changes the underlying format somehow I don't think I have anything to do to allow them to update to match. So I guess that's good news?

vipermaus
Specialist
Posts: 11
Joined: Thu 26 Jun 2014 18:25
Contact:

Re: power crystals' XML patcher and data exporter (now under old management)

Postby vipermaus » Thu 25 Mar 2021 18:17

Ahhh.... Darn it!

I couldn't get the export tools to work, so I gave up on it. I've been trying to get it to work for a while, but it wasn't worth the time because they didn't change the instance numbers any in the last 5 or 6 updates
Thanks for the reply though!

power crystals
Corporal
Posts: 44
Joined: Tue 8 Apr 2014 00:18
Contact:

Re: power crystals' XML patcher and data exporter (now under old management)

Postby power crystals » Thu 25 Mar 2021 20:24

By "export tools", you mean mine? I admit I haven't touched them in literal years, but given that I'm going to have to dig up what I did anyway to update the random deck generator when the South Africa DLC is released, I can probably take a look. What happens?

Inertia056
Private First-Class
Posts: 5
Joined: Sun 4 Nov 2018 07:44
Contact:

Re: power crystals' XML patcher and data exporter (now under old management)

Postby Inertia056 » Sun 25 Jul 2021 10:10

Newbie question here. Does the tool support find and change a value in a module two levels below TUniteAuSolDescriptor, starting from TUniteAuSolDescriptor?

below is what I have now but I think it doesn't work.
I am trying to change the altitude in MouvementHandler of B-5(Unique to B-5).
I am trying to let the tool find the MouvementHandler, starting from TUniteAuSolDescriptor.

Code: Select all

   <!-- change B-5 jet altitude from 1050(1500) to 2100 -->
   <ndfpatch ndf="pc\ndf\patchable\gfx\everything.ndfbin" table="TUniteAuSolDescriptor" name="B-5 Jet Altitude">
      <matchconditions>
         <matchcondition type="property" property="NameInMenuToken">15561A1200000000</matchcondition>
      </matchconditions>
      <changes>
         <change operation="set" property="Modules" key="MouvementHandler" type="ObjectReference">
         <!--  change operation="set" property="ProductionPrice" key="0" type="Int32">5</change>     -->
         <change operation="set" property="Modules" type="map">
            <map>
               <key type="TableString">MouvementHandler</key>
               <value type="ObjectReference">
                  <reference table="TModuleSelector">
                     <matchconditions>
                        <matchcondition type="references" table="TMouvementHandlerAirplaneDescriptor">
                           <matchconditions>
                           </matchconditions>
                           <changes>
                              <change operation="set" property="FlyingAltitude" type="Float32">156000</change>
                           </changes>
                     </matchconditions>
                  </reference>
               </value>
              </map>
         </change>
      </changes>
   </ndfpatch>

bnsonear
Private First-Class
Posts: 9
Joined: Tue 31 Jan 2017 15:53
Contact:

Need help for a correct syntax for inserting ObjectReferance to a Collection

Postby bnsonear » Wed 8 Sep 2021 10:57

Dear power crystal and modders!

Questions and answers in this thread helped me a lot, but I still experiencing to handle MapList and List (aka Collection).
Modifying numbers and strings are quite easy for me, but I received error message contrantly when my XML code is trying to modify a designation in MapList or List.

Syntax - What I CAN do.png
Syntax - What I CAN do.png (438.51 KiB) Viewed 793 times


I code is mainly based sample xml code accompanied with Sandbox 6.0.
I run the xml code by SandboxInstaller.exe after modifying the contents of pre-existed xml files.

Error message is
Welcome to the Sandbox Mod Installer
Please wait until this console says "Finished!"
======================================================


Game variant: Steam
Local mod is most updated version
Getting install config
Showing interface
mod_from_backup=False
Patching, this might take a while...

Patcher Call: SandboxMod\Patcher\WGPatcher.exe apply C:\Program Files (x86)\Steam\steamapps\common\Wargame Red Dragon\Data\WARGAME\PC\49964\NDF_Win.dat SandboxMod\Script Library\Gameplay\MunaLcuSpeed.xml
WARNING: Unable to load config.xml. Program will continue with internal defaults only!
Processing patch file SandboxMod\Script Library\Gameplay\MunaLcuSpeed.xml
INFO: patch "A-10_Fuel_TModuSelector_add" affects 1 entries in TModuleSelector
INFO: Match condition found in patch A-10_Fuel_TModuSelector_fill has no type, assuming 'property'
INFO: patch "A-10_Fuel_TModuSelector_fill" affects 1 entries in TModuleSelector
ERROR: Unable to save property Selection in patch A-10_Fuel_TModuSelector_fill!
Making asset installerConfig
Running asset installer

Finished!
Press enter to exit...
Finished!


When I touched MapList or List, I see the error above.

My code is

Code: Select all

<wargamepatch>


   <ndfcreate ndf="pc\ndf\patchable\gfx\everything.ndfbin" table="TModuleSelector" name="A-10_Fuel_TModuSelector_add" />
   <!--Making empty slots of new instance of TModuleSelector for the later use-->
   <ndfpatch  ndf="pc\ndf\patchable\gfx\everything.ndfbin" table="TModuleSelector" name="A-10_Fuel_TmoduSelector_fill">
   <!--Filling empty slots of new instance of TmoduleSelector -->

      <matchconditions>
<!--      <matchcondition type="property" property="__createdby">AKA</matchcondition> -->      <!-- Not working-->
<!--      <matchcondition property="__createdby">AKA</matchcondition>      -->      <!-- Not working too-->
<!--         https://forums.eugensystems.com/viewtopic.php?f=187&t=57927&start=20#p948275    workaround   -->
         <matchcondition property="__order">last</matchcondition>
      </matchconditions>
      <changes>
         <change operation="set" property="ControllerName" type="TableString">FuelController</change> 
            <!--No problem -->
         <change operation="set" property="Default" type="ObjectReference">                                   
            <!--No problem -->
            <reference table="TFuelModuleDescriptor">   
            
               <matchconditions>
                  <matchcondition type="property" property="FuelCapacity">5400</matchcondition>
                  <matchcondition type="property" property="FuelMoveDuration">324</matchcondition>
               </matchconditions>      
            
            </reference>
         </change>

<!--          My problem occurs here,-→ correct syntax needed                              -->
         <!-- <change operation="append" property="Selection" key="null" type="map"> -->                   
         <!-- <change operation="append" property="Selection" type="map"> -->                
         <!-- <change operation="append" property="Selection" type="ObjectReference"> -->      
         
         <change operation="set" property="Selection" type="List" />
         <change property="Selection" type="ObjectReference" operation="append">
               
            <!-- <map>    -->
            <!-- <ObjectReference> -->
               <!-- <key type="OjbectReference">null</key> --> 
               <!-- <key type="OjbectReference">93</key> -->
               <value type="ObjectReference">          
                  <reference table="TModuleSelectorFilter">
                                                      
                     <matchconditions>
                     
                        <!-- <matchcondition type="property" property="__order">first</matchcondition>  -->
                        
                        <!-- <matchcondition type="references" table="TModuleSelectorCondition_OR"> -->           <!-- <matchconditions> -->
                        
                              <!-- <matchcondition type="property" property="ControllerName">ScannerConfigurationController</matchcondition> -->   
      


               <!-- <reference table="TDeckRulesModifier"> -->   
                  <!-- <matchconditions> -->
                     <!-- <matchcondition type="property" property="__order">last</matchcondition> --> 
                  <!-- </matchconditions> -->
               <!-- </reference> -->



   
                        
                           <!-- </matchconditions> -->
                        <!-- </matchcondition> -->
                        

                              <matchcondition type="references" table="TModuleSelectorCondition_OR">     
                                 <matchconditions>
                              
                                    <matchcondition type="references" table="TModuleSelectorCondition_ParamEquals_Integer">     
                                    </matchcondition>               
                              
                                 </matchconditions>
                              </matchcondition>   
                              
                              <matchcondition type="referencedby" table="TModuleSelector"> 
                                 <matchconditions>
                                        
                                     <matchcondition type="property" property="ControllerName">FuelController</matchcondition>
                                     <matchcondition type="referencedby" table="TUniteAuSolDescriptor">
                                       <matchconditions>
                                             
                                             
                                          <matchcondition type="property" property="ClassNameForDebug">Unit_Su25T_Frogfoot</matchcondition>
                                          <matchcondition type="property" property="MotherCountry">URSS</matchcondition>
                                                
                                                
                                       </matchconditions>
                                    </matchcondition>
                                          
                                          
                                 </matchconditions>
                              </matchcondition>
                                    


                  
                        
                     </matchconditions>
                  </reference>
               </value>      
            <!-- </ObjectReference> -->
            <!-- </map> -->
         </change>   
         
         
         
      </changes>
   </ndfpatch>

 
</wargamepatch>


The code is trying to insert a Newly created ObjbectReference in an empty Collection.
Based on a LAVtransport.xml patch, I modified it so I have several working code, but this operation have never succeed.




Correct Syntax - What I want TO DO.png
Correct Syntax - What I want TO DO.png (407.08 KiB) Viewed 793 times




I'm not a professional programmer, and not an experienced modder. No language-related education, just a doing it for hobby.
I want to learn from this forum but finding a correct syntax from sample code is beyond my knowledge. Any advice is welcome.

Please help me.
Thank you.

bnsonear
Private First-Class
Posts: 9
Joined: Tue 31 Jan 2017 15:53
Contact:

(Corrected) Need help for a correct syntax for replacing a Module in a List

Postby bnsonear » Thu 9 Sep 2021 18:43

Hello, modders!

I'm a newbie modder and am experiencing an error with syntax of xml script based on power crystals' WGPatch.

My code is relatively simple, just replacing an existing module in Collection (aka List) with a new module.

I learned from the sample codes and their discussion of Sandbox 6.0 by "W:AB Noob", "Bollywood Baloney", and "power crystals", but I couldn't find solution.

Visual-aided_Code.png
Visual-aided_Code.png (46.1 KiB) Viewed 698 times

Text-version of code is at the end of post.

My problem is described in the picture below.
Deadlock.png
Deadlock.png (599.48 KiB) Viewed 698 times



Because I couldn't find a document for the syntax, I make my code from other one and applied modification.
With my code above, I get a nested module designation (a in the picture) which results a game crash at the beginng of game running.
I change a part of the code but the result were having duplicated module (b in the picture, I changed operation="set" to "append") or script failure (c in the picture, I removed <key> and <value> to avoid nesting, but Error occurs).

I have no professional experience nor education of computer language, so it is very hard to find a bug in my code.
Any advice is welcome, please help me. Thank you in advance.


Code: Select all

<wargamepatch>
   <ndfpatch ndf="pc\ndf\patchable\gfx\everything.ndfbin" table="TUniteAuSolDescriptor" name="A-10_Assign_New_FeulCtrlr">
      <matchconditions>
         <!-- Identify the LAV-25 in TUniteAuSolDescriptor by its loc hash and nationality-->
         <matchcondition type="property" property="ClassNameForDebug">Unit_A10_Thunderbolt_II</matchcondition>
         <matchcondition type="property" property="MotherCountry">US</matchcondition>
      </matchconditions>
      
      <changes>
         <!-- <change operation="delete" property="Modules" key="Fuel"/>  -->
         
         <!-- <change operation="set" property="Modules" key="Fuel" type="map"> -->
            <!-- <key type="Unset"/> -->
               <!-- <value type="Unset"/> -->
      <!--   </change> -->      


         <change operation="set" property="Modules" key="Fuel" type="map">
            <map>
               <key type="TableString">Fuel</key>
               <value type="ObjectReference">
               <!-- Now we need to borrow a TModuleSelector from another transport unit that points to a TransporterController-->
                  <reference table="TModuleSelector">
                     <matchconditions>
                        <matchcondition property="__order">last</matchcondition>
                        
                        <!-- <matchcondition type="referencedby" table="TUniteAuSolDescriptor"> -->
                           <!-- Condition two is that the TModuleSelector is itself referenced by another transport vehicle-->
                           <!-- <matchconditions> -->
                              <!-- I chose the LVTP-7 in this case -->
                              <!-- <matchcondition type="property" property="NameInMenuToken">88E6811600000000</matchcondition> -->
                              <!-- <matchcondition type="property" property="MotherCountry">US</matchcondition> -->
                           <!-- </matchconditions> -->
                        <!-- </matchcondition> -->
                     </matchconditions>
                  </reference>
               </value>
            </map>
         </change>

         
      </changes>
   </ndfpatch>

</wargamepatch>

Return to “Modding”

Who is online

Users browsing this forum: No registered users and 9 guests