robbyextreme
Prince
- Joined
- Oct 4, 2003
- Messages
- 316
Hey does anyone know a way to auto refresh the Sevopedia after editing python files, without restarting Civ4?
I do not think that is possible. As far as I am aware CIV loads all of its assets, python included when loading the game. And changing them does not take effect until you restart. That is my understanding at least.Hey does anyone know a way to auto refresh the Sevopedia after editing python files, without restarting Civ4?
I do not think that is possible. As far as I am aware CIV loads all of its assets, python included when loading the game. And changing them does not take effect until you restart. That is my understanding at least.
def handleEvent(self, argsList):
'EventMgr entry point'
# extract the last 6 args in the list, the first arg has already been consumed
self.origArgsList = argsList # point to original
tag = argsList[0] # event type string
idx = len(argsList)-6
bDummy = false
self.bDbg, bDummy, self.bAlt, self.bCtrl, self.bShift, self.bAllowCheats = argsList[idx:]
ret = 0
if self.EventHandlerMap.has_key(tag):
fxn = self.EventHandlerMap[tag]
[LINE 164] ret = fxn(argsList[1:idx]) [LINE 164]
return ret
def onUnitMove(self, argsList):
'unit move'
[LINE 454]pPlot,pUnit = argsList [LINE 454]
player = PyPlayer(pUnit.getOwner())
unitInfo = PyInfo.UnitInfo(pUnit.getUnitType())
if (not self.__LOG_MOVEMENT):
return
if player and unitInfo:
CvUtil.pyPrint('Player %d Civilization %s unit %s is moving to %d, %d'
%(player.getID(), player.getCivilizationName(), unitInfo.getDescription(),
pUnit.getX(), pUnit.getY()))
Yes this is the problem. I must have copied over the wrong version at some point. Using the BTS version of CvEventManager fixed the issue. I appreciate the help@Set: The CvEventManager.py from BtS says
pPlot,pUnit,pOldPlot = argsList
in onUnitMove. The base game and Warlords versions match the code that you've posted:
pPlot,pUnit = argsList
Maybe your mod uses a copy of an outdated version of CvEventManager.
The issue is not that python isn't reloaded. The issue is that it is reloaded without running init while reloading means ditching all the variables. Your errors are caused by lack of variable data. I'm not sure if there is a way to fix that issue.sadly just tons of errors show up when editing anything in python for the sevopedia likely because other things depend on it, doing the shift+f8 from that thread reloads the game with the entire HUD missing and no hotkeys working.
If you mean making improvements not-buildable next to each other under certain conditions, it can be done in python. CvGameUtils is your friend. I believe canBuild is the relevant method. iBuild refers to the build action you wish to effect in Civ4BuildInfos. Just stick your condition under there. You might need to edit the XML file PythonCallbackDefines to enable the canBuild callback.Is there a non DLL way to make a certain improvement non stackable. Like how you can only build watermills on one but not both sides of a river. Only without the river.
def canBuild(self,argsList):
iX, iY, iBuild, iPlayer = argsList
# Returning -1 means ignore; 0 means Build cannot be performed; 1 or greater means it can
if iBuild == gc.getInfoTypeForString("BUILD_WORKSHOP"):
lXCoordinates = range(iX - 1, iX + 2)
lYCoordinates = range(iY - 1, iY + 2)
for nX in lXCoordinates:
for nY in lYCoordinates:
cyPlot = cyMap.plot(nX, nY)
if cyPlot.getImprovementType() == gc.getInfoTypeForString("IMPROVEMENT_WORKSHOP"):
return 0
return 1
The issue is not that python isn't reloaded. The issue is that it is reloaded without running init while reloading means ditching all the variables. Your errors are caused by lack of variable data. I'm not sure if there is a way to fix that issue.
On a semi related note, the same is true for all python screens. Editing advisors while they are open breaks them. Close them, edit and then reopening works. The issue is that you do not reopen (hence run init again) the main interface.
I once had an issue where the game didn't detect changed python files, hence didn't reload. I never fully figured out why, but moving to a new computer fixed it and I haven't heard of anybody else with the same issue. I suspect the culprit was a virtual machine with a shared folder/drive messing up detection of file modification, but I'm not completely sure.
This post has inspired me to build my own Tech Tree Design tool. If I get it ironed out, I will post it to the Resources.I see. Well that ain't very convenient. Unless someone has something else to suggest I guess I'll just have to roll my own.
Do that.This post has inspired me to build my own Tech Tree Design tool. If I get it ironed out, I will post it to the Resources.
This post has inspired me to build my own Tech Tree Design tool. If I get it ironed out, I will post it to the Resources.