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">
<matchcondition type="property" property="AliasName">CHALLENGER 1 Mk.1 L-23 early</matchcondition>
<change operation="set" property="Modules" key="MouvementHandler" type="ObjectReference">
<matchcondition type="references" table="TMouvementHandlerLandVehicleDescriptor">
<!-- 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>
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.