• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

Ranged Attack - AI_leaveAttack

keldath

LivE LonG AnD PrOsPeR
Joined
Dec 20, 2005
Messages
7,578
Location
israel
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:

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?
 
Back
Top Bottom