hi all,
im working on a variation of ranged attack, base off of VIP mod and DCM and Archer bombard.
human player code works great.
ai code works but not perfect.
my correct issue, is with how to make the ai stop attacking when its odds of survival is no good.
i thought about using AI_leaveAttack()
this is my corrent code:
i have a setup of one enemy catapult that attacks a city of mine with 3 defenders, equal strength to the catapult. my expected behavior is to check if it should stay and continue or run away to a safe zone/own territory.
are there any suggestions? maybe another ai function i can harness?
im working on a variation of ranged attack, base off of VIP mod and DCM and Archer bombard.
human player code works great.
ai code works but not perfect.
my correct issue, is with how to make the ai stop attacking when its odds of survival is no good.
i thought about using AI_leaveAttack()
this is my corrent code:
Code:
if (pTargetPlot != NULL)
{
if (AI_leaveAttack(1, 30, 100)) // was 20
{
return false;
}
// K-Mod note: no AI_considerDOW here.
getGroup()->pushMission(MISSION_RANGE_ATTACK, pTargetPlot->getX(), pTargetPlot->getY(), 0);
return true;
}
i have a setup of one enemy catapult that attacks a city of mine with 3 defenders, equal strength to the catapult. my expected behavior is to check if it should stay and continue or run away to a safe zone/own territory.
are there any suggestions? maybe another ai function i can harness?