1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Need help with strange bug

Discussion in 'Civ4 - Creation & Customization' started by deanej, Aug 4, 2010.

  1. deanej

    deanej Deity

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    I recently converted my Star Trek mod to use Final Frontier Plus as a base and I have a strange bug. A few turns in to the game, I get messages saying a bunch of civs have been killed. However, those civs were never even on the map. In fact, I'm pretty sure it consists of EVERY civ that isn't on the map. I'm not sure what could possibly cause this to happen.

    You can download 4.0 here; it does require Star Trek installed, but if you rename the "Star Trek 400" folder (and the ini) to just "Star Trek" you can get away with installing just the .fpk files in the Assets folder (note that this will give you errors with the music, but it should otherwise function normally).
     
  2. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    31,104
    Location:
    Germany / Netherlands
    No exact idea here.

    Is it maybe directly after 10 rounds?
     
  3. deanej

    deanej Deity

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    It's never on the same turn (not always in the game, either), but when it happens it's always between 5 and 15 turns (possibly between 5 and 10, I didn't keep track of the ones that happened just after I did the conversion).

    Could it be in any way related to the isVictory python callback? It was changed in Final Frontier Plus as cities start pre-founded, so there shouldn't be a need for the 10 turn delay that Firaxis put in.
     
  4. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    31,104
    Location:
    Germany / Netherlands
    mmhh...
    Did you try to look at a fresh made scenario file from a game?
    If the civs are there (however), then they have to be mentioned in the WB file.
     
  5. deanej

    deanej Deity

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    Just looked at one. Those civs aren't there; also didn't get the bug until turn 17 this time!
     
  6. tchristensen

    tchristensen Emperor

    Joined:
    Jul 21, 2010
    Messages:
    1,241
    Location:
    Grand Rapids, Mi
    I wonder if it is some Event in the game that has its trigger based on a relationship to Civs both in and out of the game?

    That is what it sounds like to me -- an Event gone awry?
     
  7. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    31,104
    Location:
    Germany / Netherlands
    No, that event would not trigger.

    Deanej, do you have a debug dll?

    Maybe this thread should be moved to the FF+ subforum :think:.
     
  8. deanej

    deanej Deity

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    Don't even have events yet. Do have a debug DLL; no asserts at the time the messages appear (during a different turn than last time even though I'm pretty sure it was the same game).
     
  9. TC01

    TC01 Deity

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    You have the Inhabited Planets goodies on, correct? Do you have the "spawn new civ" one set up?

    The only thing I can possibly think of it is related to the untested code I have to spawn new civs for that goody. That goody in Final Frontier Plus is disabled. If you have it enabled, try disabling it (removing it from CIV4HandicapInfos.xml).
     
  10. deanej

    deanej Deity

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    That seems to do it; went 50 turns without seeing anything weird (related to the problem anyways; looks like the Xindi UW is broken). I actually thought about it earlier and then forgot about it.
     
  11. TC01

    TC01 Deity

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    Oh, I know what it is. I'm not breaking after I find a civ to create. So I suspect what's happening is every single civilization-leader combo that can be created is being created, destroying the previous civilization....

    Here's the code in the DLL, at the bottom of CvPlayer::receiveGoody():

    Code:
    	if (GC.getGoodyInfo(eGoody).isNewCiv())
    	{
    		int iNumTries = 50;		//(There aren't 50 civs in the game, so this should be plenty.
    		for (int i = 0; i < iNumTries; ++i)
    		{
    			CivilizationTypes eCiv = (CivilizationTypes)GC.getGame().getSorenRandNum(GC.getNumCivilizationInfos()-1, "Goodies!");
    			if (eCiv != (CivilizationTypes)GC.getDefineINT("BARBARIAN_PLAYER"))
    			{
    				if (GC.getCivilizationInfo(eCiv).isAlien())
    				{
    					if (goodyCanSpawnCiv(eCiv))
    					{
    						PlayerTypes eSlot;
    						for (int iPlayer = 0; iPlayer < GC.getMAX_PLAYERS(); ++iPlayer)
    						{
    							PlayerTypes ePlayer = (PlayerTypes)iPlayer;
    							if (ePlayer != NO_PLAYER)
    							{
    								if (!(GET_PLAYER(ePlayer).isEverAlive()))
    								{
    									eSlot = ePlayer;
    								}
    							}
    						}
    						LeaderHeadTypes eLeader = (LeaderHeadTypes)goodyGetLeaderForCiv(eCiv);
    						GC.getGame().addPlayer(eSlot, eLeader, eCiv);
    						[COLOR="Red"]break;[/COLOR]
    					}
    				}
    			}
    		}
    	}
    If you add the break statement in red it should be fixed.
     
  12. deanej

    deanej Deity

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    Did that; I still get the message that one civ has been destroyed when that goody triggers; I think the ship on the solar system kills the civ.

    I can't seem to fix the Xindi UW bug. It's not adding the population to newly colonized systems, even though I have this code at the bottom of onCityBuilt before the AI city update:
    Code:
    		#Xindi Council
    		iBath = gc.getInfoTypeForString("BUILDING_XC")
    		if (pPlayer.getBuildingClassCount(iBath) > 0):
                            pCity.changePopulation(1)
     
  13. tchristensen

    tchristensen Emperor

    Joined:
    Jul 21, 2010
    Messages:
    1,241
    Location:
    Grand Rapids, Mi
    I was digging around in some old python mods and I found this:

    http://forums.civfanatics.com/downloads.php?do=file&id=12917

    And I wonder if this could be something of what is going on. I looked in the .py and it declares that it "kills" off a bunch of civilizations so that it can later create new ones. Maybe there is something similar in your mod?
     
  14. TC01

    TC01 Deity

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    I believe I tried killing the unit, either in the DLL or in onGoodyReceived in the Python, and I'm pretty sure that caused a crash.

    The only thing I can think of is to try moving the unit off of the tile before creating the city. Or maybe not create the city until after the unit moves off of the tile? I don't know.

    I don't know why the Xindi thing isn't working, but I know what I'd do is first make sure the check for the Xindi Council is working (something like print "Got here!").

    No, I don't think so (I did not use Revolutions as a base for this part of the mod). The first problem has been dealt with, and I'm pretty sure deanej is right that the ship on the tile is killing the civ when it spawns.
     
  15. deanej

    deanej Deity

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    I figured out the Xindi Council bug: it was a building/buildingclass mixup (which means that the bug existed since 3.0 but I could have sworn I tested the UWs).

    I think I'll have the goody event move the unit to the left (it's easiest to compensate for the map that way) and make the Borg changes then re-release 4.0; at the very least, the Borg stuff will probably need balancing.

    EDIT: This doesn't fix the problem because the unit doesn't say put once moved. I have this code put in right at the start of the new civ goody code:
    Code:
    		int iX = 0;
    		int iY = pPlot->getY();
    
    		if((pPlot->getX() - 1) < 0)
    			iX = pPlot->getX() + 1;
    		else
    			iX = pPlot->getX() - 1;
    
    		CvPlot* pNewPlot = GC.getMap().plot(iX,iY);
    		pUnit->MoveTo(pNewPlot);
    But the unit doesn't stay on the new plot - it immediately moves to the plot the goody was on, killing the new civ.
     
  16. TC01

    TC01 Deity

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    Try calling finishMoves() on the unit. That should prevent it from moving back (I think).
     
  17. deanej

    deanej Deity

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    Nope, but it doesn't lose a movement point when going back - actually it never gets there first! I suspect goodies are processed mid-move and that whatever puts the unit on the tile is called after the goody code is.
     

Share This Page