.

Maybe you should switch to using the onCombatResult method instead?
I don't see any way to get the information you need through the onCombatLogCalc method.
 
If I remember correctly, the onCombatLogCalc method is also called after combat has taken place.
 
I believe so, until the SDK comes out. But what exactly are you trying to do?
 
onCombatLogCalc? I'm not entirely sure if it's called before or after the combat has taken place--it's a little hard to tell. cdAttacker & cdDefender contain modifier info, iCombatOdds is some sort of stacked odds object. The only identifying traits you have AFAIK in this function are cdMumble.sUnitName and cdMumble.eOwner. The first being a CyUnit().getName(), and the second being a CyUnit().getOwner()... Well, and you can sort of infer their terrain type by the terrain defense modifers 8). But yeah.. not really useful.
 
I experimented "onCombatLogCalc" and confirmed that this event is issued just before a actual combat begins.
But current implementation is flawed.
This event is assumed to be issued when user places mouse over hostile enemy(in war) unit and press alt key.
Then CvUtil.combatMessageBuilder() is called from onCombatLogCalc event handler to display combat odd.

But in current implementaion, it is issued when combat begins.
So you have no chance to notice the odd message which is overwritten by combat message, immediately.
So if this flaw is not fixed in next patch, we can use it as something like "onCombatStart".. which does not exists.

And I agree that the combatDetail structure (cdAttacker, cdDefender) is quite useless to find out actual attacking/defending units.. unless all the units have unique names
 
Lord Olleus said:
I had totaly forgotten about this thread but the problem still stands. So onCombatLogCalc is called before combat has been worked out. But the info which it tells us is, basicaly, useless as it only tells us the names of the units involved. Does anyone know what the 'generisArgs' are?

From what I can tell onCombatLogCalc is only called if the attacking or defending unit is a human player. It is supplied with 3 arguments, the attacker details, the defender details and the combat odds.

It looks to just be for displaying the odds. I don't see any way (without the SDK) to intercept before combat.
 
Back
Top Bottom