Anyone able to get the onUnitPromoted function to work? I assumed it would kick whenever you select a promotion for a unit (when it levels up) but no matter what code I add to the function it doesn't have any effect.
I tried it through the nice ways but since I thought maybe I was doing something wrong I went ahead and made changes directly to the functions in the main python cvEventManager.py file just to make sure it was inheriting my changes correctly. Still nothing.
That won't work for mine, unfortunately My Hero Unit system changes the base unit based on what promotions a unit takes. Bob the Warrior would become Bob the Swordsman if he took the "Sword Training" promotion or Bob the Spearman if he took the "Big Pointy Stick" promotion, etc.
There's probably still ways I could fudge it - checking all of a player's units at the end of each turn to see if any should level up, for example - but they're a lot more complex and resource or time intensive than the event should be.
I checked. It works absoluetely fine. No problems at all.
I think I might be able to guess what was going wrong. In the events manager the are the lines:
Code:
if (not self.__LOG_UNITPROMOTED):
return
Now I'm not entirely sure what this does - but "return" means that it won't carry on executing the code. If your code was after this line then it might not have worked.
I can send you a test mod I threw together to check it if you really like - but I can assure you that it works.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.