News

[bug?] ai not scouting w/ colonizers, aishipclassdefs only allows single <aishipclass>/ship

Posted on Tuesday, August 18, 2015

someone asked about AI making colony ships go scouting when I recently posted a balance overhail mod for insane loose & occasional/common maps... so I started looking a bit & ran into what seems to be a limitation in the code itself that handles aishipclassdefs.xml.  Here are two examples from it:

A terran Scout
<ShipClass>

<InternalName>TerranScout</InternalName>
<DisplayName>TerranScout_Class_Name</DisplayName>
<Description>TerranScout_Dec</Description>
<ThumbnailOverride>Temp_Terran_Scout_Alpha_01.png</ThumbnailOverride>
<ShipHullType>Tiny</ShipHullType>
<ShipRule>Scout</ShipRule>
<ShipDesign>Terran_Scout_01T</ShipDesign>
<AIShipClass>Scout</AIShipClass>
<StrategicIcon>Scout</StrategicIcon>
<BlueprintDef>ScoutBlueprint</BlueprintDef>
</ShipClass>

A terran Colony Ship

<ShipClass>

<InternalName>TerranColony</InternalName>
<DisplayName>TerranColony_Class_Name</DisplayName>
<Description>TerranColony_Dec</Description>
<ThumbnailOverride>Terran_Colony_Alpha_01.png</ThumbnailOverride>
<ShipHullType>Cargo</ShipHullType>
<ShipRule>ColonyShip</ShipRule>
<ShipDesign>Terran_<AIShipClass>Scout</AIShipClass>Colony_01T</ShipDesign>
<AIShipClass>Colony</AIShipClass>
<StrategicIcon>ColonyShip</StrategicIcon>
<BlueprintDef>ColonyBlueprint</BlueprintDef>
</ShipClass>

while most of the sml files are more than happy to take extra entries for stuff that makes logicalsense, and it seems that logically  setting a colony ship to "<AIShipClass>Scout</AIShipClass> <AIShipClass>Scout</AIShipClass>" ob two lines would make its primary role colonizing, but lacking a suitable/desirable colonizable planet, it makes a nice scout until then.  Unfortunately, making that change bombs out at launch due to invalid entries.

 

Since it seems like the code is already there for each individual function, perhaps all it needs is to accept duplicate entries and an if $ShipPrimaryClassRoleAvail==0 then $checkSecoondaryRole else, $IdleShip type check?