onUnitMove()

Scorpi

Chieftain
Joined
Mar 1, 2005
Messages
40
Location
Denmark
Is it possible to use onUnitMove() to charge x gold from any player every time any of his units moves one square?
 
Ok i made an entry for it under onUnitMove in mods/MyMod/assets/python/CvEventManager.py. But nothing seems to have changed when i play the game.
 
I'm fairly new to modding civ4, but I've got a question, already:

The things you can do with a unit, when onUnitMove triggers, come a bit late for some possibilities. Is there a way to do something with a unit automatically (for example remove a promotion) before it actually moves? I mean when the unit just got the order to leave its current square to move to another square.
 
No ideas so far? Hm ...

I was looking around in the source code by myself a bit, and I think it's not possible with Python. Probably I have to add a trigger for new event in the beginning of CvUnit::move(CvPlot* pPlot, bool bShow) after the FAssert(..). Not really an idea how to do it and I don't like to fiddle with the game core, but hey, trial and error is ussually a good way to learn new things. Whish me luck.
 
Good luck!

You are correct, there is no way to do it using the normal python events. You'll have to add a new one. IIRC there is a tutorial in the tutorials section if you need it.
 
Back
Top Bottom