PDA

View Full Version : Question on XML lay-out of db.xml



MeepoSose
September 28th, 2008, 00:52
It looks like in a lot of XML files there are large sections of sibling nodes that all have distinct element names. Is there some reason why they don't all have the same element name and just use different attribute values, like id='NPC ID0001"? That would seem to allow for a lot more flexibility in XPath queries and searches. Maybe I'm just missing something.

For instance,
This is how the NPC section of the campaign's db.xml looks today:

<npc idcounter="8">
<category name="" mergeid="" baseicon="0" decalicon="0">
<id-00002>
<atk type="string">short sword +13 (1d6+8) or short sword +11 (2d6+8) or pulse wave pistol +11 (3d6+1) or pulse-wave pistol +9 (4d6+1)</atk>
<attackoptions type="string">Devastating Attack (simple weapons), Weapon Specialization (simple weapons), Rapid Shot, Rapid Strike, Withdrawal Strike (simple weapons)</attackoptions>
<babgrp type="string">7</babgrp>
<charisma type="number">6</charisma>
<constitution type="number">0</constitution>
<dexterity type="number">16</dexterity>
<feats type="string">Armor Proficiency (light, medium), Rapid Shot, Rapid Strike, Weapon Focus (pistols), Weaopn Focus (simple weapons), Weapon Proficiency (pistols, simple weaons), Withdrawal Strike (simple weapons)</feats>
<fortitudesave type="number">20</fortitudesave>
<fullatk type="string">Rapid Shot Pulse wave pistol +9/+9 (3d6+1)</fullatk>
<gear type="string">short sword, pulse-wave pistol, durasteel battle armor, internal comlink</gear>
<hp type="number">26</hp>
<init type="number">7</init>
<intelligence type="number">6</intelligence>
<languages type="string">Basic (can't speak), Binary</languages>
<name type="string">Krath War Droid</name>
<reflexsave type="number">22</reflexsave>
<senses type="string">Perception +5</senses>
<skills type="string">Acrobatics +12</skills>
<spacereach type="string">5</spacereach>
<speed type="string">6</speed>
<strength type="number">20</strength>
<text type="formattedtext">
<p>During their conquest of the Deep Core but prior to their invasion of the galaxy at large, the Krath often have a tenuous hold on the planets they capture due to sheer lack of numbers. The Krath war droid is designed to supplement the military forces on Krath-held worlds, acting as soldiers with few needs and no mercy. Krath war droids are deployed via pods dropped from orbit to the surface of the planet, at which point they use the strength of their numbers to overwhelm enemy forces. Since Krath war droids have none of the sense of self-preservation that biological troops do, Krath commanders have no difficulties in sending wave after wave of Krath war droid to their doom in order to wear down and eventually overrun enemy positions. Krath war droids playa major role in the assault during the Conclave on Deneba, slaying many Jedi before the droids are destroyed . </p>
<p>Krath war droids cannot be played as droid heroes. </p>
</text>
<threshold type="number">17</threshold>
<token type="token"></token>
<type type="string">medium droid</type>
<willsave type="number">14</willsave>
<wisdom type="number">12</wisdom>
</id-00002>
<id-00006>
<charisma type="number">0</charisma>
<constitution type="number">0</constitution>
<dexterity type="number">0</dexterity>
<fortitudesave type="number">0</fortitudesave>
<hp type="number">0</hp>
<init type="number">10</init>
<intelligence type="number">-5</intelligence>
<name type="string">Assassin</name>
<reflexsave type="number">0</reflexsave>
<strength type="number">0</strength>
<text type="formattedtext">
<p></p>
</text>
<threshold type="number">0</threshold>
<token type="token"></token>
<willsave type="number">0</willsave>
<wisdom type="number">0</wisdom>
</id-00006>
<id-00007>
</id-00007>
</category>
</npc>

Instead of having id-00005, id-00006 and id-00007 all as uniquely named elements, why not have three NPCInstance elements?



<npc>
<category>


<npcinstance id="id-00005">(same stuff in between tags as before)</npcinstance>
<npcinstance id="id-00006">...</npcinstance>
<npcinstance id="id-00007">...</npcinstance>
</category>
</npc>


Maybe you can still do this as is (sorry, I don't use XPath that often) but with the latter option, you could run some cool queries to return all NPCs with a type="medium droid", sorted by hp, and even pass in a random # and pull the npc at that location.

Is this just a function of the ruleset and library modules I happened to look at or is this a deliberate choice by the devs of FG2?

Foen
September 28th, 2008, 06:41
The id-00001 nodes are auto-generated by the FG engine when you add something to a collection. They don't need to follow that format, but they *do* need to be unique - FG doesn't use an id attribute for uniqueness, unfortunately.

Foen