[Modding Question] sector_data.xml.

Discuss and distribute tools and methods for modding. Moderator - Grognak
All4n
Posts: 44
Joined: Fri Sep 28, 2012 12:29 pm

Re: [Modding Question] sector_data.xml.

Postby All4n » Wed Oct 03, 2012 8:52 am

I would just append it like this:

Code: Select all

<sectorDescription name="NEBULA_SECTOR" minSector="0" unique="false">
   <nameList>
      <name>Uncharted Nebula</name>
   </nameList>
   <trackList>
      <track>deepspace</track>
      <track>void</track>
   </trackList>
   <rarityList>
      <blueprint name="engi" rarity="4"/>
      <blueprint name="mantis" rarity="4"/>
      <blueprint name="energy" rarity="4"/>
      <blueprint name="slug" rarity="3"/>
      <blueprint name="rock" rarity="4"/>
      <blueprint name="human" rarity="1"/>
   </rarityList>
   <startEvent>START_BEACON_NEBULA</startEvent>
   <event name="STORE" min="0" max="1"/>
   <event name="ITEMS" min="1" max="3"/>
   <event name="NEBULA_STORE" min="1" max="1"/>
   <event name="NEBULA_EMPTY" min="4" max="4"/>
   <event name="NEBULA_HOSTILE" min="5" max="6"/>
   <event name="NEBULA_NEUTRAL" min="7" max="8"/>
   <event name="DISTRESS_BEACON" min="1" max="3"/>

<event name="YOUR_EVENT" min="1" max="1"/>
</sectorDescrption>
Last edited by All4n on Wed Oct 03, 2012 10:47 am, edited 1 time in total.
Got a event, alternative text, or maybe a new sector? Add it to the Additional Events & Texts (AET) mod! Credits will be given, and you will help make a big pack of content!
Hax
Posts: 1
Joined: Wed Oct 03, 2012 8:55 am

Re: [Modding Question] sector_data.xml.

Postby Hax » Wed Oct 03, 2012 9:04 am

PvtVain wrote:Alright so for my event mod I am currently in the works of. I would like to know how I WOULD append it, without making a new sector entirely just for my events. Like adding them to certain sectors.


@PvtVain - if you havent read this thread and the document it links to already then I heartily recommend it. It covers exactly what you're asking about:
viewtopic.php?f=12&t=2533


Also, unless your events are reliant on something within the Nebula, you might well be able to simply add the event to the STANDARD_SPACE sector to test it in the first sector quickly.

-Hax
-Hax
All4n
Posts: 44
Joined: Fri Sep 28, 2012 12:29 pm

Re: [Modding Question] sector_data.xml.

Postby All4n » Wed Oct 03, 2012 9:13 am

That said it would be better if you added it to one of the following event lists I think:

Code: Select all

   <event name="NEBULA_STORE" min="1" max="1"/>
   <event name="NEBULA_EMPTY" min="4" max="4"/>
   <event name="NEBULA_HOSTILE" min="5" max="6"/>
   <event name="NEBULA_NEUTRAL" min="7" max="8"/>
Got a event, alternative text, or maybe a new sector? Add it to the Additional Events & Texts (AET) mod! Credits will be given, and you will help make a big pack of content!
Alblaka
Posts: 98
Joined: Thu Sep 20, 2012 1:41 pm

Re: [Modding Question] sector_data.xml.

Postby Alblaka » Wed Oct 03, 2012 9:16 am

All4n wrote:I would just append this:

Code: Select all

<sectorDescription name="NEBULA_SECTOR" minSector="0" unique="false">
   <event name="YOUR_EVENT" min="1" max="1"/>
</sectorDescrption>


This should work as it is added to this:

Code: Select all

<sectorDescription name="NEBULA_SECTOR" minSector="0" unique="false">
   <nameList>
      <name>Uncharted Nebula</name>
   </nameList>
   <trackList>
      <track>deepspace</track>
      <track>void</track>
   </trackList>
   <rarityList>
      <blueprint name="engi" rarity="4"/>
      <blueprint name="mantis" rarity="4"/>
      <blueprint name="energy" rarity="4"/>
      <blueprint name="slug" rarity="3"/>
      <blueprint name="rock" rarity="4"/>
      <blueprint name="human" rarity="1"/>
   </rarityList>
   <startEvent>START_BEACON_NEBULA</startEvent>
   <event name="STORE" min="0" max="1"/>
   <event name="ITEMS" min="1" max="3"/>
   <event name="NEBULA_STORE" min="1" max="1"/>
   <event name="NEBULA_EMPTY" min="4" max="4"/>
   <event name="NEBULA_HOSTILE" min="5" max="6"/>
   <event name="NEBULA_NEUTRAL" min="7" max="8"/>
   <event name="DISTRESS_BEACON" min="1" max="3"/>
