Animal Placement

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.
 
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.

Spoiler :
Code:
## 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).getDescription(), 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
 
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.
 
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:
 
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.
 
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.
 
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.
 
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:
Code:
	<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
 

Attachments

  • AnimalPlacing.7z
    1.3 KB · Views: 209
Top Bottom