 |
|  |
 |
|
Immortal Wombat
|
 |
in perpetuity
Dec 2000 time: 05:21
|
|
mod_* functions are called at all times, basically. There is no need to call them them from anywhere - as soon as the issue becomes needed, the mod_* function springs into action.
However, the "last 3" mod functions, i.e. the ones not used in the Activision scenarios - mod_UnitAttack, mod_UnitDefense, and mod_UnitRangedAttack are not known to be functioning. Test it with some extreme values first to see whether it does actually work. Personally, I doubt it does. MrOgre mentioned the function only once on the forum, as a function "he will include" - but as both the Alexander and Samurai scenarios find different ways to do the same thing, we remain in uncertainty as to whether the function was implemented, or included and left dead.
Its a good idea though, and the code above would feasibly work with proper if() statements in.
|
|
|  |
 |
|
MATT:-) C
|
 |
London
May 2001 time: 05:21
|
|
Thanks for the info. I've done some testing and here's what I found so far, which may be wrong:
code:
int_f mod_UnitAttack(unit_t theAttacker, unit_t theDefender, int_t normalAttackValue)
{
return modifiedAttackValue;
}
int_f mod_UnitDefense(unit_t theDefender, unit_t theAttacker, int_t normalDefenseValue)
{
return modifiedDefenseValue;
}
//int_f mod_UnitRangedAttack() doesn't seem to be implemented anywhere so is useless
The return values are the modified attack/defense values to use in the battle. The units are what you expect them to be. The normal attack/defense values are the appropriate values for the attacking/defending units. Note that the defense value takes into account bonuses for terrain and fortifications as far as I can tell. The veteran status of a unit doesn't seem to be accounted for in this value (at least not for the attacker that I tested), it may be included after the function is called or in a seperate call to the function, or not at all!
As an example of how the functions are called, an infantryman attacks a warrior (no bonuses for anything) :
First mod_UnitAttack() is called twice (?why?) with the infantryman as attacker and attack value of 25. Then mod_UnitDefense() is called with warrior as defender, defense value 10.
Then the same functions, but with infantryman and warrior reversed, ie twice mod_UnitAttack() with warrior as attacker (value 10) then once mod_UnitDefense() with Infantryman as defender (value 35).
Then repeated until someone dies.
Now, if the warrior was in a forest, his defense value would rise to 12 (10 +25% bonus rounded down), and his attack value would remain at 10. If the infantryman was on a mountain his defense would rise to 70 (35 +100% bonus), but his attack would remain at 25. This happens regardless of who initiated the battle.
[This gets more complicated when ranged units are included too. All the ranged units do their attacking first and then enemy ranged units, then front line units attack as above. No calls to mod_UnitRangedAttack() are made though, only an appropriate mod_UnitDefense().]
I hope that makes sense! If that's not clear I'll try again.
TTFN, MATT:-)
|
|
|  |
 |
|
MATT:-) C
|
 |
London
May 2001 time: 05:21
|
|
(I assume you're referring to my last sentence in which case...)
All other things being equal, it will (statistically speaking) make little or no difference whether you are the overall attacker or defender. It will have a larger effect if you outnumber the enemy and have flankers/ranged units in your line in which case the first strike will kill off the enemy quicker, but that may only result in a few less hit points lost by your units in a battle you're very likely to win anyway!
Having said that, little or no difference might be 1 hit point difference between the overall attacker and overall defender, which is the difference between a dead unit and one that can be healed and return to fight again.
I have a distinct feeling that I may be wrong on that though - it seems a bit odd.
Last edited by MATT:-) C on 24-08-2002 at 03:36
|
|
|  |
 |
|
Locutus
|
|
ACS CTP1/2 Manager & Civ4 Co-Manager
|
 |
Hengelo, The Netherlands
Nov 1999 time: 06:21
|
|
Great to finally see someone trying to figure this out
It's *extremely* annoying the ranged function doesn't work though, I had several uses in mind for that one should we ever have gotten in to work 
I briefly messed with this myself and so far I found out two important things:
(1) it doesn't matter what arguments or return value you use, even when they are left out altogether the messageboxes appear. So the function (I only tested Attack, I assume Defense works the same) is *always* called during combat, regardless of what arguments value are used. The only thing you need to do is spell the function name correctly This means finding out proper arguments and return values could turn out to be tricky...
(2) I couldn't seem to get the function to work, even with very high return values (100000) it didn't seem to make much of a difference. However, when I used the following code:
code: int_f mod_UnitAttack() {
return 0;
}
The first round of combat was fought out normally, but then they units kept attacking eachother without results, as one would expect with an attack value of 0. Of course, this continued forever and closing the combat screen froze the game, as the game had entered an infinite loop. But apparently this function *does* do something...
|
|
|  |
All times are GMT. The time now is 05:21. Apolyton Time is 00:21. |
top of page
|
| archivepost |
|
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
|
|
|
|
|
|