Advertisement
Civilization Fanatics' Center  

Welcome to Civilization Fanatics' Center.

You are currently viewing our site as a guest which gives you limited access to our site features. By joining our free community, you will be able to participate in the discussions, search the forum, send private messages, vote in polls, upload your own screenshots to the gallery, and access many other special features. Registration is fast, simple and absolutely free, so sign up today! If you have any problems with the registration process or your account login, please contact support.

Go Back   Civilization Fanatics' Forums > CIVILIZATION IV > Civ4 - Creation & Customization

Notices

Reply
 
Thread Tools
Old Feb 11, 2011, 06:41 AM   #1
NuckyPalpatine
Chieftain
 
NuckyPalpatine's Avatar
 
Join Date: Feb 2011
Posts: 4
Preventing Cities from Being Founded on Certain Types of Terrain

Does anyone know how you can keep cities from being settled on forests until the civ discovers Bronze Working? Likewise with jungles until Iron Working is discovered?

I know you could just edit CIV4FeatureInfos.xml and prevent cities from being founded on forests and jungles altogether until a worker clears the tile. But I'd like to preserve the ability of settlers to clear the tile when they found cities. Plus I'm not sure the AI would know how to use workers that way.

Are there any mods out there that do something similar?

Thanks for all your help.
NuckyPalpatine is offline   Reply With Quote
Old Feb 11, 2011, 01:41 PM   #2
The_J
Say No 2 Net Validations

 
The_J's Avatar
 
Join Date: Oct 2008
Location: Germany / Netherlands
Posts: 24,851
Images: 51
mmhh...i can't see a real good solution for this, unless you want to program it into the SDK.

One option would be to make forests/jungles impassable for settlers, unless you have the needed technology (the options are in the XML, like e.g. for the galley), but that would probably slow down the expansion.

...er....wait ...i know, there's a python callback for that.
Because i'm to lazy to explain it, i've just hacked it together right now (only a few lines are really needed).
See the attachement.

But attention: That small mod will
- slow down the game
- will probably screw the AI on the city founding part, especially on maps with many forst/jungle tiles



And welcome to CFC .
Attached Files
File Type: zip testfound.zip (3.8 KB, 9 views)
__________________
Civ4-BtS-Mod "Mars, Now!"


Steam eats the souls of little gamers!!!
The_J is offline   Reply With Quote
Old Feb 11, 2011, 04:25 PM   #3
Voyhkah
Political Activist
 
Voyhkah's Avatar
 
Join Date: Apr 2009
Location: Earth
Posts: 1,444
Images: 17
I'm pretty sure it would be real easy in SDK, if you learned.

Oh, and welcome to CivFanatics!

I always enjoy new people to annoy about my mod!
__________________
Think things that I say are funny? That's okay, I didn't think so. But check out my Fake News Blog anyway!
"I do not feel obliged to believe that the same god who has endowed us with sense, reason, and intellect, has intended us to forgo their use." -Galileo
Every gun that is made, every warship launched, every rocket fired, signifies in the final sense a theft from those who hunger and are not fed, those who are cold and are not clothed. -Eisenhower
Civilization IV:is Now Obscenely Complecated! Featuring Resource Stockpiling, Stratigems, Culture Families, Heroes, and more!
I have Asperger's Syndrome. If you do too and you're willing to come out, copy and paste this into your sig.
Voyhkah is offline   Reply With Quote
Old Feb 11, 2011, 04:44 PM   #4
NuckyPalpatine
Chieftain
 
NuckyPalpatine's Avatar
 
Join Date: Feb 2011
Posts: 4
Quote:
Originally Posted by The_J View Post
But attention: That small mod will
- slow down the game
- will probably screw the AI on the city founding part, especially on maps with many forst/jungle tiles
Thanks, The_J.

