Getting GP points from Unit XP?

Hypereon

He was a Consul of Rome!
Joined
Jun 19, 2012
Messages
414
Location
Helsinki, Finland
I've been unsuccessfully trying to figure out how to code this trait:

"Gaining Unit Experience summons Great Writers in the capital"

that basically means that every point of XP is put into the Great Writer counter of the Capital city of the player. Adding GW points seems simple but the thing I can't figure out is how I'm going to make the function happen every time a unit gets some XP, and how to add a GW point for every single XP point the unit gets.

Is this possible to code through Lua and how or will I have to resort to an easier Unique Ability?
 
There is Lua to add Great Writer progress but there is no way short of DLL modding to cleanly detect when a unit gains experience points. You could do search a player's units each turn and track their exp and give the Great Person progress a turn late, but it would not be easy.
 
estimate this based on database values for unit's XPValueAttack and XPValueDefense

Those two columns in the <Units> table aren't used. The XP gained from combat (melee 5, ranged 3, defensive 2, whatever) are set in the main <Defines> table via the EXPERIENCE_ATTACKING_ and EXPERIENCE_DEFENDING_ values
 
Back
Top Bottom