I did a quick search of the forums and found no answers so here goes:
I was toying around with a random idea to do with modifying a units attack when a given tech is has been researched. This example would increase the attack of a bronze age unit after iron working has been researched to simulate weapons upgrading (don't know how realistic that is, but hey). Do any of you know if the following code outline would work in principle. I'm concerned mainly about the function's arguments, return type and return value.
And do you guys know when the function is called. Is it only when a unit attacks (move into an enemy unit) or all battles that the unit fights?
Any ideas? If not I'll try and mess around with it myself, but I'd rather someone else already has!
Thanks in advance, MATT:-)
I was toying around with a random idea to do with modifying a units attack when a given tech is has been researched. This example would increase the attack of a bronze age unit after iron working has been researched to simulate weapons upgrading (don't know how realistic that is, but hey). Do any of you know if the following code outline would work in principle. I'm concerned mainly about the function's arguments, return type and return value.
Code:
int_f mod_UnitAttack(unit_t localunit, int_t localattack) { int_t alittlebit; alittlebit = 2; //insert proper 'if' code if((localunit is a bronze age unit) && (localunit.owner has adv_iron_working)) { //beef up my attack return localattack + alittlebit; } else { return localattack; } }
Any ideas? If not I'll try and mess around with it myself, but I'd rather someone else already has!
Thanks in advance, MATT:-)
Comment