Help needed with a MOD

Hi guys!

I am trying to make a mod where I alter the way of ship designs. I find it a bit weird that every ship from a tiny interceptor to a gigantic titan uses the same equipment of the same size. Means a fighter has the same cannons like a battleship. Same for shields and armor and everything else. I'm also sick of putting 100+ cannons on my custom designs or having all my AI designed ships equiped with shields just because thats the defense system with the highest value (good idea with the bestdefense type but bad execution dear dev team!). Its just anoying.

So here the idea, I made subclasses of the weapons and defenses. Small, Medium and Large. And huge for the Doom Ray just to reflect the deadliness of this weapon. ;)

First I altered the ShipHullStatDefs.xml to create better fitting ship sizes. That worked verry well. Game accepted the new file without a crash.

My next step was to create the equipment for the ships. Therefore I created in the ComponentClassDefs.xml new classes for weapontypes. (For exaple beamweaponsmall; beamweaponmedium; beamweaponlarge.) I altered and created the shipcomponents in the ShipComponentDefs.xml. I changed the component mass, the damage inflicted and the type of the component to the new class. (from beamweapon to beamweaponsmall)

<ComponentClass>  
    <UniqueID>BeamWeaponSmall</UniqueID>
    <PrimaryStatList>BeamAttack</PrimaryStatList>
  </ComponentClass>
 

<ShipComponent>
    <InternalName>SLasers</InternalName>
    <DisplayName>Laser Beam</DisplayName>
    <Description>Lasers_Dec</Description>
    <ArtDefine>WeaponModel_07</ArtDefine>
    <Category>Weapons</Category>
    <Type>BeamWeaponSmall</Type>
    <PlacementType>Weapon</PlacementType>

With this, I altered the blueprints in ShipBlueprintDefs.xml to create the desired ship designs. Means tiny and small ships with small equipment, medium ships with medium equipment and large and huge with large equipment.

 <ShipBlueprint>
    <InternalName>SniperBlueprint</InternalName>
    <ShipHullType>Tiny</ShipHullType>
    <Role>Interceptor</Role>
    <RequiredComponentType>BeamWeaponSmall</RequiredComponentType>
    <ComponentType>BestDefense</ComponentType>
    <ComponentType>BeamWeaponSmall</ComponentType>
    <ComponentType>BeamWeaponSmall</ComponentType>
    <ComponentType>LifeSupport</ComponentType>
    <ComponentType>SublightDrive</ComponentType>
    <FillerComponentType>BeamWeaponSmall</FillerComponentType>
    <FillerComponentType>BeamWeaponSmall</FillerComponentType>
    <FillerComponentType>BestDefense</FillerComponentType>
  </ShipBlueprint>

I used folowing stats for the diferent sizes. small equipment-> mass 5 damage 5; medium-> mass 100 damage 100; large-> mass 500 damage 500. I used this values to prevent capital cannons from being placed on tiny ships. As you see the damage to mass ratio is the same. I only want to place few bigger gunns on large ships.

My first problem apeared when I started the game. My definition of the subclass was not accepted by the game. I had to change all the entries back to beamweapon. So my blueprints are using now the old entries again.

The new values are accepted by the game and the weapons are created so you can use them in the designer. Now I have shipclasses with my own size and components in three different sizes. So far so good.

Now the new problem. The AI is kind of stupid by using my newly created equipment. Since the large weapons have more damage(value) than the small or medium, the AI is trying to put them on every design. Because thats what I was trying to prevent the size is to big and the equipment doesn't fit. Instead of chosing the next best weapon, which is the next size down, (as described earlier the damage to mass ratio is the same no matter the size.) the AI decides to leave the space empty. Now it creates ships with no weapons but 20-200 free room.

Any ideas how to get this problem fixed? Or how to alter equipment class and type so the game accepts it and the AI can use it? The idea with the small, medium and large class could solve the problem of the AI if I could get it into the game.

 

Many thanks in advance

10,777 views 9 replies
Reply #1 Top

