Editing XML/Faction

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
([[XML|Back to XML Overview ]])
+
{{XMLs}}
 
 
 
The [[faction]] [[XML]] is the base definition for each faction in a tech tree mod and defines the starting [[units]], starting resources and music. The actual name of the file will be the faction's name (which must match the [[folder]]).
 
The [[faction]] [[XML]] is the base definition for each faction in a tech tree mod and defines the starting [[units]], starting resources and music. The actual name of the file will be the faction's name (which must match the [[folder]]).
  
 +
{{TOC limit|2}}
  
 
==XML==
 
==XML==
 +
{{XML_definition_header}}
 
<syntaxhighlight lang="xml">
 
<syntaxhighlight lang="xml">
 
<?xml version="1.0" standalone="no"?>
 
<?xml version="1.0" standalone="no"?>
 
<faction>
 
<faction>
 
<starting-resources>
 
<starting-resources>
<resource name="resource_name" amount="100" />
+
<resource name="resource_name" amount="100"/>
 
</starting-resources>
 
</starting-resources>
 
<starting-units>
 
<starting-units>
<unit name="unit_name" amount="1" />
+
<unit name="unit_name" amount="1"/>
</starting-units>  
+
</starting-units>
<music value="true" path="music_tech.ogg" />
+
<music value="true" path="music_tech.ogg"/>
<link>
+
<!-- Start GAE Only -->
<techtree name="techtree_name" />
+
<logo value="true">
</link>
+
<team-colour path="logo_team.png" />
<ai-behavior>
+
<rgba-colour path="logo_rgba.png" />
<worker-units>
+
</logo>
<unit name="unit_name" minimum="1" />
+
<attack-notice enabled="true" min-delay="15">
</worker-units>
+
<sound-file path="sound/attacked.ogg" />
<warrior-units>
+
</attack-notice>
<unit name="unit_name" minimum="1" />
+
<subfactions>
</warrior-units>
+
<subfaction name="subfaction_name"/>
<resource-producer-units>
+
</subfactions>
<unit name="unit_name" minimum="1" />
+
<loading-screen>
</resource-producer-units>
+
<background-image path="loading_screen.png" />
<building-units>
+
</loading-screen>
<unit name="unit_name" minimum="1" />
+
<!-- End GAE Only -->
</building-units>
 
<upgrades>
 
<upgrade name="upgrade_name" />
 
</upgrades>
 
</ai-behavior>
 
    <flat-particle-positions value="true"/>
 
 
</faction>
 
</faction>
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 47: Line 42:
  
 
===music===
 
===music===
If true, the specified music will be played in a loop while using the specified faction.  
+
If true, the specified music will be played in a loop while using the specified faction. In GAE Only, you can specify multiple music tracks and can choose whether to shuffle them (play randomly) or in order. In order to use multiple tracks, play-list must be true, such as in the below example:
  
===loading-screen===
+
<syntaxhighlight lang="xml">
MegaGlest looks for a loading screen which must be called <tt>loading_screen.*</tt> in the faction folder.
+
<!-- Start GAE Only -->
 +
<music value="true" play-list="true" shuffle="true">
 +
<music-file path="music/track1.ogg" />
 +
<music-file path="music/track2.ogg" />
 +
</music>
 +
<!-- End GAE Only -->
 +
</syntaxhighlight>
  
===link===
+
===logo===
A command which makes the faction a reference to another, existing faction, in a different techtree. The only attribute is the [[techtree]] the faction should be found in. The faction loaded will be the same name as this faction's XML name (so if creating a link to the [[Indian]] faction in the [[MegaPack]], the faction XML would be called <tt>indian.xml</tt>, with the same folder structure as any other faction. When the link element is used, all other elements except the top level faction element and XML declaration should be removed.
+
{{Main|GAE/Faction logos}}
 +
If enabled, a faction logo will be placed in the unit info box when no units or resources are selected. This image is made of two parts, a team color part which uses greyscale to define how dark or how light team color is, and a true color image that will be rendered on top of the team color image. GAE only.
  
===ai-behavior===
+
===attack-notice===
{{Main|MG/AI control}}
+
If enabled, a sound file will be played whenever your units are attacked offscreen. This will not trigger if you are attacked inside your viewing area, and will not sound more often than the min-delay, in seconds. Multiple sound files can be linked to by using multiple sound-file tags.
This tag will be present in the <tt>&lt;faction&gt;</tt> tag of the faction XML, and will contain all the other elements to define the AI's behavior.
 
  
===worker-units===
+
===subfactions===
Units specified here are treated as workers and make up the bulk of production and expansion. A minimum number is specified to tell the AI how many of this unit it should try and maintain at all times.
+
{{See|GAE/Subfactions}}
 +
If not a closed tag, a list of subfactions available must be registered here.
  
===warrior-units===
+
===loading-screen===
Units specified here are treated as warriors, meaning they will be used as the primary attack force. A minimum number is specified to tell the AI how many of this unit it should try and maintain at all times.
+
A GAE only ability that lets you specify a loading screen image to use. As of 0.4, it only allows a single image, but will later allow multiple images to be used for loading screens (chosen at random). If a scenario loading screen is also specified, it will take priority over this one.
 
 
===resource-producer-units===
 
Units here are considered to be necessary for producing different resources, such as food. A minimum number is specified to tell the AI how many of this unit it should try and maintain at all times.
 
 
 
===building-units===
 
Units here are considered to be other important buildings that the AI should attempt to build early. A minimum number is specified to tell the AI how many of this unit it should try and maintain at all times.
 
 
 
===upgrades===
 
Upgrades here are considered to be important upgrades that are priority for the AI to develop.
 
  
===flat-particle-positions===
+
MG does not need this tag, as it always looks for a loading screen which must be called "loading_screen.*".
If this is set to true the positions that are given for the particle systems are based on the ground. This means the positioning is no more unit height dependend which makes changes much more easy. This field is not mandatory and the default is set to false.
 
  
 
==See also==
 
==See also==
 
*[[XMLs]]
 
*[[XMLs]]
[[Category:XMLs]]
 
 
[[Category:XMLs]]
 
[[Category:XMLs]]

Please note that all contributions to MegaGlest are considered to be released under the Creative Commons Attribution Share Alike (see MegaGlest:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)

Template used on this page: