GC.GetBestAttacker doesn't exist

phungus420

Deity
Joined
Mar 1, 2003
Messages
6,296
So I could try posting this in the SDK and Python section, but I figure the only person to really know is jdog5000 anyway. So jdog, how do you reccomend going forward on having the engine figure out the best attacker in a stack?

In Piece of Mind's Advanced Combat Modcomp a recent addition to the code has been made. It might not make it into the final version of the modcomp, but I want it anyway. Here is how it works, you check out the battle odds normally, but then you can press control and the battle is reversed, showing the odds as though the defending unit were to attack you. That's pretty awesome in and of itself but, unfortunatly it shows the combat odds of the best defender in the stack attacking you. The goal is to get it to shift to the best attacker:

This is an explanation of what I've tried so far:
Spoiler :
Here is where we start, this code works to show the defending unit's odds as if it were attacking:
Code:
				int iEnemyOdds = GC.getDefineINT("SEE_ATTACKER_ODDS");
				if (iEnemyOdds > 0)
				{
					bool bctrl; bctrl = gDLL->ctrlKey(); if (bctrl)
					{
					CvUnit* swap = pAttacker;
					pAttacker = pDefender;
					pDefender = swap;
				}
Now I tried adding in a line
Code:
pAttacker = pPlot->getBestAttacker(pAttacker->getOwnerINLINE(), pAttacker, false, NO_TEAM == pAttacker->getDeclareWarMove(pPlot));
But it said getBestAttacker wasn't a member of CVPlot. So I tried to create getBestAttacker in CVPlot, but it said the group was already full (presumably by getBestDefender?), then I tried finding some relevant code in the CVUnit_AI, but couldn't find anything relevant. Finally I tried to use this code from CVSelectionGroupAI.
Code:
 					int CvSelectionGroupAI::AI_attackOdds(const CvPlot* pPlot, bool bPotentialEnemy) const
					{
						CvUnit* pAttacker;
						FAssert(getOwnerINLINE() != NO_PLAYER);
						int iOdds = 0;
						pAttacker = AI_getBestGroupAttacker(pPlot, bPotentialEnemy, iOdds);
					}
and said it was illegal. So I changed CVSelectionGroupAI to CVGameTextMng (the file I'm editing), and then it said AI_attackOdds wasn't a valid group for CVGameTextMng. This last snippet of code I tried twisting around every which way I could, but it always failed to compile for some reason or another.

Any ideas on how to get this to work?
 
I don't think so. If it is getting looked at, it's only by EmperorFool, and if he came up with something, I would have expected a reply in the relevant thread (the POM's modcomp thread). EF is the one who came up with the idea, and like he noted in passing there has got to be a way to use the AI's finding best attacker routine to get this to work, but unfortunately I can't find it, hence my asking here...
 
Top Bottom