Quick Modding Questions Thread

You can ignore that.
As background: It seems that NONE is not really a valid value at several instances (correct would be a closed XML tag), but this is nothing which causes the game to break. The devs still decided to log it, and we have totally no idea why. Yes, it clutters the logs, would have been better if they had not decided that.
 
I´m not sure if this is a modding question...

In SinglePlayer it´s possible for me to use the SmartMap Mapscript. But when I try to use it in MultiPlayer games the following error shows up:

Code:
Traceback (most recent call last):

  File "<string>", line 1, in ?

ImportError: No module named SmartMap
Failed to load python module SmartMap.
ERR: Call function getNumCustomMapOptions failed. Can't find module SmartMap

I have the same script on both computers and copied the script in all public maps and private maps folders I´ve found (Civ4, BtS, Mod) and it still doesn´t work.

Any idea what´s the problem?

EDIT: Problem solved. At one point was an older version spelled a little bit different!:wallbash:
 
In BuildingInfos: The building provides this type of resource, like .e.g Hollywood.

I disagree. That would be the FreeBonus that selects the free bonus to provide, with the iNumFreeBonuses to specify how many of that bonus (I think a value of -1 has it scale with map size).

No building in regular BtS uses the plain old Bonus tag (it is set to NONE for every building). It should be a bonus that is required to build the building - the city must have access to this resource as shown in the list in the city screen. The tag right after it, PrereqBonuses, takes sub-tags to specify a list of bonuses, any one of which is required (it is an "or" type list).

So, for example, a building that requires stone and either copper or iron (or both) should probably have tags that look like this:
Code:
			<Bonus>BONUS_STONE</Bonus>
			<PrereqBonuses>
				<Bonus>BONUS_COPPER</Bonus>
				<Bonus>BONUS_IRON</Bonus>    
			</PrereqBonuses>

Note: the Modki claim the Bonus tag is "Bonus type that speeds production." This is not correct. The tag for the list of bonuses that speed production (and by how much) is BonusProductionModifiers. Ultimately in there the BonusType tag is used to specify the bonus, not the Bonus tag. You can see several examples of this in regular BtS.

As long as the topic is "bonus" in building specifications, I may as well add that the NoBonus tag specifies a bonus which the city will lose access to if the building is built. The is only used in BtS for the National Parks wonder, which removes access to coal for that city.
 
I disagree. That would be the FreeBonus that selects the free bonus to provide, with the iNumFreeBonuses to specify how many of that bonus (I think a value of -1 has it scale with map size).

:blush: oops, you're right.
 
How can I cancel a peace treaty between two civs with Python?
 
Do you mean the 10 rounds of forced peace after any negotiations, or do you mean actively declaring war?
Don't think the former can be done (at least I don't see any commands), the latter would be the function declareWar(TeamID,bNewDiplo) in the CyTeam class.
 
Yeah, I meant the ten turns of forced peace. It seems that I have a problem with the declareWar() method if there is a peace treaty, which causes a crash.

To elaborate, my mod is scripted to spawn troops and declare war once a certain tech (Economics) is acquired. Apparently, trading Economics causes a trash because the forced peace from the deal and the triggered war collide. At least that is my assumption, which I wanted to put to the test my invalidating the peace treaty first.
 
I tried using declareWar before with Advanced Start.
Works fine even during the first 10 turns where peace is forced.
 
I tried using declareWar before with Advanced Start.
Works fine even during the first 10 turns where peace is forced.
Okay, thanks. I guess then the problem is somewhere else.
 
Other things which could cause crashes in Python (which are relatively rare):
- Destruction of an element which is later used in the dll (sometimes)
- Recursions
- Sometimes changes in variables of a loop

Does anything of that apply?
 
How do you add in another civilization to a premade scenario? Does the nation have to be coded in somehow, or is there a way to make you able to adjust which nations are in the scenario?

It's a Europe scenario that has France, England, Germany, Spain, Rome, Russia, Greece and Egypt in it, and I want to add in the Vikings.

Thanks for your time and help,

Vince
 
No, they don't have cities, just a warrior and settler each. It is an Ancient-era scenario start.
 
Then you should take a look at this tutorial.
I didn't cover adding civs to a scenario, but if you understand the tutorial, you should be able to add a new civ too.
If you have problems, then just ask.
(Answers from me will take til tomorrow, it's bed time here...)
 
Other things which could cause crashes in Python (which are relatively rare):
- Destruction of an element which is later used in the dll (sometimes)
- Recursions
- Sometimes changes in variables of a loop

Does anything of that apply?
I don't think so, it seems to crash right when war is declared.
 
So if you take just the war declaration out, then it works? (without a crash, I mean)
At least in the situation where the crash occurs. The situation is hard to reproduce.
 
Top Bottom