</sectorDescrption>


Or am I missing something completely?


This should NOT work.
'Append' merely refers to adding the content of your file after the original ones. FTL's parser will override previous tags with repeating ones.
With that code, you will replace the entire content of the nebula sector with your defined event.

Code: Select all

<sectorDescription name="NEBULA_SECTOR" minSector="0" unique="false">
   ...
   <startEvent>START_BEACON_NEBULA</startEvent>
   <event name="STORE" min="0" max="1"/>
   <event name="ITEMS" min="1" max="3"/>
   <event name="NEBULA_STORE" min="1" max="1"/>
   <event name="NEBULA_EMPTY" min="4" max="4"/>
   <event name="NEBULA_HOSTILE" min="5" max="6"/>
   <event name="NEBULA_NEUTRAL" min="7" max="8"/>
   <event name="DISTRESS_BEACON" min="1" max="3"/>
       
        <event name="YOUR_EVENT" min="1" max="1"/>
</sectorDescrption>


This is how you would want to do it.
OR you could adress the eventlist hidden behind those names. They're stored in the events_xyz.xml's.
Greetz,
Alblaka
All4n
Posts: 44
Joined: Fri Sep 28, 2012 12:29 pm

Re: [Modding Question] sector_data.xml.

Postby All4n » Wed Oct 03, 2012 9:18 am

Alblaka wrote:
This should NOT work.
'Append' merely refers to adding the content of your file after the original ones. FTL's parser will override previous tags with repeating ones.
With that code, you will replace the entire content of the nebula sector with your defined event.

Code: Select all

<sectorDescription name="NEBULA_SECTOR" minSector="0" unique="false">
   ...
   <startEvent>START_BEACON_NEBULA</startEvent>
   <event name="STORE" min="0" max="1"/>
   <event name="ITEMS" min="1" max="3"/>
   <event name="NEBULA_STORE" min="1" max="1"/>
   <event name="NEBULA_EMPTY" min="4" max="4"/>
   <event name="NEBULA_HOSTILE" min="5" max="6"/>
   <event name="NEBULA_NEUTRAL" min="7" max="8"/>
   <event name="DISTRESS_BEACON" min="1" max="3"/>
       
        <event name="YOUR_EVENT" min="1" max="1"/>
</sectorDescrption>


This is how you would want to do it.
OR you could adress the eventlist hidden behind those names. They're stored in the events_xyz.xml's.


Ahh. Thanks!

That's a shame, event mods will overwrite each other easily then.

We really need a .merge file/function then.
Got a event, alternative text, or maybe a new sector? Add it to the Additional Events & Texts (AET) mod! Credits will be given, and you will help make a big pack of content!
All4n
Posts: 44
Joined: Fri Sep 28, 2012 12:29 pm

Re: [Modding Question] sector_data.xml.

Postby All4n » Wed Oct 03, 2012 10:32 am

PvtVain wrote:
*bla bla bla*

And so on and so fourth. Of course this would require everyone who wanted to make their mods compatible with each other to share their event/upcoming event coding. Which of course would be no problem once you release the mod and stuff.

But none the less, that was just a idea that was pulled out in a second.


I see that, but it is not very user/mod friendly.
Got a event, alternative text, or maybe a new sector? Add it to the Additional Events & Texts (AET) mod! Credits will be given, and you will help make a big pack of content!
Icehawk78
Posts: 230
Joined: Tue Sep 18, 2012 4:55 pm

Re: [Modding Question] sector_data.xml.

Postby Icehawk78 » Thu Oct 04, 2012 6:25 pm

All4n wrote:Ahh. Thanks!

That's a shame, event mods will overwrite each other easily then.

We really need a .merge file/function then.

Yes, this is correct. Anything that modifies two of the same events/root tags will end up overwriting each other until we work out a valid means of "merging" mods.

One idea I'm working with is adding a "mergeChildren" attribute that mod authors can add to .xml.merge files (actually, I dislike that convention and if I implement it will more likely set them as '.merge.xml' files, so that people with syntax highlighting editors don't need to manually set the language).

In this case, you'd set particular attributes to be set to "MERGE_NAME", "MERGE_TAG", "MERGE_ALL", "APPEND_ALL", "REMOVE_ALL", "OVERWRITE_ALL", "OVERWRITE_NAME", or "OVERWRITE_TAG".

