Unit Combat

desk.doc

Chieftain
Joined
May 23, 2007
Messages
9
Hi all ~
I have a question, and I hope someone can answer it for me. I added the AH-64 helicopter unit to a mod I am creating. (Thanks Snafusmith for the great model). I have a question about the combat. I modified the XML so that the copter will fly over the coastal water, not enter ocean squares, and not fly over the peaks. The issue I am having and I haven't seen a way to do this through the XML, is when the helicopter is over the coastal water, it won't attack any naval units. Works fine on all land units.

On a whim, I added an extra combat option to the unitinfoschema and tried to give the copter, plus other added units, a second combat option. This didn't work. I don't have any other ideas. Has anyone been able to do this?
Is there a way for the helicopter to attack both land and sea units??
 
I think the main reason for this is that the game recognizes it as a land unit, making it unable to attack naval. I think the easiest thing to do would be to have the game recognize it being both a naval and land unit at once, similar to what you were trying to do. Unfortunetly, if you add something in a schema and don't define it in python or C++, the new tag will do nothing. If you don't know python or C++, I don't know what you should do.
 
Thanks for the reply popcornlord. I slept on it, took a fresh look at it this morning, and found a solution. In the unitinfos XML you can give it an AI to use.
Code:
<UnitAIs>
     <UnitAI>
          <UnitAIType>UNITAI_ATTACK</UnitAIType>
          <bUnitAI>1</bUnitAI>
     </UnitAI>
     <UnitAI>
          <UnitAIType>UNITAI_PILLAGE</UnitAIType>
          <bUnitAI>1</bUnitAI>
     </UnitAI>
     <UnitAI>
          <UnitAIType>UNITAI_ASSAULT_SEA</UnitAIType>
          <bUnitAI>1</bUnitAI>
     </UnitAI>			
</UnitAIs>
After quick testing it, this does work. It will attack both land and sea units.
 
thanks for the info on how to let a gunship attack naval units.

i also like your idea of limiting gunships to just coastal waters, not oceans.
 
Back
Top Bottom