AI question

Lenowill

Warlord
Joined
Sep 10, 2009
Messages
174
In case anyone in this subforum knows the answer, I'll try here first.

In editing units in the XML files, it's come to my attention that it's possible to make land units have cargo space for carrying other units.

This gave me the idea of making what amounts to a land-based aircraft carrier unit, as a proof of concept for something different (but related) that I'd like to do.

A problem I'm running into is that, while I can make that type of unit work fine for a human player, I can't seem to make it work for an AI player. The AI never seems to understand that loading aircraft onto this strange land unit is actually possible.

Does anyone know if there is a UnitAI type that can be applied to air units and/or the land unit that should be used as the carrier, that will make the AI realize the unit is intended as an aircraft carrier type of unit?

The only AI types that I've found that seem to work for that purpose appear to be naval unit AI types, which if memory serves can cause crashes if applied to land units.

If I really want something like this, am I going to need to go on a DLL editing excursion?

Thanks in advance for any responses.
 
I've seen in a Mod like PAE (Pie's Ancient Europe) that chariots can carry land units. I don't see that a special UNITAI is assigned to such a unit. What I see is that only <SpecialCargo>SPECIALUNIT_FUSSTRUPPEN</SpecialCargo> are authorised to go aboard! FUSSTRUPPEN means "Troops on feet" or something like that! This, in turn, is assigned to several land units like <Special>SPECIALUNIT_FUSSTRUPPEN</Special>.

I don't know how the AI is using this as I don't play PAE. If you don't see any improvement, you might ask in their forum how it works.

EDIT: forgot to mention that, of course, you would need to add an entry in the CIV4SpecialUnitInfos.xml file. This is the example from PAE:

Spoiler :
Code:
                <SpecialUnitInfo>
                        <Type>SPECIALUNIT_FUSSTRUPPEN</Type>
                        <Description>TXT_KEY_SPECIALUNIT_FUSSTRUPPEN</Description>
                        <bValid>1</bValid>
                        <bCityLoad>0</bCityLoad>
                        <CarrierUnitAIs>
                                <CarrierUnitAI>
                                        <UnitAIType>UNITAI_COUNTER</UnitAIType>
                                        <bUnitAI>1</bUnitAI>
                                </CarrierUnitAI>   
                                <CarrierUnitAI>
                                        <UnitAIType>UNITAI_ASSAULT_SEA</UnitAIType>
                                        <bUnitAI>1</bUnitAI>
                                </CarrierUnitAI>
                        </CarrierUnitAIs>
                        <ProductionTraits/>
                </SpecialUnitInfo>

EDIT 2: so the <UnitAIType>UNITAI_COUNTER</UnitAIType> in this SpecialUnitInfos file is important as all the chariot units transporting land units have that one as well. This might very well be a trick as, if I remember correctly, a Counter unit is just used for whatever purpose, when the AI has no specific unit to build. But it looks like it is a prerequisite to have a corresponding UNITAI for it to work. The UNITAI_ASSAULT_SEA allows those land units to also board ships (with this UNITAI).
 
I don't think its possible to make the AI carry cargo with units its not used to without going into the hardcoded stuff.
 
Thank you for your replies.

Unfortunately, unless I'm forgetting something, I've already tried everything isenchine said, so it sounds like I would indeed need to edit the code in the DLL somewhere.

I will double-check next time I work on my personal mod (or at some point) before asking on the PAE subforum (or another subforum).
 
Back
Top Bottom