Mexico said:but i mean to attach this into bug tracker
Serga said:Guys, can you send me a piece of code where experience distributed after battle?
May be my fresh look find there some bugs?
## Sid Meier's Civilization 4
## Copyright Firaxis Games 2005
##
## sdUnitXP by Stone-D (Laga Mahesa)
## Copyright Laga Mahesa 2005
##
## Version 1.00
from CvPythonExtensions import *
import PyHelpers
import sys
import time
gc = CyGlobalContext()
PyPlayer = PyHelpers.PyPlayer
PyInfo = PyHelpers.PyInfo
################# SD-UTILITY-PACK ###################
import SdToolKitAdvanced as sdToolKit
sdEcho = sdToolKit.sdEcho
sdModLoad = sdToolKit.sdModLoad
sdEntityInit = sdToolKit.sdEntityInit
sdEntityWipe = sdToolKit.sdEntityWipe
sdGetVal = sdToolKit.sdGetVal
sdSetVal = sdToolKit.sdSetVal
sdGetGlobal = sdToolKit.sdGetGlobal
sdSetGlobal = sdToolKit.sdSetGlobal
sdDelGlobal = sdToolKit.sdDelGlobal
############### SD-CULTURE-CONQUEST #################
szModID = 'sdUnitXP'
szVersion = '1.00'
bUpgradeXP = True
bShareXP = True
class sdUnitXP:
def sdUnitXPGetUnitID(self, unit):
szUnitID = 'Unit_%s' %(str(unit.getID()).rjust(10, '0'))
return szUnitID
# Version Check and Fix
def sdUnitXPDoVersionCheck(self):
if ( sdGetGlobal(szModID, 'Version') == szVersion ):
return 0
self.sdUnitXPFixUnits()
self.sdUnitXPUpgradeProtect()
sdSetGlobal(szModID, 'Version', szVersion)
sdEcho('StackXP : Upgraded to version %s' %(szVersion))
return 1
def sdUnitXPFixUnits(self):
for i in range(gc.getMAX_PLAYERS()):
iPlayer = PyPlayer(i)
if ((iPlayer.isAlive()) or (iPlayer.isBarbarian())):
unitList = iPlayer.getUnitList()
mTable = sdModLoad(szModID)
for c in range(len(unitList)):
unit = unitList[c]
uType = unit.getUnitCombatType()
if ( (uType > 0) and (uType != 4) and (not mTable.has_key(self.sdUnitXPGetUnitID(unit))) ):
self.sdUnitXPInitUnit(unit)
def sdUnitXPInitUnit(self, unit):
szUnitID = self.sdUnitXPGetUnitID(unit)
oldXP = unit.getExperience()
vTable = {
'Experience' : oldXP,
'createTurn' : gc.getGame().getGameTurn()
}
sdEntityInit(szModID, szUnitID, vTable)
sdEcho('Initialized %s (%s)' %(unit.getName(), szUnitID))
sdSetGlobal(szModID, 'LastInitUnitID', unit.getID())
sdSetGlobal(szModID, 'LastInitUnitTM', unit.getTeam())
sdSetGlobal(szModID, 'LastInitUnitMV', unit.getMoves())
sdSetGlobal(szModID, 'LastInitUnitCT', gc.getGame().getGameTurn())
sdEcho('Meh lCT=%s GT=%s' %(sdGetGlobal(szModID, 'LastInitUnitCT'), gc.getGame().getGameTurn()))
sdEcho('Mex X=%s Y=%s' %(unit.getX(),unit.getY()))
return oldXP
def sdUnitXPUpgradeCheck(self, oldunit):
u = oldunit
uID = u.getID()
uTM = u.getTeam()
uXP = u.getExperience()
try:
lID = sdGetGlobal(szModID, 'LastInitUnitID')
lTM = sdGetGlobal(szModID, 'LastInitUnitTM')
lMV = sdGetGlobal(szModID, 'LastInitUnitMV')
lCT = sdGetGlobal(szModID, 'LastInitUnitCT')
except:
return 0
if ( (bUpgradeXP) and (lTM == uTM) and (lMV == 0) and (lCT == gc.getGame().getGameTurn()) ):
gc.getActivePlayer().getUnit(lID).setExperience(uXP, -1)
self.sdUnitXPUpgradeProtect()
def sdUnitXPUpgradeProtect(self):
sdDelGlobal(szModID, 'LastInitUnitID')
sdDelGlobal(szModID, 'LastInitUnitTM')
sdDelGlobal(szModID, 'LastInitUnitMV')
sdDelGlobal(szModID, 'LastInitUnitCT')
def sdUnitXPWipeUnit(self, unit):
self.sdUnitXPUpgradeCheck(unit)
szUnitID = self.sdUnitXPGetUnitID(unit)
sdEntityWipe(szModID, szUnitID)
sdEcho('Purging %s (%s)' %(szUnitID, unit.getName()))
return 0
def sdUnitXPCombatResult(self, argsList):
u = argsList[0]
uPlot = u.plot()
uType = u.getUnitCombatType()
self.sdUnitXPUpgradeProtect()
typesTable = {
'-1' : 'Unknown',
'0' : 'None',
'1' : 'Archer',
'2' : 'Mounted',
'3' : 'Melee',
'4' : 'Siege',
'5' : 'Gun',
'6' : 'Armor',
'7' : 'Helicopter',
'8' : 'Naval'
}
if (uPlot.getNumUnits() < 2): # He's on his lonesome!
return 0
if ( (uType < 1) or (uType == 4) ): # People don't learn from siege weapons.
sdEcho('StackXP : %s unit is invalid for stack distribution.' %(typesTable[str(uType)]))
return 0
try:
oXP = sdGetVal(szModID, self.sdUnitXPGetUnitID(u), 'Experience')
except:
oXP = self.sdUnitXPInitUnit(u)-1
dXP = u.getExperience()-oXP
if ( (not bShareXP) or (dXP < 1) ):
sdSetVal(szModID, self.sdUnitXPGetUnitID(u), 'Experience', u.getExperience())
return 0
sdEcho('StackXP : %s %s (%s) : Distributing %s (%s-%s) Experience Points.' %(typesTable[str(uType)], u.getName(), self.sdUnitXPGetUnitID(u), dXP, u.getExperience(), oXP))
u.setExperience(oXP, -1)
# Look for the crappiest unit in the stack with the same combat type as the winner.
w = u
while (dXP > 0):
for i in range(uPlot.getNumUnits()):
pUnit = CyInterface().getInterfacePlotUnit(uPlot, i)
if (pUnit):
if ( (pUnit.getID() != w.getID()) and (pUnit.getTeam() == u.getTeam()) and (pUnit.getUnitCombatType() == u.getUnitCombatType()) and (pUnit.getExperience() < w.getExperience()) ):
w = pUnit
# sdEcho('StackXP : Plus 1 XP to %s %s (%s)' %(w.getName(), self.sdUnitXPGetUnitID(w), w.getExperience()))
w.setExperience((w.getExperience()+1), -1)
sdSetVal(szModID, self.sdUnitXPGetUnitID(u), 'Experience', w.getExperience())
sdEcho('StackXP : Gave 1 XP to %s %s (%s)' %(w.getName(), self.sdUnitXPGetUnitID(w), w.getExperience()))
dXP -= 1
sdSetVal(szModID, self.sdUnitXPGetUnitID(u), 'Experience', u.getExperience())
return 0
you have already link in start menu folder, or you have this in readme.txt fileSerga said:where is it?
Toys®Us said:Now, the Civilopedia ---> the only thing I'm able to do to help! Enjoy!
I found some text problems... it will be nice to fix it in the next version.
***
(Scanning)
Technologies
------------
Scientific Method
Units
-----
Bomber
Nuclear Carrier
Persian Horse Archer
Stealth Bomber
Strike Fighter
Zeppelin
Buildings
--------
*Free Specialist Listed ??
Zoroastrian Fire Temple
Zoroastrian Monastery
Zoroastrian Temple
Wonders
--------
Adur Burzen-Mihr
The Three Gorges Dam
***
You did a splendid work!
A piece of art!
THANK YOU!
if (pUnit):
if ( (pUnit.getID() != w.getID()) and (pUnit.getTeam() == u.getTeam()) and (pUnit.getUnitCombatType() == u.getUnitCombatType()) and (pUnit.getExperience() < w.getExperience()) ):
w = pUnit
if (pUnit):
if ( (pUnit.getID() != u.getID()) and (pUnit.getTeam() == u.getTeam()) and (pUnit.getUnitCombatType() == u.getUnitCombatType()) and (pUnit.getExperience() < u.getExperience()) ):
w = pUnit
Serga said:Code:if (pUnit): if ( (pUnit.getID() != w.getID()) and (pUnit.getTeam() == u.getTeam()) and (pUnit.getUnitCombatType() == u.getUnitCombatType()) and (pUnit.getExperience() < w.getExperience()) ): w = pUnit
is this correct?
may be it must be so?
Code:if (pUnit): if ( (pUnit.getID() != u.getID()) and (pUnit.getTeam() == u.getTeam()) and (pUnit.getUnitCombatType() == u.getUnitCombatType()) and (pUnit.getExperience() < u.getExperience()) ): w = pUnit
u.setExperience(oXP, -1)
# Look for the crappiest unit in the stack with the same combat type as the winner.
w = u
while (dXP > 0):
for i in range(uPlot.getNumUnits()):
pUnit = CyInterface().getInterfacePlotUnit(uPlot, i)
if (pUnit):
if ( (pUnit.getID() != w.getID()) and (pUnit.getTeam() == u.getTeam()) and (pUnit.getUnitCombatType() == u.getUnitCombatType()) and (pUnit.getExperience() < w.getExperience()) ):
w = pUnit
# sdEcho('StackXP : Plus 1 XP to %s %s (%s)' %(w.getName(), self.sdUnitXPGetUnitID(w), w.getExperience()))
w.setExperience((w.getExperience()+1), -1)
sdSetVal(szModID, self.sdUnitXPGetUnitID(u), 'Experience', w.getExperience())
sdEcho('StackXP : Gave 1 XP to %s %s (%s)' %(w.getName(), self.sdUnitXPGetUnitID(w), w.getExperience()))
dXP -= 1
sdSetVal(szModID, self.sdUnitXPGetUnitID(u), 'Experience', u.getExperience())
return 0
Vishaing said:I THINK I might have figured out the Judaism "bug".
Unfortunately I don't have the save, but here is the thing I noticed:
I founded Judaism, as Germany, and the Holy city was Hamburg (My Second City, in keeping with the core founding paramaters) There was a brief problem with Judaism spreading to Rome (Antium) before I converted and became "Defender of the Faith". So I went into the WB and removed Judaism from Rome before they could convert, and then continued playing.
So its about... Dangit, I forgot there aren't years in this... and suddenly I notice that BOTH Russia and Greece are now Jewish. And I think wtf mate?
Then I notice something else, Hamburg is no longer the Jewish Holy City.
The Holy City is gone. Vamis Vamadoes, Vanished. (Sorry for all the spelling errors)
I think that might be the problem, the script focuses on a civ having Judaism's Holy City to be the "Defender of the Faith" and only let it spread in their borders. For some reason, my city is losing its holy city status, and the Jewish people are now feeling homeless, thinking I'm not their defender, so they try to wander to find someone who is a bit more considerate to them.
hmm.Serga said:Winner does not receive any exp if there are any same less experienced units in a stack ?
Am i right?
I think its not very realistic.
JohnnyBuck9 said:Hey Guys,
I have Writing (and Alphabet) but still can't trade techs with anyone else?
Do they need to have Writing also?
Do I need to connect via trade route first?
Something else I am missing here?
Thanks much,
Seato.
ravenone said:Couple possible bugs.
1.) MINOR: after the install, I did not see nor was I shown the Readme as was stated earlier in the thread.
2.) MEDIUM: I have multiple cases where I send a missionary to a foreign city and when they get in the city, NONE of their command buttons are visible again. I can use my numpad to move them out and magically their buttons all apear again. It only happens on a few of the foreign cities and not all of them. I looked and the city is not a holy city or anything that I can tell about it.
3.) MINOR: this could be an exploit on being able to use slavery to provide free experience to your garrisoned troops. Does the exp. code check to see if it was just a slave uprising and not give any exp? If not, this would be too easy to "run up" some cheap exp. points.
Request (beside my "hoping" holy city issue posted aboved):
1.) please add a hover over label (like the other command ones) for the "make a mercenary" button. Its not clear, not document(yes I searched the readme).
Serga said:Chariot with 3/10 exp has two permanent promotions.
IMHO its a same bug with experience distribution.
Annoying..
ravenone said:Mexico,
Bug tracker = good.
Suggest you put in BIG BOLD TEXT right near (Above or below) the download link on the first page, first message a notice about using the bug tracker for all issue searching and entry.
No where on the first few messages talking about the mod does it mention that bug tracker. Hence noobs like me not knowing to enter/search all bugs there.
I tried to read through the entire thread, but at 12 pages things can get missed. (sorry for the duplicate bugs. )
ravenone said:Can something be done to slow down the holy city "movement" ? In my current game, Zoroaterism..(can't remember the full spelling) religion holy city keeps poping around and I CONSTANTLY get its music (sometimes twice in one turn). It was a cool song the first 100 times, but now its MASSIVLY annoying to hear almost every turn. After a 100 turns, its clear that NO CIV WANTS IT !!!
Some kind of Hysterisis (sp??) needs to be added so the holy city doesn't rapdily pop around if no one wants to have it as their religion.
Don't get me wrong, its a good concept , but when your down to a few civs then you always have multiple religons that will never have a "home" and they just constantly keep poping around, playing their songs and poping up messages. WAYYYY to much "noise"
Mexico said:hmm.
i think i must look deeper into code..this very good note...(we are implement this without changing , so if this is a bug, it is from original - must look into forum)
EDIT: in my tested game winner get exp. too - so i really must carefully study this code..