However, I don't want to do anything that would cripple the AI. Maybe something like this could apply only to the human player (and then not slow the game down as much). Is that possible to implement?
NuckyPalpatine is offline   Reply With Quote
Old Feb 12, 2011, 01:28 AM   #5
Baldyr
"Hit It"
 
Baldyr's Avatar
 
Join Date: Dec 2009
Location: Sweden
Posts: 5,530
This is what The_J did:
Spoiler:
Code:
	def cannotFoundCity(self,argsList):
		iPlayer, iPlotX, iPlotY = argsList
		###can't found city on forest unless bronze tech
		pPlot = CyMap().plot(iPlotX,iPlotY)
		if pPlot.getFeatureType ()== gc.getInfoTypeForString("FEATURE_FOREST"):
                        pPlayer = gc.getPlayer(iPlayer)
                        pTeam = gc.getTeam(pPlayer.getTeam())
                        if pTeam.isHasTech(gc.getInfoTypeForString("TECH_BRONZE_WORKING")):
                                return False
                        else:
                                return True
                ###can't found city on jungle unless iron tech
		if pPlot.getFeatureType ()==gc.getInfoTypeForString("FEATURE_JUNGLE"):
                        pPlayer = gc.getPlayer(iPlayer)
                        pTeam = gc.getTeam(pPlayer.getTeam())
                        if pTeam.isHasTech(gc.getInfoTypeForString("TECH_IRON_WORKING")):
                                return False
                        else:
                                return True
                ###modification end
		return False

I'd suggest this, then:
Spoiler:
Code:
	def cannotFoundCity(self,argsList):
		iPlayer, iPlotX, iPlotY = argsList
		pPlot = CyMap().plot(iPlotX,iPlotY)
		if iPlayer != gc.getGame().getActivePlayer():
			return False
		###can't found city on forest unless bronze tech
		if pPlot.getFeatureType () == gc.getInfoTypeForString("FEATURE_FOREST"):
			return not gc.getTeam(gc.getPlayer(iPlayer).getTeam()).isHasTech(gc.getInfoTypeForString("TECH_BRONZE_WORKING")):
                ###can't found city on jungle unless iron tech
		elif pPlot.getFeatureType () == gc.getInfoTypeForString("FEATURE_JUNGLE"):
                        return not gc.getTeam(gc.getPlayer(iPlayer).getTeam()).isHasTech(gc.getInfoTypeForString("TECH_IRON_WORKING")):
                ###modification end
		return False
The addition is highlighted. The other changes is basically reformatting and doesn't affect functionality.

With all due respect to what The_J did, of course.
__________________
How to Make a Python Mod - Python modding tutorial
CivIV Python Class Reference - modding Python API
How to Think Like a Computer Scientist - online Python textbook
CivPlayer - Python scripting tool
Spoiler:
Q: Who is the woman in the avatar image?
A: Miss Li.
Q: Why does she have a brass-eye?
A: It's a conceptual thing. More of the same on the profile page.

Q: What does you title mean?
A: That is the title of Miss Li's latest single.

Last edited by Baldyr; Feb 12, 2011 at 01:31 AM.
Baldyr is offline   Reply With Quote
Old Feb 12, 2011, 05:34 AM   #6
NuckyPalpatine
Chieftain
 
NuckyPalpatine's Avatar
 
Join Date: Feb 2011
Posts: 4
Uh, oh...

I probably should've mentioned I'm using Farsight's Totally Replaced Leaders Redux mod, which incorporates Better BTS AI v1.01.

This is what happens when I start a game using The_J and Baldyr's modifications. No mini-map, no advisor buttons, no research bar, nothing.

UPDATE: Same thing seems to happen when I do this to unmodded BTS as well.
Spoiler:


Attached Thumbnails
Click image for larger version

Name:	Iroquois_start.JPG
Views:	50
Size:	64.2 KB
ID:	282504  

