View Full Version : Python Modding


TC01
Jul 15, 2009, 10:07 AM
Last Updated: 9/24/09

So I've been charged with writing the python code that is needed to make this mod work. So this thread is mainly so I don't clutter up the other one.

As I add to the code, I'm going to do it in the original Civ 4 python files (copied over, of course), rather than in the Final Frontier ones. This is mainly so I don't have to mess with the solar system code.

Currently, I've done/am working on:

-Make mapscript use planets instead of solar systems [Complete]
-Adding python action buttons for "force powers" [Complete]
-Limit building of specific units to specific planets [Complete]
-Add an Ion Pulse python action button to certain fighter craft [Complete]
-Add Superweapons, created by projects, with unique nuke abilities. [Complete]
-Add Starbases from Final Frontier [Complete]
-Make the Star Forge improvement provide units every turn randomly if you control it [In progress]
-Fix any reported bugs


If someone has a request for what should go into the Star Wars mod python code, post here. I'll tell you if I can do it, if I need to post in the main C&C forum to get other opinions, on how to it, or if you need an SDK/DLL/C++ modder to get done what you want to do. And, if you have a bug in what I have written, post it here.

Below, in spoilers for size, is a list of everything that is referenced in Python that is coded in the XML. Mapscript stuff not included. If you have a question on what something there should do, please ask here.

Units:

This is a nuke that has a special nuke ability.
UNIT_DEATH_STAR

Terrains:

This is space terrain.
TERRAIN_TUNDRA

Features:

Forest is asteroids (see Final Frontier), while Planet Core has no graphics but is important to the mapscript and random planets.
FEATURE_FOREST
FEATURE_PLANET_CORE

Promotions:

Force Ability Prereqs: These promotions form two chains, Light Side and Dark Side. Each should individually be available to a Unit Combat Jedi and Unit Combat Sith. Each ability is a requirement for a certain force ability- but this is handled in python. They should also decrease combat strength of their owners to balance force abilities.
PROMOTION_LIGHT_SIDE_1
PROMOTION_LIGHT_SIDE_2
PROMOTION_LIGHT_SIDE_3
PROMOTION_LIGHT_SIDE_4

PROMOTION_DARK_SIDE_1
PROMOTION_DARK_SIDE_2
PROMOTION_DARK_SIDE_3
PROMOTION_DARK_SIDE_4

PROMOTION_ION_BLAST

Force-Awarded Promotions: All of these promotions should not be awardable to any specific unit. They are all attached via force action abilities and removed on the next turn.

PROMOTION_BATTLE_MEDITATION
PROMOTION_ION_BLASTED
PROMOTION_MIND_TRICKED
PROMOTION_FORCE_CONCEALED

Buildings:

Planetary Buildings: Each is built via python and thus should be unbuildable, but should have a 100% chance to survive invasion. Specific units can be made the prereqs for individual worlds.
BUILDING_BALMORRA
BUILDING_FOEROST
BUILDING_FONDOR
BUILDING_MECHIS_III
BUILDING_MUSTAFAR
BUILDING_NELVAAN
BUILDING_ORD_CESTUS
BUILDING_QUEYTA
BUILDING_SALUECAMI
BUILDING_SKAKO
BUILDING_TAR_MORDEN
BUILDING_TELTI
BUILDING_VULPTER
BUILDING_XAGOBAH

Credits:
-TC01
-civ_editor11
-Jawa's Revenge
-God-Emperor
-The_J

Latest Version:

TC01
Jul 16, 2009, 09:13 AM
So I've completed a basic version of the mapscript. It should NOT be used with Final Frontier python code. It should be used in default civ.

Features like black holes, supernovas, radiation clouds, asteroids are all in here.

I've renamed TERRAIN_TUNDRA, space terrain, to TERRAIN_SPACE. Further, all terrain used for the planets has been given the original name. So Grass, Plains, Burning Sands, Tundra, Snow, and Desert (four planet types for now) are in here.

There's currently a 1 in 10 chance of finding a habitable (Grass + Plains) planet. There's a 3 in 10 chance of finding either a volcanic, desert, or arctic planet. Or at least, theoretically it would work that way.

I have yet to do bug-testing. If you find any, please let me know and I'll fix them. It's attached below.

(Attachment removed, new files attached directly to first post)

civ editor11
Jul 16, 2009, 07:02 PM
Could you post the Death Star Python So that I can add it
The one on the other was planet core/edge

TC01
Jul 16, 2009, 07:34 PM
Could you post the Death Star Python So that I can add it

I said this in the other thread, but I'd prefer to add the python code to the files myself, and then attach them here for you to add into the mod.

So attached is a Python folder containing CvEventManager.py for the Star Wars mod. It's the original Event Manager file from normal Civ 4, with one change: the Death Star code has been added to onNukeExplosion(). Because that's the only python we have needed so far.

The Python folder should be copied into the Star Wars/Assets folder.

(Attachment removed, new files attached directly to first post)

civ editor11
Jul 16, 2009, 08:15 PM
This one is planet core/edge still

TC01
Jul 16, 2009, 09:18 PM
Ah. My mistake. I'll fix the error and reupload it when I have time. Sorry.

civ editor11
Jul 16, 2009, 09:25 PM
Thanks
and after that could you see if you could add force powers to the game as promotions

TC01
Jul 18, 2009, 07:48 PM
Updated version with the planetary stuff for Death Star straightened out.

Thanks
and after that could you see if you could add force powers to the game as promotions

Force powers?

Do you mean, that, if a unit had the promotion PROMOTION_FORCE_LIGHTNING, it would be able to, say, use force lightning on an opponent? I'm thinking the FFH spell system would be very useful for this. Unfortunately, that's custom DLL work.

I know you're away, but I'll start investigating what would be necessary to do this. Custom DLL work is tricky, and I'd rather get started now. I'd rather not use the entire FFH DLL, just what's necessary for the spell system to work.

TC01
Jul 19, 2009, 09:17 PM
Okay, so I think I can do the force powers by using python action buttons. The advantage of this is that a custom DLL is not necessary and it's slightly easier to code.

I think I can make this work instead of needing to use a custom DLL.

What kind of force powers do you want? Thus far I've added Force Lightning, Force Choke, and Force Push- all of which need promotions and promotion button graphics to work.

civ editor11
Jul 29, 2009, 08:53 AM
When I used your map script it takes a long time to load and then its just plains and rivers do you Know how to fix this
And the Death Star code doesn't work it just adds Fallout

TC01
Jul 29, 2009, 01:18 PM
When I used your map script it takes a long time to load and then its just plains and rivers do you Know how to fix this
And the Death Star code doesn't work it just adds Fallout

What are you calling the asteroid feature? You see, in Final Frontier it's "Forest", so that's what (out of habit) I used in the death star code. if you're calling it FEATURE_ASTEROIDS, then it won't find a FEATURE_FOREST and not set the plot to anything (so fallout will appear as by default). I'll fix this in the new version that I upload.

In fact, that may be the problem with the mapscript. In FF, features are called by their "original" Civ names (FEATURE_OASIS is the black hole, for instance). That's what the mapscript is supposed to deal with- and it's not finding those features so giving errors.

