Announcement

Collapse
No announcement yet.

CvUnitController?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • CvUnitController?

    CvUnitController looks like a really useful class, but it doesn't seem to ever be used. Anybody have the scoop on it?

    CvUnitController (in Python/pyUnit/) is the event handler for units. The only handler that's *implemented* is ENTEVENT_MOVE, and the handler just controls how the unit subentities (individual figures when you've got multiple-people-per-unit) move. However, from grepping around in XML/Units/CIV4MissionInfos.xml it looks like there are events for SLEEP, FORTIFY, AIRSTRIKE, DAMAGE, ...

    This seems like the perfect starting place to put in, say, counterbattery fire if one were implementing artillery duels, or maybe an approach to doing local antiaircraft. But these events don't seem to ever be generated.

    I copied CvUnitController into CustomAssets - and I've got several other customized python files there, so I figure my custom assets directory must be configured OK. If I change the file and save it while Civ4 is minimized, when I fullscreen Civ4 again it reloads the Python subsystem. (Neat development shortcut! Thanks, Firaxis.) I put print() and pyPrint() calls into processEvent(), and they're never called. I even put print() and pyPrint() calls into __init__(), and they're never called. Is that class not used?

    (The oddest thing is that if I have a semantic error in my print calls there, it causes an exception to be thrown during a *different* print call in CvEventManager, typically in onCityGrowth() or onCultureExpansion().
Working...
X