Siege units and experience

migck

Señor de la guerra
Joined
Apr 6, 2009
Messages
197
As you may already know, in BTS the behavior of siege units was changed so that they no longer can kill on the offense, instead if they win the battle they withdraw. They can kill when defending against an attack, but in both cases the game rules are the same for all units: they can only earn a maximum of 1 xp point per fight.

To me this sounds a bit excessive, and condemns siege units to become cannon fodder to be thrown at the enemies' stacks before the real battle, with no chance of achieving their full potential from promotions.

My idea would be to make an exception for siege units in the rules that determine the experience earned on the offense, so that a siege unit's retreat odds are treated as survival odds in standard combats to determine the experience reward.

Does such a mod or something similar exist already? If not, any pointers about how could this be done? I'm pretty sure it has to do with the SDK, but I'm quite green when it comes to it.
 
Looks like you can globally change it by altering the "EXPERIENCE_FROM_WITHDRAWL" (nice spellcheck Firaxis!) in GlobalDefines.xml

If you wanted to make exceptions just for Siege units, then you would probably need to alter the code in the SDK under CvUnit::resolveCombat
 
Ok, I went there and changed it to this:
Spoiler :
Code:
if (getDamage() + iAttackerDamage >= maxHitPoints() && GC.getGameINLINE().getSorenRandNum(100, "Withdrawal") < withdrawalProbability())
{
	flankingStrikeCombat(pPlot, iAttackerStrength, iAttackerFirepower, iAttackerKillOdds, iDefenderDamage, pDefender);

	//Tweaked - siege units get full experience from withdrawing on the attack
	if (getUnitCombatType() != 4)
	{
		changeExperience(GC.getDefineINT("EXPERIENCE_FROM_WITHDRAWL"), pDefender->maxXPValue(), true, pPlot->getOwnerINLINE() == getOwnerINLINE(), !pDefender->isBarbarian());
		break;
	}
	else
	{
		int iExperience = pDefender->attackXPValue();
		iExperience = ((iExperience * iDefenderStrength) / iAttackerStrength);
		iExperience = range(iExperience, GC.getDefineINT("MIN_EXPERIENCE_PER_COMBAT"), GC.getDefineINT("MAX_EXPERIENCE_PER_COMBAT"));
		changeExperience(iExperience, pDefender->maxXPValue(), true, pPlot->getOwnerINLINE() == getOwnerINLINE(), !pDefender->isBarbarian());
		break;
	}
}
It is still not working it would seem. I've set some catapults against axemen in WB, which should be a fair fight so the experience from attacking should be somewhere over 2 points in most outcomes, but the catapults are still gaining one point no matter the outcome.
So, any insights?

EDIT: Woops, siege units don't actually withdraw due to a withdraw chance, I have to edit the code a bit below that part.
I'm starting to see how this could be exploited for cheap experience though...
 
Back
Top Bottom