Just to check, are these terrains and features in your terrain and feature infos (for features, tell me which one it's called).

TERRAIN_GRASS
TERRAIN_PLAINS
TERRAIN_SNOW
TERRAIN_TUNDRA
TERRAIN_BURNING_SANDS
TERRAIN_DESERT
TERRAIN_SPACE

FEATURE_ASTEROIDS (or FEATURE_FOREST)
FEATURE_NEBULA (or FEATURE_ICE)
FEATURE_BLACK_HOLE (or FEATURE_OASIS)
FEATURE_SUPERNOVA (or FEATURE_JUNGLE)
FEATURE_GRAV_FIELD
FEATURE_DAMAGE_ZONE
FEATURE_FALLOUT (radiation cloud)
FEATURE_FLOOD_PLAINS

If you don't, copy the Grav Field, Damage Zone, and Flood Plains feature infos from the Final Frontier CIV4FeatureInfos.xml, as well as their art defines from CIV4ArtDefines_Feature.xml in that same folder. These are "fake features"- they are used to prevent other features from being placed too close, or to damage units when they get near features (supernova), or to pull them in closer (black hole).

civ editor11
Jul 29, 2009, 03:40 PM
What would space be I have Tundra set as space but called tundra
I don't have grav-field
Damage Zone
I used bts feature and terrain infos
Basically I've been building it off of bts and adding in final frontier where I need it

TC01
Jul 29, 2009, 04:45 PM
Please copy over the Final Frontier feature info file, but delete Solar System from the top of it since we're not using those. This has all of the feature infos for a space terrain map. With the same names that are used in the mapscript.


Other than that, you should be good with features and terrains, but there are some bugs I've found and will solve before reuploading.

Sorry about this, but as I have no real way to test, there will probably be plenty of bugs...

TC01
Jul 29, 2009, 06:44 PM
One of the main problems in my code was that I was using the "set plot feature" command for terrains... I've fixed this.

I've attached a revised mapscript to the first post. Please test it without waiting for the other stuff- but make sure you did the copying of the Final Frontier FeatureInfos and ArtDefines_Features over first.

civ editor11
Jul 29, 2009, 08:18 PM
Where's the Event Manager code for the death star

TC01
Jul 29, 2009, 08:51 PM
Where's the Event Manager code for the death star

It's zipped in, along with an XML file containing the Force Power button descriptions (drop it in Star Wars\Assets\XML\Text), and the Force Powers code, in the first post. However, if you don't have the 8 force promotions and the 12 buttons that I said were needed in the Graphics thread, you can not test that stuff yet.

civ editor11
Jul 29, 2009, 09:00 PM
Thanks this is great I'll check it soon my bts isn't currently workig so I have to try and fix that

civ editor11
Jul 30, 2009, 10:13 AM
I've fixed my bts but neither one is working do you know what is wrong
Do I need to rename TERRAIN_TUNDRA as TERRAIN_SPACE?
Am i doing something wrong or is it the programming I'm looking at it don't completely understand it but it looks like it should be working

TC01
Jul 30, 2009, 10:59 AM
I've fixed my bts but neither one is working do you know what is wrong
Do I need to rename TERRAIN_TUNDRA as TERRAIN_SPACE?
Am i doing something wrong or is it the programming I'm looking at it don't completely understand it but it looks like it should be working

What are your errors? The same as before? Or does the mapscript simply not load?

Did you copy Final Frontier's CIV4FeatureInfos.xml into the Star Wars\Assets\XML\Terrain folder?

You shouldn't have to rename TERRAIN_TUNDRA. Do you have the other terrains?

civ editor11
Jul 30, 2009, 11:47 AM
Yes to everything

The mapscript adds plains and rivers and it also has the ice polar caps

The Death Star Code makes it fallout exactly like a regular ICBM

TC01
Jul 30, 2009, 12:30 PM
Yes to everything

The mapscript adds plains and rivers and it also has the ice polar caps

The Death Star Code makes it fallout exactly like a regular ICBM

In the mapscript, does it have three game options called "Solar System Density", "Feature Density", and "Hostile Feature Density" when starting a custom game?

Then, in the .ini file, there should be something like this:

; Allow public maps to be used with this mod
AllowPublicMaps = 0

Make sure that value is set to 0, then test it again.

Then, what did you name the Death Star unit? I mean exactly, in the XML. The python defines it as UNIT_DEATH_STAR... is this what you have?

civ editor11
Jul 30, 2009, 12:48 PM
It's defined just like that in the XML

TC01
Jul 30, 2009, 12:58 PM
Please turn on python exceptions in your _CivilizationIV/Civilization.ini file (in the BTS folder and the vanilla Civ folder, just in case). Change the value of "set to 1 to hide python exception popups" to a 0. I forgot to mention this, but it would have saved me a few hours of wondering about the problem- which was that I missed a parenthesis. The python exception would have reported this. It will also help in diagnosing the mapscript error.

For a quick fix, in this post I've uploaded a new event manager to this post. Please drop it into the Python folder and overwrite the old one. I'll reupload a python folder to the first post when I have time.


What about the other stuff for the mapscript?

civ editor11
Jul 30, 2009, 01:25 PM
I don't have that option in the ini file would I just drop it in there if so where

TC01
Jul 30, 2009, 01:31 PM
I don't have that option in the ini file would I just drop it in there if so where

For what? Python exceptions or the mod ini?

For the mod ini, copy over something like the Gods of Old ini file- if you're using the ini file originally from the old Star Wars mod, there have been new additions to the file since BTS was released. Your ini should look something like this:


[CONFIG]

; Modular XML Loading
ModularLoading = 0

; Read Game options from XML, not .ini
ForceGameOptions = 0

; Custom Art from user folder is not loaded
NoCustomArt = 1

; Custom XML and Python from user folder are not loaded
NoCustomAssets = 1

; No Custom Scenario option in main menu
NoCustomScenario = 0

; Scenario file (Single player)
ForceScenario = 0

; No team play allowed
NoTeams = 0

; Always start in the standard era
ForceStandardEra = 0

; Skip the Main menu
SkipMainMenu = 0

; This mod is only for single player games
SinglePlayerOnly = 0

; Allow public maps to be used with this mod
AllowPublicMaps = 0

; Mod Image file
ImageFile = 0

; Name of Mod
Name = Star Wars

; Description of Mod
Description = Star Wars Mod


For python exceptions, I messed up- it's called the "_Civ4Config" file, but is really CivilizationIV.ini. It should be there:

; Set to 1 for no python exception popups
HidePythonExceptions = 0

civ editor11
Jul 30, 2009, 03:32 PM
Wheres the civ4config file
Its not in the ini

TC01
Jul 30, 2009, 05:10 PM
Wheres the civ4config file
Its not in the ini

Civilization IV\Beyond the Sword directory (no mods).

For python exceptions, I'm not talking about specific mod ini files, but python exception popups are enabled in the CivilizationIV.ini file, labeled for some reason as the _Civ4Config file. Can you find it? It should be in your BTS main directory.

civ editor11
Jul 30, 2009, 07:22 PM
Currrently there are no errors until you get into loading the actual map
Then this comes up
File "StarWars", line 585, in findStartingPlot
IndexError: list index out of range
Then another one comes up
File "StarWars", line 514, in addFeatures
File "StarWars", line 350, in addFeatures
ArgumentError Python argument types in
Cyplot.setTerrainType CyPlot, int
didn't match C++ signature:
setTerrainType(classCyPlot{lvalue}, int, bool, bool)

TC01
Jul 30, 2009, 07:33 PM
Tis is what the error message in the game says
Traceback (most recent call last):
File "string", line 1, in ?
File "string", line 35, in load_module
File "string", line 13, in _get_code
File "StarWars", line 352
if iRnd = 1:


^


SyntaxError invalid syntax

shouldn't you change this:
if iRnd = 1:
to:
if iRnd == 1:

I'm guessing i don't know much about python but i think i know that

Aha! Almost as bad as missing a parenthesis! It's the old "compare versus define" (== is a comparison, = is defining a variable) error.

I'd reupload a file, but since you found the error, you can fix it (Yes, it should be "iRnd == 1") in your version. I've fixed it in mine.

civ editor11
Jul 30, 2009, 07:43 PM
None here now just ones when you try loading a game

TC01
Jul 30, 2009, 07:46 PM
Yes, those one-line box popups are annoying...

Anyway, here's the correct code, from line 370 to line 381 in CvEventManager.py (I was missing parenthesis). You should be able to insert it there. It should overwrite the function def onBeginPlayerTurn.

def onBeginPlayerTurn(self, argsList):
'Called at the beginning of a players turn'
iGameTurn, iPlayer = argsList
pPlayer = gc.getPlayer(iPlayer)
for i in range(pPlayer.getNumUnits()):
pUnit = pPlayer.getUnit(i)
if pUnit.isHasPromotion(gc.getInfoTypeForString('PROM OTION_MIND_TRICKED')):
pUnit.setHasPromotion(gc.getInfoTypeForString('PRO MOTION_MIND_TRICKED'), false)
if pUnit.isHasPromotion(gc.getInfoTypeForString('PROM OTION_FORCE_CONCEALED')):
pUnit.setHasPromotion(gc.getInfoTypeForString('PRO MOTION_FORCE_CONCEALED'), false)
if pUnit.isHasPromotion(gc.getInfoTypeForString('PROM OTION_BATTLE_MEDITATION')):
pUnit.setHasPromotion(gc.getInfoTypeForString('PRO MOTION_BATTLE_MEDITATION'), false)

After we get all of these bugs fixed, I'll reupload a new python folder and mapscript to the first post.

civ editor11
Jul 30, 2009, 07:55 PM
I updated the errors to what I got after your fixes

TC01
Jul 30, 2009, 08:00 PM
Another one... (= versus ==) or rather, 7.

Drop the code below between lines 498 and lines 556 (the def onPlotPicked function), overwrite it:

def onPlotPicked(self, argsList):
'Plot Picked'
pPlot = argsList[0]
CvUtil.pyPrint('Plot was picked at %d, %d'
%(pPlot.getX(), pPlot.getY()))
pCaster = StarWars.iPushedButtonUnit
pCaster.changeMoves(60)
pPlayer = pCaster.getOwner()
iUnitX = pCaster.plot().getX()
iUnitY = pCaster.plot().getY()
iX = pPlot.getX()
iY = pPlot.getY()
pUnit = pPlot.getUnit(0)
iDmgRnd += 25 + CyGame().getSorenRandNum(25, "Force Power")
if plotDistance(iUnitX,iUnitY, iX, iY) == 1:
if StarWars.iPushButton == 1:
pUnit.setDamage(pUnit.getDamage()+iDmgRnd, False)
if pCaster.getDamage() > 0:
pCaster.setDamage(0, PlayerTypes.NO_PLAYER)
if StarWars.iPushButton == 2:
pUnit.setDamage(pUnit.getDamage()+iDmgRnd, False)
if StarWars.iPushButton == 3:
if (iX = iUnitX + 1 and iY = iUnitY + 1):
pPushPlot = CyMap().plot(iX+1, iY+1)
if not pPushPlot.isNone():
if pUnit.canMoveInto(pPushPlot,False,False,False):
pUnit.setXY(iX+1, iY+1)
if (iX = iUnitX + 1 and iY = iUnitY - 1):
pPushPlot = CyMap().plot(iX+1, iY-1)
if not pPushPlot.isNone():
if pUnit.canMoveInto(pPushPlot,False,False,False):
pUnit.setXY(iX+1, iY-1)
if (iX = iUnitX - 1 and iY = iUnitY + 1):
pPushPlot = CyMap().plot(iX-1, iY+1)
if not pPushPlot.isNone():
if pUnit.canMoveInto(pPushPlot,False,False,False):
pUnit.setXY(iX-1, iY+1)
if (iX = iUnitX - 1 and iY = iUnitY - 1):
pPushPlot = CyMap().plot(iX-1, iY-1)
if not pPushPlot.isNone():
if pUnit.canMoveInto(pPushPlot,False,False,False):
pUnit.setXY(iX-1, iY-1)
if StarWars.iPushButton == 4:
pUnit.setHasPromotion(gc.getInfoTypeForString('PRO MOTION_MIND_TRICKED'), True)
if StarWars.iPushButton == 5:
pUnit.setDamage(0, PlayerTypes.NO_PLAYER)
if StarWars.iPushButton == 6:
pUnit.setHasPromotion(gc.getInfoTypeForString('PRO MOTION_LIGHT_SIDE_1'), False)
pUnit.setHasPromotion(gc.getInfoTypeForString('PRO MOTION_LIGHT_SIDE_2'), False)
pUnit.setHasPromotion(gc.getInfoTypeForString('PRO MOTION_LIGHT_SIDE_3'), False)
pUnit.setHasPromotion(gc.getInfoTypeForString('PRO MOTION_LIGHT_SIDE_4'), False)
pUnit.setHasPromotion(gc.getInfoTypeForString('PRO MOTION_DARK_SIDE_1'), False)
pUnit.setHasPromotion(gc.getInfoTypeForString('PRO MOTION_DARK_SIDE_2'), False)
pUnit.setHasPromotion(gc.getInfoTypeForString('PRO MOTION_DARK_SIDE_3'), False)
pUnit.setHasPromotion(gc.getInfoTypeForString('PRO MOTION_DARK_SIDE_4'), False)
if StarWars.iPushButton == 7:
newUnit = pPlayer.initUnit(pUnit.getUnitType(), iX, iY, UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
newUnit.convert(pUnit)
pCaster.setScriptData("Has cast Mind Control")

civ editor11
Jul 30, 2009, 08:08 PM
I updated it again

TC01
Jul 30, 2009, 08:12 PM
Again, the same bug!

This should overwrite the code from lines 520 to 529:

if (iX == iUnitX + 1 and iY == iUnitY + 1):
pPushPlot = CyMap().plot(iX+1, iY+1)
if not pPushPlot.isNone():
if pUnit.canMoveInto(pPushPlot,False,False,False):
pUnit.setXY(iX+1, iY+1)
if (iX == iUnitX + 1 and iY == iUnitY - 1):
pPushPlot = CyMap().plot(iX+1, iY-1)
if not pPushPlot.isNone():
if pUnit.canMoveInto(pPushPlot,False,False,False):
pUnit.setXY(iX+1, iY-1)
if (iX == iUnitX - 1 and iY == iUnitY + 1):
pPushPlot = CyMap().plot(iX-1, iY+1)
if not pPushPlot.isNone():
if pUnit.canMoveInto(pPushPlot,False,False,False):
pUnit.setXY(iX-1, iY+1)
if (iX == iUnitX - 1 and iY == iUnitY - 1):
pPushPlot = CyMap().plot(iX-1, iY-1)
if not pPushPlot.isNone():
if pUnit.canMoveInto(pPushPlot,False,False,False):
pUnit.setXY(iX-1, iY-1)

civ editor11
Jul 30, 2009, 08:25 PM
I've updated it yet again

TC01
Jul 30, 2009, 08:29 PM
I've updated it yet again

Are you sure that's what it says? Because in my code I have this:

if pNukeUnit.getUnitType() == gc.getInfoTypeForString('UNIT_DEATH_STAR'):

Go into your file and check, and if you don't have what's above, copy and paste it in. In yours, there's two errors at least ("pNukeeUnit", and no colon at the end of the line).

civ editor11
Jul 30, 2009, 08:44 PM
What i have now is what it says

TC01
Jul 30, 2009, 08:49 PM
Thanks.

I think the error's indentation problem. But I'm not sure. Try copying this code over lines 558 to 577:

def onNukeExplosion(self, argsList):
'Nuke Explosion'
pPlot, pNukeUnit = argsList
CvUtil.pyPrint('Nuke detonated at %d, %d'
%(pPlot.getX(), pPlot.getY()))
if pNukeUnit.getUnitType() == gc.getInfoTypeForString('UNIT_DEATH_STAR'):
iX = pPlot.getX()
iY = pPlot.getY()
for iiX in range(iX - 2, iX + 3, 1):
for iiY in range(iY - 2, iY + 3, 1):
pTarget = CyMap().plot(iiX, iiY)
if not pTarget.getTerrainType() == gc.getInfoTypeForString('TERRAIN_TUNDRA'):
pTarget.setTerrainType(gc.getInfoTypeForString('TE RRAIN_TUNDRA'))
pTarget.setFeatureType(gc.getInfoTypeForString('FE ATURE_FOREST'),0)
for i in range(pTarget.getNumUnits()):
pUnit = pTarget.getUnit(i)
pUnit.kill(false, -1)
if pTarget.isCity()
pCity = pPlot.getPlotCity()
pCity.kill()

civ editor11
Jul 30, 2009, 08:52 PM
Updated again

TC01
Jul 30, 2009, 08:58 PM
I was missing a colon at the end of the line. Here is what it should be:

if pTarget.isCity():

civ editor11
Jul 30, 2009, 09:24 PM
updated with a little extra time taken sorry

TC01
Jul 31, 2009, 08:16 AM
In my file, I have:

pPlot = argsList[0]

If you don't copy this over line 500. If you do, I'm not sure of the error.

civ editor11
Jul 31, 2009, 08:17 AM
I've updated the ingame errors

civ editor11
Jul 31, 2009, 08:20 AM
Same error when loading when I put your code in

TC01
Jul 31, 2009, 08:32 AM
For the main interface file (CvMainInterface), overwrite lines 1516 to 1568:

###### Unit Buttons ######
pUnit = g_pSelectedUnit
iUnitType = pUnit.getUnitType()
pUnitOwner = gc.getPlayer( pUnit.getOwner( ))
if pUnitOwner.isTurnActive( ):
if pUnit.isHasPromotion(gc.getInfoTypeForString('PROM OTION_DARK_SIDE_2')):
screen.appendMultiListButton( "BottomButtonContainer", gc.getPromotionInfo(gc.getInfoTypeForString('PROMO TION_DARK_SIDE_2')).getButton(), 0, WidgetTypes.WIDGET_GENERAL, 660, 660, False )
screen.show( "BottomButtonContainer" )
iCount = iCount + 1
if pUnit.isHasPromotion(gc.getInfoTypeForString('PROM OTION_DARK_SIDE_1')):
screen.appendMultiListButton( "BottomButtonContainer", gc.getPromotionInfo(gc.getInfoTypeForString('PROMO TION_DARK_SIDE_1')).getButton(), 0, WidgetTypes.WIDGET_GENERAL, 661, 661, False )
screen.show( "BottomButtonContainer" )
iCount = iCount + 1
if (pUnit.isHasPromotion(gc.getInfoTypeForString('PRO MOTION_DARK_SIDE_1')) or pUnit.isHasPromotion(gc.getInfoTypeForString('PROM OTION_LIGHT_SIDE_1'))):
screen.appendMultiListButton( "BottomButtonContainer",ArtFileMgr.getInterfaceArtInfo("INTERFACE_FORCE_1").getPath(), 0, WidgetTypes.WIDGET_GENERAL, 662, 662, False )
screen.show( "BottomButtonContainer" )
iCount = iCount + 1
if pUnit.isHasPromotion(gc.getInfoTypeForString('PROM OTION_LIGHT_SIDE_3')):
screen.appendMultiListButton( "BottomButtonContainer", gc.getPromotionInfo(gc.getInfoTypeForString('PROMO TION_MIND_TRICK')).getButton(), 0, WidgetTypes.WIDGET_GENERAL, 663, 663, False )
screen.show( "BottomButtonContainer" )
iCount = iCount + 1
if (pUnit.isHasPromotion(gc.getInfoTypeForString('PRO MOTION_DARK_SIDE_4')) or pUnit.isHasPromotion(gc.getInfoTypeForString('PROM OTION_LIGHT_SIDE_4'))):
screen.appendMultiListButton( "BottomButtonContainer", ArtFileMgr.getInterfaceArtInfo("INTERFACE_FORCE_4").getPath(), 0, WidgetTypes.WIDGET_GENERAL, 664, 664, False )
screen.show( "BottomButtonContainer" )
iCount = iCount + 1
if (pUnit.isHasPromotion(gc.getInfoTypeForString('PRO MOTION_DARK_SIDE_2')) or pUnit.isHasPromotion(gc.getInfoTypeForString('PROM OTION_LIGHT_SIDE_2'))):
screen.appendMultiListButton( "BottomButtonContainer", ArtFileMgr.getInterfaceArtInfo("INTERFACE_FORCE_2").getPath(), 0, WidgetTypes.WIDGET_GENERAL, 665, 665, False )
screen.show( "BottomButtonContainer" )
iCount = iCount + 1
if pUnit.isHasPromotion(gc.getInfoTypeForString('PROM OTION_DARK_SIDE_4')):
screen.appendMultiListButton( "BottomButtonContainer", gc.getPromotionInfo(gc.getInfoTypeForString('PROMO TION_DARK_SIDE_4')).getButton(), 0, WidgetTypes.WIDGET_GENERAL, 666, 666, False )
screen.show( "BottomButtonContainer" )
iCount = iCount + 1
if pUnit.isHasPromotion(gc.getInfoTypeForString('PROM OTION_LIGHT_SIDE_1')):
screen.appendMultiListButton( "BottomButtonContainer", gc.getPromotionInfo(gc.getInfoTypeForString('PROMO TION_LIGHT_SIDE_1')).getButton(), 0, WidgetTypes.WIDGET_GENERAL, 667, 667, False )
screen.show( "BottomButtonContainer" )
iCount = iCount + 1
if pUnit.isHasPromotion(gc.getInfoTypeForString('PROM OTION_LIGHT_SIDE_4')):
screen.appendMultiListButton( "BottomButtonContainer", gc.getPromotionInfo(gc.getInfoTypeForString('PROMO TION_LIGHT_SIDE_4')).getButton(), 0, WidgetTypes.WIDGET_GENERAL, 668, 668, False )
screen.show( "BottomButtonContainer" )
iCount = iCount + 1
if (pUnit.isHasPromotion(gc.getInfoTypeForString('PRO MOTION_DARK_SIDE_3')) or pUnit.isHasPromotion(gc.getInfoTypeForString('PROM OTION_LIGHT_SIDE_3'))):
screen.appendMultiListButton( "BottomButtonContainer", ArtFileMgr.getInterfaceArtInfo("INTERFACE_FORCE_3").getPath(), 0, WidgetTypes.WIDGET_GENERAL, 669, 669, False )
screen.show( "BottomButtonContainer" )
iCount = iCount + 1
if (pUnit.isHasPromotion(gc.getInfoTypeForString('PRO MOTION_DARK_SIDE_3')) and not pUnit.getScriptData() == "Has cast Mind Control"):
screen.appendMultiListButton( "BottomButtonContainer", gc.getPromotionInfo(gc.getInfoTypeForString('PROMO TION_DARK_SIDE_3')).getButton(), 0, WidgetTypes.WIDGET_GENERAL, 670, 670, False )
screen.show( "BottomButtonContainer" )
iCount = iCount + 1
if pUnit.isHasPromotion(gc.getInfoTypeForString('PROM OTION_LIGHT_SIDE_2')):
screen.appendMultiListButton( "BottomButtonContainer", gc.getPromotionInfo(gc.getInfoTypeForString('PROMO TION_LGIHT_SIDE_2')).getButton(), 0, WidgetTypes.WIDGET_GENERAL, 671, 671, False )
screen.show( "BottomButtonContainer" )
iCount = iCount + 1

This is what's confusing me, though. There should be an equals sign between pPlot and argsList[0] (line 500, CvEventManager). But in the error message, there is no equal sign...

civ editor11
Jul 31, 2009, 08:35 AM
There was an equals sign I had just forgotten it

civ editor11
Jul 31, 2009, 11:10 AM
Do you need python or just XML to change the dating system cause we need to change it to star wars tim aka bby and aby

TC01
Jul 31, 2009, 11:21 AM
Do you need python or just XML to change the dating system cause we need to change it to star wars tim aka bby and aby

There's this in GlobalDefines.xml to control the starting year:

<Define>
<DefineName>START_YEAR</DefineName>
<iDefineIntVal>-4000</iDefineIntVal>
</Define>

But all you'd have to do is add this to your game text files:

<TEXT>
<Tag>TXT_KEY_TIME_BC_SAVE</Tag>
<English>ABY-%s1_Date</English>
</TEXT>
<TEXT>
<Tag>TXT_KEY_TIME_BC</Tag>
<English>%d1_Date ABY</English>
</TEXT>
<TEXT>
<Tag>TXT_KEY_TIME_AD_SAVE</Tag>
<English>ABY-%s1_Date</English>
</TEXT>
<TEXT>
<Tag>TXT_KEY_TIME_AD</Tag>
<English>%d1_Date ABY</English>
</TEXT>

civ editor11
Jul 31, 2009, 11:23 AM
Thank You have you found out how to fix the other problems in the python

TC01
Jul 31, 2009, 11:37 AM
I'm not sure. My line 1521 in CvMainInterface.py has nothing to do with buttons, it reads:

if pUnit.isHasPromotion(gc.getInfoTypeForString('PROM OTION_DARK_SIDE_2')):

I've reuploaded the python folder and mapscript with all the existing bugfixes. Download them again and see if you still get the error (and the error in the Event Manager).

civ editor11
Jul 31, 2009, 11:39 AM
Do I need to do anything to make it start in 4,000bby and end in 1500 aby

TC01
Jul 31, 2009, 11:45 AM
Do I need to do anything to make it start in 4,000bby and end in 1500 aby

I'm not entirely sure how to do this. You should probably ask in the C&C forum...

civ editor11
Jul 31, 2009, 11:46 AM
The ones when you try to load a game have been updated
I'll ask there a little later

TC01
Jul 31, 2009, 11:53 AM
The ones when you try to load a game have been updated
I'll ask there a little later

This is because you have no such thing as "PROMOTION_DARK_SIDE_1" or any of the force promotions.

Try adding them into CIV4PromotionInfos.xml first (DARK_SIDE_1-4 and LIGHT_SIDE_1-4)

civ editor11
Jul 31, 2009, 12:36 PM
I'll add those in soon
Which promotion should I make it off

civ editor11
Jul 31, 2009, 01:02 PM
New Erors ingame

TC01
Jul 31, 2009, 01:05 PM
I'll add those in soon
Which promotion should I make it off

Combat 1 has the least extra stuff in it. But:

1. You might want to make it only available to UNITCOMBAT_FORCE (units who can use force powers), then define this in UnitCombatInfos.xml, and give all units like UNIT_JEDI and UNIT_SITH UNITCOMBAT_FORCE.

2. You should probably make each promotion give -5 combat (where Combat 1 gives +10), to weaken Jedi/Sith with force abilities in combat. (That way, you have to specialize your units- are they casters or fighters?)

3. Light 1 leads to Light 2, etc. Dark 1 leads to Dark 2, etc.

civ editor11
Jul 31, 2009, 01:09 PM
What are the names to the force power for the description and the buttons I need them

civ editor11
Jul 31, 2009, 03:39 PM
I've added the force powers in game they aren't giving error messages
Now there are just the ingame errors
The game worked through the errors but didn't create any land just fallout supernovas and tundra. do you know whats wrong? can you fix it?

TC01
Jul 31, 2009, 04:13 PM
I've added the force powers in game they aren't giving error messages
Now there are just the ingame errors
The game worked through the errors but didn't create any land just fallout supernovas and tundra. do you know whats wrong? can you fix it?

By tundra, do you mean space?

I have one idea. Try replacing, in the mapscript, lines 350 to 375 with this:

iRnd = self.gc.getSorenRandNum(9, "Place Planets")
pPlanetCore = self.map.sPlot(iX, iY)
if iRnd == 0:
pPlanetCore.setTerrainType(self.planetClassMCore)
for iPlanetX in range(iX-1, iX+2, 1):
for iPlanetY in range(iY-1, iY+2, 1):
pPlanetEdge = self.map.sPlot(iPlanetX, iPlanetY)
if (iPlanetX == iX and iPlanetY == iY):
continue
else:
pPlanetEdge.setTerrainType(self.planetClassMEdge)
if 1 <= iRnd <= 3:
for iPlanetX in range(iX-1, iX+2, 1):
for iPlanetY in range(iY-1, iY+2, 1):
pPlanetEdge = self.map.sPlot(iPlanetX, iPlanetY)
pPlanetEdge.setTerrainType(self.planetArctic)
if 4 <= iRnd <= 6:
for iPlanetX in range(iX-1, iX+2, 1):
for iPlanetY in range(iY-1, iY+2, 1):
pPlanetEdge = self.map.sPlot(iPlanetX, iPlanetY)
pPlanetEdge.setTerrainType(self.planetDesert)
if 7 <= iRnd <= 9:
for iPlanetX in range(iX-1, iX+2, 1):
for iPlanetY in range(iY-1, iY+2, 1):
pPlanetEdge = self.map.sPlot(iPlanetX, iPlanetY)
pPlanetEdge.setTerrainType(self.planetVolcanic)

civ editor11
Jul 31, 2009, 04:19 PM
Yes i mean Space but it is defined as tundra

civ editor11
Jul 31, 2009, 04:22 PM
It still has no planets and all the boxes are the same as what I've already posted

civ editor11
Jul 31, 2009, 04:23 PM
This is what the pop up boxes say there are two of them in the order they come up

File "StarWars", line 634, in findStartingPlot
RuntimeError: unidentifiable C++ expression

Then after a click through the first on a few times

File "StarWars", line 565, in findStartingPlot
NameError: global name self not defined

It woorks through these no real land just tundra/space and when you end your turn
this comes up

[Code]File "EventInterface", line 23, in onEvent
File "EventManager", line 193, in handleEvent
File "EventManager", line 401, in onBeginPlayerTurn
RuntimeError unidentifiable C++ exception

TC01
Jul 31, 2009, 05:10 PM
In the code above, where it says self.gc.getSorenRandNum() (this is line 350, in the error message), change the self.gc to CyGame().getSorenRandNum().

The first error is a result of no plots that are acceptable to have cities on them be added to a list- if you fix the self.gc problem (by changing it to CyGame()) this should fix itself.

civ editor11
Jul 31, 2009, 07:15 PM
New errors

TC01
Jul 31, 2009, 08:06 PM
I've reuploaded the mapscript to the first post with the errors fixed. DL it from there and try it again. (I had forgotten how to use the setTerrainType function, you need "true, true" (or something like that) at the end of it).

civ editor11
Jul 31, 2009, 08:10 PM
I've done a fix of my own so switch
if (iCount2 == 9 and iCount1 = 0):
to
if (iCount2 == 9 and iCount1 == 0):
its on line 570

civ editor11
Jul 31, 2009, 08:15 PM
errors updated

TC01
Jul 31, 2009, 08:40 PM
errors updated

Whoops. I fixed this before, but when I went to update my backup I made it "CyMap" instead of "CyGame". This is correct:

iRnd = CyGame().getSorenRandNum(9, "Place Planets")

civ editor11
Jul 31, 2009, 08:44 PM
I tried to start a game but as soon as it started initializing my game crashed do you know what went wrong?

TC01
Jul 31, 2009, 08:50 PM
I tried to start a game but as soon as it started initializing my game crashed do you know what went wrong?

Crashed while loading the map, or crashed while starting up the mod?

I'll pore over the mapscript later, but I really have no idea. The game did not crash before which change? (I mean it gave exceptions but did not crash).

civ editor11
Jul 31, 2009, 08:56 PM
It happens when i change cymap to cygame

TC01
Jul 31, 2009, 09:00 PM
It happens when i change cymap to cygame

Try changing that line (with CyGame() in it) to this (overwrite the line with both of the other lines):

game = CyGame()
iRnd = game.getSorenRandNum(9, "Place Planets")

civ editor11
Jul 31, 2009, 09:03 PM
That works

TC01
Jul 31, 2009, 09:07 PM
That works

Good.

Any other problems? Python exceptions should trigger whenever the syntax is wrong, or something else is wrong, but if things aren't behaving as they should be, the code might be perfectly correct but what you want it to do might not be happening.

civ editor11
Jul 31, 2009, 09:12 PM
It started crashing again until I changed it back

TC01
Jul 31, 2009, 09:17 PM
It started crashing again until I changed it back

Wait...

It worked with the change. Then it crashed again, so you changed it back, and now it works again?

So now it's the way it was before the game = CyGame() line was added and the iRnd = line changed to iRnd = game.getSorenRandNum?

civ editor11
Jul 31, 2009, 09:40 PM
I added it and the xml files it needs to a seperate mod for testing to see if they work without my messed up XML messing them up

civ editor11
Jul 31, 2009, 09:40 PM
It worked and made land and founded a city in the midddle but there are still errors

TC01
Aug 01, 2009, 07:57 AM
It worked and made land and founded a city in the midddle but there are still errors

What are the errors?

civ editor11
Aug 01, 2009, 08:04 AM
These are the errors that come up
This is what the pop up boxes say there are two of them in the order they come up

File "StarWars", line 634, in findStartingPlot
RuntimeError: unidentifiable C++ expression

Then after a click through the first on a few times

File "StarWars", line 565, in findStartingPlot
NameError: global name self not defined

It gets through those but then every few times you end your turn this comes up

[Code]File "EventInterface", line 23, in onEvent
File "EventManager", line 193, in handleEvent
File "EventManager", line 401, in onBeginPlayerTurn
RuntimeError unidentifiable C++ exception

TC01
Aug 01, 2009, 08:13 AM
What are you calling the capital building? FF calls it BUILDING_CAPITOL. If yours is BUILDING_PALACE, you need to change here:

iBuildingCapitol = gc.getInfoTypeForString("BUILDING_CAPITOL")
pCity.setNumRealBuilding(iBuildingCapitol, 1)
To say BUILDING_PALACE.

I'm not sure about the other error, though.

civ editor11
Aug 01, 2009, 08:17 AM
What line is that on

TC01
Aug 01, 2009, 08:17 AM
What line is that on

634, I believe, but it may be 635 or 633. But in that area.

civ editor11
Aug 01, 2009, 08:18 AM
Okay and yes it is palace i'm building it off bts and adding final frontier where needed

civ editor11
Aug 01, 2009, 08:28 AM
Here are the files you should neede to do the python checks i need to get on with xml or do i need to check for errors and reportthem here you can do it right I haven't changed CAPITOL to PALACE yet in this one

TC01
Aug 01, 2009, 08:57 AM
Here are the files you should neede to do the python checks i need to get on with xml or do i need to check for errors and reportthem here you can do it right I haven't changed CAPITOL to PALACE yet in this one

I can do it.

When loading it up, I found one problem first- the FF mapscript's options text are saved in a file somewhere- I'll move them directly into the mapscript.

Then, it gave me the line 565 error, and then it crashed.

civ editor11
Aug 01, 2009, 09:14 AM
Thats whats been happening to me you can fix it right

TC01
Aug 01, 2009, 09:18 AM
Thats whats been happening to me you can fix it right

Hopefully.

I've gotten around the first error (the "self" is not defined error) by re-adding a FEATURE_PLANET_CORE. However, I've only used the Black Hole Gravity Field feature to do this (this feature has no graphic image in the game). So the game doesn't need to do the complicated check if the starting plot is in the center of the city.

All you basically need to do is copy the Gravity Field feature (FEATURE_GRAV_FIELD), rename it FEATURE_PLANET_CORE, call it "Planet Core", and nothing else, in CIV4FeatureInfos.xml. It should have no graphics in game (the Grav Field art define has no graphics, I think).

The second error was resolved by the capitol-to-palace.

I'm finding a third error, however, in that the game is trying and failing to place a UNIT_PLANETARY_DEFENSE_I, the planetary defense ship, on your starting city. For now, I've just made it place a Warrior there instead. But you need to tell me what the starting units should be, and then I'll make python place them (instead of using the Starting Unit tags in the Civilizations XML)

civ editor11
Aug 01, 2009, 09:21 AM
Could you make it a Wookie

TC01
Aug 01, 2009, 09:25 AM
Could you make it a Wookie

Well, yes, but you'd first need to give me the Unit XML for the Wookie, or else there'd be another crash. And I don't see why some civs, like the Sith, would start with a Wookie.

I fixed the crash, but the graphics... don't look that good.

First, are you using the default Final Frontier space terrain and asteroid graphics? If you aren't I strongly suggest that you do. (Whether you are or aren't, I don't really like the way it looks on my computer...) And, there's all kind of weird things going on with the terrain.

The other problems are mainly that bonuses are being placed all over the map (for now, I think using the Final Frontier bonuses, which only place in asteroids, would be useful, because then we don't have Corn and Ivory in Tundra tiles).

I'll reattach the mapscript as is in the first post. Remember to add the Planet Core (with no graphics) back in.

civ editor11
Aug 01, 2009, 10:16 AM
Here are the XML files with art for the wookie
There is no better unit for starting the game whose graphics i currently have downloaded

civ editor11
Aug 01, 2009, 12:03 PM
I've updated all XML files it now includes the one jedi unit and one sith the deathstar which is currently a missile because i have no animations for the original
The Unitcombats for force users are UNITCOMBAT_LIGHT for jedi and UNITCOMBAT_DARK for Sith i didn't include any python so that any fixes you have you can use
It is set up so you can just unzip it and throw it in the mods folder

TC01
Aug 01, 2009, 12:08 PM
I've updated all XML files it now includes the one jedi unit and one sith the deathstar which is currently a missile because i have no animations for the original
The Unitcombats for force users are UNITCOMBAT_LIGHT for jedi and UNITCOMBAT_DARK for Sith i didn't include any python so that any fixes you have you can use
It is set up so you can just unzip it and throw it in the mods folder

Thanks. Unfortunately I can't test it right now, so I'll get back to you later.

civ editor11
Aug 02, 2009, 03:20 PM
Planet core is a feature right
Grav Field

TC01
Aug 02, 2009, 03:45 PM
Planet core is a feature right
Grav Field

Yes.

Basically, it should be a feature with no in-game graphic, like Grav Field, which is why I suggested it. (Supernova Area would work as well).

civ editor11
Aug 02, 2009, 08:22 PM
Okay I'll add it now

civ editor11
Aug 02, 2009, 09:45 PM
This happens when you use the death star
Traceback (most recent call last):

File "CvEventInterface", line 23, in onEvent

File "CvEventManager", line 193, in handleEvent

File "CvEventManager", line 570, in onNukeExplosion

ArgumentError: Python argument types in
CyPlot.setTerrainType(CyPlot, int)
did not match C++ signature:
setTerrainType(class CyPlot {lvalue}, int, bool, bool)
ERR: Python function onEvent failed, module CvEventInterface

TC01
Aug 02, 2009, 09:52 PM
Whoops...

Made this change to the mapscript but forgot it here.

Basically, in line 570, change it to this:

pTarget.setTerrainType(gc.getInfoTypeForString('TE RRAIN_TUNDRA'),true,true)

I forgot to mention this, but try moving CIV4TerrainSettings.xml from the Final Frontier\Assets\XML\Terrain folder into the Star Wars one. See if it makes the space terrain look better (by "better" I mean like it does in Final Frontier.)

civ editor11
Aug 03, 2009, 06:11 AM
I used your fix and my game crashed when i used the death star

civ editor11
Aug 03, 2009, 06:51 AM
I found in the logs there was this error message
Traceback (most recent call last):

File "CvEventInterface", line 23, in onEvent

File "CvEventManager", line 193, in handleEvent

File "CvEventManager", line 577, in onNukeExplosion

RuntimeError: unidentifiable C++ exception
ERR: Python function onEvent failed, module CvEventInterface

civ editor11
Aug 03, 2009, 07:01 AM
Could we implement Jawas idea of only certain planets being able to build certain units easily or at all?

TC01
Aug 03, 2009, 08:31 AM
Could we implement Jawas idea of only certain planets being able to build certain units easily or at all?

My first answer is: yes

My second answer is: maybe.

The problem is that planets are randomized. So you can't say "these coordinates are Kuat", because they won't be.

The easiest idea way is to make a bonus per planet (say, Kuati is the bonus for Kuat) to give random planets a specific Star Wars planet counterpart. Kuati would be required to build certain resources.

I can write python to do this, maybe. At the beginning of the game, I get a list of all Planet Cores, and a list of all planet resources. For each one, I get a random number, 0 or 1 (if you wanted, you could make it so that some planet would appear rarer), and then if it's 1 (or whatever), x planet (the planet core plot) gets the resource "Kuati" (or whatever).

The "maybe" comes in when I considered that planets will be connected, and thus trade bonuses, thus allowing multiple worlds to build said units.

However, this is no challenge that can't be overcome. I'll ask on the Python forum if this is possible to restrict.

civ editor11
Aug 03, 2009, 09:18 AM
Thanks if we can please do if its to hard we don't need it that was just for realism

TC01
Aug 03, 2009, 10:05 AM
Never mind, it's much easier then I thought.

In onGameStart, I simply add some script data to each planet (and a landmark tag) that defines what each planet is. Using the random method I described above.

Then in onCityBuilt (or acquired, or whatever the function's called), if a city's built on or near a planet with the script data Kuat, say, I give the city the Kuat Building. Of course, I'd like a better name than "Kuat Building".

Then any unit that requires to be built on Kuat requires the "Kuat Building".

Whatever you decide to call this, please make the actual XML read KUAT_BUILDING, or FONDOR_BUILDING or MON_CALAMARI_BUILDING, etc.

I'd need a list of planets, but with that I could implement this.


As for the error message in the Death Star, here's the problem. You must change the line "pCity = pPlot.getCity()" (which should be line 576) to:

pCity = pTarget.getPlotCity()

civ editor11
Aug 03, 2009, 10:24 AM
All of these errors come up and when the death star goes off the game crashes
raceback (most recent call last):

File "StarWars", line 628, in findStartingPlot

RuntimeError: unidentifiable C++ exception
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 628, in findStartingPlot

RuntimeError: unidentifiable C++ exception
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 628, in findStartingPlot

RuntimeError: unidentifiable C++ exception
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):
File "CvScreensInterface", line 705, in forceScreenRedraw
File "CvMainInterface", line 717, in redraw
File "CvMainInterface", line 1082, in updatePlotListButtons
File "CvMainInterface", line 110, in numPlotListButtons
AttributeError
:
CvMainInterface instance has no attribute 'm_iNumPlotListButtons'

ERR: Python function forceScreenRedraw failed, module CvScreensInterface
Traceback (most recent call last):
File "CvEventInterface", line 23, in onEvent
File "CvEventManager", line 193, in handleEvent
File "CvEventManager", line 577, in onNukeExplosion
RuntimeError
:
unidentifiable C++ exception

ERR: Python function onEvent failed, module CvEventInterface

TC01
Aug 03, 2009, 10:36 AM
I thought I fixed this. Apparently I didn't...

Change line 627 to 631 to this (I included the "start game with Wookie" stuff):

iBuildingCapitol = gc.getInfoTypeForString("BUILDING_PALACE")
pCity.setNumRealBuilding(iBuildingCapitol, 1)

if (pPlayer.getNumUnits() == 0):
iUnitType = gc.getInfoTypeForString("UNIT_WOOKIE")
pPlayer.initUnit(iUnitType, pRandomPlot.getX(), pRandomPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.NO_DIRECTION)

Did you make my change at the bottom of the above post to line 577?

I have no idea what's wrong with the MainInterface file...

civ editor11
Aug 03, 2009, 10:37 AM
Yes i did

civ editor11
Aug 03, 2009, 10:42 AM
I added all of your fixes and started a game as soon as it started loading the game crashed and its not showing any python errors in the log

civ editor11
Aug 03, 2009, 11:13 AM
These are the errors without the code change and with all of my XML
Traceback (most recent call last):

File "StarWars", line 579, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars

TC01
Aug 03, 2009, 11:21 AM
Are BUILDING_PALACE and UNIT_WOOKIE correct tags? When they were incorrect, they were causing a crash.

It seems to be saying that it has run out of potential starting plots... Which code change did you take out, the one with adding Wookie and Palace?

civ editor11
Aug 03, 2009, 12:12 PM
I have the Palace and wookie fix in it
and its still showing the same error message

TC01
Aug 03, 2009, 01:34 PM
Then what change made it crash?

What size map are you trying a game on?

Use the Custom Game option, and start a game on a Huge map, but reduce the number of civs to 2 and see if you get the same error.

civ editor11
Aug 03, 2009, 01:44 PM
Okay I did that but then this popped up and it didn't make any land plots
Traceback (most recent call last):

File "StarWars", line 579, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars

TC01
Aug 03, 2009, 01:49 PM
Can you please post the mapscript you are using? (via attachment)? I want to check some things on it and it would be easier if I had a copy on my computer.

civ editor11
Aug 03, 2009, 01:52 PM
This is the version I'm using

TC01
Aug 03, 2009, 02:03 PM
Identical to mine, so there goes that theory...

Attached is the same mapscript, but I drastically simplified the findStartingPlot algorithm. If it works, I know what the problem is but not why it occured... if it doesn't work, I don't...

civ editor11
Aug 03, 2009, 09:41 PM
Look in possible production solutions for ideas you don't have to use all of or many of them just enough to add a little more realism to the game

TC01
Aug 04, 2009, 08:06 AM
Look in possible production solutions for ideas you don't have to use all of or many of them just enough to add a little more realism to the game

Okay, I'll start working on that.

civ editor11
Aug 04, 2009, 08:47 AM
This is the new error which is crashing the game
Traceback (most recent call last):

File "StarWars", line 579, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

TC01
Aug 04, 2009, 09:41 AM
You seem to have cut the error off in mid-error...

What's below the Traceback (most recent call last): section? Usually it details what was being done by the game before the error.

civ editor11
Aug 04, 2009, 09:47 AM
Oh that was just it repeating itself
Heres what it should of been
Traceback (most recent call last):

File "StarWars", line 519, in addFeatures

File "StarWars", line 364, in addFeatures

RuntimeError: unidentifiable C++ exception
ERR: Python function addFeatures failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 579, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 579, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 579, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 579, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 579, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 579, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 579, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 579, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 579, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 579, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 579, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 579, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 579, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 579, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 579, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 579, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 579, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 579, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 579, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 579, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 579, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 579, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars

Edit: This is what it is now that i've fixed all the XML errors

This is what happens when you go through the civilopedia

Traceback (most recent call last):

File "CvScreensInterface", line 251, in pediaJumpToLeader

File "CvPediaMain", line 897, in pediaJump

File "CvPediaLeader", line 86, in interfaceScreen

RuntimeError: unidentifiable C++ exception
ERR: Python function pediaJumpToLeader failed, module CvScreensInterface

civ editor11
Aug 04, 2009, 04:23 PM
Using the heroes mod could you make darth vader a national unit

TC01
Aug 04, 2009, 04:25 PM
The thing in the pedia means that a leader's art define is incorrect somewhere.

For the first set of errors- are you using the new mapscript I uploaded on the last page? Right under where I asked for you to show me the mapscript?

TC01
Aug 04, 2009, 04:28 PM
Using the heroes mod could you make darth vader a national unit

I don't need that mod to do it- yes, I can make Darth Vader a national unit... do you have a list of land/space unit to make heroes?

civ editor11
Aug 04, 2009, 04:34 PM
I redit it after reloading the new mapscript and i got this when trying to load a game
File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWarsrs

This then crashes the game

TC01
Aug 04, 2009, 05:00 PM
Change line 555 to this (overwrite it with two lines):

iPlanetCore = self.gc.getInfoTypeForString("FEATURE_PLANET_CORE")
if (pPlot.getFeatureType() == iPlanetCore):

civ editor11
Aug 04, 2009, 05:13 PM
I did that now this comes up
o load python module StarWars.
ERR: Call function getNumHiddenCustomMapOptions failed. Can't find module StarWars
Traceback (most recent call last):

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

File "<string>", line 35, in load_module

File "<string>", line 13, in _get_code

IndentationError: expected an indented block (StarWars, line 559)
Failed to load python module StarWars.
ERR: Call function getNumCustomMapOptions failed. Can't find module StarWars
Traceback (most recent call last):

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

File "<string>", line 35, in load_module

File "<string>", line 13, in _get_code

IndentationError: expected an indented block (StarWars, line 559)
Failed to load python module StarWars.
ERR: Call function getNumHiddenCustomMapOptions failed. Can't find module StarWars
Traceback (most recent call last):

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

File "<string>", line 35, in load_module

File "<string>", line 13, in _get_code

IndentationError: expected an indented block (StarWars, line 559)
Failed to load python module StarWars.
ERR: Call function getNumCustomMapOptions failed. Can't find module StarWars
Traceback (most recent call last):

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

File "<string>", line 35, in load_module

File "<string>", line 13, in _get_code

IndentationError: expected an indented block (StarWars, line 559)
Failed to load python module StarWars.
ERR: Call function getNumHiddenCustomMapOptions failed. Can't find module StarWars
Traceback (most recent call last):

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

File "<string>", line 35, in load_module

File "<string>", line 13, in _get_code

IndentationError: expected an indented block (StarWars, line 559)
Failed to load python module StarWars.
ERR: Call function getNumCustomMapOptions failed. Can't find module StarWars

This doesn't crash the game

civ editor11
Aug 04, 2009, 05:17 PM
Could you make a promotion like the force powers just for fighters/bombers called ion blast that would disable one unit for a turn

TC01
Aug 04, 2009, 05:33 PM
Could you make a promotion like the force powers just for fighters/bombers called ion blast that would disable one unit for a turn

Yes, sure.

By the way, this just occurred to me. Should I add in checks to prevent some things (like the ion blast or force push) from being used on units like land or space units respectively?

As for the error, my line 559 is a comment (with the # symbol in front of it).

civ editor11
Aug 04, 2009, 05:42 PM
I had messed up when pasting your last fix
now its just this

Traceback (most recent call last):

File "StarWars", line 520, in addFeatures

File "StarWars", line 371, in addFeatures

RuntimeError: unidentifiable C++ exception
ERR: Python function addFeatures failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 555, in findStartingPlot

NameError: global name 'self' is not defined
ERR: Python function findStartingPlot failed, module StarWars


This crashes the game

TC01
Aug 04, 2009, 05:58 PM
For line 555, where it says "self.gc.getInfoTypeForString("FEATURE_PLANET_CORE"), delete the "self." part. Jon Shafer defined CyGlobalContext() as self.gc for every other part of the mapscript, except here when he went with "gc".

That should fix most of those errors (everything except the first one). Not sure about the first one.

civ editor11
Aug 04, 2009, 06:06 PM
Now this is there

Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars

This crashes the game

TC01
Aug 04, 2009, 06:26 PM
I've opened a thread (http://forums.civfanatics.com/showthread.php?t=330565) in the SDK & Python forum to help fix this issue, as I have no idea what's wrong, sorry.

civ editor11
Aug 04, 2009, 06:30 PM
Could you the ion blast just work on mechanical units? or is that possible?

TC01
Aug 04, 2009, 06:32 PM
Could you the ion blast just work on mechanical units? or is that possible?

It is if you give all units you want it to work on the starting promotion (starting promotions doable via UnitInfos, I think- if not I can do it via python) PROMOTION_MECHANICAL.

civ editor11
Aug 04, 2009, 06:33 PM
I could do that should promotion Mechanical do anything except be there.

TC01
Aug 04, 2009, 07:58 PM
I could do that should promotion Mechanical do anything except be there.

I'm not sure what it should do. But maybe you should have similar promotions for Land units and Starships?

civ editor11
Aug 04, 2009, 08:06 PM
I think I might add those promotions in soon
These are what i'm adding
PROMOTION_MECHANICAL
PROMOTION_LAND
PROMOTION_SPACE
PROMOTION_VEHICLE

civ editor11
Aug 04, 2009, 08:48 PM
I've added those promotions in now

civ editor11
Aug 05, 2009, 11:10 AM
Could you make it that if Fighters/Bombers didn't return to a base in a certain amount of turns they crash/die

TC01
Aug 05, 2009, 12:05 PM
Could you make it that if Fighters/Bombers didn't return to a base in a certain amount of turns they crash/die

I think Fighters/Bombers would be better implemented as aircraft units (like fighters/bombers from regular Civ 4 and Final Frontier). I could do something like this but if I did there would be no way of tracking it for each unit (the player would not know what was going on), so I don't think it's worth it.

civ editor11
Aug 05, 2009, 12:21 PM
Okay But in star wars I was thinking of putting the planes as land units like the gunship so they could move around freely. I thought that would keep them from staying out in the open forever. It would keep realism and that was what i had wanted, but if you don't think it would work right you don't need to do it. By the way how is the ion blast coming along?

TC01
Aug 05, 2009, 01:14 PM
You can still make fighters like gunship units, but I just don't think that the "crash if away for too long" would be good to implement. It's:
a. Too complicated
b. Too hard to implement (I'd have to make sure the player knew the value of how long the fighter could be away and I don't really know how to make this work)

I think God-Emperor may have fixed the mapscript error.

Replace from lines 351 to 381 (or where it says game = CyGame() to pPlanetEdge.setTerrainType(self.planetVolcanic,tru e,true)) with the code below:

game = CyGame()
iRnd = game.getSorenRandNum(9, "Place Planets")
pPlanetCore = self.map.sPlot(iX, iY)
if iRnd == 0:
self.map.sPlot(iX, iY).setTerrainType(self.planetClassMCore,true,true )
self.map.sPlot(iX, iY).setFeatureType(self.planetCore,0)
for iPlanetX in range(iX-1, iX+2, 1):
for iPlanetY in range(iY-1, iY+2, 1):
pPlanetEdge = self.map.sPlot(iPlanetX, iPlanetY)
if (iPlanetX == iX and iPlanetY == iY):
continue
else:
self.map.sPlot(iPlanetX, iPlanetY).setTerrainType(self.planetClassMEdge,tru e,true)
if 1 <= iRnd <= 3:
self.map.sPlot(iX, iY).setFeatureType(self.planetCore,0)
for iPlanetX in range(iX-1, iX+2, 1):
for iPlanetY in range(iY-1, iY+2, 1):
pPlanetEdge = self.map.sPlot(iPlanetX, iPlanetY)
self.map.sPlot(iPlanetX, iPlanetY).setTerrainType(self.planetArctic,true,tr ue)
if 4 <= iRnd <= 6:
self.map.sPlot(iX, iY).setFeatureType(self.planetCore,0)
for iPlanetX in range(iX-1, iX+2, 1):
for iPlanetY in range(iY-1, iY+2, 1):
pPlanetEdge = self.map.sPlot(iPlanetX, iPlanetY)
self.map.sPlot(iPlanetX, iPlanetY).setTerrainType(self.planetDesert,true,tr ue)
if 7 <= iRnd <= 9:
self.map.sPlot(iX, iY).setFeatureType(self.planetCore,0)
for iPlanetX in range(iX-1, iX+2, 1):
for iPlanetY in range(iY-1, iY+2, 1):
pPlanetEdge = self.map.sPlot(iPlanetX, iPlanetY)
self.map.sPlot(iPlanetX, iPlanetY).setTerrainType(self.planetVolcanic,true, true)

civ editor11
Aug 05, 2009, 01:36 PM
When I used that this came up

raceback (most recent call last):

File "StarWars", line 520, in addFeatures

File "StarWars", line 371, in addFeatures

RuntimeError: unidentifiable C++ exception
ERR: Python function addFeatures failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars

This crashes the game

TC01
Aug 05, 2009, 02:05 PM
On lines 355, 356, 363, 365, 369, 371, 375, 377, 381 (wherever it starts with self.map.sPlot and then has setFeatureType or setTerrainType), change the "self.map.sPlot" part to "CyMap().plot".

Also, under the line where it calculates iNumSolarSystems (line 560 it should be) add a "print iNumSolarSystems" line below that- this should make the value of iNumSolarSystems appear in the log.

civ editor11
Aug 05, 2009, 06:33 PM
This is what it said

Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars

This crashes the game

TC01
Aug 05, 2009, 07:21 PM
Look through the logs for iNumSolarSystems (the other log files). I'm not sure which log it would be in but it should be in one of them.

If you can't find it, just attach the directory containing the logs and I'll look through them.

civ editor11
Aug 05, 2009, 07:25 PM
I think this is what you want

load_module CvUtil

load_module traceback

load_module CvEventManager

load_module CvScreensInterface

load_module CvMainInterface

load_module ScreenInput

load_module CvScreenEnums

load_module time

load_module StarWarsUtils

load_module PyHelpers

load_module pickle

load_module CvDomesticAdvisor

load_module CvTechChooser

load_module CvForeignAdvisor

load_module math

load_module CvExoticForeignAdvisor

load_module IconGrid

load_module DomPyHelpers

load_module TechTree

load_module CvMilitaryAdvisor

load_module CvFinanceAdvisor

load_module CvReligionScreen

load_module CvCorporationScreen

load_module CvCivicsScreen

load_module string

load_module CvVictoryScreen

load_module CvEspionageAdvisor

load_module CvOptionsScreen

load_module CvReplayScreen

load_module CvHallOfFameScreen

load_module CvDanQuayle

load_module CvGameUtils

load_module CvUnVictoryScreen

load_module CvDawnOfMan

load_module CvTechSplashScreen

load_module CvTopCivs

load_module random

load_module CvInfoScreen

load_module CvIntroMovieScreen

load_module CvVictoryMovieScreen

load_module CvWonderMovieScreen

load_module CvEraMovieScreen

load_module CvSpaceShipScreen

load_module CvPediaMain

load_module CvPediaScreen

load_module CvScreen

load_module CvPediaTech

load_module CvPediaUnit

load_module CvPediaBuilding

load_module CvPediaPromotion

load_module CvPediaUnitChart

load_module CvPediaBonus

load_module CvPediaTerrain

load_module CvPediaFeature

load_module CvPediaImprovement

load_module CvPediaCivic

load_module CvPediaCivilization

load_module CvPediaLeader

load_module CvPediaSpecialist

load_module CvPediaHistory

load_module CvPediaProject

load_module CvPediaReligion

load_module CvPediaCorporation

load_module CvWorldBuilderScreen

load_module Popup

load_module CvWorldBuilderDiplomacyScreen

load_module CvDebugTools

load_module CvDebugInfoScreen

load_module CvMapGeneratorUtil

load_module CvGFCScreen

load_module CvPopupInterface

load_module CvScreenUtilsInterface

load_module CvScreenUtils

init-ing world builder screen

load_module CvWBPopups

load_module CvCameraControls

load_module CvAdvisorUtils

PY:OnInit
load_module CvAppInterface

load_module Archipelago

load_module Balanced

load_module Continents

load_module Custom_Continents

load_module Fantasy_Realm

load_module Fractal

load_module Great_Plains

load_module Highlands

load_module Hub

load_module Ice_Age

load_module Inland_Sea

load_module Islands

load_module Lakes

load_module Maze

load_module Mirror

load_module Oasis

load_module Pangaea

load_module Ring

load_module Shuffle

load_module Team_Battleground

load_module Terra

load_module Tilted_Axis

load_module Wheel

load_module Arboria

load_module Big_and_Small

load_module Boreal

load_module Donut

load_module Earth2

load_module Global_Highlands

load_module Hemispheres

load_module Medium_and_Small

load_module Rainforest

load_module RandomScriptMap

load_module Tectonics

load_module StarWars

PY:Player 0's alive status set to: 1
PY:Player 1's alive status set to: 1
PY:Player 2's alive status set to: 1
PY:Player 3's alive status set to: 1
PY:Player 4's alive status set to: 1
PY:Player 5's alive status set to: 1
PY:Player 6's alive status set to: 1
PY:Player 7's alive status set to: 1
PY:Player 8's alive status set to: 1
PY:Player 9's alive status set to: 1
PY:Player 10's alive status set to: 1
PY:Player 18's alive status set to: 1
0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

load_module CvGameInterface

load_module CvGameInterfaceFile

TC01
Aug 05, 2009, 07:45 PM
Yes, thanks. God-Emperor was correct.

On line 348, change pPlot.setFeatureType(self.featureFloodPlain, 0) to say "pEffectPlot.setFeatureType(self.featureFloodPlain, 0)". Just the first part of it, change pPlot to pEffectPlot.

civ editor11
Aug 05, 2009, 07:56 PM
This is what the error log says now
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 572, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars

Heres what it prints off

load_module StarWars

PY:Player 0's alive status set to: 1
PY:Player 1's alive status set to: 1
PY:Player 2's alive status set to: 1
PY:Player 3's alive status set to: 1
PY:Player 4's alive status set to: 1
PY:Player 5's alive status set to: 1
PY:Player 6's alive status set to: 1
PY:Player 7's alive status set to: 1
PY:Player 8's alive status set to: 1
PY:Player 9's alive status set to: 1
PY:Player 10's alive status set to: 1
PY:Player 18's alive status set to: 1
0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

load_module CvGameInterface

load_module CvGameInterfaceFile

TC01
Aug 06, 2009, 07:38 PM
Remove the print iNumSolarSystems line.

Then, from where it says " # Make list of valid plots (Solar Systems), but only once" to "g_apSolarSystemPlotList.append(pPlot)"- or something like that- overwrite the code there with this:

# Make list of valid plots (Solar Systems), but only once
if (len(g_apSolarSystemPlotList) == 0):
print( "Making list")
iPlanetCore = gc.getInfoTypeForString("FEATURE_PLANET_CORE")
print( " iPlanetCore = %d" % (iPlanetCore))
for iPlotLoop in range(CyMap().numPlots()):
pPlot = CyMap().plotByIndex(iPlotLoop)
print( " checking plot %d, feature type = %d" % (iPlotLoop, pPlot.getFeatureType()))
if (pPlot.getFeatureType() == iPlanetCore):
print( " plot feature matched iPlanetCore, adding to list")
g_apSolarSystemPlotList.append(pPlot)

This is the same stuff, but God-Emperor added some print commands to print out results.

Test this. I don't expect it to work (if it does, I'll be very surprised), but test it and then post the stuff from the log file (load_module StarWars).

civ editor11
Aug 06, 2009, 09:34 PM
Same errors but here is the debug log its to big to post in a code block

TC01
Aug 06, 2009, 09:49 PM
I just had a horrible thought.

civ_editor, did you:

a. Overwrite FEATURE_GRAV_FIELD with FEATURE_PLANET_CORE?
b. Not name FEATURE_PLANET_CORE, well, FEATURE_PLANET_CORE?

If you did either of those, you need to either:

a. Re-add FEATURE_GRAV_FIELD but copy the existing define for it as FEATURE_PLANET_CORE.
b. Name FEATURE_PLANET CORE, well, FEATURE_PLANET_CORE.


Anyway, I want you to replace the code from "game = CyGame()" to right before " break #Solar System placed, effects placed, break loop." appears with this:

game = CyGame()
iRnd = game.getSorenRandNum(9, "Place Planets")
pPlanetCore = self.map.sPlot(iX, iY)
pPlanetCore.setFeatureType(self.planetCore,0)
if iRnd == 0:
pPlanetCore.setTerrainType(self.planetClassMCore,t rue,true)
for iPlanetX in range(iX-1, iX+2, 1):
for iPlanetY in range(iY-1, iY+2, 1):
pPlanetEdge = self.map.sPlot(iPlanetX, iPlanetY)
if (iPlanetX == iX and iPlanetY == iY):
continue
else:
pPlanetEdge.setTerrainType(self.planetClassMEdge,t rue,true)
if 1 <= iRnd <= 3:
for iPlanetX in range(iX-1, iX+2, 1):
for iPlanetY in range(iY-1, iY+2, 1):
pPlanetEdge = self.map.sPlot(iPlanetX, iPlanetY)
pPlanetEdge.setTerrainType(self.planetArctic,true, true)
if 4 <= iRnd <= 6:
for iPlanetX in range(iX-1, iX+2, 1):
for iPlanetY in range(iY-1, iY+2, 1):
pPlanetEdge = self.map.sPlot(iPlanetX, iPlanetY)
pPlanetEdge.setTerrainType(self.planetDesert,true, true)
if 7 <= iRnd <= 9:
for iPlanetX in range(iX-1, iX+2, 1):
for iPlanetY in range(iY-1, iY+2, 1):
pPlanetEdge = self.map.sPlot(iPlanetX, iPlanetY)
pPlanetEdge.setTerrainType(self.planetVolcanic,tru e,true)

civ editor11
Aug 06, 2009, 09:54 PM
Do I need to have planet core and grav field

TC01
Aug 06, 2009, 09:59 PM
Do I need to have planet core and grav field

Yes, you do. Gravity field is still important, it's a feature for black holes to draw ships in closer if they approach too close. But Planet Core is also important- but it needs to be a seperate feature.

civ editor11
Aug 06, 2009, 10:00 PM
New python errors

Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars
Traceback (most recent call last):

File "StarWars", line 571, in findStartingPlot

IndexError: list index out of range
ERR: Python function findStartingPlot failed, module StarWars

This crashes the game

TC01
Aug 07, 2009, 03:40 PM
Okay.

Delete the line: (it's the fourth line in the code block I posted above)

pPlanetCore.setFeatureType(self.planetCore,0)

Then, at the end of the code block I posted above, add this:

self.map.plot(iX, iY).setFeatureType(self.planetCore, 0)
print ("Planet Core Feature Type = %d", % (self.map.plot(iX, iY).getFeatureType()))

Make sure the indentations are accurate. The end of the block should look like this:

if 7 <= iRnd <= 9:
for iPlanetX in range(iX-1, iX+2, 1):
for iPlanetY in range(iY-1, iY+2, 1):
pPlanetEdge = self.map.sPlot(iPlanetX, iPlanetY)
pPlanetEdge.setTerrainType(self.planetVolcanic,tru e,true)
self.map.plot(iX, iY).setFeatureType(self.planetCore, 0)
print ("Planet Core Feature Type = %d", % (self.map.plot(iX, iY).getFeatureType()))

civ editor11
Aug 07, 2009, 08:47 PM
I need grahics for those buildings if There are no graphics I won't be able to add them in

civ editor11
Aug 07, 2009, 09:04 PM
New errors

Traceback (most recent call last):

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

File "<string>", line 35, in load_module

File "<string>", line 13, in _get_code

File "StarWars", line 379

print ("Planet Core Feature Type = 260742380", (self.map.plot(iX, iY).getFeatureType()))

^

SyntaxError: invalid syntax
Failed to load python module StarWars.
ERR: Call function getNumHiddenCustomMapOptions failed. Can't find module StarWars
Traceback (most recent call last):

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

File "<string>", line 35, in load_module

File "<string>", line 13, in _get_code

File "StarWars", line 379

print ("Planet Core Feature Type = 260742380", (self.map.plot(iX, iY).getFeatureType()))

^

SyntaxError: invalid syntax
Failed to load python module StarWars.
ERR: Call function getNumCustomMapOptions failed. Can't find module StarWars
Traceback (most recent call last):

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

File "<string>", line 35, in load_module

File "<string>", line 13, in _get_code

File "StarWars", line 379

print ("Planet Core Feature Type = 260742380", (self.map.plot(iX, iY).getFeatureType()))

^

SyntaxError: invalid syntax
Failed to load python module StarWars.
ERR: Call function getNumHiddenCustomMapOptions failed. Can't find module StarWars
Traceback (most recent call last):

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

File "<string>", line 35, in load_module

File "<string>", line 13, in _get_code

File "StarWars", line 379

print ("Planet Core Feature Type = 260742380", (self.map.plot(iX, iY).getFeatureType()))

^

SyntaxError: invalid syntax
Failed to load python module StarWars.
ERR: Call function getNumCustomMapOptions failed. Can't find module StarWars
Traceback (most recent call last):

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

File "<string>", line 35, in load_module

File "<string>", line 13, in _get_code

File "StarWars", line 379

print ("Planet Core Feature Type = 260742380", (self.map.plot(iX, iY).getFeatureType()))

^

SyntaxError: invalid syntax
Failed to load python module StarWars.
ERR: Call function getNumHiddenCustomMapOptions failed. Can't find module StarWars
Traceback (most recent call last):

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

File "<string>", line 35, in load_module

File "<string>", line 13, in _get_code

File "StarWars", line 379

print ("Planet Core Feature Type = 260742380", (self.map.plot(iX, iY).getFeatureType()))

^

SyntaxError: invalid syntax
Failed to load python module StarWars.
ERR: Call function getNumCustomMapOptions failed. Can't find module StarWars
Traceback (most recent call last):

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

File "<string>", line 35, in load_module

File "<string>", line 13, in _get_code

File "StarWars", line 379

print ("Planet Core Feature Type = 260742380", (self.map.plot(iX, iY).getFeatureType()))

^

SyntaxError: invalid syntax
Failed to load python module StarWars.
ERR: Call function isAdvancedMap failed. Can't find module StarWars

TC01
Aug 07, 2009, 09:04 PM
I need grahics for those buildings if There are no graphics I won't be able to add them in

I suggest you use a placeholder graphics like the Barracks or something like that for now. On the grand scheme of things getting a graphic for these buildings probably isn't too important compared, to, say, with fixing the mapscript...

I've finished adding in the Ion Pulse. I've also finished coding the random buildings- but I'm not sure about the function I wrote to place said random buildings. I want to refine it but not make it take forever. Which probably means adding it to the mapscript.

civ editor11
Aug 07, 2009, 09:16 PM
I'll use barracks as the graphics

civ editor11
Aug 07, 2009, 09:22 PM
Grav field is back in
I have all light/dark side promotions
Buildings will be in tomorrow
and units are still a work in progress

TC01
Aug 08, 2009, 09:04 AM
Oops, I missed a comma. Or rather, I had an extra comma. On line 379 change the print statement to this:

print ( "Planet Core Feature Type = %d" % (self.map.plot(iX, iY).getFeatureType()))

civ editor11
Aug 08, 2009, 10:31 AM
New error

Traceback (most recent call last):

File "StarWars", line 518, in addFeatures

File "StarWars", line 378, in addFeatures

RuntimeError: unidentifiable C++ exception
ERR: Python function addFeatures failed, module StarWars


Debug log

load_module StarWars

PY:Player 0's alive status set to: 1
PY:Player 1's alive status set to: 1
PY:Player 2's alive status set to: 1
PY:Player 3's alive status set to: 1
PY:Player 4's alive status set to: 1
PY:Player 5's alive status set to: 1
PY:Player 6's alive status set to: 1
PY:Player 7's alive status set to: 1
PY:Player 8's alive status set to: 1
PY:Player 9's alive status set to: 1
PY:Player 10's alive status set to: 1
PY:Player 18's alive status set to: 1

The game crashes still

TC01
Aug 08, 2009, 10:46 AM
Well, that's the line where I add FEATURE_PLANET_CORE, so we seem to have gotten to the problem. :)

def __initFeatureTypes(self):
self.featureForest = self.gc.getInfoTypeForString("FEATURE_FOREST")
self.featureIce = self.gc.getInfoTypeForString("FEATURE_ICE")
self.featureFallout = self.gc.getInfoTypeForString("FEATURE_FALLOUT")
self.featureJungle = self.gc.getInfoTypeForString("FEATURE_JUNGLE")
self.featureSupernovaArea = self.gc.getInfoTypeForString("FEATURE_SUPERNOVA_AREA")
self.featureOasis = self.gc.getInfoTypeForString("FEATURE_OASIS")
self.featureGravField = self.gc.getInfoTypeForString("FEATURE_GRAV_FIELD")
self.featureFloodPlain = self.gc.getInfoTypeForString("FEATURE_FLOOD_PLAINS")

#Planet terrain types
self.planetCore = self.gc.getInfoTypeForString("FEATURE_PLANET_CORE")
self.planetClassMCore = self.gc.getInfoTypeForString("TERRAIN_GRASS")
self.planetClassMEdge = self.gc.getInfoTypeForString("TERRAIN_PLAINS")
self.planetArctic = self.gc.getInfoTypeForString("TERRAIN_SNOW")
self.planetDesert = self.gc.getInfoTypeForString("TERRAIN_DESERT")
self.planetVolcanic = self.gc.getInfoTypeForString("TERRAIN_BURNING_SANDS")

Are you sure that all of these are in the Terrain and Feature XMLs?

If they are- try changing the "self.map." part of line 378 to CyMap()."

civ editor11
Aug 08, 2009, 11:13 AM
It works now i just had to add i n the burning sands terrain
I'll show you a screenshot soon

TC01
Aug 08, 2009, 11:32 AM
Hurray! After 4 pages of trying to solve this we finally have.

Make sure you credit The_J and God Emperor for helping me solve this issue.

Zipped is the python folder. As usual, any bugs, errors, etc. report them here and I'll solve them. I'm still not entirely happy with the planet code in this folder but that should be fixable in the future.

civ editor11
Aug 09, 2009, 05:05 PM
I found a bug with the force powers when you use them one of these errors will pop up I've posted a few of them

Traceback (most recent call last):

File "CvEventInterface", line 23, in onEvent

File "CvEventManager", line 193, in handleEvent

File "CvEventManager", line 511, in onPlotPicked

UnboundLocalError: local variable 'iDmgRnd' referenced before assignment
ERR: Python function onEvent failed, module CvEventInterface
Traceback (most recent call last):

File "CvEventInterface", line 23, in onEvent

File "CvEventManager", line 193, in handleEvent

File "CvEventManager", line 511, in onPlotPicked

UnboundLocalError: local variable 'iDmgRnd' referenced before assignment
ERR: Python function onEvent failed, module CvEventInterface
Traceback (most recent call last):

File "CvEventInterface", line 23, in onEvent

File "CvEventManager", line 193, in handleEvent

File "CvEventManager", line 511, in onPlotPicked

UnboundLocalError: local variable 'iDmgRnd' referenced before assignment
ERR: Python function onEvent failed, module CvEventInterface
Traceback (most recent call last):

File "CvScreensInterface", line 657, in handleInput

File "CvMainInterface", line 3219, in handleInput

AttributeError: 'CyGlobalContext' object has no attribute 'getPlot'
ERR: Python function handleInput failed, module CvScreensInterface
Traceback (most recent call last):

File "CvScreensInterface", line 657, in handleInput

File "CvMainInterface", line 3219, in handleInput

AttributeError: 'CyGlobalContext' object has no attribute 'getPlot'
ERR: Python function handleInput failed, module CvScreensInterface

TC01
Aug 09, 2009, 05:55 PM
There should be a line in onPlotPicked (around line 511, Event Manager) that looks like this:

iDmgRnd += 25 + CyGame().getSorenRandNum(25, "Force Power")

I need you to remove the plus sign directly before the equals sign, so it looks like this:

iDmgRnd = 25 + CyGame().getSorenRandNum(25, "Force Power")

Then, in the handleInput function in CvMainInterface, overwrite it entirely with this (I fixed a few more errors I found)

def handleInput (self, inputClass):

if (inputClass.getNotifyCode() == 11 and inputClass.getData1() == 660 and inputClass.getData2() == 660):
StarWars.iPushButton = 1
StarWars.iPushedButtonUnit = g_pSelectedUnit
CyInterface().setInterfaceMode(InterfaceModeTypes. INTERFACEMODE_PYTHON_PICK_PLOT)
if (inputClass.getNotifyCode() == 11 and inputClass.getData1() == 661 and inputClass.getData2() == 661):
StarWars.iPushButton = 2
StarWars.iPushedButtonUnit = g_pSelectedUnit
CyInterface().setInterfaceMode(InterfaceModeTypes. INTERFACEMODE_PYTHON_PICK_PLOT)
if (inputClass.getNotifyCode() == 11 and inputClass.getData1() == 662 and inputClass.getData2() == 662):
StarWars.iPushButton = 3
StarWars.iPushedButtonUnit = g_pSelectedUnit
CyInterface().setInterfaceMode(InterfaceModeTypes. INTERFACEMODE_PYTHON_PICK_PLOT)
if (inputClass.getNotifyCode() == 11 and inputClass.getData1() == 663 and inputClass.getData2() == 663):
StarWars.iPushButton = 4
StarWars.iPushedButtonUnit = g_pSelectedUnit
CyInterface().setInterfaceMode(InterfaceModeTypes. INTERFACEMODE_PYTHON_PICK_PLOT)
if (inputClass.getNotifyCode() == 11 and inputClass.getData1() == 664 and inputClass.getData2() == 664):
self.iPushedButtonUnit = g_pSelectedUnit
self.iPushedButtonUnit.setHasPromotion(gc.getInfoT ypeForString('PROMOTION_FORCE_CONCEALED'), true)
self.iPushedButtonUnit.changeMoves(60)
if (inputClass.getNotifyCode() == 11 and inputClass.getData1() == 665 and inputClass.getData2() == 665):
self.iPushedButtonUnit = g_pSelectedUnit
self.iPushedButtonUnit.changeMoves(60)
pUnitPlot = self.iPushedButtonUnit.plot()
iX = pUnitPlot.getX()
iY = pUnitPlot.getY()
for iiX in range(iX-1, iX+2, 1):
for iiY in range(iY-1, iY+2, 1):
pScreamPlot = CyMap().plot(iX, iY)
if not pScreamPlot == pUnitPlot:
if not pScreamPlot.getTerrainType() == gc.getInfoTypeForString('TERRAIN_SPACE'):
for i in range(pScreamPlot.getNumUnits()):
pScreamUnit = pScreamPlot.getUnit(i)
iDmgRnd += 25 + CyGame().getSorenRandNum(25, "Force Scream")
pScreamUnit.setDamage(pUnit.getDamage()+iDmgRnd, False)
if (inputClass.getNotifyCode() == 11 and inputClass.getData1() == 666 and inputClass.getData2() == 666):
self.iPushedButtonUnit = g_pSelectedUnit
self.iPushedButtonUnit.changeMoves(60)
pUnitPlot = self.iPushedButtonUnit.plot()
iX = pUnitPlot.getX()
iY = pUnitPlot.getY()
for iiX in range(iX-1, iX+2, 1):
for iiY in range(iY-1, iY+2, 1):
pBombPlot = CyMap().plot(iX, iY)
if not pBombPlot.getTerrainType() == gc.getInfoTypeForString('TERRAIN_SPACE'):
for i in range(pBombPlot.getNumUnits()):
pBombUnit = pBombPlot.getUnit(i)
pBombUnit.kill(false, -1)
if (inputClass.getNotifyCode() == 11 and inputClass.getData1() == 667 and inputClass.getData2() == 667):
StarWars.iPushButton = 5
StarWars.iPushedButtonUnit = g_pSelectedUnit
CyInterface().setInterfaceMode(InterfaceModeTypes. INTERFACEMODE_PYTHON_PICK_PLOT)
if (inputClass.getNotifyCode() == 11 and inputClass.getData1() == 668 and inputClass.getData2() == 668):
StarWars.iPushButton = 6
StarWars.iPushedButtonUnit = g_pSelectedUnit
CyInterface().setInterfaceMode(InterfaceModeTypes. INTERFACEMODE_PYTHON_PICK_PLOT)
if (inputClass.getNotifyCode() == 11 and inputClass.getData1() == 669 and inputClass.getData2() == 669):
self.iPushedButtonUnit = g_pSelectedUnit
self.iPushedButtonUnit.changeMoves(60)
pUnitPlot = self.iPushedButtonUnit.plot()
iX = pMeditationPlot.getX()
iY = pMeditationPlot.getY()
for i in range(pBombPlot.getNumUnits()):
pMeditationUnit = pMeditationPlot.getUnit(i)
pMeditationUnit.setHasPromotion(gc.getInfoTypeForS tring('PROMOTION_BATTLE_MEDITATION'), true)
if (inputClass.getNotifyCode() == 11 and inputClass.getData1() == 670 and inputClass.getData2() == 670):
StarWars.iPushButton = 7
StarWars.iPushedButtonUnit = g_pSelectedUnit
CyInterface().setInterfaceMode(InterfaceModeTypes. INTERFACEMODE_PYTHON_PICK_PLOT)
if (inputClass.getNotifyCode() == 11 and inputClass.getData1() == 671 and inputClass.getData2() == 671):
self.iPushedButtonUnit = g_pSelectedUnit
self.iPushedButtonUnit.changeMoves(60)
self.iPushedButtonUnit.setDamage(0, PlayerTypes.NO_PLAYER)
if (inputClass.getNotifyCode() == 11 and inputClass.getData1() == 672 and inputClass.getData2() == 672):
StarWars.iPushButton = 8
StarWars.iPushedButtonUnit = g_pSelectedUnit
CyInterface().setInterfaceMode(InterfaceModeTypes. INTERFACEMODE_PYTHON_PICK_PLOT)


return 0

civ editor11
Aug 09, 2009, 06:09 PM
I got this error after giving a jedi master force heal and regenerate

Traceback (most recent call last):

File "CvScreensInterface", line 705, in forceScreenRedraw

File "CvMainInterface", line 721, in redraw

File "CvMainInterface", line 1566, in updateSelectionButtons

AttributeError: 'NoneType' object has no attribute 'getButton'
ERR: Python function forceScreenRedraw failed, module CvScreensInterface

TC01
Aug 09, 2009, 06:20 PM
Is PROMOTION_LIGHT_SIDE_2 a valid tag in the XML? That error means I defined/you defined a promotion incorrectly and thus the game cannot find the button associated it (which is how i coded it in the Python). Or, for that matter, PROMOTION_LIGHT_SIDE_1. Those are the Force Heals and Force Regenerates.


Also, I think it would maybe be easier if you named the promotions Light Side 1, Light Side 2, etc. instead of Force Regenerate, Force Healing... did you already do this?

It's just that the LS 1 promotion allows more then just Force Regenerate/Force Healing (I don't remember which is which), and FFH which already implemented such a system uses this type of naming scheme, and it works fine.

Then in the promotion's help text you can have this:

<TEXT>
<Tag>TXT_KEY_PROMOTION_LIGHT_SIDE_1</Tag>
<English>[ICON_BULLET]Allows use of Force Regenerate ability</English>
<TEXT>

civ editor11
Aug 09, 2009, 06:37 PM
Wasn't force regenerate light side 2
When I end my turn when trying to play a game the game freezes. do you know what causes this?

TC01
Aug 09, 2009, 06:46 PM
Yeah, it was. Sorry. But the same applies for that.


When you end your turn, is this the first turn of the game?

Do you get a "Waiting for Other Civilizations" message? Or other circumstances?

If it's that, then the probable cause is that the AI is taking forever to decide what to do, probably because of something I did.

civ editor11
Aug 09, 2009, 06:50 PM
It says press enter to end turn but its slightly faded.
I gave it an hour to decide and it still didn't.
The task manager said it wasn't responding.

TC01
Aug 09, 2009, 07:17 PM
What difficulty level were you playing on?

Here are some things that might give the AI trouble:

1. Deciding how to assign citizens to work plots in the city
2. Deciding what to build
3. Deciding where to move it's units
4. Deciding what to research

1. What have you set the various terrain yields to? If you used the default ones, you should change them. I'm thinking the PLAINS and GRASS should have very high yields, GRASS should be the best, PLAINS second best, in all three categories. But balanced.

Whereas ICE and BURNING_SANDS should be high in production, but low in commerce and food (but enough food to feed a decently sized city), and likewise DESERT should be high in commerce but low in production and food (but again, it should produce just enough food).

If an AI started on an ice world, they would not be able to work any city tiles (if you used the default yields), and might produce problems...

2. Can the AI build anything? Or more to the point, in your city screen, can you build anything? Buildings, units? What right now are you capable of building?

3. The only issue here is if the AI decides to use it's first unit for exploration, but can't, because it knows there are no tiles said unit is capable of moving across within it's range save the tiles immediately surrounding it. So maybe I should try making that starting unit fortified or used for defense, or maybe I should give them a space unit as well that can cross space tiles.

4. If you're using the normal Civ 4 tech tree, you should be fine.

civ editor11
Aug 09, 2009, 08:31 PM
I've been playing on noble
Yes I can build things
and I'm using the default tech tree until T_Commander gets the tech tree finished which should be soon

civ editor11
Aug 09, 2009, 09:14 PM
This is the error when you end your turn the original problem was my fault the AI couldn't do anything because the terrain wasn't giving them what they needed to make decisions like commerce production and food. Now it does have a python error though

Traceback (most recent call last):

File "CvEventInterface", line 23, in onEvent

File "CvEventManager", line 193, in handleEvent

File "CvEventManager", line 377, in onBeginPlayerTurn

RuntimeError: unidentifiable C++ exception
ERR: Python function onEvent failed, module CvEventInterface
Traceback (most recent call last):

File "CvEventInterface", line 23, in onEvent

File "CvEventManager", line 193, in handleEvent

File "CvEventManager", line 377, in onBeginPlayerTurn

RuntimeError: unidentifiable C++ exception
ERR: Python function onEvent failed, module CvEventInterface
Traceback (most recent call last):

File "CvEventInterface", line 23, in onEvent

File "CvEventManager", line 193, in handleEvent

File "CvEventManager", line 377, in onBeginPlayerTurn

RuntimeError: unidentifiable C++ exception
ERR: Python function onEvent failed, module CvEventInterface
Traceback (most recent call last):

File "CvEventInterface", line 23, in onEvent

File "CvEventManager", line 193, in handleEvent

File "CvEventManager", line 377, in onBeginPlayerTurn

RuntimeError: unidentifiable C++ exception
ERR: Python function onEvent failed, module CvEventInterface
Traceback (most recent call last):

File "CvEventInterface", line 23, in onEvent

File "CvEventManager", line 193, in handleEvent

File "CvEventManager", line 377, in onBeginPlayerTurn

RuntimeError: unidentifiable C++ exception
ERR: Python function onEvent failed, module CvEventInterface
Traceback (most recent call last):

File "CvEventInterface", line 23, in onEvent

File "CvEventManager", line 193, in handleEvent

File "CvEventManager", line 377, in onBeginPlayerTurn

RuntimeError: unidentifiable C++ exception
ERR: Python function onEvent failed, module CvEventInterface
Traceback (most recent call last):

File "CvEventInterface", line 23, in onEvent

File "CvEventManager", line 193, in handleEvent

File "CvEventManager", line 377, in onBeginPlayerTurn

RuntimeError: unidentifiable C++ exception
ERR: Python function onEvent failed, module CvEventInterface
Traceback (most recent call last):

File "CvEventInterface", line 23, in onEvent

File "CvEventManager", line 193, in handleEvent

File "CvEventManager", line 377, in onBeginPlayerTurn

RuntimeError: unidentifiable C++ exception
ERR: Python function onEvent failed, module CvEventInterface
Traceback (most recent call last):

File "CvEventInterface", line 23, in onEvent

File "CvEventManager", line 193, in handleEvent

File "CvEventManager", line 377, in onBeginPlayerTurn

RuntimeError: unidentifiable C++ exception
ERR: Python function onEvent failed, module CvEventInterface
Traceback (most recent call last):

File "CvEventInterface", line 23, in onEvent

File "CvEventManager", line 193, in handleEvent

File "CvEventManager", line 377, in onBeginPlayerTurn

RuntimeError: unidentifiable C++ exception
ERR: Python function onEvent failed, module CvEventInterface
Traceback (most recent call last):

File "CvEventInterface", line 23, in onEvent

File "CvEventManager", line 193, in handleEvent

File "CvEventManager", line 377, in onBeginPlayerTurn

RuntimeError: unidentifiable C++ exception
ERR: Python function onEvent failed, module CvEventInterface

This doesn't crash the game you just have to click the error box enough times and it'll fade away

TC01
Aug 10, 2009, 10:30 AM
def onBeginPlayerTurn(self, argsList):
'Called at the beginning of a players turn'
iGameTurn, iPlayer = argsList
pPlayer = gc.getPlayer(iPlayer)
for i in range(pPlayer.getNumUnits()):
pUnit = pPlayer.getUnit(i)
if pUnit.isHasPromotion(gc.getInfoTypeForString('PROM OTION_MIND_TRICKED')):
pUnit.setHasPromotion(gc.getInfoTypeForString('PRO MOTION_MIND_TRICKED'), false)
if pUnit.isHasPromotion(gc.getInfoTypeForString('PROM OTION_FORCE_CONCEALED')):
pUnit.setHasPromotion(gc.getInfoTypeForString('PRO MOTION_FORCE_CONCEALED'), false)
if pUnit.isHasPromotion(gc.getInfoTypeForString('PROM OTION_BATTLE_MEDITATION')):
pUnit.setHasPromotion(gc.getInfoTypeForString('PRO MOTION_BATTLE_MEDITATION'), false)
if pUnit.isHasPromotion(gc.getInfoTypeForString('PROM OTION_ION_PULSED')):
pUnit.setHasPromotion(gc.getInfoTypeForString('PRO MOTION_ION_PULSED'), false)

Here is the function onBeginPlayerTurn.

Are all of those promotions correct? They are all awarded by force abilities- guess which force ability awards which. What they do is, they remove those promotions from each player's units on the beginning of that player's turn.

civ editor11
Aug 10, 2009, 12:40 PM
No but I'll add them in soon

TC01
Aug 10, 2009, 01:03 PM
No but I'll add them in soon

Then that is your C++ exception. :)

civ editor11
Aug 10, 2009, 01:08 PM
Could you make Ion pulse weaken the target a little?

civ editor11
Aug 10, 2009, 01:22 PM
New errors

Traceback (most recent call last):
ERR: Call function onEvent failed. Can't find module CvEventInterface
File "<string>", line 1, in ?
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
File "<string>", line 52, in load_module
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
File "CvEventInterface", line 13, in ?
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
File "<string>", line 52, in load_module
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
File "CvEventManager", line 14, in ?
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
File "<string>", line 52, in load_module
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
File "CvScreensInterface", line 19, in ?
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
File "<string>", line 52, in load_module
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
File "CvDanQuayle", line 8, in ?
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
File "<string>", line 35, in load_module
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
File "<string>", line 13, in _get_code
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
File "
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
CvGameUtils
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
", line
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
447
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
elif (iData1 = 672):
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
^
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
SyntaxError
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
:
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
invalid syntax
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
Failed to load python module CvEventInterface.
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

TC01
Aug 10, 2009, 01:40 PM
Could you make Ion pulse weaken the target a little?

Well, the point is that it adds the promotion PROMOTION_ION_PULSED. So you have to decide what that promotion does.

You can make it, for instance, grant a -10 or a -20 or even a -50 to combat strength if you want.

But the promotion wears off on the next turn.

All of the promotions I listed in that function are like this.


As for those errors- do you get any in-game failures or problems, or just those errors?

civ editor11
Aug 10, 2009, 01:44 PM
Those errors but thats when it loads up so i didn't try to play a game

TC01
Aug 10, 2009, 01:47 PM
Those errors but thats when it loads up so i didn't try to play a game

But do you actually get them when loading the game, or only in the log?

Since what change have they been occuring?

civ editor11
Aug 10, 2009, 01:55 PM
They started after I downloaded the python folder you posted here a while ago

civ editor11
Aug 10, 2009, 04:04 PM
I've removed many of my files from here because anyone can get the updated version at the current download

civ editor11
Aug 10, 2009, 06:34 PM
I tried playing a game and this happened

Traceback (most recent call last):
ERR: Call function onEvent failed. Can't find module CvEventInterface
File "<string>", line 1, in ?
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
File "<string>", line 52, in load_module
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
File "CvEventInterface", line 13, in ?
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
File "<string>", line 52, in load_module
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
File "CvEventManager", line 14, in ?
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
File "<string>", line 52, in load_module
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
File "CvScreensInterface", line 19, in ?
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
File "<string>", line 52, in load_module
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
File "CvDanQuayle", line 8, in ?
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
File "<string>", line 35, in load_module
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
File "<string>", line 13, in _get_code
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
File "
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
CvGameUtils
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
", line
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
447
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
elif (iData1 = 672):
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
^
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
SyntaxError
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
:
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
invalid syntax
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
Failed to load python module CvEventInterface.
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function pediaShow failed. Can't find module CvScreensInterface
ERR: Call function pediaShow failed. Can't find module CvScreensInterface
ERR: Call function pediaShow failed. Can't find module CvScreensInterface
ERR: Call function pediaShow failed. Can't find module CvScreensInterface
ERR: Call function pediaShow failed. Can't find module CvScreensInterface
ERR: Call function pediaShow failed. Can't find module CvScreensInterface
ERR: Call function pediaShow failed. Can't find module CvScreensInterface
ERR: Call function showHallOfFame failed. Can't find module CvScreensInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

Note: this includes the ones when the game starts

TC01
Aug 10, 2009, 06:55 PM
elif (iData1 = 672):

This line should be changed to:

elif (iData1 == 672):

It's in CvGameUtils, I think it's line 447, but if it's not, you can search for it.

civ editor11
Aug 11, 2009, 07:38 AM
Heres the python error log This stays up for the entire time and I have to exit out of Bts

TC01
Aug 11, 2009, 09:22 AM
Traceback (most recent call last):

File "CvScreensInterface", line 251, in pediaJumpToLeader

File "CvPediaMain", line 897, in pediaJump

File "CvPediaLeader", line 86, in interfaceScreen

RuntimeError: unidentifiable C++ exception
ERR: Python function pediaJumpToLeader failed, module CvScreensInterface

This means that a leader's art define is incorrect or missing, I think. I suggest you check your leader art.

Traceback (most recent call last):

File "CvEventInterface", line 23, in onEvent

File "CvEventManager", line 193, in handleEvent

File "CvEventManager", line 347, in onGameStart

File "StarWarsUtils", line 34, in assignPlanets

IndexError: list index out of range
ERR: Python function onEvent failed, module CvEventInterface

For this, now that we've fixed the mapscript, I can move the code used to assign random planet scripts directly into the mapscript (which will be a lot better). So I want you to remove the def assignPlanets function from StarWarsUtils.py (lines 30 to 41), and it's function call in CvEventManager in onGameStart, which should be line 347 and look like this:

StarWars.assignPlanets()

Then, can you please attach the fixed mapscript?

Traceback (most recent call last):

File "CvScreensInterface", line 705, in forceScreenRedraw

File "CvMainInterface", line 721, in redraw

File "CvMainInterface", line 1534, in updateSelectionButtons

AttributeError: 'NoneType' object has no attribute 'getButton'
ERR: Python function forceScreenRedraw failed, module CvScreensInterface

From 1533 to 1536 in CvMainInterface.py, overwrite those lines with this:

if pUnit.isHasPromotion(gc.getInfoTypeForString('PROM OTION_LIGHT_SIDE_3')):
screen.appendMultiListButton( "BottomButtonContainer", gc.getPromotionInfo(gc.getInfoTypeForString('PROMO TION_LIGHT_SIDE_3')).getButton(), 0, WidgetTypes.WIDGET_GENERAL, 663, 663, False )
screen.show( "BottomButtonContainer" )
iCount = iCount + 1

civ editor11
Aug 11, 2009, 01:15 PM
Sorry i knew the leader art define was wrong.

civ editor11
Aug 11, 2009, 01:38 PM
These are the newest errors first is from when you use Mind Trick, second when I try to use ion pulse

Traceback (most recent call last):

File "CvEventInterface", line 23, in onEvent

File "CvEventManager", line 193, in handleEvent

File "CvEventManager", line 520, in onPlotPicked

UnboundLocalError: local variable 'iDmgRnd' referenced before assignment
ERR: Python function onEvent failed, module CvEventInterface
Traceback (most recent call last):

File "CvEventInterface", line 23, in onEvent

File "CvEventManager", line 193, in handleEvent

File "CvEventManager", line 520, in onPlotPicked

UnboundLocalError: local variable 'iDmgRnd' referenced before assignment
ERR: Python function onEvent failed, module CvEventInterface

TC01
Aug 11, 2009, 02:35 PM
I thought I fixed this...

You need to remove the first plus sign (highlighted in red) from the line below:

iDmgRnd += 25 + CyGame().getSorenRandNum(25, "Force Power")

civ editor11
Aug 11, 2009, 03:01 PM
I got this after we did all those fixes so we might still have to do some of them

civ editor11
Aug 11, 2009, 03:13 PM
I haven't found any more bugs you done a great job

civ editor11
Aug 11, 2009, 04:25 PM
Heres the python folder I'm using now
I hope you find it useful

TC01
Aug 13, 2009, 07:49 PM
Thanks.


It just occured that somewhere, mixed up among the bug reports, there was a request to make hero units.

No python is necessary for this. You need to do some simple XML modification.

<UnitClassInfo>
<Type>UNITCLASS_DARTH_VADER</Type>
<Description>TXT_KEY_UNIT_DARTH_VADER</Description>
<iMaxGlobalInstances>1</iMaxGlobalInstances>
<iMaxTeamInstances>1</iMaxTeamInstances>
<iMaxPlayerInstances>1</iMaxPlayerInstances>
<iInstanceCostModifier>0</iInstanceCostModifier>
<DefaultUnit>UNIT_DARTH_VADER</DefaultUnit>
</UnitClassInfo>

This is Vader's unit class. It prevents you from making him more then once, for any player or team.

<Units>
<Unit>
<UnitClassType>UNITCLASS_DARTH_VADER</UnitClassType>
<UnitType>NONE</UnitType>
</Unit>
</Units>

This is the <Units> tag in CIV4CivilizationInfos.xml. It's where unique units are defined. However, here, we are making no other civ able to build Darth Vader except the civ who should (Empire, I assume). By saying that for this unitclass, whatever civ this is can build no unit, we essentially make him a hero unit.

civ editor11
Aug 14, 2009, 06:37 AM
Thanks this is great

TC01
Sep 24, 2009, 07:05 PM
I've updated it again. Changes:

-Added superweapons:

You must add a PROJECT_ and a UNIT_ for the following:


DEATH_STAR_PROTOTYPE
DEATH_STAR
DEATH_STAR_II
WORLD_DEVASTATOR
GALAXY_GUN
MASS_SHADOW_GENERATOR
DARK_REAPER
SUN_CRUSHER
CENTERPOINT_STATION


You must also add a PROMOTION_PROCESSING, which is applied to World Devastators once they are processing material from a planet. You can also make this weaken the World Devastator... maybe make it unable to move? And you need to add a FEATURE_GRAVITY_WELL. For now, I suggest using the Black Hole graphics, but maybe resizing it to be smaller (take up less plots) would be good. It should have a high movement cost.

Finally for Superweapons, the following units are "processeable" by the World Devastator and should be in the game:

lProcesseableUnits = [ 'UNIT_TIE_FIGHTER', 'UNIT_TIE_BOMBER', 'UNIT_TIE_DEFENDER',
'UNIT_AT-AT', 'UNIT_AT-ST', 'UNIT_DREADNOUGHT','UNIT_INTERDICTOR']

-Added Starbases:

The following Starbase stuff must be added.


BUILD_STARBASE_I (Builds IMPROVEMENT_STARBASE)
BUILD_STARBASE_II (Builds IMPROVEMENT_STARBASE)
BUILD_STARBASE_III (Builds IMPROVEMENT_STARBASE)
UNIT_STARBASE_I
UNIT_STARBASE_II
UNIT_STARBASE_III
IMPROVEMENT_STARBASE


You'll also need to add some kind of space construction ship (you could use the Final Fronter unit for that) to be able to build a starbase.

(None of this is in the spoiler on the first post yet. It will be added eventually).

civ editor11
Sep 24, 2009, 07:07 PM
I'll get on this as soon as I finish with the new SDK code.

TC01
Oct 29, 2009, 05:48 PM
Since no one listened to civ_editor when he told them to repost their bugs in respective threads, I'm not sure if this was the only problem reported. But the attached CvEventManager.py below fixes a problem where certain nukes do not do anything.

In regards to the other issues identified as "python" issues:

1. If the Death Star has Force Regenerate, this is an XML issue... Buttons only appear for units with the Force promotions OR with the Ion pulse promotion. Or, Worldbuilder was used to give it those promotions.

2. While a mapscript issue, not a python issue, the reason Deer are in space is because the old Civ IV resources are still in the game. Resource placement is done in XML, not in the mapscript.