So, given the following source XML:

Code: Select all

<!-- Source -->
<event name="FINISH_BEACON">
   <text>You've arrived at the Long-Range Beacon. When the FTL Drive is charged you can jump to the next Sector.</text>
   <choice hidden="true">
      <text>Continue...</text>
      <event load="NON_HOSTILE"/>
   </choice>
</event>


This mod would replace the entire event with itself:

Code: Select all

<!-- Mod -->
<event name="FINISH_BEACON" mergeChildren="OVERWRITE_ALL">
   <text>This is the end. Prepare yourself!</text>
   <choice hidden="true">
      <text>Continue...</text>
      <event />
   </choice>
   <choice hidden="true">
      <text>Pick a fight!</text>
      <event load="HOSTILE1"/>
   </choice>
   <choice hidden="true">
      <text>Go shopping!</text>
      <store />
   </choice>
</event>


This mod would simply add another choice to the event without changing anything else:

Code: Select all

<event name="FINISH_BEACON" mergeChildren="APPEND_ALL">
   <choice hidden="true">
      <text>Go shopping!</text>
      <store />
   </choice>
</event>


This mod would make the event completely empty (note: I have no clue what this would do to the game):

Code: Select all

<event name="FINISH_BEACON" mergeChildren="REMOVE_ALL" />


To demonstrate the "MERGE" attributes, I'll instead use the following source example:

Code: Select all

<shipBlueprint name="PLAYER_SHIP_HARD" layout="kestral" img="kestral">
   <class>Kestrel Cruiser</class>
   <name>The Kestrel</name>
   <desc>This class of ship was decommissioned from Federation service years ago.  After a number of refits and updating this classic ship is ready for battle.</desc>
   <systemList>
      <pilot power="1" room="0" start="true" img="room_pilot">
         <slot>
            <direction>right</direction>
            <number>0</number>
         </slot>
      </pilot>
      <doors power="1" room="2" start="true" img="room_doors"/>
      <sensors power="1" room="3" start="true" img="room_sensors"/>
      <medbay power="1" room="4" start="true" img="room_medbay">
         <slot>
            <number>1</number>
         </slot>
      </medbay>
      <oxygen power="1"  room="13" start="true" img="room_oxygen"/>
      <shields power="2" room="5" start="true" img="room_shields"/>
      <engines power="2" room="14" start="true" img="room_engines"/>
      <weapons power="3" room="10" start="true" img="room_weapons"/>
      <drones power="2" room="1" start="false"/>
      <teleporter power="1" room="15"   start="false"/>
      <cloaking power="1" room="8" start="false"/>
   </systemList>
   <weaponSlots>4</weaponSlots>
   <droneSlots>2</droneSlots>
   <weaponList count="2" missiles="8">
      <weapon name="MISSILES_2_PLAYER"/>
      <weapon name="LASER_BURST_3"/>
   </weaponList>
   <health amount="30"/>
   <maxPower amount ="8"/>
   <crewCount amount = "3" class="human"/>
</shipBlueprint>


The following mod would alter the existing ship to start with L2 cloaking:

Code: Select all

<shipBlueprint name="PLAYER_SHIP_HARD" mergeChildren="MERGE_TAG">
   <systemList mergeChildren="OVERWRITE_TAG">
      <cloaking power="2" room="8" start="true"/>
   </systemList>
</shipBlueprint>


Open issues which I don't know how to handle yet:

If I want to add L2 cloaking and change the number of crewmembers to 2, rather than 3, how would I do that?

This mod wouldn't modify the crew:

Code: Select all

<shipBlueprint name="PLAYER_SHIP_HARD" mergeChildren="MERGE_TAG">
   <systemList mergeChildren="OVERWRITE_TAG">
      <cloaking power="2" room="8" start="true"/>
   </systemList>
   <crewCount amount="2" class="human" />
</shipBlueprint>


This mod would remove every system other than the Cloaking room:

Code: Select all

<shipBlueprint name="PLAYER_SHIP_HARD" mergeChildren="OVERWRITE_TAG">
   <systemList mergeChildren="OVERWRITE_TAG">
      <cloaking power="2" room="8" start="true"/>
   </systemList>
   <crewCount amount="2" class="human" />
</shipBlueprint>


I could possibly add a second tag (ie allow both a "mergeSelf" and a "mergeChildren") but I'm trying to keep it simple.

Any ideas?