View Full Version : Need help and advice on a few things...


LoneTraveller
Sep 27, 2009, 09:50 PM
Hello modding community,

I have problems with the following and would like some help with it :

- How do modders take a map from mod and transfert it to another without having the initial mod's sdk/python attached to it ? Everything I tried ended up with errors stating that the program can't find the files relating to the initial mod. I just want to rip the map and plug it in another mod.

- I have a concept I would like to see realized. I know it requires SDK but haven't found where to look to accomplish it. Here is the general situation : Let's suppose that a civ has multiple cities on it's mainland and a city on another island which are not included in the same territory area. Suppose also that "the other island" contains a key resource (oil, iron, etc).

How would I make it so that only a certain resource of the "other island" is not shared with the "home island" ?

The second part of this concept is to create a cargo ship (ex: oil tanker) that would sail from "other island" to a "home island" port and then unload it's cargo. Unloading would have the effect to give all the cities on "home island" access to the resource for a couple of turns. When those turns are done then "home island" production requiring the resource would freeze until another cargo ship unloads again.

I guess I would define an integer named "iNumTurnsLeftOil" in the object relating to the territory (but I'm uncertain if this is in the CvArea.cpp file). A ship unit would be created with an action attached that when activated would increase the integer by the number of turns defined. An icon somewhere on the GUI would indicate the number of turns left.

Any ideas or advice would be appreciated

Thank you for your time

EDIT: I forgot another problem.

I have added custom great generals to a mod but now the colors of the models change each time I load the mod itself. One time it uses an .dds from the same folder and then some other times it uses a different one (though always the same ones). I has happened to me before but I don't remember how to fix it.

primordial stew
Sep 27, 2009, 11:46 PM
> How do modders take a map from mod and transfert it to another without having the initial mod's sdk/python attached to it

I don't know of any direct relation between the SDK/dll and the wbs other than the number of civs. Everything else is in XML. If you don't have the XML, then you'll just have to rip everything out of the wbs for objects you don't have in your XML.


> How would I make it so that only a certain resource of the "other island" is not shared with the "home island" ?

Make sure the island is surrounded by ocean tiles and don't allow oversea trade.

LoneTraveller
Sep 28, 2009, 09:44 PM
Make sure the island is surrounded by ocean tiles and don't allow oversea trade.

How would I do such a thing ?

The_J
Sep 29, 2009, 07:26 AM
The first or the second part?
Ocean trade is allowed in the TechInfos.xml, look at astronomy.

LoneTraveller
Oct 01, 2009, 09:42 PM
The first or the second part?
Ocean trade is allowed in the TechInfos.xml, look at astronomy.

Beautiful answer the_J.

You are really starting to be my hero around here :)

But after looking in a mod that adds an action to a unit...I question myself on adding actions to units. (I checked the Inquisition mod)

I don't understand what in the method called "updateSelectionButtons" (in the python file named "CvMainInterface.py") pops up the icon of "Inquisition" in the mod's unit (the mod's unit name is "inquisitor" in the CIV4UnitInfos.xml file).

I admit...sounds vague. Sorry I can't put it in other words.

I really wish I had your experience in Python and SDK knowledge.

The_J
Oct 02, 2009, 07:30 PM
Beautiful answer the_J.

You are really starting to be my hero around here :)


:lol: thanks.


But after looking in a mod that adds an action to a unit...I question myself on adding actions to units. (I checked the Inquisition mod)


There are two ways of doing this:
First, you could mod the SDK and add a new mission to Civ4MissionInfos.xml.
Or you could create a python action button (tutorial (http://forums.civfanatics.com/showthread.php?t=331001)), but this could only be used by the human.

LoneTraveller
Oct 10, 2009, 08:23 PM
where are the access to resources managed for each city in the SDK?

The_J
Oct 11, 2009, 07:27 PM
You should ask this in the SDK/python subforum. The real cracks will probably not look in here.

LoneTraveller
Oct 15, 2009, 01:40 PM
I finished my SDK part of the mod now I'm having problems with the button creation. Specifically when I start the mod up I always get this error message and I don't understand what the python is reading. I lookied in the python API and in theory it should work.

Here is the error log :

Traceback (most recent call last):

File "CvScreensInterface", line 705, in forceScreenRedraw

File "CvMainInterface", line 727, in redraw

File "CvMainInterface", line 1541, in updateSelectionButtons

ArgumentError: Python argument types in
CyGInterfaceScreen.appendMultiListButton(CyGInterf aceScreen, str, str, int, CvPythonExtensions.WidgetTypes, CyPlayer, int, bool)
did not match C++ signature:
appendMultiListButton(class CyGInterfaceScreen {lvalue}, char const *, char const *, int, enum WidgetTypes, int, int, bool)
ERR: Python function forceScreenRedraw failed, module CvScreensInterface

Here is the code relating to the error message :

# Lone's Tanker Addon Start

# Section for the unloading of Oil to cities

pUnit = g_pSelectedUnit
iUnitType = pUnit.getUnitType()
pPlot = CyInterface().getSelectionPlot()
pUnitOwner = gc.getPlayer( pUnit.getOwner( ))
if pUnitOwner.isTurnActive( ):
if iUnitType == gc.getInfoTypeForString('UNIT_TANKER') and pPlot.isCity() and pUnit.isTankerFull():
screen.appendMultiListButton( "BottomButtonContainer", ArtFileMgr.getInterfaceArtInfo("INTERFACE_BUTTON_OIL").getPath(), 0, WidgetTypes.WIDGET_TANKER_UNLOAD_OIL, pUnitOwner, pUnit.getID(), False )
pPlot.addOilToPlotGroup(NB_TURNS_OIL, pUnitOwner)
screen.show( "BottomButtonContainer" )
iCount = iCount + 1

# Section for the loading of oil from oil producing cities
pUnit = g_pSelectedUnit
if pUnitOwner.isTurnActive( ):
if iUnitType == gc.getInfoTypeForString('UNIT_TANKER') and (pPlot.getPlotCity()).hasBonus(gc.getInfoTypeForSt ring('BONUS_OIL')) and (pUnit.isTankerFull()!= 1):
screen.appendMultiListButton( "BottomButtonContainer", ArtFileMgr.getInterfaceArtInfo("INTERFACE_BUTTON_OIL").getPath(), 0, WidgetTypes.WIDGET_TANKER_LOAD_OIL, pUnitOwner, pUnit.getID(), False )
screen.show( "BottomButtonContainer" )
iCount = iCount + 1

# Lone's Tanker Addon End

It seems to think that the 1st parameter for the widget is a CyPlayer although when I searched this API (http://civ4bug.sourceforge.net/PythonAPI/index.html) it leads to an integer.

Please help

PS : the error is for the second "appendMultiListButton" the first one seems to pass.

The_J
Oct 16, 2009, 04:56 PM
I can't see, where the problem could be :dunno:, so:

You should ask this in the SDK/python subforum. The real cracks will probably not look in here.

God-Emperor
Oct 16, 2009, 07:00 PM
It appears to be saying that youa re passing a CyPlayer where it wants an int.

In both of the calls have you tried passing pUnit.getOwner() instead of pUnitOwner?
That would make each an int instead of a CyPlayer.

LoneTraveller
Oct 21, 2009, 09:10 AM
Hi again,

I got the above problem fixed. Now I have another.

I have a related problem with limiting trade. It seems that trade itself can pass through friendly (open) borders whether or not there are sea tiles all around some islands. Only if the open borders diplo. thing is disactivated does it effectively stop.

Is there a way to leave the coming and going of ships and units of open borders but stop the pooling of resources ?