Le Sage
Emperor
I am trying to add this to my game. It's a simple Python addition that makes it so that when a specific unit is killed, the player is supposed to win the game.
Now, It seems it conflicts somehow with BUG, for some reason or other. Mostly when fiddling with it, I get no user Interface at all, and I get an BugEventManager error (referring to killing units; unit kill event handler, or something like that) when the Interface actually appears and I am to test it out. Can anyone tell me what to do? I have no knowledge in Python; I am just trying to merge this simple function with my mod.
Spoiler :
def onUnitKilled(self, argsList):
'Unit Killed'
unit, iAttacker = argsList
player = PyPlayer(unit.getOwner())
attacker = PyPlayer(iAttacker)
###new code start
if unit.getType() == gc.getInfoTypeForString("UNIT_BAD_GUY"):
CyGame().setWinner(gc.getPlayer(iAttacker).getTeam(), gc.getInfoTypeForString("VICTORY_BADDYKILL"))
###new code end
if (not self.__LOG_UNITKILLED):
return
CvUtil.pyPrint('Player %d Civilization %s Unit %s was killed by Player %d'
%(player.getID(), player.getCivilizationName(), PyInfo.UnitInfo(unit.getUnitType()).getDescription(), attacker.getID()))
'Unit Killed'
unit, iAttacker = argsList
player = PyPlayer(unit.getOwner())
attacker = PyPlayer(iAttacker)
###new code start
if unit.getType() == gc.getInfoTypeForString("UNIT_BAD_GUY"):
CyGame().setWinner(gc.getPlayer(iAttacker).getTeam(), gc.getInfoTypeForString("VICTORY_BADDYKILL"))
###new code end
if (not self.__LOG_UNITKILLED):
return
CvUtil.pyPrint('Player %d Civilization %s Unit %s was killed by Player %d'
%(player.getID(), player.getCivilizationName(), PyInfo.UnitInfo(unit.getUnitType()).getDescription(), attacker.getID()))
Now, It seems it conflicts somehow with BUG, for some reason or other. Mostly when fiddling with it, I get no user Interface at all, and I get an BugEventManager error (referring to killing units; unit kill event handler, or something like that) when the Interface actually appears and I am to test it out. Can anyone tell me what to do? I have no knowledge in Python; I am just trying to merge this simple function with my mod.