Awesome. This makes it much easier to alter existing game types.Starting in 1.8 Beta 5 you may create overrides of any type (not just <ShipClass> as in previous versions). You specify an override by creating a type definition that ends in Override. For example, <ShipClassOverride> or <StationTypeOverride>. An override must refer to an existing UNID of the same type.
Also:
We can use this to add more ships to the "Commonwealth traffic". These are the random ships that fly around in the systems, gating in and out, docking with stations, looting and scuttling wrecks, etc. We will use a <ShipTableOverride> type to add Hammerhead-IIs to the system traffic. This is the code needed:The <ShipTable> type has been enhanced to append elements in <Table> and <LevelTable> when inheriting (or overriding). This allows an extension to add new entries to an existing table.
Currently, only append is supported. You cannot delete or modify table elements without re-defining the entire ship table.
Code: Select all
<ShipTableOverride UNID="&tbCommTraffic;">
<LevelTable>
<Ship levelFrequency="uurr- -----" count="1" class="&scHammerhead-II;"/>
</LevelTable>
</ShipTableOverride>
There are 10 system levels in SOTP. Eridani is a level 1 system. The system level increases as you journey towards Heretic, a level 10 system. A few examples. Rigel is level 3, St Kats is 4, Eta Ceti is 7 and Point Juno is level 8. The system level can be found by using the (sysGetLevel) function or by checking the system code in HumanSpaceMap.xml in 'Transcendence_Source'.
The 'levelFrequency' code in the above example, "uurr- -----", has 10 values. The first five, then a space, then the last five. These are related to the system levels. The first "u" value is for level 1 systems, the second "u" value for level 2 systems, the next two values 'rr' are for level 3 and 4 systems. The dash values, "-", are for systems of level 5 to 10.
These values can be either:
c = common,
u = uncommon,
r = rare,
v = veryrare, or
- = none.
These values determine the likelihood of a ship being created to fly around in systems of that level. So in our example the Hammerhead-IIs are more likely to be created in level 1 and 2 systems (uncommon) than level 3 and 4 systems (rare). So we will generally see more Hammerhead-IIs flying around in Eridani (level 1 system) than Rigel (level 3 system). Hammerhead-IIs will never be created in systems of level 5 and above because of the "-" value.
Here are a few examples from the existing ShipTable in CommonwealthShips.xml
Code: Select all
<Ship levelFrequency="uuurr -----" count="1" class="&scBorer;"/>
<Ship levelFrequency="uurr- -----" count="1" class="&scRoninA;"/>
<Ship levelFrequency="ccrr- -----" count="1" class="&scSapphireYacht;"/>
<Ship levelFrequency="cccrr -----" count="1" class="&scIAVLight;"/>
Although it is fun to have Aquilas and Corporate cruisers flying around in Eridani, it isn't really appropriate. Because of their high-level weapons, there is a real chance they will destroy stations by accident when they are firing on Centauri raiders!
As a rough guide, ships should be added to systems of about the same level. Ships also have a level value. This can be found using the (objGetLevel) function. Sometimes the level is set in the ShipClass UNID using "level=". If no level is set in this way then the game auto-sets the ship level as the level of the highest installed item (many thanks to NMS for that info).
The Hammerhead-IIs are level 2 ships. They have a level 2 dual recoilless cannon installed so the game auto-sets the level at 2. So we use 'levelFrequency' values for level 1 to 4 systems.
Aquilas are set at level 10 in their ship code. Corporate cruisers are level 9 due to having hexacarbide armor installed (a level 9 item).
So to add Aquilas to the random traffic we could use 'levelFrequency' values of "----- --vvu". They would then only occur in level 8 or higher systems and more frequently in level 10 systems than level 8 or 9 systems.
You may also add more entries to this code, perhaps to add your favorite custom playership to the game as well. Just cut and paste the line of code, set appropriate 'levelFrequency' values and change the ship class.
A complete mod is attached. Add it to your Extensions folder, select it (Hammerhead-II Traffic) at game start, and within a couple of minutes you should see a Hammerhead or two zipping around Eridani.
I have assumed a basic level of modding knowledge. If you have problems or would like more info, add a post detailing what you would like to know.