XML:Expert tutorial: Difference between revisions

From OniGalore
Jump to navigation Jump to search
(dropping commented-out notes from main XML page here so we can see them and so we can flag this page to be finished)
 
mNo edit summary
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{finish}}
{{finish}}


''Setting up alarm consoles should be a good candidate for this. Alternative choices for such a tutorial: TRAM usage of characters, ONIE.''
Expert-level modding, huh?


''Alarm console reading material:''
That's when you not just design XML data that depend on each other but when you also have to consider special behavior of how files types/data get packed and processed.
*[[AI#Pursuit_of_enemy_alias_.22I_will_find_you....22]]
*[[AI#Alarm_behavior_-_.22She.27s_everywhere.21.22]]


===Patch mods===
[[Making_a_patch_mod|Patching XML files]] with code fragments or special instructions can combine features and avoid conflicts.
====Example: Rifle Sprinting====
There was a compatibility problem between "51000 Rifle Sprinting" and "54000 New Combat Moves for Konoko".
Both packages modify TRAC files whereby 54000 has priority because it has a higher value and so 51000 was breaking when both were installed at the same time.
To avoid conflicts 51000 needed to become a XML patch mod (*.oni-patch). The code from 51000 needed to become injected into the files of 54000 (or any other package that comes with the same file (names)).
Note how Rifle Sprinting uses the '''oni''' folder for new content and the '''patches''' folder for code injections.
For simplicity of this example the striker and ninja files within the 51000 package are not listed.
'''Old structure:'''
AE\AEInstaller\packages\51000Rifle_Sprinting\'''oni'''\common\level0_Final
TRACkonokolev1_animations.oni
TRACkonoko_animations.oni
TRACkonokocore_animations.oni
TRAMKONSPRPISrun_lt.oni
TRAMKONSPRPISrun_rt.oni
TRAMKONSPRRIFrun_lt.oni
TRAMKONSPRRIFrun_rt.oni
'''New structure:'''
AE\AEInstaller\packages\51000Rifle_Sprinting\'''oni'''\common\level0_Final
TRAMKONSPRPISrun_lt.oni
TRAMKONSPRPISrun_rt.oni
TRAMKONSPRRIFrun_lt.oni
TRAMKONSPRRIFrun_rt.oni
AE\AEInstaller\packages\51000Rifle_Sprinting\'''patches'''\common\level0_Final
TRACkonokocore_animations.oni-patch
The lines inside the TRAC file were reduced to the new animations instead of holding all approximate 500 animations:
'''TRACkonokocore_animations.oni-patch'''
@XML_TOOLS Version "2.0"
@ADD_INSIDE_NODES ElementName "Animations"
<xml>
            <TRACAnimation>
                <Weight>100</Weight>
                <Animation>TRAMKONSPRPISrun_lt</Animation>
            </TRACAnimation>
            <TRACAnimation>
                <Weight>100</Weight>
                <Animation>TRAMKONSPRPISrun_rt</Animation>
            </TRACAnimation>
            <TRACAnimation>
                <Weight>100</Weight>
                <Animation>TRAMKONSPRRIFrun_lt</Animation>
            </TRACAnimation>
            <TRACAnimation>
                <Weight>100</Weight>
                <Animation>TRAMKONSPRRIFrun_rt</Animation>
            </TRACAnimation>
</xml>
'''Special note on TRAMs'''
In order to register the new anims in the "'''core'''" TRAC the two parent TRAC files had to be delivered as well.
: TRACkonokolev1_animations -> TRACkonoko_animations.oni -> TRACkonoko'''core'''_animations (holds new run animations)
But since these 3 TRAC files are Vanilla game data (always present) and the '''XML patcher can directly modify the one interesting TRACkonokocore_animations'''.oni file we don't need all 3 files anymore - just one patch.
'''The possibilities of XML patching'''
script10k's XmlTools is very powerful. It can not only '''add''' but also '''remove''' and '''modify''' nodes based on [https://www.w3schools.com/xml/xml_xpath.asp XPath] expressions - and it can even run custom JS code.
Learn more '''[[XmlTools|HERE]]'''.
==Other candidates==
''ToDo: Finish both sections.''
===ONIE modifications===
ONIE is a good example why packages should be used. Plug-in modding is in one half "expert+" and in the other half simply a black box.
===Alarm consoles===
''Reading material:''
*[[AI#Pursuit]]
*[[AI#Alarm_behavior]]
{{XML}}
[[Category:Modding tutorials]]
[[Category:Modding tutorials]]

Latest revision as of 08:49, 28 March 2023

Unfinished building-60px.jpg

This page is unfinished. Can you fill in any missing information?
If it is not clear which part of the page is unfinished, ask on the talk page.

Expert-level modding, huh?

That's when you not just design XML data that depend on each other but when you also have to consider special behavior of how files types/data get packed and processed.

Patch mods

Patching XML files with code fragments or special instructions can combine features and avoid conflicts.

Example: Rifle Sprinting

There was a compatibility problem between "51000 Rifle Sprinting" and "54000 New Combat Moves for Konoko".

Both packages modify TRAC files whereby 54000 has priority because it has a higher value and so 51000 was breaking when both were installed at the same time.

To avoid conflicts 51000 needed to become a XML patch mod (*.oni-patch). The code from 51000 needed to become injected into the files of 54000 (or any other package that comes with the same file (names)).

Note how Rifle Sprinting uses the oni folder for new content and the patches folder for code injections.

For simplicity of this example the striker and ninja files within the 51000 package are not listed.


Old structure:

AE\AEInstaller\packages\51000Rifle_Sprinting\oni\common\level0_Final

TRACkonokolev1_animations.oni
TRACkonoko_animations.oni
TRACkonokocore_animations.oni
TRAMKONSPRPISrun_lt.oni
TRAMKONSPRPISrun_rt.oni
TRAMKONSPRRIFrun_lt.oni
TRAMKONSPRRIFrun_rt.oni


New structure:

AE\AEInstaller\packages\51000Rifle_Sprinting\oni\common\level0_Final

TRAMKONSPRPISrun_lt.oni
TRAMKONSPRPISrun_rt.oni
TRAMKONSPRRIFrun_lt.oni
TRAMKONSPRRIFrun_rt.oni


AE\AEInstaller\packages\51000Rifle_Sprinting\patches\common\level0_Final

TRACkonokocore_animations.oni-patch


The lines inside the TRAC file were reduced to the new animations instead of holding all approximate 500 animations:

TRACkonokocore_animations.oni-patch

@XML_TOOLS Version "2.0"

@ADD_INSIDE_NODES ElementName "Animations"
<xml>
           <TRACAnimation>
               <Weight>100</Weight>
               <Animation>TRAMKONSPRPISrun_lt</Animation>
           </TRACAnimation>
           <TRACAnimation>
               <Weight>100</Weight>
               <Animation>TRAMKONSPRPISrun_rt</Animation>
           </TRACAnimation>
           <TRACAnimation>
               <Weight>100</Weight>
               <Animation>TRAMKONSPRRIFrun_lt</Animation>
           </TRACAnimation>
           <TRACAnimation>
               <Weight>100</Weight>
               <Animation>TRAMKONSPRRIFrun_rt</Animation>
           </TRACAnimation>
</xml>


Special note on TRAMs

In order to register the new anims in the "core" TRAC the two parent TRAC files had to be delivered as well.

TRACkonokolev1_animations -> TRACkonoko_animations.oni -> TRACkonokocore_animations (holds new run animations)

But since these 3 TRAC files are Vanilla game data (always present) and the XML patcher can directly modify the one interesting TRACkonokocore_animations.oni file we don't need all 3 files anymore - just one patch.


The possibilities of XML patching

script10k's XmlTools is very powerful. It can not only add but also remove and modify nodes based on XPath expressions - and it can even run custom JS code.

Learn more HERE.

Other candidates

ToDo: Finish both sections.

ONIE modifications

ONIE is a good example why packages should be used. Plug-in modding is in one half "expert+" and in the other half simply a black box.

Alarm consoles

Reading material: