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

Modmodding Q&A Thread

Discussion in 'Rhye's and Fall - Dawn of Civilization' started by Leoreth, Dec 14, 2013.

  1. Mouthwash

    Mouthwash Escaped Lunatic

    Joined:
    Sep 26, 2011
    Messages:
    9,368
    Location:
    Hiding
    Yes, but does that change from era to era? Surely medieval christian music wouldn't be heard in 1864 AD?
    And I lol'd that the huge tutorial. I just stuff them in there.
     
  2. Mouthwash

    Mouthwash Escaped Lunatic

    Joined:
    Sep 26, 2011
    Messages:
    9,368
    Location:
    Hiding
    OK, this is weird. Upon loading up a German game, I noticed an Egyptian lion loitering near Vienna. I quickly deleted it (sorry I don't have a save) and went back to remove it from the scenario. I was 100% sure that was what was causing it. But I can't find the lion anywhere. I looked at the entire map in WB with all units highlighted, and clicked on each stack to search. There's nothing there. Maybe it was just the game acting screwy again... I've known it to put Ethiopian catapults randomly in Antarctica. But still, it's a huge coincidence that it happened to be an Egyptian lion. I had just opened WB and don't see how I could have accidentally placed it there.

    Anyway, maybe it's because of Ethiopia? I put them in the scenario.
     
  3. Lone Wolf

    Lone Wolf Deity

    Joined:
    Dec 4, 2006
    Messages:
    9,908
    Eyptian lions often spring into existence as a result of WorldBuilder unit adding misclicks, since Egypt is the first civ in the list, while lion is the first unit.
     
  4. Mouthwash

    Mouthwash Escaped Lunatic

    Joined:
    Sep 26, 2011
    Messages:
    9,368
    Location:
    Hiding
    I know, I've done them aplenty.
     
  5. Leoreth

    Leoreth Prince of Blood Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,961
    Gender:
    Male
    Location:
    House of Hades
    Yeah, that's right, so that's not the reason. The game doesn't create Egyptian lions on its own so if you see one, that was your doing (the catapults in Antarctica are related to the autoplay mode).

    Could you give a quick summary of your changes? Most importantly, what's your starting date?

    Since the normal ancient/classical/medieval etc. sequence of soundtracks already contains Christian chants for the Middle Ages, you have to be Christian to have them as soundtracks (I have also added 1-2 extra Christian music pieces from SoI).

    Then there are a couple of special cases that "override" the normal eras under the following conditions:

    - Muslim: different music for the Medieval era (and Renaissance maybe? Not sure) if state religion is Islam or Zoroastrianism
    - East Asia: different music for the Classical, Medieval and Renaissance eras if state religion is Confucianism or Taoism, or your state religion is Buddhism and you're China, Korea, Mongolia or Japan
    - South Asia: different music for the Classical, Medieval and Renaissance if state religion is Hinduism or state religion is Buddhism and you're not China, Korea, Mongolia or Japan
    - "Heathens": civs without a state religion will continue to get the Classical soundtrack in the Medieval era (typical civs are the early Vikings and Congolese, as well as the Native Americans)

    (I should note that the South Asia soundtrack is identical to the East Asia soundtrack unless you have the soundtrack module.)

    You can easily change the tracks of the single soundtracks by locating the respective dummy era. Adding new conditional soundtracks or changing the conditions requires a DLL change.
     
  6. mrrandomplayer

    mrrandomplayer Hopeless Situation Warrior

    Joined:
    Aug 1, 2012
    Messages:
    3,320
    Gender:
    Male
    Location:
    The land of prequel memes
    Do you know anything about my communications/interface bugs?
     
  7. Mouthwash

    Mouthwash Escaped Lunatic

    Joined:
    Sep 26, 2011
    Messages:
    9,368
    Location:
    Hiding
    Take a look here: View attachment Mouthwash's 600 AD.CivBeyondSwordWBSave

    I can't even remember all the changes. The starting date is still 600 AD and I added and then removed the Tamils. It's not done, but I'll have to learn how to edit stability maps and spawn areas before I can really balance it.

    Why does Guiyang disappear ingame if I add it to the scenario? China never founds it on its own.

    How do I edit the soundtrack module? Is there a guide for editing the DLL?
     
  8. Leoreth

    Leoreth Prince of Blood Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,961
    Gender:
    Male
    Location:
    House of Hades
    I'll glance over it later.

    Guiyang also exists in the 600 AD scenario so that its culture covers areas that are meant to be surrounded by the Great Wall, and afterwards removed. Look in initScenario() RiseAndFall.py, for the 600 AD scenario (and every other scenario that starts in 600 AD) there should a method like prepareChina or something that does that.

    You can edit the soundtrack module like the main mod, the only difference is that its Assets are in the Modules folder. There are guides for compiling the DLL in the Creation & Customization -> Modding Tutorials subforum.
     
  9. NKN

    NKN Prince

    Joined:
    Aug 10, 2011
    Messages:
    342
    Location:
    GMT-5
    None, at least in PythonDbg.log and PythonErr.log
     
  10. mrrandomplayer

    mrrandomplayer Hopeless Situation Warrior

    Joined:
    Aug 1, 2012
    Messages:
    3,320
    Gender:
    Male
    Location:
    The land of prequel memes
    How do you make the flip area of a civ bigger or smaller, like you did for Persia? What I'm trying to do is make the Moor's flip area smaller if Carthage is controlled by the player.

    Additionally, how do you make the core area of a civ change later? Right now a Carthage without Sur has no core population, and I'm trying to change that.
     
  11. Mouthwash

    Mouthwash Escaped Lunatic

    Joined:
    Sep 26, 2011
    Messages:
    9,368
    Location:
    Hiding
    Thanks. I found this and deleted it:

    It worked, but now I get a exception message when I start a game. Have I done something wrong?
     
  12. Leoreth

    Leoreth Prince of Blood Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,961
    Gender:
    Male
    Location:
    House of Hades
    What if you only change the starting year without renaming the scenario?

    Look in initBirth() in RiseAndFall.py.

    Every player has a reborn value. I use it to implement actual rebirths, so a reborn civ has a different stability map / core area than its "unreborn" predecessor. I abuse this mechanic to change the stability areas for civs whose slot isn't used by a rebirth.

    This already happens for Phoenicia as soon as they acquire Carthage, though.

    You should not delete the complete method, because the code still tries to call it somewhere and produces an error when it doesn't find it. Instead, just make "return" the first line after "def prepareChina", you can even keep everything after it.
     
  13. NKN

    NKN Prince

    Joined:
    Aug 10, 2011
    Messages:
    342
    Location:
    GMT-5
    It freezes as well.
     
  14. mrrandomplayer

    mrrandomplayer Hopeless Situation Warrior

    Joined:
    Aug 1, 2012
    Messages:
    3,320
    Gender:
    Male
    Location:
    The land of prequel memes
    Thanks for your quick responses. However, even when I make Carthage reborn at the beginning of the scenario, it shows the proper core areas but does not register them as core population. Also, I am having a problem with communicAtions. Everyone knows each other for a while, and everyone has a few votes in the AP. Do you know what the problem is,
     
  15. Mouthwash

    Mouthwash Escaped Lunatic

    Joined:
    Sep 26, 2011
    Messages:
    9,368
    Location:
    Hiding
    Tried it and it gave me the defeated at startup bug. Can you show me how in the code I gave?
     
  16. IrishDragon

    IrishDragon Legend

    Joined:
    Mar 1, 2006
    Messages:
    443
    Do we need a makefile to compile the .dll or is there a way of making it yourself?
     
  17. Leoreth

    Leoreth Prince of Blood Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,961
    Gender:
    Male
    Location:
    House of Hades
    This could be a bug ...

    I have no idea.

    You should enable Python exceptions.

    I suggest just following the guides in the tutorial section, which also provide a makefile.
     
  18. mrrandomplayer

    mrrandomplayer Hopeless Situation Warrior

    Joined:
    Aug 1, 2012
    Messages:
    3,320
    Gender:
    Male
    Location:
    The land of prequel memes
    I think the stability is just a bug, or I actually need to manually reset the stability rather than just put:
    Code:
    if getScenario()==500AD:
            #blah blah blah random definitions relating to the scenario
            pCarthage.setReborn()
    Not that I'm typing from memory on my iPad and I'm too lazy to spell out the other definitions here, so that isn't the problem.

    I think the communications bugs have to do with the communications pool. I tried to solve the problem by doing:

    Code:
    #blah blah blah 3rd pool stuff
            while self.getScenario() == con.i500AD and self.getTurnForYear < (900):
                    break
    To break from the communications loop. That doesn't work, however. How would I break from a communications loop?
     
  19. Leoreth

    Leoreth Prince of Blood Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,961
    Gender:
    Male
    Location:
    House of Hades
    Nope, that should be enough, I'm also not doing more than that. But I'll check this.

    Which loop are you talking about (line number)?
     
  20. srpt

    srpt Deist

    Joined:
    May 10, 2010
    Messages:
    2,038
    Location:
    Toronto
    I've succeeded in limiting some units to a certain number of instances per resource instance controlled by the player. here is the code in CvPlot::canTrain:

    Spoiler :
    Code:
    		if (GC.getUnitInfo(eUnit).getPrereqAndBonus() != NO_BONUS)
    		{
    			if (NULL == pCity)
    			{
    				if (!isPlotGroupConnectedBonus(getOwnerINLINE(), (BonusTypes)GC.getUnitInfo(eUnit).getPrereqAndBonus()))
    				{
    					return false;
    				}
    			}
    			else
    			{
    				if (!pCity->hasBonus((BonusTypes)GC.getUnitInfo(eUnit).getPrereqAndBonus()))
    				{
    					return false;
    				}
    			}
    		//}
    		// srpt resource unit restriction mk II
    			int iJ = 0;
    			for (int iI = 0; iI < GC.getNumUnitInfos(); iI++)
    			{
    				if ( GC.getUnitInfo((UnitTypes)iI).getPrereqAndBonus() == GC.getUnitInfo(eUnit).getPrereqAndBonus() )
    				{
    					UnitClassTypes eUnitClass = ((UnitClassTypes)(GC.getUnitInfo((UnitTypes)iI).getUnitClassType()));
    					iJ += (GET_PLAYER(getOwnerINLINE()).getUnitClassCountPlusMaking(eUnitClass));
    				}
    			}
    			if (iJ > ((pCity->getNumBonuses((BonusTypes)GC.getUnitInfo(eUnit).getPrereqAndBonus())) * 6) )
    			{
    				return false;
    			}
    		}
    		// srpt end


    this seems to work in all cases including units being restricted by either of 2 resouces required.

    I'm now trying to make a tooltip. this is my attempt in CvGameTextMgr::setUnitHelp:

    Spoiler :
    Code:
    	// srpt resource unit restriction
    	if( GC.getUnitInfo(eUnit).getPrereqAndBonus() != NO_BONUS )
    	{
    		int iJ = 0;
    		int iK = 0;
    		for (int iI = 0; iI < GC.getNumUnitInfos(); iI++)
    		{
    			if ( GC.getUnitInfo((UnitTypes)iI).getPrereqAndBonus() == GC.getUnitInfo(eUnit).getPrereqAndBonus() )
    			{
    				UnitClassTypes eUnitClass = (UnitClassTypes)GC.getUnitInfo(eUnit).getUnitClassType();
    				iJ += (GET_PLAYER(ePlayer).getUnitClassCountPlusMaking(eUnitClass));
    			}
    		}
    		iK = pCity->getNumBonuses((BonusTypes)GC.getUnitInfo(eUnit).getPrereqAndBonus());
    		szBuffer.append(NEWLINE);
    		szBuffer.append(gDLL->getText("TXT_KEY_UNIT_RESOURCE_BASED_UNIT_LEFT", (iK - iJ)));
    	}


    however, it causes a very strange unidentified C++ exception when you try to open WB:

    Spoiler :
    Traceback (most recent call last):

    File "CvScreensInterface", line 385, in showWorldBuilderScreen

    File "CvWorldBuilderScreen", line 122, in interfaceScreen

    File "CvWorldBuilderScreen", line 2370, in refreshPlayerTabCtrl

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

Share This Page