Last edited by NuckyPalpatine; Feb 12, 2011 at 05:53 AM.
NuckyPalpatine is offline   Reply With Quote
Old Feb 12, 2011, 05:56 AM   #7
Baldyr
"Hit It"
 
Baldyr's Avatar
 
Join Date: Dec 2009
Location: Sweden
Posts: 5,530
Ok, this on its own first, then. Because if it works then its merely a matter of merging these two mods.
__________________
How to Make a Python Mod - Python modding tutorial
CivIV Python Class Reference - modding Python API
How to Think Like a Computer Scientist - online Python textbook
CivPlayer - Python scripting tool
Spoiler:
Q: Who is the woman in the avatar image?
A: Miss Li.
Q: Why does she have a brass-eye?
A: It's a conceptual thing. More of the same on the profile page.

Q: What does you title mean?
A: That is the title of Miss Li's latest single.
Baldyr is offline   Reply With Quote
Old Feb 12, 2011, 06:23 AM   #8
The_J
Say No 2 Net Validations

 
The_J's Avatar
 
Join Date: Oct 2008
Location: Germany / Netherlands
Posts: 24,851
Images: 51
Quote:
Originally Posted by NuckyPalpatine View Post
UPDATE: Same thing seems to happen when I do this to unmodded BTS as well.
Unmodded? I bet you're using BUG as default, right?
__________________
Civ4-BtS-Mod "Mars, Now!"


Steam eats the souls of little gamers!!!
The_J is offline   Reply With Quote
Old Feb 12, 2011, 06:24 AM   #9
NuckyPalpatine
Chieftain
 
NuckyPalpatine's Avatar
 
Join Date: Feb 2011
Posts: 4
Nevermind. I fixed it. There were colons incorrectly placed at the end of the lines immediately following the "if" statements (in Baldyr's code).

Works great now.
NuckyPalpatine is offline   Reply With Quote
Old Feb 12, 2011, 06:24 AM   #10
Baldyr
"Hit It"
 
Baldyr's Avatar
 
Join Date: Dec 2009
Location: Sweden
Posts: 5,530
Aha, there is a Python exception happening at startup. Probably a syntax error when CvGameUtils is being loaded, or something. Enable exceptions and logging in the CivilizationIV.ini file and look in the PythonErr.log file for errors.
__________________
How to Make a Python Mod - Python modding tutorial
CivIV Python Class Reference - modding Python API
How to Think Like a Computer Scientist - online Python textbook
CivPlayer - Python scripting tool
Spoiler:
Q: Who is the woman in the avatar image?
A: Miss Li.
Q: Why does she have a brass-eye?
A: It's a conceptual thing. More of the same on the profile page.

Q: What does you title mean?
A: That is the title of Miss Li's latest single.
Baldyr is offline   Reply With Quote
Old Feb 12, 2011, 06:26 AM   #11
Baldyr
"Hit It"
 
Baldyr's Avatar
 
Join Date: Dec 2009
Location: Sweden
Posts: 5,530
Yeah, I should have spotted that when I edited the code.
__________________
How to Make a Python Mod - Python modding tutorial
CivIV Python Class Reference - modding Python API
How to Think Like a Computer Scientist - online Python textbook
CivPlayer - Python scripting tool
Spoiler:
Q: Who is the woman in the avatar image?
A: Miss Li.
Q: Why does she have a brass-eye?
A: It's a conceptual thing. More of the same on the profile page.

Q: What does you title mean?
A: That is the title of Miss Li's latest single.
Baldyr is offline   Reply With Quote
Reply

Bookmarks

Go Back Civilization Fanatics' Forums > CIVILIZATION IV > Civ4 - Creation & Customization > [BTS] Preventing Cities from Being Founded on Certain Types of Terrain

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Advertisement

All times are GMT -6. The time now is 01:47 AM.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
This site is copyright © Civilization Fanatics' Center.
Support CFC: Amazon.com | Amazon UK | Amazon DE | Amazon CA | Amazon FR