As you noticed, you can't define new equipment classes - they're defined in the schema, which cannot be edited. As such, you'll need to remove some of the existing types in order to do so. 

 

For example, if you re-defined the 'beamaugment1' type to be your 'large' beam weapon, and removed the buff module, then you could re-write the shipblueprintdefs.xml file to switch larger ships to use them instead of 'normal' beam weapons. This would cause the AI to use them properly (since it relies on the default blueprints outlined in that file).

 

There might also be a few 'spare' equipment types that you can use which aren't in use in the game at the moment; I think the cloaking device is defined but not used.

Reply #2 Top

Thanks! Good Idea.

Yeah I tryed to activate cloaking too when I discovered its deactivated but on gamestart I got a report its not in the enummeration or something like that... It was the same report I got on edited equipment classes. So it looks to me the cloak is not in the game yet.

I hoped to get it done more easily. :D

Reply #3 Top

'not in enums' literally means 'this is not defined in the schema'.

 

Every file in the game/data folder has a corresponding schema file, which is identified in the blurb at the top of the file. You can open these schema files in notepad. They contain long lists of effectively called 'enumerations' which determine the structure of the xml objects. Reading through the relevant schema files can be very helpful in figuring out what you can and cannot do - not everything that can be used in a certain table is used in the base game.

Reply #4 Top

Ok, I did it with BeamAugment1 and BeamAugment2 for medium and heavy cannons. I changed the PrimaryStatList to BeamAttack in the ComponentClassDefs.xml too. In my test now the AI is using the correct weapons. More or less. Still need to polish a bit but I guess when I change all the weapons, it should be good.

But there is a new problem! I can't find the medium and heavy cannons in the ship designer. I checked every weapon, defense, augment and support item. these cannons are not displayed and therefore not usable for own designs. Do I need to change something else too?

 

Is it possible to add new equipment classes to the schema? So they are in the enumaration?

Reply #5 Top

Did you properly set their prerequisites to unlock with tech?

Reply #6 Top

Yes, otherwise AI wouldn't be able to use it. The weapons are unlocked and available for the AI. Only abscent in the designer.

Reply #7 Top

I just added new equipmet class to the ShipComponentType.xsd. Weapon types accepted by the game and also usable in designer.

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">


    <xs:simpleType name="ShipComponentTypes">
        <xs:restriction base="xs:string">
            <xs:enumeration value="InterstellarDrive"/>
            <xs:enumeration value="SublightDrive"/>
            <xs:enumeration value="LifeSupport"/>
            <xs:enumeration value="Sensor"/>
            <xs:enumeration value="Targeting"/>
            <xs:enumeration value="Jamming"/>
      <xs:enumeration value="BeamSupport3"/>
      <xs:enumeration value="MissileSupport3"/>
            <xs:enumeration value="Repair"/>
            <xs:enumeration value="Armor"/>
            <xs:enumeration value="Shields"/>
            <xs:enumeration value="PointDefense"/>            
            <xs:enumeration value="BeamWeapon"/>
            <xs:enumeration value="BeamWeaponMedium"/>
            <xs:enumeration value="BeamWeaponLarge"/>
            <xs:enumeration value="MissileWeapon"/>
            <xs:enumeration value="KineticWeapon"/>
            <xs:enumeration value="BeamAugment1"/>
      <xs:enumeration value="BeamAugment2"/>
      <xs:enumeration value="BeamAugment3"/>

The only flaw is now, when I enter the ship designer the categories are messed up. Beamweaponmedium is now under missileweapon and beamweaponlarge under kinetic weapon. Everything below them is slipped to the next categorie.

Reply #8 Top

This is because you cannot edit the .XSD files in the schema and expect anything to work. The schema files themselves require hard-code support from the .exe file in order to work, and the .exe file also expects the schema files to remain unchanged when it does everything, or else things start to break. You're lucky the game started at all.

Basically what I'm saying is, I've been told from the devs themselves that if what you're doing is limited by the schema, abandon all hope. You can't change the schema files.

Reply #9 Top

OK, thanks. I gave up on the idea. Causing too much trouble and it doesn't seem to work...