Wormholes for MOO2Civ Modcomp

TC01

Deity
Joined
Jun 28, 2009
Messages
2,216
Location
Irregularly Online
Wormholes v1.4 for MOO2Civ 5.0

This modcomp will add my Wormholes modcomp (available for Final Frontier and Star Trek, as well as included in Final Frontier Plus) to MOO2Civ 5.0. It also includes the EnclosedSpace mapscript that I was working on some time ago- that creates a region of "Antaran space" and a barbarian system, reachable only by wormhole.

I'm releasing this as a modmod since it appears that attempts by JEELEN to merge it in have not been successful. And I could provide limited support since I didn't have a version of Wormholes running with MOO2Civ. I've tested this version, and on my end, it works. (I wouldn't release it otherwise). If it doesn't work for you, please let me know and I'll try to fix it.

Finally, newer versions include a few bugfixes for MOO2Civ errors. Both a fix for Worldbuilder and fixes for various Python exceptions (due to references to Final Frontier stuff that didn't exist anymore).

Features:
-Three new mapscripts (Wormholes, WormholesSpiralGalaxy, EnclosedSpace)
-Three Wormhole features (of three different colors) that allow instantaneous travel between each other
-In-game documentation
-Two minor things- public maps (non-MOO2Civ maps) are no longer enabled, and a fix by God-Emperor that should help decrease lag each turn.
-Bugfix for MOO2Civ's Worldbuilder- you can now load and save scenarios!
-Bugfix for MOO2Civ- all the Python exceptions have gone away

More details can be found in the respective threads for each subcomponent.

Download Here

Code:
v1.4 Changelog:
-Fixed a bug where systems were not created on the start of a game

v1.3 Changelog:
-Fixed a lot of MOO2Civ Python exceptions (can't find enum type errors)

v1.2 Changelog:
-Fixed MOO2Civ bug with saving/loading of Worldbuilder Saves

v1.1 Changelog:
-Fixed bug with wormholes on the same X or Y axis

To Install:

1. Extract the files into a temporary directory.

2. There should be a MOO2Civ 5.0 folder in the extracted files. Copy it into Beyond the Sword\Mods. Be warned: this will overwrite:

-MOO2Civ 5.0.ini
-CvAI.py
-CvFinalFrontierEvents.py
-CvSolarSystem.py

If you have changed those files, you may wish to back them up.

3. Start up the game. In the civilopedia, you should see three new features, and if you go to start a game, you will see three new mapscripts.

Credits:
TC01

JEELEN (suggestions, maker of MOO2Civ)
God-Emperor (a lot of help)
The_J, Deliverator (for helping me make the Barzan Wormhole graphics)
renegadechicken (suggestions)
deanej (Star Trek Mod, FF Flat mapscript)
cephalo (SpiralGalaxy mapscript)

Firaxis/2K Games (for making Civ 4)
 
Works like a charm! :cooool:

Highly recommended for everyone who has downloaded v. 5.0. :thumbsup:

EDIT 1: I've added a link to your modcomp on the v. 5.0 DL page.

EDIT 2: Tried out all 3 mapscripts, but I found there's an issue with the Enclosed Space one: loading a savegame resulted in the disappearance of all visible star system features and the City screen shows no population (I think this occurred before, but don't if/how it was fixed).
 

Attachments

  • Planets unvisible no population0000.JPG
    Planets unvisible no population0000.JPG
    107.8 KB · Views: 373
AFAIK it's a Worldbuilder issue: I haven't yet gotten that to work yet w/MOO2Civ. (The screenshot doesn't show that there also get 5000 score points added when reloading the savegame.)
 
:hmm: I'm afraid I found another glitch: in my second game on a Large Spiral Galaxy wormhole map a Destroyer "entered" a Blue Wormhole, but nothing happened. (Extra odd, because in my first game they seemed to work perfectly...)
 
:hmm: I'm afraid I found another glitch: in my second game on a Large Spiral Galaxy wormhole map a Destroyer "entered" a Blue Wormhole, but nothing happened. (Extra odd, because in my first game they seemed to work perfectly...)

Well, I just tested Large WormholesSpiralGalaxy with all wormhole order configurations that would place a blue wormhole and things worked okay.

The only way (at least, that I am aware of) that a wormhole could not work is that for some reason only one wormhole, instead of two, is placed by a mapscript. Did only one Blue Wormhole get placed in your game?
 
No, there's two Blue Wormholes in the game. I find it puzzling as it's the only non-functioning wormhole I encountered; whatever type, they work. (I just started another game on a Huge Spiral map: no problems.) I can post a savegame if it helps?
 
No, there's two Blue Wormholes in the game. I find it puzzling as it's the only non-functioning wormhole I encountered; whatever type, they work. (I just started another game on a Huge Spiral map: no problems.) I can post a savegame if it helps?

You might as well post the savegame. I'm not sure why it wouldn't be working in one game but working in another.
 
I take it your save was done in a test of "MOO2Civ 5.1" because when I try to load the save, it says "Mods\MOO2Civ 5.1 is an invalid mod directory, ignoring"... and loads vanilla BTS. I opened the save in Notepad++ and discovered that I can change the mod directory to "MOO2Civ 5.0" (even though the rest of the file is strange characters, the mod directory was not).

Anyway:

I've figured it out!

Your two Blue Wormholes have the same x coordinates. This is screwing up the check to see if the plots are the same, because I wrote it as "and" instead of "or".

Code:
if (pWormhole.getX() != iX and pWormhole.getY() != iY):

If you change that "and" (on line 1381 in CvFinalFrontierEvents.py) to "or" it will fix the problem.
 
Yes, I renamed a backup version to 5.1 (can't have two 5.0s, obviously; probably should have added that). Thanks, I'll put that in. ;)
 
I've released v1.2. This fixes all issues with Worldbuilder (the "You have been defeated!!!" message when loading a scenario).

It's not really relevant to Wormholes, but since both Wormholes and the Worldbuilder fix use one of the same files, it was easier to just bundle them together.
 
Very odd, but I once again got a failed wormhole with v. 1.2... :( (Doubly odd cos it had been fixed in 1.1 and 1.2 includes no wormhole related changes.) :crazyeye:

Here's the savfile if you want to have a look at it.
 

Attachments

  • Psilons 5.0 Bad Wormhole 2.0.CivBeyondSwordSave
    176.7 KB · Views: 224
I'm not sure- the save works on my computer.

Because I've since edited CvFinalFrontierEvents.py to get rid of all those "enum type not found" errors, I at first wondered if it could be that Wormholes 1.2 doesn't have the bugfix from Wormholes 1.1. But I downloaded 1.1 and all was fine.

So I'm not sure. Could you open your CvFinalFrontierEvents and take a look at what it says on line 1349, under onUnitMove (easily done using Notepad++)? Is there an and or an or?
 
Checked by looking for onunitmove, but i don't see any and and/or or in this bit from CvFinalFrontierEvents.py:

def onUnitMove(self, argsList):
'unit move'
pPlot,pUnit,pOldPlot = argsList

#Wormhole code -- TC01
#if gc.getInfoTypeForString('FEATURE_WORMHOLE') != -1:
if pPlot.getFeatureType() == gc.getInfoTypeForString('FEATURE_WORMHOLE'):
iX = pPlot.getX()
iY = pPlot.getY()
for i in range (CyMap().numPlots()):
pWormhole = CyMap().plotByIndex(i)
if pWormhole.getFeatureType() == gc.getInfoTypeForString('FEATURE_WORMHOLE'):
if (pWormhole.getX() != iX or pWormhole.getY() != iY):
iiX = pWormhole.getX()
iiY = pWormhole.getY()
pUnit.setXY(iiX, iiY, False, True, True)
if pPlot.getFeatureType() == gc.getInfoTypeForString('FEATURE_RED_WORMHOLE'):
iX = pPlot.getX()
iY = pPlot.getY()
for i in range (CyMap().numPlots()):
pRedWormhole = CyMap().plotByIndex(i)
if pRedWormhole.getFeatureType() == gc.getInfoTypeForString('FEATURE_RED_WORMHOLE'):
if (pRedWormhole.getX() != iX and pRedWormhole.getY() != iY):
iiX = pRedWormhole.getX()
iiY = pRedWormhole.getY()
pUnit.setXY(iiX, iiY, False, True, True)
if pPlot.getFeatureType() == gc.getInfoTypeForString('FEATURE_PURPLE_WORMHOLE'):
iX = pPlot.getX()
iY = pPlot.getY()
for i in range (CyMap().numPlots()):
pPurpleWormhole = CyMap().plotByIndex(i)
if pPurpleWormhole.getFeatureType() == gc.getInfoTypeForString('FEATURE_PURPLE_WORMHOLE'):
if (pPurpleWormhole.getX() != iX and pPurpleWormhole.getY() != iY):
iiX = pPurpleWormhole.getX()
iiY = pPurpleWormhole.getY()
pUnit.setXY(iiX, iiY, False, True, True)
#End of wormhole code -- TC01

And that's the only part of code that contains an OnUnitMove...
 
Checked by looking for onunitmove, but i don't see any and and/or or in this bit from CvFinalFrontierEvents.py:

Code:
    def onUnitMove(self, argsList):
        'unit move'
        pPlot,pUnit,pOldPlot = argsList
        
#Wormhole code -- TC01
        #if gc.getInfoTypeForString('FEATURE_WORMHOLE') != -1:
        if pPlot.getFeatureType() == gc.getInfoTypeForString('FEATURE_WORMHOLE'):
            iX = pPlot.getX()
            iY = pPlot.getY()
            for i in range (CyMap().numPlots()):
                pWormhole = CyMap().plotByIndex(i)
                if pWormhole.getFeatureType() == gc.getInfoTypeForString('FEATURE_WORMHOLE'):
                    if (pWormhole.getX() != iX or pWormhole.getY() != iY):
                        iiX = pWormhole.getX()
                        iiY = pWormhole.getY()
                        pUnit.setXY(iiX, iiY, False, True, True)
        if pPlot.getFeatureType() == gc.getInfoTypeForString('FEATURE_RED_WORMHOLE'):
            iX = pPlot.getX()
            iY = pPlot.getY()
            for i in range (CyMap().numPlots()):
                pRedWormhole = CyMap().plotByIndex(i)
                if pRedWormhole.getFeatureType() == gc.getInfoTypeForString('FEATURE_RED_WORMHOLE'):
                    if (pRedWormhole.getX() != iX and pRedWormhole.getY() != iY):
                        iiX = pRedWormhole.getX()
                        iiY = pRedWormhole.getY()
                        pUnit.setXY(iiX, iiY, False, True, True)
        if pPlot.getFeatureType() == gc.getInfoTypeForString('FEATURE_PURPLE_WORMHOLE'):
            iX = pPlot.getX()
            iY = pPlot.getY()
            for i in range (CyMap().numPlots()):
                pPurpleWormhole = CyMap().plotByIndex(i)
                if pPurpleWormhole.getFeatureType() == gc.getInfoTypeForString('FEATURE_PURPLE_WORMHOLE'):
                    if (pPurpleWormhole.getX() != iX and pPurpleWormhole.getY() != iY):
                        iiX = pPurpleWormhole.getX()
                        iiY = pPurpleWormhole.getY()
                        pUnit.setXY(iiX, iiY, False, True, True)
#End of wormhole code -- TC01
And that's the only part of code that contains an OnUnitMove...

I see the problem (at least, once I put code tags around everything).

When I explained what the problem was, I mentioned that to fix it, you change this line:

Code:
if (pWormhole.getX() != iX [COLOR="red"]and[/COLOR] pWormhole.getY() != iY):

to

Code:
if (pWormhole.getX() != iX [COLOR="Red"]or[/COLOR] pWormhole.getY() != iY):

However, I did not mention that for the other wormholes, you must do the same- change the lines:

Code:
if (pRedWormhole.getX() != iX [COLOR="Red"]and[/COLOR] pRedWormhole.getY() != iY):

and:

Code:
if (pPurpleWormhole.getX() != iX [COLOR="red"]and[/COLOR] pPurpleWormhole.getY() != iY):

to have an or as well (in place of the and). Now, my version of the file (and the one posted for download) has these changes, so I'm not sure why you wouldn't have that change. But if you make the changes above, it should fix the problem.
 
Thanks for looking into that. Since I'm the only one reporting this I'll assume it only occurs with me... oddly. :crazyeye:
 
Top Bottom