View Full Version : Animal Placement
strategyonly May 11, 2010, 11:25 AM This is a beta for now.
It needs some work, what it does now:
- Places Animals (Horse, Cow, Sheep, Deer, Pig, Fur and Ivory) as a resource by the worker, but must have that resource requirement prior to placement. You can place the resource anyplace you want in your boundaries.
I need ideas for requirements, buildings to be used before requirements if any, or leave it just as it is, etc.
Is this a good idea, not so good an idea, etc.
Installation:
To be used with RoM (of course), and with AND inplace.
Just place the Assets folder in the RoM Assets folder and when it says override, just say yes.
Remember always to have a back-up prior to doing this.
If you dont want to do this, it is alredy in NWA mod.
NotSoGood thx for making this for me!!
Killtech May 11, 2010, 12:03 PM that sounds very cool.
as for the prerequisites i think it quite depends which way you want to go. however you should aim to make it so that it is not worth to place multiple animal resources in one city vicinity.
first things first: a pasture with an animal resource should give less yield then a farmland thus farms become preferable to be placed around cities for the purpose of food production. (this is even realistic since pure agriculture will always produce way more food then the meat from pastures) currently in ancient age pigs give you +4 :food: while farms will give you only +2 :food: which will result in replacing all farms with pig pastures. thus the bonus in this case must be heavily reduces down to +1:food: to be less attractive then farms (do not forget that there are buildings that give additional boni for the resource, so in the end it's still worth it to build one pasture but no more). otherwise you will need a prerequisite to prevent spamming animal resources within city range.
however i think the optimum would be to place one animal resource per city. to make this attractive you would need to modify buildings like butcheries to give the bonus from resources within vicinity only. however buildings should give only a bonus for a single resource (e.g. you have pigs and cows within city range but you will only get a bonus for one of them) so you don't build a pasture with each animal on it around a single city (that's just too much). to be more precise there is some need for a new building tag like this (http://forums.civfanatics.com/showthread.php?p=9178185#post9178185). otherwise you need to implement a prerequisite to prevent this.
as for buildings i can only think of a 'domesticate animal x' national wonder for each animal (available at animal husbandry) to unlock the possibility of placement.
this concept is interesting because it changes the very nature how animal resources behave to a much more realistic and intuitive one.
thx for implementing :D
i hope i will find the time to give it a shot this week
EDIT:
will cause problems with guilds and corporations as this resources will be available in quite large numbers. don't have a solution right now except just to lower the corporation gain on these resources.
EDIT2:
the simplest way to resolve the corporations issue is to add a property e.g. something like MaxConsumedResource for each resource type thus the max gain from food corporations can be limited in this way.
soup567 May 11, 2010, 03:45 PM Sounds great I've been waiting for someone to do this. Though I think it should also be implemented with crops like corn and rice, and maybe farmed fish.
Hydromancerx May 11, 2010, 04:09 PM Is there a limit on how many you can place?
Killtech May 11, 2010, 04:17 PM Sounds great I've been waiting for someone to do this. Though I think it should also be implemented with crops like corn and rice, and maybe farmed fish.
yep, but first find a way to run this such that it works well with the game. i bet it's quite overpowered atm.
strategyonly May 11, 2010, 05:31 PM Is there a limit on how many you can place?
ATM, as far as i can see, No.
@Killtech, good ideas
http://forums.civfanatics.com/showpost.php?p=9179345&postcount=2
Killtech May 12, 2010, 04:47 AM another small problems and their's solutions:
1) resources give you a direct tile yield bonus even without any matching improvement. so it makes sense to place cows everywhere and then build farms there (so farms produce 1 more food). this is of course not as it should be. thus either give no natural bonus to resources (don't like that one) or: any tile improvement that is incompatible with the resource should make the resource disappear (well deer will disappear if you transform their living space into farmland). however to not directly destroy resources they should not just disappear by building a wrong improvement on them but just move to the next free tile (if there's one with the same resource they will move there which means they disappear. this is due to prevent having too much of the same resource for petter game play - not realism).
2) if you can place it, there should be a way to remove it. however the solution of point 1 already covers that.
guess the descried mechanics can be done with python.
NotSoGood May 12, 2010, 07:42 AM Hmm, I don't think it's possible to add a limit in python how many resources you can place. I think I can easily add requirements when and where you can place the resources. The bonus and improvement yield changes are easy to do in xml and removing and replacing them shouldn't be a problem.
Killtech May 12, 2010, 07:51 AM Hmm, I don't think it's possible to add a limit in python how many resources you can place.
i call it balanced when the concept is such that you don't need any (artificial) limits to make something work properly. my ideas aim exactly this purpose to not to need any limits.
there's just the issue with the building tags that requires a SDK change. i hope Afforess or someone else can realize them.
BlackZiggerat May 12, 2010, 07:06 PM don't limit the resources. Make the animals worth nothing, until a tech activates a value in the bonus file. Cows aren't worth food, till we know how to milk them, or kill and cook them. But, the resources shouldn't be placeable without a facility first. I had postulated that specific farms be buildable based on acquisition of a bonus and a technology, I still think that's a great idea. It does away with the need for placing multiple bonus's. Keep in mind that animal farms are typically filthy, both in past and present, so attach an unhealth value to a farm. Even though animal meat may increase the health of a civilization, the tile is unhealthy, adjusted by other technological breakthroughs. Also, animals don't produce the same quantity of food as fields, true, but they produce happiness and production materials, also activated by technologies.
It;s a good step, and one that is definately rightly taken.
Edit
Animals must be fed, so one could take away their innate food value, and add a building to process the animals into a food value into the city itself. Also, could milk become a tradeable resource, provided by animals? That would be a definate benefit to a society. Adding health and food value to each city which is in the trade network.
Killtech May 12, 2010, 07:34 PM that's a good point with the unhealthiness from animals. after all most illnesses come form animal agents. and it surly will prevent spamming. 1.5 :yuck: per pasture sounds good and might make the suggested changes to buildings unnecessary (not the vicinity requirement; only the restriction of boni for multiple resources thus a SDK change is not needed; only xml).
strategyonly May 13, 2010, 09:08 AM I put up a newer one, only thing i changed was the python files, cause Afforess took out the Mercenaries part in his stuff.
Killtech May 13, 2010, 05:42 PM just tried your mod. but i have the problem that i can place any of the animal resources although i only have access to deers. obviously the check for requirements doesn't work. could i have done something wrong? i copied it into RoM Assets directory into a fresh new installation of RoM with AND.
also the workers plant resources instantly instead requiring some turns.
EDIT: i attached the improvement changes i played to prevent spamming. these are rather simple: the resources give usually +1 yield without any improvement. farms, mines, cottages-towns subtract this yield bonus from resources (so a farm on a cow resource gives just normal food). pastures give a slightly smaller bonus then farms. additionally i allowed camps to be build on every animal. however they do not give you access to the additional resources (cow, pig, sheep, horse); only yield bonus for the tile.
Killtech May 14, 2010, 09:46 AM oh. just looked through the python files. it seems that this works by adding to the worker interface for each resource and places them directly on the tile if you click on them.
Hmm, I don't think it's possible to add a limit in python how many resources you can place. I think I can easily add requirements when and where you can place the resources. The bonus and improvement yield changes are easy to do in xml and removing and replacing them shouldn't be a problem.
can you add following requirements: check if a tile has access to the resource you want to place just the same way as cities check the resources they have access to?
this is the most important prerequisite for a resource placing button to appear. however in the end the AI (and maybe automated workers) should be able to utilize this feature too, so it can't be just done via the interface alone i guess.
if possible resource placement should work just like improvement building and occupy the worker for some turns. ideally the need turns to place a resource should depend on how far the next available resource is.
NotSoGood May 16, 2010, 10:31 AM Okay strategyonly, I redid the animal placement completely. I removed it from interface and changed them to improvements. (takes time to build now) I also added the killtech's changes to improvements. There's now also a check in CvGameUtils if the improvementcan be built. (if the plot has access to the bonus) And in CvEventManager onImprovementBuilt removes the newly built improvement and adds the bonus. Unfortunately I don't know how the modding goes with RoM, so I provide mostly only the changes I made to original game files.
strategyonly May 16, 2010, 11:59 AM MotSoGood@,
OK i tried it out and i got this error message?
Traceback (most recent call last):
File "BugConfig", line 110, in unknown_endtag
File "BugConfig", line 334, in endChild
File "BugConfig", line 337, in end
File "BugConfig", line 318, in process
File "BugGameUtils", line 405, in handle
File "BugUtil", line 651, in callFunction
File "RoMGameUtils", line 49, in __init__
# NotSoGood start
plot = CyMap.plot(iX, iY)
if iBuild == gc.getInfoTypeForString("BUILD_BONUS_HORSE"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString("BONUS_HORSE")):
return 1
else:
NameError: global name 'iX' is not defined
NotSoGood May 16, 2010, 12:12 PM Hmm, could I see some code around it?
strategyonly May 16, 2010, 02:08 PM Hmm, could I see some code around it?
Sure heres the whole file:
## Sid Meier's Civilization 4
## Copyright Firaxis Games 2005
##
## Implementaion of miscellaneous game functions
import CvUtil
from CvPythonExtensions import *
import CvEventInterface
import Popup as PyPopup
import PyHelpers
import zCivics
import BugOptions
import BugCore
import BugUtil
import RevInstances
import RevDCM
import PlayerUtil
# globals
gc = CyGlobalContext()
PyPlayer = PyHelpers.PyPlayer
PyInfo = PyHelpers.PyInfo
PyCity = PyHelpers.PyCity
PyGame = PyHelpers.PyGame
civics = zCivics.zCivics()
# BUG - Mac Support - start
BugUtil.fixSets(globals())
# BUG - Mac Support - end
class RoMGameUtils:
"Rise of Mankind mod game functions"
def __init__(self):
#RevolutionDCM - Inquisition Mod
self.revModEnabled = gc.getGame().isOption(GameOptionTypes.GAMEOPTION_R EVOLUTION)
self.iNationalMint = gc.getInfoTypeForString("BUILDING_NATIONAL_MINT")
self.iHimejiCastle = gc.getInfoTypeForString("BUILDING_HIMEJI_CASTLE")
self.iDjenne = gc.getInfoTypeForString("BUILDING_DJENNE")
self.iTerrainDesert = gc.getInfoTypeForString("TERRAIN_DESERT")
self.iTechCloning = gc.getInfoTypeForString("TECH_CLONING")
self.iObelisk = gc.getInfoTypeForString("BUILDINGCLASS_OBELISK")
self.iRapidPrototyping = gc.getInfoTypeForString("TECH_RAPID_PROTOTYPING")
self.iReplicators = gc.getInfoTypeForString("BONUS_PERSONAL_REPLICATORS")
# NotSoGood start
plot = CyMap.plot(iX, iY)
if iBuild == gc.getInfoTypeForString("BUILD_BONUS_HORSE"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString("BONUS_HORSE")):
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_COW"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString("BONUS_COW")):
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_DEER"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString("BONUS_DEER")):
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_PIG"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString("BONUS_PIG")):
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_SHEEP"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString("BONUS_SHEEP")):
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_FUR"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString("BONUS_FUR")):
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_IVORY"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString("BONUS_IVORY")):
return 1
else:
return 0
# NotSoGood end
def doPillageGold(self, argsList):
"controls the gold result of pillaging"
pPlot = argsList[0]
pUnit = argsList[1]
iPillageGold = 0
iPillageGold = CyGame().getSorenRandNum(gc.getImprovementInfo(pPl ot.getImprovementType()).getPillageGold(), "Pillage Gold 1")
iPillageGold += CyGame().getSorenRandNum(gc.getImprovementInfo(pPl ot.getImprovementType()).getPillageGold(), "Pillage Gold 2")
iPillageGold += (pUnit.getPillageChange() * iPillageGold) / 100
# Himeji Samurai Castle Start #
pPlayer = gc.getPlayer( pUnit.getOwner( ) )
pPlayer2 = gc.getPlayer( pPlot.getOwner( ) )
obsoleteTech = gc.getBuildingInfo(self.iHimejiCastle).getObsolete Tech()
if ( gc.getTeam(pPlayer.getTeam()).isHasTech(obsoleteTe ch) == false or obsoleteTech == -1 ):
for iCity in range(pPlayer.getNumCities()):
ppCity = pPlayer.getCity(iCity)
if ppCity.getNumActiveBuilding(self.iHimejiCastle) == true:
iPillageGold = ( ( 0 ) * 2 )
iPillageGold = ( ( CyGame().getSorenRandNum(gc.getImprovementInfo(pPl ot.getImprovementType()).getPillageGold(), "Pillage Gold 1") ) * 2 )
iPillageGold += ( ( CyGame().getSorenRandNum(gc.getImprovementInfo(pPl ot.getImprovementType()).getPillageGold(), "Pillage Gold 2") ) * 2 )
iPillageGold += ( ( (pUnit.getPillageChange() * iPillageGold) / 100 ) * 2 )
else:
iPillageGold = 0
iPillageGold = CyGame().getSorenRandNum(gc.getImprovementInfo(pPl ot.getImprovementType()).getPillageGold(), "Pillage Gold 1")
iPillageGold += CyGame().getSorenRandNum(gc.getImprovementInfo(pPl ot.getImprovementType()).getPillageGold(), "Pillage Gold 2")
iPillageGold += (pUnit.getPillageChange() * iPillageGold) / 100
if pPlot.getOwner( ) >= 0:
if ( gc.getTeam(pPlayer2.getTeam()).isHasTech(obsoleteT ech) == false or obsoleteTech == -1 ):
for iCity in range(pPlayer2.getNumCities()):
ppCity = pPlayer2.getCity(iCity)
if ppCity.getNumActiveBuilding(self.iHimejiCastle) == true:
iPillageGold = 0
# Himeji Samurai Castle End #
return iPillageGold
def doCityCaptureGold(self, argsList):
"controls the gold result of capturing a city"
pOldCity = argsList[0]
pPlayer = gc.getPlayer( pOldCity.getOwner( ) )
iCaptureGold = 0
iCaptureGold += gc.getDefineINT("BASE_CAPTURE_GOLD")
iCaptureGold += (pOldCity.getPopulation() * gc.getDefineINT("CAPTURE_GOLD_PER_POPULATION"))
iCaptureGold += CyGame().getSorenRandNum(gc.getDefineINT("CAPTURE_GOLD_RAND1"), "Capture Gold 1")
iCaptureGold += CyGame().getSorenRandNum(gc.getDefineINT("CAPTURE_GOLD_RAND2"), "Capture Gold 2")
if (gc.getDefineINT("CAPTURE_GOLD_MAX_TURNS") > 0):
iCaptureGold *= cyIntRange((CyGame().getGameTurn() - pOldCity.getGameTurnAcquired()), 0, gc.getDefineINT("CAPTURE_GOLD_MAX_TURNS"))
iCaptureGold /= gc.getDefineINT("CAPTURE_GOLD_MAX_TURNS")
# Himeji Samurai Castle Start
obsoleteTech = gc.getBuildingInfo(self.iHimejiCastle).getObsolete Tech()
if ( gc.getTeam(pPlayer.getTeam()).isHasTech(obsoleteTe ch) == false or obsoleteTech == -1 ):
for iCity in range(pPlayer.getNumCities()):
ppCity = pPlayer.getCity(iCity)
if ppCity.getNumActiveBuilding(self.iHimejiCastle) == true:
iCaptureGold = 0
if ppCity.getNumActiveBuilding(self.iNationalMint) == true:
iCaptureGold *= 10
# Himeji Samurai Castle End
return iCaptureGold
def getUpgradePriceOverride(self, argsList):
iPlayer, iUnitID, iUnitTypeUpgrade = argsList
pPlayer = gc.getPlayer(iPlayer)
pUnit = pPlayer.getUnit(iUnitID)
if ( gc.getTeam(pPlayer.getTeam()).isHasTech(self.iRapi dPrototyping)):
if pPlayer.hasBonus(self.iReplicators):
iPrice = ((gc.getDefineINT("BASE_UNIT_UPGRADE_COST"))/2)
iPrice += (((max(0, (pPlayer.getUnitProductionNeeded(iUnitTypeUpgrade) - pPlayer.getUnitProductionNeeded(pUnit.getUnitType( )))) * gc.getDefineINT("UNIT_UPGRADE_COST_PER_PRODUCTION")))/2)
if ((not pPlayer.isHuman()) and (not pPlayer.isBarbarian())):
pHandicapInfo = gc.getHandicapInfo(gc.getGame().getHandicapType())
iPrice = ((iPrice * pHandicapInfo.getAIUnitUpgradePercent() / 100)/2)
iPrice = ((iPrice * max(0, ((pHandicapInfo.getAIPerEraModifier() * pPlayer.getCurrentEra()) + 100)) / 100)/2)
iPrice = ((iPrice - ((iPrice * pUnit.getUpgradeDiscount()) / 100))/2)
return iPrice
else:
return -1 # Any value 0 or above will be used
def getExperienceNeeded(self, argsList):
# use this function to set how much experience a unit needs
iLevel, iOwner = argsList
iExperienceNeeded = 0
# regular epic game experience
iExperienceNeeded = iLevel * iLevel + 1
# iExperienceNeeded = iLevel * 5
iModifier = gc.getPlayer(iOwner).getLevelExperienceModifier()
if (0 != iModifier):
iExperienceNeeded += (iExperienceNeeded * iModifier + 99) / 100 # ROUND UP
return iExperienceNeeded
NotSoGood May 16, 2010, 02:17 PM Okay, that part is used to determine if the improvement can be built. It can't be placed anywhere you want. This is ofcourse just a quess but what if you add this to the end of that file: def canBuild(self,argsList):
iX, iY, iBuild, iPlayer = argsList
# NotSoGood start
plot = CyMap.plot(iX, iY)
bonusHorse = gc.getInfoTypeForString("BONUS_HORSE")
bonusCow = gc.getInfoTypeForString("BONUS_COW")
bonusDeer = gc.getInfoTypeForString("BONUS_DEER")
bonusPig = gc.getInfoTypeForString("BONUS_PIG")
bonusSheep = gc.getInfoTypeForString("BONUS_SHEEP")
bonusFur = gc.getInfoTypeForString("BONUS_FUR")
bonusIvory = gc.getInfoTypeForString("BONUS_IVORY")
if iBuild == gc.getInfoTypeForString("BUILD_BONUS_HORSE"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, bonusHorse) and plot.getBonusType() != bonusHorse:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_COW"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, bonusCow) and plot.getBonusType() != bonusCow:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_DEER"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, bonusDeer) and plot.getBonusType() != bonusDeer:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_PIG"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, bonusPig) and plot.getBonusType() != bonusPig:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_SHEEP"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, bonusSheep) and plot.getBonusType() != bonusSheep:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_FUR"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, bonusFur) and plot.getBonusType() != bonusFur:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_IVORY"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, bonusIvory) and plot.getBonusType() != bonusIvory:
return 1
else:
return 0
# NotSoGood end
return -1 # Returning -1 means ignore; 0 means Build cannot be performed; 1 or greater means it canI added another check to prevent AI place the same bonus over and over again.
strategyonly May 16, 2010, 02:32 PM Okay, that part is used to determine if the improvement can be built. It can't be placed anywhere you want. This is ofcourse just a quess but what if you add this to the end of that file: def canBuild(self,argsList):
iX, iY, iBuild, iPlayer = argsList
# NotSoGood start
plot = CyMap.plot(iX, iY)
bonusHorse = gc.getInfoTypeForString("BONUS_HORSE")
bonusCow = gc.getInfoTypeForString("BONUS_COW")
bonusDeer = gc.getInfoTypeForString("BONUS_DEER")
bonusPig = gc.getInfoTypeForString("BONUS_PIG")
bonusSheep = gc.getInfoTypeForString("BONUS_SHEEP")
bonusFur = gc.getInfoTypeForString("BONUS_FUR")
bonusIvory = gc.getInfoTypeForString("BONUS_IVORY")
if iBuild == gc.getInfoTypeForString("BUILD_BONUS_HORSE"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, bonusHorse) and plot.getBonusType() != bonusHorse:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_COW"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, bonusCow) and plot.getBonusType() != bonusCow:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_DEER"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, bonusDeer) and plot.getBonusType() != bonusDeer:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_PIG"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, bonusPig) and plot.getBonusType() != bonusPig:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_SHEEP"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, bonusSheep) and plot.getBonusType() != bonusSheep:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_FUR"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, bonusFur) and plot.getBonusType() != bonusFur:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_IVORY"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, bonusIvory) and plot.getBonusType() != bonusIvory:
return 1
else:
return 0
# NotSoGood end
return -1 # Returning -1 means ignore; 0 means Build cannot be performed; 1 or greater means it canI added another check to prevent AI place the same bonus over and over again.
Now this error?
Traceback (most recent call last):
File "BugConfig", line 110, in unknown_endtag
File "BugConfig", line 334, in endChild
File "BugConfig", line 337, in end
File "BugConfig", line 318, in process
File "BugGameUtils", line 405, in handle
File "BugUtil", line 650, in callFunction
File "BugUtil", line 629, in lookupFunction
File "BugUtil", line 621, in lookupModule
File "<string>", line 35, in load_module
File "<string>", line 13, in _get_code
IndentationError: expected an indented block (RoMGameUtils, line 49)
EDIT: OK i moved over the return -1 and that part works now, but then i get this error instead?
Traceback (most recent call last):
File "BugConfig", line 110, in unknown_endtag
File "BugConfig", line 334, in endChild
File "BugConfig", line 337, in end
File "BugConfig", line 318, in process
File "BugGameUtils", line 405, in handle
File "BugUtil", line 650, in callFunction
File "BugUtil", line 629, in lookupFunction
File "BugUtil", line 621, in lookupModule
File "<string>", line 35, in load_module
File "<string>", line 13, in _get_code
IndentationError: expected an indented block (RoMGameUtils, line 49)
EDIT EDIT: ok i tried a different way by leaving the RoM one alone and just adding yours and it is working, i think, i will have to test alot more to see?
Dancing Hoskuld May 16, 2010, 04:00 PM @StrategyOnly, RoM is WoC/BUG modular so you should try and make your mods likewise:mischief:. The main reason for doing it that way is that it reduces the likelihood of other mods breaking yours by overwriting your XML, for example AND:rolleyes: Yes, I do know that some XML isn't WoC-able but I don't think any of these are.
Since this does something which I maybe able to pinch to expand the Subdue Animals mod I will have a look at making this fit RoM in a modular form. Who knows it may then be usable in other mods :).
Also you only give workers the ability what about the future workers (clones et al) in RoM plus the undead worker in AAranda's religions? Should they be able to make these as well?
strategyonly May 16, 2010, 05:51 PM @StrategyOnly, RoM is WoC/BUG modular so you should try and make your mods likewise:mischief:. The main reason for doing it that way is that it reduces the likelihood of other mods breaking yours by overwriting your XML, for example AND:rolleyes: Yes, I do know that some XML isn't WoC-able but I don't think any of these are.
Since this does something which I maybe able to pinch to expand the Subdue Animals mod I will have a look at making this fit RoM in a modular form. Who knows it may then be usable in other mods :).
Also you only give workers the ability what about the future workers (clones et al) in RoM plus the undead worker in AAranda's religions? Should they be able to make these as well?
Yeah i thought about the clones etc and i was just going to test it before, but it does sound reasonable to put that knowledge with the clones etc.
But as far as making it a modular, DEFINITELY have at it, i just dont get that BUG/REV stuff that much, and i do know your alot better than i am at that stuff, so by all means PLEASE do it, and thx.;)
Dancing Hoskuld May 16, 2010, 06:29 PM I think the main problem you are having with it at the moment is because the CvGameUtils.py in RoM is totally different to the one in your mod. I am trying to figure out where the canBuild function should be. The rest is progressing quite quickly.
strategyonly May 18, 2010, 04:00 AM I thought it was working but i guess NOT? I dont get anything now with the worker?
Killtech May 18, 2010, 04:40 AM the worker stands on a tile without road. it means this tile doesn't have access to the resource - just like a city without a road connection.
strategyonly May 18, 2010, 06:18 AM the worker stands on a tile without road. it means this tile doesn't have access to the resource - just like a city without a road connection.
Thats not what i was getting to, before there were horses/sheep etc in the worker area?
Dancing Hoskuld May 30, 2010, 04:46 PM @StrategyOnly & NotSoGood, Attached is my work on this so far. It is almost fully WocBUG modular but I am getting a Python error I can't figure out in the callback code. I have been looking at it for three days so thought a fresh pair (or two) of eyes my help.
Installation:-
1. Edit init.xml and add <load mod=AnimalPlacing"/>
2. Edit Assets/XML/PythonCallbackDefines.xml and change USE_CAN_BUILD_CALLBACK tag to 1.
Note. the RoM PythonCallbackDefines is different to the AND one so I did not include the file here.
Killtech May 30, 2010, 08:35 PM that are good news
NotSoGood May 31, 2010, 08:47 AM Okay, I looked at your python code and I think it should work. One thing that I think should be there too is the class and the eventhandlers. I'm not a python expert so I'll have to do some more searching to find the problem, but what is the error you're getting? It might help to spot it.
EDIT: I haven't modded BUG ever so all this is pretty much quessing, but by following the BUG modding tutorial I can see you haven't added the AnimalPlacing to init.xml which loads your python. Also seems that the class isn't required. But I think improvementBuilt in AnimalPlacing.xml should start with a capital letter (ImprovementBuilt).
Dancing Hoskuld May 31, 2010, 04:08 PM Okay, I looked at your python code and I think it should work. One thing that I think should be there too is the class and the eventhandlers. I'm not a python expert so I'll have to do some more searching to find the problem, but what is the error you're getting? It might help to spot it.
The error I am getting is with the cyMap function in the call back. The rest seems to work. With the latest BUG stuff you do not need event handlers or classes.
EDIT: I haven't modded BUG ever so all this is pretty much quessing, but by following the BUG modding tutorial I can see you haven't added the AnimalPlacing to init.xml which loads your python. Also seems that the class isn't required. But I think improvementBuilt in AnimalPlacing.xml should start with a capital letter (ImprovementBuilt).
Definatelly not I but i we figured that out in the Militia mod :).
strategyonly May 31, 2010, 07:38 PM I dont have any action button(s) with the one you posted in 27? For some reason my BUG is not reading ANY of the Config stuff, just like the slaves one:mad:
EDIT: So i tried it this time with the <load mod="AnimalPlacing"/>: and got this? But still no action btns.
Traceback (most recent call last):
File "BugEventManager", line 361, in _handleDefaultEvent
File "AnimalPlacing", line 50, in onImprovementBuilt
NameError: global name 'PyInfo' is not defined
NotSoGood Jun 01, 2010, 08:11 AM Argh :mad: , that was one nasty error. It was a typo. In canBuild:def canBuild(argsList):
iX, iY, iBuild, iPlayer = argsList
# NotSoGood start
plot = CyMap.plot(iX, iY)
...I forgot () after CyMap. :cry:
I hope that fixes it...
strategyonly Jun 01, 2010, 09:53 AM @StrategyOnly & NotSoGood, Attached is my work on this so far. It is almost fully WocBUG modular but I am getting a Python error I can't figure out in the callback code. I have been looking at it for three days so thought a fresh pair (or two) of eyes my help.
Installation:-
1. Edit init.xml and add <load mod=AnimalPlacing"/>
2. Edit Assets/XML/PythonCallbackDefines.xml and change USE_CAN_BUILD_CALLBACK tag to 1.
Note. the RoM PythonCallbackDefines is different to the AND one so I did not include the file here.
Argh :mad: , that was one nasty error. It was a typo. In canBuild:def canBuild(argsList):
iX, iY, iBuild, iPlayer = argsList
# NotSoGood start
plot = CyMap.plot(iX, iY)
...I forgot () after CyMap. :cry:
I hope that fixes it...
Even after that i still get nothing in Dancing H's worker??:(
NotSoGood Jun 01, 2010, 10:13 AM Even after that i still get nothing in Dancing H's worker??:(
You don't seem to have any animals yet. It was designed to allow you to "build" animals only after you already have them. Try WBing yourself a horse and a pasture with road.
Killtech Jun 01, 2010, 10:21 AM Even after that i still get nothing in Dancing H's worker??:(
why should you? you don't have access to any animal resource.
the plot you want to place an animal resource must have a road connection the resource of that type (which must be under your control ofc).
strategyonly Jun 03, 2010, 05:11 AM You don't seem to have any animals yet. It was designed to allow you to "build" animals only after you already have them. Try WBing yourself a horse and a pasture with road.
why should you? you don't have access to any animal resource.
the plot you want to place an animal resource must have a road connection the resource of that type (which must be under your control ofc).
OK, i made a road and a pasture for both sheep and horses, still, NOTHING?
Killtech Jun 03, 2010, 05:42 AM okay, that's strange. if your city has access to horses so should the worker.
Dancing Hoskuld Jun 03, 2010, 01:53 PM @StrategyOnly & NotSoGood, I agree it is not working. My latest version is attached.
Installation:-
1. Edit init.xml and add <load mod=AnimalPlacing"/>
2. Edit Assets/XML/PythonCallbackDefines.xml and change USE_CAN_BUILD_CALLBACK tag to 1.
Note. the RoM PythonCallbackDefines is different to the AND one so I did not include the file here.
NotSoGood Jun 03, 2010, 02:05 PM Hmm, odd. So do you both have the buttons not appearing? Do you have python exceptions on?
I'll download your version Dancing Hoskuld and will test it as soon as possible.
strategyonly Jun 03, 2010, 02:35 PM OK when i just downloaded the above i now get this error(s):
Traceback (most recent call last):
File "BugConfig", line 78, in parse
File "e:/main/civilization4/warlords/assets/python/system\xmllib.py", line 175, in close
File "e:/main/civilization4/warlords/assets/python/system\xmllib.py", line 408, in goahead
File "BugConfig", line 122, in syntax_error
ConfigError: error parsing configuration: bogus `<'
Traceback (most recent call last):
File "BugUtil", line 691, in <lambda>
File "BugEventManager", line 569, in preGameStart
File "BugEventManager", line 338, in fireEvent
File "BugEventManager", line 348, in _dispatchEvent
File "BugEventManager", line 408, in _handleInitBugEvent
File "BugInit", line 43, in init
File "BugInit", line 64, in loadMod
File "BugConfig", line 78, in parse
File "e:/main/civilization4/warlords/assets/python/system\xmllib.py", line 175, in close
File "e:/main/civilization4/warlords/assets/python/system\xmllib.py", line 408, in goahead
File "BugConfig", line 122, in syntax_error
ConfigError: error parsing configuration: bogus `<'
ERR: Python function preGameStart failed, module CvAppInterface
NotSoGood Jun 03, 2010, 02:57 PM I tested the Dancing Hoskuld's version and after animal husbandry I build a pasture on cows and then build cows to the next plot. It seems to work fine. One thing that doesn't work are the new descriptions (both builds and improvements). It shows the TXT_KEY.. thing instead of the text.
Also I think I spotted another bug in my code. In canBuild all those isAdjacentPlotGroupConnectedBonus should be isPlotGroupConnectedBonus. Sorry.
strategyonly Jun 08, 2010, 11:11 AM One thing i have notice in ALL of the one's that you'll use "load mod =" is that i cant get any of them to work, none.
Dancing Hoskuld Jun 08, 2010, 04:04 PM One thing i have notice in ALL of the one's that you'll use "load mod =" is that i cant get any of them to work, none.
Post your config.ini and I will see if there is something different between mine and yours.
While getting the female missionary mod converted I found a couple of bugs in this one. I have fixed them but not tested yet.
Arakhor Jun 08, 2010, 04:05 PM "mod=\Rise of Mankind" should be all you need to add onto the command line of your RoM short-cut.
Dancing Hoskuld Jun 08, 2010, 04:16 PM "mod=\Rise of Mankind" should be all you need to add onto the command line of your RoM short-cut.
Sorry that should have been the config\init.xml file that I requested. I was posting three other things at the same time - bad idea!
strategyonly Jun 08, 2010, 05:02 PM Sorry that should have been the config\init.xml file that I requested. I was posting three other things at the same time - bad idea!
I knew what you meant. (This isnt the one I used for AnimalPlacement but its all the same just that one entry is all.
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!--
Main BUG Mod Initialization
This file initializes the BUG Core and all mods.
Copyright (c) 2008 The BUG Mod.
-->
<bug>
<!-- BUG Core -->
<load mod="BUG Config"/>
<load mod="BUG Core"/>
<!-- Civilization Core -->
<!-- Domestic and Military Advisors and Civilopedia are chosen by options -->
<init module="CvScreensInterface"/>
<!-- Utility Modules -->
<init module="FontUtil" immediate="True"/>
<symbol id="war" from="COMMERCE_GOLD" offset="25"/>
<symbol id="peace"/>
<symbol id="space"/> <!-- blank symbol the same size as other standard symbols -->
<symbol id="militaryinstructor" name="MILITARY_INSTRUCTOR"/>
<symbol id="land" name="DOMAIN_LAND"/>
<symbol id="sea" name="DOMAIN_SEA"/>
<symbol id="air" name="DOMAIN_AIR"/>
<symbol id="sentry" name="ORDER_SENTRY"/>
<symbol id="fortify" name="ORDER_FORTIFY"/>
<symbol id="wait" name="ORDER_WAIT"/>
<symbol id="upgrade"/>
<symbol id="cancel"/>
<symbol id="ss casing" from="HAPPY" offset="-25"/>
<symbol id="ss cockpit"/>
<symbol id="ss docking bay"/>
<symbol id="ss engine"/>
<symbol id="ss life support"/>
<symbol id="ss stasis chamber"/>
<symbol id="ss thruster"/>
<symbol id="citizen" from="POWER" offset="1"/>
<symbol id="greatgeneral" name="GREAT_GENERAL"/>
<init module="AttitudeUtil">
<!-- Furious, Annoyed, Cautious, Pleased, Friendly -->
<arg name="colors" type="tuple">
"COLOR_RED",
"COLOR_CYAN",
"COLOR_CLEAR",
"COLOR_GREEN",
"COLOR_YELLOW"
</arg>
<!-- Non-memory attitude modifier keys -->
<arg name="modifiers" type="tuple">
"TXT_KEY_MISC_ATTITUDE_LAND_TARGET",
"TXT_KEY_MISC_ATTITUDE_WAR",
"TXT_KEY_MISC_ATTITUDE_PEACE",
"TXT_KEY_MISC_ATTITUDE_SAME_RELIGION",
"TXT_KEY_MISC_ATTITUDE_DIFFERENT_RELIGION",
"TXT_KEY_MISC_ATTITUDE_BONUS_TRADE",
"TXT_KEY_MISC_ATTITUDE_OPEN_BORDERS",
"TXT_KEY_MISC_ATTITUDE_DEFENSIVE_PACT",
"TXT_KEY_MISC_ATTITUDE_RIVAL_DEFENSIVE_PACT",
"TXT_KEY_MISC_ATTITUDE_RIVAL_VASSAL",
"TXT_KEY_MISC_ATTITUDE_SHARE_WAR",
"TXT_KEY_MISC_ATTITUDE_FAVORITE_CIVIC",
"TXT_KEY_MISC_ATTITUDE_TRADE",
"TXT_KEY_MISC_ATTITUDE_RIVAL_TRADE",
"TXT_KEY_MISC_ATTITUDE_FREEDOM",
"TXT_KEY_MISC_ATTITUDE_EXTRA_GOOD",
"TXT_KEY_MISC_ATTITUDE_EXTRA_BAD"
</arg>
</init>
<event type="LanguageChanged" module="AttitudeUtil" function="initModifiers"/>
<symbol id="furious" name="ATTITUDE_FURIOUS" from="POWER" offset="4"/>
<symbol id="annoyed" name="ATTITUDE_ANNOYED"/>
<symbol id="cautious" name="ATTITUDE_CAUTIOUS"/>
<symbol id="pleased" name="ATTITUDE_PLEASED"/>
<symbol id="friendly" name="ATTITUDE_FRIENDLY"/>
<init module="ColorUtil">
<!--
You can safely modify this list to change the color dropdown menus
for color options. You can change the text displayed in the menus by
adding translations for your new colors to Colors_CIV4GameText.xml
in the XML/Text directory.
-->
<arg name="colors" type="tuple">
"COLOR_RED",
"COLOR_YELLOW",
"COLOR_CYAN",
"COLOR_GREEN",
"COLOR_BLUE",
"COLOR_MAGENTA",
"COLOR_WHITE",
"COLOR_LIGHT_GREY",
"COLOR_GREY",
"COLOR_DARK_GREY",
"COLOR_BLACK"
</arg>
</init>
<event type="LanguageChanged" module="ColorUtil" function="createColors"/>
<events module="DealUtil" function="addEvents"/>
<events module="DiplomacyUtil" function="addEvents"/>
<extend how="after" module="DiplomacyUtil" function="handleAIComment" to="CvDiplomacyInterface" as="beginDiplomacy"/>
<extend how="after" module="DiplomacyUtil" function="handleUserResponse" to="CvDiplomacyInterface" as="handleUserResponse"/>
<!-- Rise of Mankind -->
<events module="WarPrizes"> </events>
<events module="ScreenResolutionSize"> </events>
<events module="CvWaterAnimalsModEventManager"> </events>
<events module="NukeAfterEffects"> </events>
<events module="WarriorsOfGod"> </events>
<events module="SubdueAnimals"> </events>
<events module="CaptureSlaves"> </events>
<events module="Espionage"> </events>
<events module="Militia"> </events>
<events module="CvEnhancedTechConquestEventManager">
</events>
<!-- Rise of Mankind end -->
<init module="GGUtil"/>
<init module="GPUtil"/>
<init module="ReligionUtil"/>
<init module="TechUtil"/>
<init module="TradeUtil"/>
<init module="TraitUtil"/>
<init module="UnitUtil"/>
<gameutils module="WidgetUtil" handler="getWidgetHelp"/>
<event type="OnLoad" module="CvTechChooser" function="resetTechPrefs"/>
<event type="GameStart" module="CvTechChooser" function="resetTechPrefs"/>
<!-- Mods -->
<load mod="BUG Main Interface"/>
<load mod="BUG City Screen"/>
<load mod="BUG Advisors"/>
<load mod="Customizable Domestic Advisor"/>
<load mod="Better Espionage"/>
<load mod="All Eras Dawn of Man Screen"/>
<load mod="TechWindow"/>
<load mod="Not Just Another Game Clock"/>
<load mod="Advanced Scoreboard"/>
<load mod="Plot List Enhancements"/>
<load mod="Autolog"/>
<load mod="Reminder"/> <!-- requires Autolog -->
<load mod="Civ4lerts"/>
<load mod="MoreCiv4lerts"/>
<load mod="Unit Naming"/>
<load mod="FavoriteCivicDetector"/>
<load mod="EventSigns"/>
<load mod="Strategy Overlay"/>
<load mod="StatusDump"/>
<load mod="MovieMod"/>
<!--RevolutionDCM start - mod components -->
<load mod="RevDCM"/>
<load mod="Revolution"/>
<!--RevolutionDCM end-->
<load mod="Abandon City Mod"/>
<!-- BULL -->
<load mod="BULL Core"/>
<load mod="BULL Actions"/>
<load mod="BULL City Bar"/>
<load mod="BULL Misc Hovers"/>
<load mod="AutoSave"/>
<load mod="MapFinder"/>
<load mod="Advanced Combat Odds"/>
<!-- BUFFY -->
<load mod="BUFFY"/>
<load mod="RoMSettings"/>
<load mod="DiplomacySettings"/>
<!--<load mod="EnhancedTechConquest"/> -->
<!-- Options Screen -->
<screen id="BUGFull">
<tab module="BugGeneralOptionsTab"/>
<tab module="RevDCMOptionsTab"/>
<tab module="RoMOptionsTab"/>
<tab module="ANDDiplomacyTab"/>
<tab module="BugMapOptionsTab"/>
<tab module="BugCityScreenOptionsTab"/>
<tab module="BugAdvisorOptionsTab"/>
<tab module="BugAlertsOptionsTab"/>
<tab module="BugScoreOptionsTab"/>
<tab module="BugNJAGCOptionsTab"/>
<tab module="BugPleOptionsTab"/>
<tab module="BugACOOptionsTab"/>
<tab module="BugUnitNameOptionsTab"/>
<tab module="BugAutologOptionsTab"/>
<tab module="BugSystemOptionsTab"/>
<tab module="BugCreditsOptionsTab"/>
</screen>
</bug>
Dancing Hoskuld Jun 08, 2010, 05:13 PM :blush:I can't find Animal Placement in that code anywhere?
This is mine. I put the loads at the bottom and I have converted Capture Slaves to this form also.
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!--
Main BUG Mod Initialization
This file initializes the BUG Core and all mods.
Copyright (c) 2008 The BUG Mod.
-->
<bug>
<!-- BUG Core -->
<load mod="BUG Config"/>
<load mod="BUG Core"/>
<!-- Civilization Core -->
<!-- Domestic and Military Advisors and Civilopedia are chosen by options -->
<init module="CvScreensInterface"/>
<!-- Utility Modules -->
<init module="FontUtil" immediate="True"/>
<symbol id="war" from="COMMERCE_GOLD" offset="25"/>
<symbol id="peace"/>
<symbol id="space"/> <!-- blank symbol the same size as other standard symbols -->
<symbol id="militaryinstructor" name="MILITARY_INSTRUCTOR"/>
<symbol id="land" name="DOMAIN_LAND"/>
<symbol id="sea" name="DOMAIN_SEA"/>
<symbol id="air" name="DOMAIN_AIR"/>
<symbol id="sentry" name="ORDER_SENTRY"/>
<symbol id="fortify" name="ORDER_FORTIFY"/>
<symbol id="wait" name="ORDER_WAIT"/>
<symbol id="upgrade"/>
<symbol id="cancel"/>
<symbol id="ss casing" from="HAPPY" offset="-25"/>
<symbol id="ss cockpit"/>
<symbol id="ss docking bay"/>
<symbol id="ss engine"/>
<symbol id="ss life support"/>
<symbol id="ss stasis chamber"/>
<symbol id="ss thruster"/>
<symbol id="citizen" from="POWER" offset="1"/>
<symbol id="greatgeneral" name="GREAT_GENERAL"/>
<init module="AttitudeUtil">
<!-- Furious, Annoyed, Cautious, Pleased, Friendly -->
<arg name="colors" type="tuple">
"COLOR_RED",
"COLOR_CYAN",
"COLOR_CLEAR",
"COLOR_GREEN",
"COLOR_YELLOW"
</arg>
<!-- Non-memory attitude modifier keys -->
<arg name="modifiers" type="tuple">
"TXT_KEY_MISC_ATTITUDE_LAND_TARGET",
"TXT_KEY_MISC_ATTITUDE_WAR",
"TXT_KEY_MISC_ATTITUDE_PEACE",
"TXT_KEY_MISC_ATTITUDE_SAME_RELIGION",
"TXT_KEY_MISC_ATTITUDE_DIFFERENT_RELIGION",
"TXT_KEY_MISC_ATTITUDE_BONUS_TRADE",
"TXT_KEY_MISC_ATTITUDE_OPEN_BORDERS",
"TXT_KEY_MISC_ATTITUDE_DEFENSIVE_PACT",
"TXT_KEY_MISC_ATTITUDE_RIVAL_DEFENSIVE_PACT",
"TXT_KEY_MISC_ATTITUDE_RIVAL_VASSAL",
"TXT_KEY_MISC_ATTITUDE_SHARE_WAR",
"TXT_KEY_MISC_ATTITUDE_FAVORITE_CIVIC",
"TXT_KEY_MISC_ATTITUDE_TRADE",
"TXT_KEY_MISC_ATTITUDE_RIVAL_TRADE",
"TXT_KEY_MISC_ATTITUDE_FREEDOM",
"TXT_KEY_MISC_ATTITUDE_EXTRA_GOOD",
"TXT_KEY_MISC_ATTITUDE_EXTRA_BAD"
</arg>
</init>
<event type="LanguageChanged" module="AttitudeUtil" function="initModifiers"/>
<symbol id="furious" name="ATTITUDE_FURIOUS" from="POWER" offset="4"/>
<symbol id="annoyed" name="ATTITUDE_ANNOYED"/>
<symbol id="cautious" name="ATTITUDE_CAUTIOUS"/>
<symbol id="pleased" name="ATTITUDE_PLEASED"/>
<symbol id="friendly" name="ATTITUDE_FRIENDLY"/>
<init module="ColorUtil">
<!--
You can safely modify this list to change the color dropdown menus
for color options. You can change the text displayed in the menus by
adding translations for your new colors to Colors_CIV4GameText.xml
in the XML/Text directory.
-->
<arg name="colors" type="tuple">
"COLOR_RED",
"COLOR_YELLOW",
"COLOR_CYAN",
"COLOR_GREEN",
"COLOR_BLUE",
"COLOR_MAGENTA",
"COLOR_WHITE",
"COLOR_LIGHT_GREY",
"COLOR_GREY",
"COLOR_DARK_GREY",
"COLOR_BLACK"
</arg>
</init>
<event type="LanguageChanged" module="ColorUtil" function="createColors"/>
<events module="DealUtil" function="addEvents"/>
<events module="DiplomacyUtil" function="addEvents"/>
<extend how="after" module="DiplomacyUtil" function="handleAIComment" to="CvDiplomacyInterface" as="beginDiplomacy"/>
<extend how="after" module="DiplomacyUtil" function="handleUserResponse" to="CvDiplomacyInterface" as="handleUserResponse"/>
<!-- Rise of Mankind -->
<events module="WarPrizes"> </events>
<events module="ScreenResolutionSize"> </events>
<events module="CvWaterAnimalsModEventManager"> </events>
<events module="NukeAfterEffects"> </events>
<events module="SubdueAnimals"> </events>
<events module="Militia"> </events>
<events module="CvEnhancedTechConquestEventManager">
</events>
<!-- Rise of Mankind end -->
<init module="GGUtil"/>
<init module="GPUtil"/>
<init module="ReligionUtil"/>
<init module="TechUtil"/>
<init module="TradeUtil"/>
<init module="TraitUtil"/>
<init module="UnitUtil"/>
<gameutils module="WidgetUtil" handler="getWidgetHelp"/>
<event type="OnLoad" module="CvTechChooser" function="resetTechPrefs"/>
<event type="GameStart" module="CvTechChooser" function="resetTechPrefs"/>
<!-- Mods -->
<load mod="BUG Main Interface"/>
<load mod="BUG City Screen"/>
<load mod="BUG Advisors"/>
<load mod="Customizable Domestic Advisor"/>
<load mod="Better Espionage"/>
<load mod="All Eras Dawn of Man Screen"/>
<load mod="TechWindow"/>
<load mod="Not Just Another Game Clock"/>
<load mod="Advanced Scoreboard"/>
<load mod="Plot List Enhancements"/>
<load mod="Autolog"/>
<load mod="Reminder"/> <!-- requires Autolog -->
<load mod="Civ4lerts"/>
<load mod="MoreCiv4lerts"/>
<load mod="Unit Naming"/>
<load mod="FavoriteCivicDetector"/>
<load mod="EventSigns"/>
<load mod="Strategy Overlay"/>
<load mod="StatusDump"/>
<load mod="MovieMod"/>
<!--RevolutionDCM start - mod components -->
<load mod="RevDCM"/>
<load mod="Revolution"/>
<!--RevolutionDCM end-->
<load mod="Abandon City Mod"/>
<!-- BULL -->
<load mod="BULL Core"/>
<load mod="BULL Actions"/>
<load mod="BULL City Bar"/>
<load mod="BULL Misc Hovers"/>
<load mod="AutoSave"/>
<load mod="MapFinder"/>
<load mod="Advanced Combat Odds"/>
<!-- BUFFY -->
<load mod="BUFFY"/>
<load mod="RoMSettings"/>
<load mod="DiplomacySettings"/>
<!--<load mod="EnhancedTechConquest"/> -->
<!-- Options Screen -->
<screen id="BUGFull">
<tab module="BugGeneralOptionsTab"/>
<tab module="RevDCMOptionsTab"/>
<tab module="RoMOptionsTab"/>
<tab module="ANDDiplomacyTab"/>
<tab module="BugMapOptionsTab"/>
<tab module="BugCityScreenOptionsTab"/>
<tab module="BugAdvisorOptionsTab"/>
<tab module="BugAlertsOptionsTab"/>
<tab module="BugScoreOptionsTab"/>
<tab module="BugNJAGCOptionsTab"/>
<tab module="BugPleOptionsTab"/>
<tab module="BugACOOptionsTab"/>
<tab module="BugUnitNameOptionsTab"/>
<tab module="BugAutologOptionsTab"/>
<tab module="BugSystemOptionsTab"/>
<tab module="BugCreditsOptionsTab"/>
</screen>
<load mod="AnimalPlacing" />
<load mod="Capture Slaves" />
<load mod="Female Missionaries" />
</bug>
strategyonly Jun 08, 2010, 11:03 PM I wonder if its asking for this?
import PyHelpers
EDIT: Yeppers that was it, but now i am not getting anything for the AP in the workers area??
I have Animal Husbandry/Hunters etc?
Dancing Hoskuld Jun 09, 2010, 02:51 AM Yes, I got that error myself plus one other. Not had time to test yet.
Dancing Hoskuld Jun 09, 2010, 04:20 PM This is now working for me.
Installation:-
1. Edit init.xml and add <load mod=AnimalPlacing"/>
2. Edit Assets/XML/PythonCallbackDefines.xml and change USE_CAN_BUILD_CALLBACK tag to 1.
Note. the RoM PythonCallbackDefines is different to the AND one so I did not include the file here.
Edit: Rats it doesn't quite work :(.
Edit 2: It does not work on all terrains (rivers only). Could it be something to do with cart paths instead of roads?
NotSoGood Jun 10, 2010, 02:41 AM Hmm, I can't really say much. For me it's working as it should exept those info texts. :confused:
strategyonly Jun 10, 2010, 05:15 AM Hmm, I can't really say much. For me it's working as it should exept those info texts. :confused:
Are you using it in RoM? If so can you d/l it to a site so i can look at it then?
I am still getting this????:(
On a good note the Captures Slaves works good.:p
NotSoGood Jun 10, 2010, 05:26 AM Are you using it in RoM? If so can you d/l it to a site so i can look at it then?
Actually I'm using using AND too. Do you want me to upload the entire mod or just part of it?
On a good note the Captures Slaves works good.:p
That's good to hear.
strategyonly Jun 10, 2010, 05:41 AM Actually I'm using using AND too. Do you want me to upload the entire mod or just part of it?
That's good to hear.
I forgot to put the python CallBacks in, thats why it took so long to get back to you sorry, but it didnt help, l still had nothing in the workers area, other than the normal stuff:(
If you have a site that can load it all sure, and that means if you have anything you want tried also, or if you have extra stuff in yours thats ok also, i like all kinds of extra goodies.;)
EDIT: I got it to work, i changed the name of the folder when i tried back to my normal game, then i realized i needed to put back the folder that had AP in it, DUH!!
And my horses are not by any rivers either.
EDIT EDIT: I wonder how Afforess gets the pythoncallback to work without changing it in the MAIN pythoncallback area?
NotSoGood Jun 10, 2010, 06:07 AM That's great! What about your hover texts, do they display correct? (I mean in the build improvement help info text what ever... :lol: :crazyeye:)
strategyonly Jun 10, 2010, 06:42 AM That's great! What about your hover texts, do they display correct? (I mean in the build improvement help info text what ever... :lol: :crazyeye:)
No they are still CAPITAL. (Maybe "we" will just have to put in the Description there ourselves in the BuildInfos?
Also i figured out why i was having trouble before also, i have a worker that i went thru on WB and a worker that i built? See the difference? One has the horse (the one i built) and one worker does NOT (the WB one).
NotSoGood Jun 10, 2010, 07:16 AM No they are still CAPITAL. (Maybe "we" will just have to put in the Description there ourselves in the BuildInfos?I think that way it should work.
Also i figured out why i was having trouble before also, i have a worker that i went thru on WB and a worker that i built? See the difference? One has the horse (the one i built) and one worker does NOT (the WB one).
Could you explain little more? I'm not a native english speaker so I don't get what you mean, sorry.
strategyonly Jun 10, 2010, 08:55 AM I think that way it should work.
Could you explain little more? I'm not a native english speaker so I don't get what you mean, sorry.
OK, when i first started the game i went into the WorldBuilder (WB) and had two workers that i put in my civ, to see if everything was working correctly, but i also had a worker being built in the city. (I hope this is clearer, i am NOT very good in writing either, my mind wonders to fast, and things dont come out the wat they should sometimes).
EDIT: OK i figured out a way to fix the TXT stuff:
1. Change the modules folder name to: AnimalPlacing
2. Change the Civ4GameText file to this: AnimalPlacing_CIV4GameText
It will work correctly then.
NotSoGood Jun 10, 2010, 10:09 AM You got the texts work?! Awesome!
One minor note, I don't think you should be able to place the bonus if it already exist on the plot. Something like this: plot = CyMap.plot(iX, iY)
bonusHorse = gc.getInfoTypeForString("BONUS_HORSE")
bonusCow = gc.getInfoTypeForString("BONUS_COW")
bonusDeer = gc.getInfoTypeForString("BONUS_DEER")
bonusPig = gc.getInfoTypeForString("BONUS_PIG")
bonusSheep = gc.getInfoTypeForString("BONUS_SHEEP")
bonusFur = gc.getInfoTypeForString("BONUS_FUR")
bonusIvory = gc.getInfoTypeForString("BONUS_IVORY")
if iBuild == gc.getInfoTypeForString("BUILD_BONUS_HORSE"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, bonusHorse) and plot.getBonusType() != bonusHorse:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_COW"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, bonusCow) and plot.getBonusType() != bonusCow:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_DEER"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, bonusDeer) and plot.getBonusType() != bonusDeer:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_PIG"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, bonusPig) and plot.getBonusType() != bonusPig:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_SHEEP"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, bonusSheep) and plot.getBonusType() != bonusSheep:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_FUR"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, bonusFur) and plot.getBonusType() != bonusFur:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_IVORY"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, bonusIvory) and plot.getBonusType() != bonusIvory:
return 1
else:
return 0
strategyonly Jun 10, 2010, 12:29 PM You got the texts work?! Awesome!
One minor note, I don't think you should be able to place the bonus if it already exist on the plot. Something like this: plot = CyMap.plot(iX, iY)
bonusHorse = gc.getInfoTypeForString("BONUS_HORSE")
bonusCow = gc.getInfoTypeForString("BONUS_COW")
bonusDeer = gc.getInfoTypeForString("BONUS_DEER")
bonusPig = gc.getInfoTypeForString("BONUS_PIG")
bonusSheep = gc.getInfoTypeForString("BONUS_SHEEP")
bonusFur = gc.getInfoTypeForString("BONUS_FUR")
bonusIvory = gc.getInfoTypeForString("BONUS_IVORY")
if iBuild == gc.getInfoTypeForString("BUILD_BONUS_HORSE"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, bonusHorse) and plot.getBonusType() != bonusHorse:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_COW"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, bonusCow) and plot.getBonusType() != bonusCow:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_DEER"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, bonusDeer) and plot.getBonusType() != bonusDeer:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_PIG"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, bonusPig) and plot.getBonusType() != bonusPig:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_SHEEP"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, bonusSheep) and plot.getBonusType() != bonusSheep:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_FUR"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, bonusFur) and plot.getBonusType() != bonusFur:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_IVORY"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, bonusIvory) and plot.getBonusType() != bonusIvory:
return 1
else:
return 0
Now i completely agree with that. So the code above does just that?
NotSoGood Jun 10, 2010, 01:05 PM Now i completely agree with that. So the code above does just that?
Sorry, should have been more precise. That code should replace the code in canBuild.
EDIT: Darn! I noticed it still uses isAdjacentPlotGroupConnectedBonus when it should be isPlotGroupConnectedBonus. :mad:
This code should be the correct one: plot = CyMap.plot(iX, iY)
bonusHorse = gc.getInfoTypeForString("BONUS_HORSE")
bonusCow = gc.getInfoTypeForString("BONUS_COW")
bonusDeer = gc.getInfoTypeForString("BONUS_DEER")
bonusPig = gc.getInfoTypeForString("BONUS_PIG")
bonusSheep = gc.getInfoTypeForString("BONUS_SHEEP")
bonusFur = gc.getInfoTypeForString("BONUS_FUR")
bonusIvory = gc.getInfoTypeForString("BONUS_IVORY")
if iBuild == gc.getInfoTypeForString("BUILD_BONUS_HORSE"):
if plot.isPlotGroupConnectedBonus(iPlayer, bonusHorse) and plot.getBonusType() != bonusHorse:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_COW"):
if plot.isPlotGroupConnectedBonus(iPlayer, bonusCow) and plot.getBonusType() != bonusCow:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_DEER"):
if plot.isPlotGroupConnectedBonus(iPlayer, bonusDeer) and plot.getBonusType() != bonusDeer:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_PIG"):
if plot.isPlotGroupConnectedBonus(iPlayer, bonusPig) and plot.getBonusType() != bonusPig:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_SHEEP"):
if plot.isPlotGroupConnectedBonus(iPlayer, bonusSheep) and plot.getBonusType() != bonusSheep:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_FUR"):
if plot.isPlotGroupConnectedBonus(iPlayer, bonusFur) and plot.getBonusType() != bonusFur:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_IVORY"):
if plot.isPlotGroupConnectedBonus(iPlayer, bonusIvory) and plot.getBonusType() != bonusIvory:
return 1
else:
return 0
strategyonly Jun 10, 2010, 03:36 PM Sorry, should have been more precise. That code should replace the code in canBuild.
EDIT: Darn! I noticed it still uses isAdjacentPlotGroupConnectedBonus when it should be isPlotGroupConnectedBonus. :mad:
This code should be the correct one: plot = CyMap.plot(iX, iY)
bonusHorse = gc.getInfoTypeForString("BONUS_HORSE")
bonusCow = gc.getInfoTypeForString("BONUS_COW")
bonusDeer = gc.getInfoTypeForString("BONUS_DEER")
bonusPig = gc.getInfoTypeForString("BONUS_PIG")
bonusSheep = gc.getInfoTypeForString("BONUS_SHEEP")
bonusFur = gc.getInfoTypeForString("BONUS_FUR")
bonusIvory = gc.getInfoTypeForString("BONUS_IVORY")
if iBuild == gc.getInfoTypeForString("BUILD_BONUS_HORSE"):
if plot.isPlotGroupConnectedBonus(iPlayer, bonusHorse) and plot.getBonusType() != bonusHorse:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_COW"):
if plot.isPlotGroupConnectedBonus(iPlayer, bonusCow) and plot.getBonusType() != bonusCow:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_DEER"):
if plot.isPlotGroupConnectedBonus(iPlayer, bonusDeer) and plot.getBonusType() != bonusDeer:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_PIG"):
if plot.isPlotGroupConnectedBonus(iPlayer, bonusPig) and plot.getBonusType() != bonusPig:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_SHEEP"):
if plot.isPlotGroupConnectedBonus(iPlayer, bonusSheep) and plot.getBonusType() != bonusSheep:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_FUR"):
if plot.isPlotGroupConnectedBonus(iPlayer, bonusFur) and plot.getBonusType() != bonusFur:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_IVORY"):
if plot.isPlotGroupConnectedBonus(iPlayer, bonusIvory) and plot.getBonusType() != bonusIvory:
return 1
else:
return 0
Since i used this code, ALL of my settlers no matter what civ i play freezes when trying to start the game?:(
Even on a game i had started before it freezes right away even the ingame already started.
I took out that one in your post above and replaced it with the older one and it does NOT freeze?
But i dont like where i had a resource that i have and can place these AP resources anyplace, and overrides the other resource, not good.
EDIT: Is thing line correct?
plot = CyMap.plot(iX, iY)
or should it be:
pPlot = CyMap().plot(iX, iY)
EDIT EDIT: ok I used what i have above: pPlot = CyMap().plot(iX, iY)
and at least the settler didnt freeze
but now i get this:
Traceback (most recent call last):
File "BugGameUtils", line 342, in callHandler
File "AnimalPlacing", line 67, in canBuild
NameError: global name 'plot' is not defined
Traceback (most recent call last):
File "BugGameUtils", line 342, in callHandler
File "AnimalPlacing", line 72, in canBuild
NameError: global name 'plot' is not defined
Traceback (most recent call last):
File "BugGameUtils", line 342, in callHandler
File "AnimalPlacing", line 77, in canBuild
NameError: global name 'plot' is not defined
Traceback (most recent call last):
File "BugGameUtils", line 342, in callHandler
File "AnimalPlacing", line 82, in canBuild
NameError: global name 'plot' is not defined
Traceback (most recent call last):
File "BugGameUtils", line 342, in callHandler
File "AnimalPlacing", line 87, in canBuild
NameError: global name 'plot' is not defined
Traceback (most recent call last):
File "BugGameUtils", line 342, in callHandler
File "AnimalPlacing", line 92, in canBuild
NameError: global name 'plot' is not defined
Traceback (most recent call last):
File "BugGameUtils", line 342, in callHandler
File "AnimalPlacing", line 97, in canBuild
NameError: global name 'plot' is not defined
Dancing Hoskuld Jun 10, 2010, 04:35 PM It turns out that except for the TXT and the being able to place horses on horses etc that the code I posted acutally worked! i have even replaced all isAdjacentPlotGroupConnectedBonus with isPlotGroupConnectedBonus. Also SO I had changed the name around in the slaves mod to get the game text working so don't know why I missed that here.
Edit: it should have been
and pPlot.getBonusType() != bonusHorse
in NotSoGood's code not
and plot.getBonusType() != bonusHorse
No that does not work either I get
Traceback (most recent call last):
File "BugGameUtils", line 342, in callHandler
File "AnimalPlacing", line 67, in canBuild
ArgumentError: Python argument types in
CyPlot.getBonusType(CyPlot)
did not match C++ signature:
getBonusType(class CyPlot {lvalue}, int)
Traceback (most recent call last):
Edit 2: we still need to add in these actions for the other "worker" units like clones et al.
Edit 3: yes it slows the game down - that is what PythonCallBacks do. ;)
NotSoGood Jun 11, 2010, 03:04 AM :mad: I thought that code was fixed. :mad:
Lets try again, this one should work without problems, mayby little faster but I don't know if it's possible to notice it: plot = CyMap().plot(iX, iY)
player = gc.getPlayer(iPlayer)
if iBuild == gc.getInfoTypeForString("BUILD_BONUS_HORSE"):
bonusHorse = gc.getInfoTypeForString("BONUS_HORSE")
if plot.isPlotGroupConnectedBonus(iPlayer, bonusHorse) and plot.getBonusType(player.getTeam()) != bonusHorse:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_COW"):
bonusCow = gc.getInfoTypeForString("BONUS_COW")
if plot.isPlotGroupConnectedBonus(iPlayer, bonusCow) and plot.getBonusType(player.getTeam()) != bonusCow:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_DEER"):
bonusDeer = gc.getInfoTypeForString("BONUS_DEER")
if plot.isPlotGroupConnectedBonus(iPlayer, bonusDeer) and plot.getBonusType(player.getTeam()) != bonusDeer:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_PIG"):
bonusPig = gc.getInfoTypeForString("BONUS_PIG")
if plot.isPlotGroupConnectedBonus(iPlayer, bonusPig) and plot.getBonusType(player.getTeam()) != bonusPig:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_SHEEP"):
bonusSheep = gc.getInfoTypeForString("BONUS_SHEEP")
if plot.isPlotGroupConnectedBonus(iPlayer, bonusSheep) and plot.getBonusType(player.getTeam()) != bonusSheep:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_FUR"):
bonusFur = gc.getInfoTypeForString("BONUS_FUR")
if plot.isPlotGroupConnectedBonus(iPlayer, bonusFur) and plot.getBonusType(player.getTeam()) != bonusFur:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_IVORY"):
bonusIvory = gc.getInfoTypeForString("BONUS_IVORY")
if plot.isPlotGroupConnectedBonus(iPlayer, bonusIvory) and plot.getBonusType(player.getTeam()) != bonusIvory:
return 1
else:
return 0
strategyonly Jun 11, 2010, 04:47 PM :mad: I thought that code was fixed. :mad:
Lets try again, this one should work without problems, mayby little faster but I don't know if it's possible to notice it: plot = CyMap().plot(iX, iY)
player = gc.getPlayer(iPlayer)
if iBuild == gc.getInfoTypeForString("BUILD_BONUS_HORSE"):
bonusHorse = gc.getInfoTypeForString("BONUS_HORSE")
if plot.isPlotGroupConnectedBonus(iPlayer, bonusHorse) and plot.getBonusType(player.getTeam()) != bonusHorse:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_COW"):
bonusCow = gc.getInfoTypeForString("BONUS_COW")
if plot.isPlotGroupConnectedBonus(iPlayer, bonusCow) and plot.getBonusType(player.getTeam()) != bonusCow:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_DEER"):
bonusDeer = gc.getInfoTypeForString("BONUS_DEER")
if plot.isPlotGroupConnectedBonus(iPlayer, bonusDeer) and plot.getBonusType(player.getTeam()) != bonusDeer:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_PIG"):
bonusPig = gc.getInfoTypeForString("BONUS_PIG")
if plot.isPlotGroupConnectedBonus(iPlayer, bonusPig) and plot.getBonusType(player.getTeam()) != bonusPig:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_SHEEP"):
bonusSheep = gc.getInfoTypeForString("BONUS_SHEEP")
if plot.isPlotGroupConnectedBonus(iPlayer, bonusSheep) and plot.getBonusType(player.getTeam()) != bonusSheep:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_FUR"):
bonusFur = gc.getInfoTypeForString("BONUS_FUR")
if plot.isPlotGroupConnectedBonus(iPlayer, bonusFur) and plot.getBonusType(player.getTeam()) != bonusFur:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_IVORY"):
bonusIvory = gc.getInfoTypeForString("BONUS_IVORY")
if plot.isPlotGroupConnectedBonus(iPlayer, bonusIvory) and plot.getBonusType(player.getTeam()) != bonusIvory:
return 1
else:
return 0
Nope didnt work, i can STILL build over other resources:(
NotSoGood Jun 12, 2010, 01:52 AM Nope didnt work, i can STILL build over other resources:(
Hmm, I never thought about that. I think it should prevent you from placing the bonuses over other bonuses. Currently it just prevents you to spam the same resource if it already excists on the plot.
Was that what you were thinking?
strategyonly Jun 12, 2010, 02:06 AM Hmm, I never thought about that. I think it should prevent you from placing the bonuses over other bonuses. Currently it just prevents you to spam the same resource if it already excists on the plot.
Was that what you were thinking?
Yeah both of these will work great together then, if thats ok.
NotSoGood Jun 12, 2010, 02:34 AM Okay, this code should prevent you from placing the bonuses over other bonuses: plot = CyMap().plot(iX, iY)
player = gc.getPlayer(iPlayer)
if iBuild == gc.getInfoTypeForString("BUILD_BONUS_HORSE"):
if plot.isPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString("BONUS_HORSE")) and plot.getBonusType(player.getTeam()) == -1:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_COW"):
if plot.isPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString("BONUS_COW")) and plot.getBonusType(player.getTeam()) == -1:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_DEER"):
if plot.isPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString("BONUS_DEER")) and plot.getBonusType(player.getTeam()) == -1:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_PIG"):
if plot.isPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString("BONUS_PIG")) and plot.getBonusType(player.getTeam()) == -1:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_SHEEP"):
if plot.isPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString("BONUS_SHEEP")) and plot.getBonusType(player.getTeam()) == -1:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_FUR"):
if plot.isPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString("BONUS_FUR")) and plot.getBonusType(player.getTeam()) == -1:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_IVORY"):
if plot.isPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString("BONUS_IVORY")) and plot.getBonusType(player.getTeam()) == -1:
return 1
else:
return 0
Killtech Jun 12, 2010, 08:41 AM ehmm... i think you should swap the ifs in your code... first check if there is a resource on a tile and then set the iBuild... will be more efficient and shorten up the code.
EDIT: sry, nvm. i misunderstood your code.
however you could generalize your code somewhat when you make the bonus names into a variable list. then you can reduce the redundancy in the code. but i don't know python commands for string operations so i can't give you the code.
EDIT2: with some help of the internet:
plot = CyMap().plot(iX, iY)
player = gc.getPlayer(iPlayer)
sBonusName = ["BONUS_HORSE","BONUS_COW"]
for n in range (0,1):
if iBuild == gc.getInfoTypeForString("BUILD_"+ sBonusName[n]):
if plot.isPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString(sBonusName[n])) and plot.getBonusType(player.getTeam()) == -1:
return 1
else:
return 0
just wrote it down here. so no warranty its bug free.
strategyonly Jun 12, 2010, 02:45 PM Okay, this code should prevent you from placing the bonuses over other bonuses: plot = CyMap().plot(iX, iY)
player = gc.getPlayer(iPlayer)
if iBuild == gc.getInfoTypeForString("BUILD_BONUS_HORSE"):
if plot.isPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString("BONUS_HORSE")) and plot.getBonusType(player.getTeam()) == -1:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_COW"):
if plot.isPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString("BONUS_COW")) and plot.getBonusType(player.getTeam()) == -1:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_DEER"):
if plot.isPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString("BONUS_DEER")) and plot.getBonusType(player.getTeam()) == -1:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_PIG"):
if plot.isPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString("BONUS_PIG")) and plot.getBonusType(player.getTeam()) == -1:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_SHEEP"):
if plot.isPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString("BONUS_SHEEP")) and plot.getBonusType(player.getTeam()) == -1:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_FUR"):
if plot.isPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString("BONUS_FUR")) and plot.getBonusType(player.getTeam()) == -1:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_IVORY"):
if plot.isPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString("BONUS_IVORY")) and plot.getBonusType(player.getTeam()) == -1:
return 1
else:
return 0
OK the code works, WHEN the bonus is already been acquired, but like in the pic, i have not yet founded sulphur so it does NOT show up yet, but i still can build a horse on it, thus removing the sulphur, which i will need BADLY when Gunpowder tech is founded.:(:(
Dancing Hoskuld Jun 12, 2010, 03:27 PM ehmm... i think you should swap the ifs in your code... first check if there is a resource on a tile and then set the iBuild... will be more efficient and shorten up the code.
EDIT: sry, nvm. i misunderstood your code.
however you could generalize your code somewhat when you make the bonus names into a variable list. then you can reduce the redundancy in the code. but i don't know python commands for string operations so i can't give you the code.
EDIT2: with some help of the internet:
plot = CyMap().plot(iX, iY)
player = gc.getPlayer(iPlayer)
sBonusName = ["BONUS_HORSE","BONUS_COW"]
for n in range (0,1):
if iBuild == gc.getInfoTypeForString("BUILD_"+ sBonusName[n]):
if plot.isPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString(sBonusName[n])) and plot.getBonusType(player.getTeam()) == -1:
return 1
else:
return 0
just wrote it down here. so no warranty its bug free.
You mean something like this?
## Sid Meier's Civilization 4
## Copyright Firaxis Games 2006
##
## Animal Placing - placing of an animal resource on the map.
from CvPythonExtensions import *
import CvUtil
import sys
import BugUtil
import PyHelpers
#~ import CvEventInterface
#~ import CvWorldBuilderScreen
# globals
gc = CyGlobalContext()
localText = CyTranslator()
PyPlayer = PyHelpers.PyPlayer
PyInfo = PyHelpers.PyInfo
g_aiAnimalPlacementRules = []
def onGameStart(argList);
asAnimalRules = [
['IMPROVEMENT_BONUS_HORSE', 'BONUS_HORSE', 'BUILD_BONUS_HORSE'],
['IMPROVEMENT_BONUS_COW', 'BONUS_COW', 'BUILD_BONUS_COW'],
['IMPROVEMENT_BONUS_DEER', 'BONUS_DEER', 'BUILD_BONUS_DEER'],
['IMPROVEMENT_BONUS_PIG', 'BONUS_PIG', 'BUILD_BONUS_PIG'],
['IMPROVEMENT_BONUS_SHEEP', 'BONUS_SHEEP', 'BUILD_BONUS_SHEEP'],
['IMPROVEMENT_BONUS_FUR', 'BONUS_FUR', 'BUILD_BONUS_FUR'],
['IMPROVEMENT_BONUS_IVORY', 'BONUS_IVORY', 'BUILD_BONUS_IVORY'],
]
# Convert these into integers for speed when used in game
BugUtil.debug("Animals placement definitions:-")
g_aiAnimalPlacementRules = []
for i in range(asAnimalRules.__len__()):
iImprovement = gc.getInfoTypeForString(asSubdueRules[i][0])
iBonus = gc.getInfoTypeForString(asSubdueRules[i][1])
iBUild = gc.getInfoTypeForString(asSubdueRules[i][2])
BugUtil.debug("Improvement %s (%d) bonus %s (%d) build %s (%d).", asAnimalRules[i][0], iImprovement, asAnimalRules[i][1], iBonus, asAnimalRules[i][2], iBUild)
if (iImprovement >= 0 ) and (iBonus >= 0) and (iBUild > = 0):
g_aiAnimalPlacementRules.append([iImprovement, iBonus, iBUild])
else:
BugUtil.warn("Bad Rule. Improvement %s (%d) bonus %s (%d) build %s (%d).", asAnimalRules[i][0], iImprovement, asAnimalRules[i][1], iBonus, asAnimalRules[i][2], iBUild)
################################################## #
def onImprovementBuilt(argsList):
'Improvement Built'
iImprovement, iX, iY = argsList
# NotSoGood start
pPlot = CyMap().plot(iX, iY)
for i in range(g_aiAnimalPlacementRules.__len__()):
if iImprovement == g_aiAnimalPlacementRules[i][0]:
pPlot.setImprovementType(-1)
pPlot.setBonusType(g_aiAnimalPlacementRules[i][1])
return
# NotSoGood end
def canBuild(argsList):
iX, iY, iBuild, iPlayer = argsList
# NotSoGood start
plot = CyMap().plot(iX, iY)
player = gc.getPlayer(iPlayer)
if plot.getBonusType(player.getTeam()) == -1:
return 1
for i in range(g_aiAnimalPlacementRules.__len__()):
if iBuild == g_aiAnimalPlacementRules[i][2]:
if plot.isPlotGroupConnectedBonus(iPlayer, g_aiAnimalPlacementRules[i][1]) and :
return 1
else:
return 0
# NotSoGood end
return -1 # Returning -1 means ignore; 0 means Build cannot be performed; 1 or greater means it can
I also only just wrote it down so there is no reason to expect it is bug free. Note I test for something on the plot and exit before I test for these improvements, giving a slight speed improvement. As is the bit that converts the strings to integers first. I also have the XML done for clones etc. so as soon as I test this I will post the code.
StrategyOnly has a point in that this overwrites unknown resources. If we stop it doing that people will complain of a bug because they will not be able to place animals where they like :crazyeye:
Killtech Jun 12, 2010, 04:07 PM You mean something like this?
## Sid Meier's Civilization 4
## Copyright Firaxis Games 2006
##
## Animal Placing - placing of an animal resource on the map.
from CvPythonExtensions import *
import CvUtil
import sys
import BugUtil
import PyHelpers
#~ import CvEventInterface
#~ import CvWorldBuilderScreen
# globals
gc = CyGlobalContext()
localText = CyTranslator()
PyPlayer = PyHelpers.PyPlayer
PyInfo = PyHelpers.PyInfo
g_aiAnimalPlacementRules = []
def onGameStart(argList);
asAnimalRules = [
['IMPROVEMENT_BONUS_HORSE', 'BONUS_HORSE', 'BUILD_BONUS_HORSE'],
['IMPROVEMENT_BONUS_COW', 'BONUS_COW', 'BUILD_BONUS_COW'],
['IMPROVEMENT_BONUS_DEER', 'BONUS_DEER', 'BUILD_BONUS_DEER'],
['IMPROVEMENT_BONUS_PIG', 'BONUS_PIG', 'BUILD_BONUS_PIG'],
['IMPROVEMENT_BONUS_SHEEP', 'BONUS_SHEEP', 'BUILD_BONUS_SHEEP'],
['IMPROVEMENT_BONUS_FUR', 'BONUS_FUR', 'BUILD_BONUS_FUR'],
['IMPROVEMENT_BONUS_IVORY', 'BONUS_IVORY', 'BUILD_BONUS_IVORY'],
]
# Convert these into integers for speed when used in game
BugUtil.debug("Animals placement definitions:-")
g_aiAnimalPlacementRules = []
for i in range(asAnimalRules.__len__()):
iImprovement = gc.getInfoTypeForString(asSubdueRules[i][0])
iBonus = gc.getInfoTypeForString(asSubdueRules[i][1])
iBUild = gc.getInfoTypeForString(asSubdueRules[i][2])
BugUtil.debug("Improvement %s (%d) bonus %s (%d) build %s (%d).", asAnimalRules[i][0], iImprovement, asAnimalRules[i][1], iBonus, asAnimalRules[i][2], iBUild)
if (iImprovement >= 0 ) and (iBonus >= 0) and (iBUild > = 0):
g_aiAnimalPlacementRules.append([iImprovement, iBonus, iBUild])
else:
BugUtil.warn("Bad Rule. Improvement %s (%d) bonus %s (%d) build %s (%d).", asAnimalRules[i][0], iImprovement, asAnimalRules[i][1], iBonus, asAnimalRules[i][2], iBUild)
################################################## #
def onImprovementBuilt(argsList):
'Improvement Built'
iImprovement, iX, iY = argsList
# NotSoGood start
pPlot = CyMap().plot(iX, iY)
for i in range(g_aiAnimalPlacementRules.__len__()):
if iImprovement == g_aiAnimalPlacementRules[i][0]:
pPlot.setImprovementType(-1)
pPlot.setBonusType(g_aiAnimalPlacementRules[i][1])
return
# NotSoGood end
def canBuild(argsList):
iX, iY, iBuild, iPlayer = argsList
# NotSoGood start
plot = CyMap().plot(iX, iY)
player = gc.getPlayer(iPlayer)
if plot.getBonusType(player.getTeam()) == -1:
return 1
for i in range(g_aiAnimalPlacementRules.__len__()):
if iBuild == g_aiAnimalPlacementRules[i][2]:
if plot.isPlotGroupConnectedBonus(iPlayer, g_aiAnimalPlacementRules[i][1]) and :
return 1
else:
return 0
# NotSoGood end
return -1 # Returning -1 means ignore; 0 means Build cannot be performed; 1 or greater means it can
I also only just wrote it down so there is no reason to expect it is bug free. Note I test for something on the plot and exit before I test for these improvements, giving a slight speed improvement. As is the bit that converts the strings to integers first. I also have the XML done for clones etc. so as soon as I test this I will post the code.
yeah, that looks good. if you use the + operator for strings you can shorten it up a bit so you don't need the three of these 'IMPROVEMENT_BONUS_HORSE', 'BONUS_HORSE', 'BUILD_BONUS_HORSE' for one resource. (so you can write "BUILD_" + asSubdueRules[i])
it's no big deal to write code in a well structured way; the code is easier readable and reusable for other modders. it's just that when i look at some functions in the dll source code... they all look like everyone added his part to it and no one ever cleaned it up. (e.g. city AI has a something about 2000 lines of code to decide what it builds next in a city and no one fully understands what this code does. making any improvements to such functions now cost a lot of time.)
StrategyOnly has a point in that this overwrites unknown resources. If we stop it doing that people will complain of a bug because they will not be able to place animals where they like :crazyeye:
true.
fast solution:
display the 'build horses' button for invisible resources tiles but if someone attempts it display a message that this terrain is not habitable for horses.
good/complicated solution:
allow to replace the iron with horses. but when you when you can see iron, the iron will replace the horses back. (requires to store additional data in a tile)
Dancing Hoskuld Jun 12, 2010, 04:10 PM yeah, that looks good. if you use the + operator for strings you can shorten it up a bit so you don't need the three of these 'IMPROVEMENT_BONUS_HORSE', 'BONUS_HORSE', 'BUILD_BONUS_HORSE' for one resource. (so you can write "BUILD_" + asSubdueRules[i])
Except I am only using them for this function (onGameStart) then converting them to integers so that I only use the getInfoTypeForString function at game start not multiple times every turn and player. So readability is better this way. And it should have been asAnimalRules not asSubdueRules - see I said it probably was bad code:p.
good/complicated solution:
allow to replace the iron with horses. but when you when you can see iron, the iron will replace the horses back. (requires to store additional data in a tile)
Needs to keep the information in the saves also, which I now know how to do. which means a load function as well.
strategyonly Jun 13, 2010, 03:45 PM OK which is which here guys, i need to test as much as i can with the best one out there right now, thx.
On the above by Dancing H,(http://forums.civfanatics.com/showpost.php?p=9278015&postcount=71) i got these errors:
Traceback (most recent call last):
File "BugConfig", line 110, in unknown_endtag
File "BugConfig", line 334, in endChild
File "BugConfig", line 337, in end
File "BugConfig", line 318, in process
File "BugConfig", line 565, in handle
File "BugUtil", line 642, in getFunction
File "BugUtil", line 629, in lookupFunction
File "BugUtil", line 621, in lookupModule
File "<string>", line 35, in load_module
File "<string>", line 13, in _get_code
File "AnimalPlacing", line 23
def onGameStart(argList);
^
SyntaxError: invalid syntax
Dancing Hoskuld Jun 13, 2010, 04:21 PM It is not ready at all yet. Currently it is letting me scrub fallout from day one.
NotSoGood Jun 14, 2010, 04:00 AM It is not ready at all yet. Currently it is letting me scrub fallout from day one.
That's because you have the check in canBuild if the plot has no bonuses you can build what ever you want.def canBuild(argsList):
iX, iY, iBuild, iPlayer = argsList
# NotSoGood start
plot = CyMap().plot(iX, iY)
player = gc.getPlayer(iPlayer)
if plot.getBonusType(player.getTeam()) == -1:
return 1
for i in range(g_aiAnimalPlacementRules.__len__()):
if iBuild == g_aiAnimalPlacementRules[i][2]:
if plot.isPlotGroupConnectedBonus(iPlayer, g_aiAnimalPlacementRules[i][1]) and :
return 1
else:
return 0
# NotSoGood end
I fixed some syntax errors in your code but when testing it doesn't have any effects. No errors, no bonus placing.This is the code I edited a little, it's possible and very likely that I have done something wrong:## Sid Meier's Civilization 4
## Copyright Firaxis Games 2006
##
## Animal Placing - placing of an animal resource on the map.
from CvPythonExtensions import *
import CvUtil
import sys
import BugUtil
import PyHelpers
#~ import CvEventInterface
#~ import CvWorldBuilderScreen
gc = CyGlobalContext()
localText = CyTranslator()
#~ PyPlayer = PyHelpers.PyPlayer
PyInfo = PyHelpers.PyInfo
g_aiAnimalPlacementRules = []
# globals
def onGameStart(argList):
asAnimalRules = [
['IMPROVEMENT_BONUS_HORSE', 'BONUS_HORSE', 'BUILD_BONUS_HORSE'],
['IMPROVEMENT_BONUS_COW', 'BONUS_COW', 'BUILD_BONUS_COW'],
['IMPROVEMENT_BONUS_DEER', 'BONUS_DEER', 'BUILD_BONUS_DEER'],
['IMPROVEMENT_BONUS_PIG', 'BONUS_PIG', 'BUILD_BONUS_PIG'],
['IMPROVEMENT_BONUS_SHEEP', 'BONUS_SHEEP', 'BUILD_BONUS_SHEEP'],
['IMPROVEMENT_BONUS_FUR', 'BONUS_FUR', 'BUILD_BONUS_FUR'],
['IMPROVEMENT_BONUS_IVORY', 'BONUS_IVORY', 'BUILD_BONUS_IVORY'],
]
# Convert these into integers for speed when used in game
BugUtil.debug("Animals placement definitions:-")
g_aiAnimalPlacementRules = []
for i in range(asAnimalRules.__len__()):
iImprovement = gc.getInfoTypeForString(asAnimalRules[i][0])
iBonus = gc.getInfoTypeForString(asAnimalRules[i][1])
iBuild = gc.getInfoTypeForString(asAnimalRules[i][2])
BugUtil.debug("Improvement %s (%d) bonus %s (%d) build %s (%d).", asAnimalRules[i][0], iImprovement, asAnimalRules[i][1], iBonus, asAnimalRules[i][2], iBuild)
if (iImprovement >= 0 ) and (iBonus >= 0) and (iBuild >= 0):
g_aiAnimalPlacementRules.append([iImprovement, iBonus, iBuild])
else:
BugUtil.warn("Bad Rule. Improvement %s (%d) bonus %s (%d) build %s (%d).", asAnimalRules[i][0], iImprovement, asAnimalRules[i][1], iBonus, asAnimalRules[i][2], iBuild)
################################################## #
def onImprovementBuilt(argsList):
'Improvement Built'
iImprovement, iX, iY = argsList
# NotSoGood start
pPlot = CyMap().plot(iX, iY)
for i in range(g_aiAnimalPlacementRules.__len__()):
if iImprovement == g_aiAnimalPlacementRules[i][0]:
pPlot.setImprovementType(-1)
pPlot.setBonusType(g_aiAnimalPlacementRules[i][1])
return
# NotSoGood end
def canBuild(argsList):
iX, iY, iBuild, iPlayer = argsList
# NotSoGood start
plot = CyMap().plot(iX, iY)
player = gc.getPlayer(iPlayer)
for i in range(g_aiAnimalPlacementRules.__len__()):
if iBuild == g_aiAnimalPlacementRules[i][2]:
if plot.isPlotGroupConnectedBonus(iPlayer, g_aiAnimalPlacementRules[i][1]) and plot.getBonusType(player.getTeam()) == -1:
return 1
else:
return 0
# NotSoGood end
return -1 # Returning -1 means ignore; 0 means Build cannot be performed; 1 or greater means it can
Dancing Hoskuld Jun 14, 2010, 05:22 AM Yes I fixed it in mine also but the onGameStart debug messages are not being displayed/printed which means that there is nothing in the arrays. But It seems to mean that everything is failing instead of just the.....
strategyonly Jun 14, 2010, 05:47 AM Any one have the one that works semi-ok, for some odd reason, mine has stopped altogether.
Dancing Hoskuld Jun 14, 2010, 03:49 PM Real life is getting in the way atm. Attached is the XML file for clones etc.
strategyonly Jul 05, 2010, 10:11 AM I still cant get a good copy of it working anymore, any ideas?
Dancing Hoskuld Jul 06, 2010, 04:39 PM I am back and as soon as I get AAranda's, Tsentom1's and Orion Veteran's wonders balanced and into a pack I will have a look at this. Testing OK but balance still a bit off.
strategyonly Jul 15, 2010, 02:00 PM OK i finally got a good (old) copy working again, i found out its that DARN MLF stuff again, i had to move my name down to or really near the very very bottom of the list.
Killtech Jul 15, 2010, 08:21 PM that's cool. is this the version available for download in your OP?
strategyonly Jul 15, 2010, 10:24 PM that's cool. is this the version available for download in your OP?
I dont think so, but here is the current python i am using, it is going to change, because Dancing H is trying to make it faster and better so that you cant place a bonus over another bonus and other things also. But at least it something to work with for now, plus it comes in very handy when needed resources become more available.
Plus look at the thread above, i changed it to read (OLD)-er file.
Name of file: AnimalPlacing, but you will need the other Config and art files if you followed along with the and getting longer thread, sorry.
## Sid Meier's Civilization 4
## Copyright Firaxis Games 2006
##
## Animal Placing - placing of an animal resource on the map.
from CvPythonExtensions import *
import CvUtil
import sys
import BugUtil
import PyHelpers
#~ import CvEventInterface
#~ import CvWorldBuilderScreen
# globals
gc = CyGlobalContext()
localText = CyTranslator()
PyPlayer = PyHelpers.PyPlayer
PyInfo = PyHelpers.PyInfo
################################################## #
def onImprovementBuilt(argsList):
'Improvement Built'
iImprovement, iX, iY = argsList
# NotSoGood start
pPlot = CyMap().plot(iX, iY)
if iImprovement == gc.getInfoTypeForString("IMPROVEMENT_BONUS_HORSE"):
pPlot.setImprovementType(-1)
pPlot.setBonusType(gc.getInfoTypeForString("BONUS_HORSE"))
elif iImprovement == gc.getInfoTypeForString("IMPROVEMENT_BONUS_COW"):
pPlot.setImprovementType(-1)
pPlot.setBonusType(gc.getInfoTypeForString("BONUS_COW"))
elif iImprovement == gc.getInfoTypeForString("IMPROVEMENT_BONUS_DEER"):
pPlot.setImprovementType(-1)
pPlot.setBonusType(gc.getInfoTypeForString("BONUS_DEER"))
elif iImprovement == gc.getInfoTypeForString("IMPROVEMENT_BONUS_PIG"):
pPlot.setImprovementType(-1)
pPlot.setBonusType(gc.getInfoTypeForString("BONUS_PIG"))
elif iImprovement == gc.getInfoTypeForString("IMPROVEMENT_BONUS_SHEEP"):
pPlot.setImprovementType(-1)
pPlot.setBonusType(gc.getInfoTypeForString("BONUS_SHEEP"))
elif iImprovement == gc.getInfoTypeForString("IMPROVEMENT_BONUS_FUR"):
pPlot.setImprovementType(-1)
pPlot.setBonusType(gc.getInfoTypeForString("BONUS_FUR"))
elif iImprovement == gc.getInfoTypeForString("IMPROVEMENT_BONUS_IVORY"):
pPlot.setImprovementType(-1)
pPlot.setBonusType(gc.getInfoTypeForString("BONUS_IVORY"))
# NotSoGood end
CvUtil.pyPrint('Improvement %s was built at %d, %d'
%(PyInfo.ImprovementInfo(iImprovement).getDescript ion(), iX, iY))
def canBuild(argsList):
iX, iY, iBuild, iPlayer = argsList
# NotSoGood start
plot = CyMap().plot(iX, iY)
player = gc.getPlayer(iPlayer)
if iBuild == gc.getInfoTypeForString("BUILD_BONUS_HORSE"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString("BONUS_HORSE")) and plot.getBonusType(player.getTeam()) == -1:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_COW"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString("BONUS_COW")) and plot.getBonusType(player.getTeam()) == -1:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_DEER"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString("BONUS_DEER")) and plot.getBonusType(player.getTeam()) == -1:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_PIG"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString("BONUS_PIG")) and plot.getBonusType(player.getTeam()) == -1:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_SHEEP"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString("BONUS_SHEEP")) and plot.getBonusType(player.getTeam()) == -1:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_FUR"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString("BONUS_FUR")) and plot.getBonusType(player.getTeam()) == -1:
return 1
else:
return 0
elif iBuild == gc.getInfoTypeForString("BUILD_BONUS_IVORY"):
if plot.isAdjacentPlotGroupConnectedBonus(iPlayer, gc.getInfoTypeForString("BONUS_IVORY")) and plot.getBonusType(player.getTeam()) == -1:
return 1
else:
return 0
# NotSoGood end
return -1 # Returning -1 means ignore; 0 means Build cannot be performed; 1 or greater means it can
Killtech Jul 19, 2010, 06:34 PM i did. i think i can merge it together.
strategyonly Jul 19, 2010, 09:24 PM i did. i think i can merge it together.
If you cant, just let me know and i will put it in a ZIP:p
strategyonly Jul 28, 2010, 08:17 AM Dancing Hoskuld, NotSoGood @ any headway on making this work the correct way yet?
NotSoGood Jul 28, 2010, 09:36 AM Dancing Hoskuld, NotSoGood @ any headway on making this work the correct way yet?
Well, I think Dancing Hoskuld has the best and most uptodate version of it.
Dancing Hoskuld Jul 28, 2010, 03:14 PM I am not getting the time I need to work on any of this at the moment. I am about to package up all my stuff and post it. I will have another look after that, if I remember rightly one of the events was not firing or maybe I had not declared the global/object variable properly.
strategyonly Aug 15, 2010, 04:13 AM I am not getting the time I need to work on any of this at the moment. I am about to package up all my stuff and post it. I will have another look after that, if I remember rightly one of the events was not firing or maybe I had not declared the global/object variable properly.
How is this going now, one thing, i don't like about it is that you have to ALREADY have the resource to make it work, it would (in my opinion) be better even if you DIDN'T have the resource as alot of maps have waaaay less of these resources available, your thoughts or anyone else:confused:
Killtech Aug 15, 2010, 01:25 PM since the player is the only one who will place new resources you can't expect to get any advantage by this. only way to benefit from this mechanic is to somehow trade such a resource. however if AI also would use this feature it'd have much more to trade with and rare animal resources spread quite fast over the globe becoming very frequent.
NotSoGood Aug 22, 2010, 05:47 AM I am not getting the time I need to work on any of this at the moment. I am about to package up all my stuff and post it. I will have another look after that, if I remember rightly one of the events was not firing or maybe I had not declared the global/object variable properly.
Can you post the current code? I have played with BUG in my mod and I could try to make it work.
Dancing Hoskuld Aug 22, 2010, 04:38 PM Can you post the current code? I have played with BUG in my mod and I could try to make it work.
I will see what I can do. I have had a version control problem, but I make far too many backups anyway.
Edit: see attached - just the python and config xml files.
NotSoGood Aug 23, 2010, 11:26 AM Strategyonly, do you still have the BuildInfos and ImprovementInfos?
strategyonly Aug 23, 2010, 11:59 AM Strategyonly, do you still have the BuildInfos and ImprovementInfos?
Try this:
http://www.filefront.com/17228537/AnimalPlacing.rar/
NotSoGood Aug 24, 2010, 01:27 PM Okay, I think I got it to work. Use the build info, improvement info and the unit info you already have. Add this line to Assets/Config init.xml: <load mod="AnimalPlacing"/>Then add the AnimalPlacing.xml (attached) file to the same folder. And the AnimalPlacing.py (also attached) to the python folder. You can add it any where you want to, I guess. I think that was all.
Also do you want to change anything in it?
Currently, IIRC the requirements were:
You need to have atleast one of the bonus before you can build it
The plot must have access to this previous bonus
You cannot ever build bonuses over existing bonuses, you know it or not
|
|