help with ranged bombardment

Been following this topic and I'm wondering if someone can clarify to me what is possible without DLL changes (Mac modder). I'm not interested in ranged attacks or bombardment with a range of more than 1. What UnitAIs (if any) can be used to make siege units attack or bombard from a distance offensively? Defensively? How good at these is the AI likely to be without DLL changes?
 
Been following this topic and I'm wondering if someone can clarify to me what is possible without DLL changes (Mac modder). I'm not interested in ranged attacks or bombardment with a range of more than 1. What UnitAIs (if any) can be used to make siege units attack or bombard from a distance offensively? Defensively? How good at these is the AI likely to be without DLL changes?

I'm not a mac modder, so I have no idea what that means as far as modding differences goes in mac.

I'll try to answer your question to the best of my ability, but to be clear, I'm not completely sure what you're asking since you said you're not interested in bombardment/attacks of more than 1. So to answer your question, I'll go through a runthrough of a few xml tags:

ATTACK_CITY as a unitai will cause the unit to go through standard bombard city defense attacks as well as bombing units stationed in cities. Without changing the core game files, all city defense bombardment is limited to a range of 1

CITY_DEFENSE as a unitai will cause the unit to stay in the city and defend it. this is not tested yet, but I assume that it will bombard enemy units from within the city

iAirRange can be set to allow ground/sea units to have a ranged bombardment attack. This will attack UNITS ONLY. you cannot bombard walls from range without changing game core files.

COUNTER as a unitai causes units to use ranged bombardment attacks on units outside of cities

Finally, to make your units bombard instead of attack, you can set their withdrawal damage percentage to really low but not 0 (I'm using 2). I haven't tested how well this works, but it does work mostly into tricking the ai to think that they won't do enough damage to be worthwhile. if you set the % to 1, it generally won't bombard units with a natural defense (aka units sitting in forests or on hills). 2 seems to work for them, but they don't generally attack them past 75% of their max hp for some reason. You may want to try 3 or 4.
 
BTW discovered rather curious behavior by AI.
So I set AI siege weapons to have Range Attack and set them as defend only. Result - AI refuses to use them - they sit next to my city and do nothing.
However, if stack of siege weapons with defend only includes ONE siege weapon with range attack that can attack normally - AI will use Range Attack on ALL siege weapons.

Test example:
1
give barbarian AI 10 cannons that have Range Attack and set to Defend only.
AI will NOT use range attack.
2
add to AI stack 1 rifleman (to test for attacking unit present)
AI will attack with rifleman but will NOT use range attack with cannons.
3
add to AI stack 1 mobile artillery that have both range attack and can attack normally
AI will suddenly use Range Attack with his Cannons.
 
Yup, the only way to really get AI to use Rangestrikes is to change the way they value their action :

in
bool CvUnitAI::AI_rangeAttack(int iRange)

change
int iValue = getGroup()->AI_attackOdds(pLoopPlot, true);
to
int iValue = GET_PLAYER(getOwnerINLINE()).AI_getEnemyPlotStrength(pLoopPlot, 2, false, false);

iirc that was all it took. However they also need a UnitAI that will make them aggressive, as defend city and similar AIs makes them passive/skip turn. The longbowmen have iirc defendcity unitAI.
Attack and attackCity are imho the best (iirc. lots of iirc, but its been a while since I had a look at it ;))
 
Well I have experimented with 2 UnitAI and Archers with range strike, here here are results:

UnitAI_Counter:

in city - will use range strike, when enemy gets low enough will attack directly
outside - will keep using range strike, but NEVER attacks directly

UnitAI_Reserve:

in city - will use range strike, but NEVER attacks directly
outside - will use range strike, when enemy gets low enough will attack directly
 
Last edited:
Back
Top Bottom