The Modding Q&A Thread

Leoreth

Blue Period
Moderator
Joined
Aug 23, 2009
Messages
37,060
Location
東京藝術大学
Hey everyone,

I noticed there were quite a lot questions regarding modding RFC or its modmods the last days. To avoid cluttering the respective modmod's thread or this subforum, I took the initiative to create this thread so
  • we save space in the forum and the modmod threads
  • questions don't get lost in some discussions
  • repeating questions don't have to be anwered twice

This is not "my" thread, so of course everyone can answer here if he likes.
 
Hey everyone,

I noticed there were quite a lot questions regarding modding RFC or its modmods the last days. To avoid cluttering the respective modmod's thread or this subforum, I took the initiative to create this thread so
  • we save space in the forum and the modmod threads
  • questions don't get lost in some discussions
  • repeating questions don't have to be anwered twice

This is not "my" thread, so of course everyone can answer here if he likes.

Excellent idea. I by the way also was thinking about whether it would be an idea to have one thread dedicated to proposals/suggestions - a lot of stuff written in the respective modmod-threads are really just general idea, and while that's of course a great thing, to have new idea and brainstorming en masse, maybe it would be better to have all that focused in one thread, instead of randomly spread out. This would also serve the same purpose, of keeping the modmod-threads focused.
But this is just me rambling off-topic really :D

On-topic: Can anybody show me how to toggle the thing off where already existing cities are destroyed if build at or around the spawn tile for the new civ? Also, in which file(s) is tech speeds regulated - the bonusses (or penalties) that certain civs get?
 
That's right, but I'd like to keep this thread free from ideas because the subsequent enthusiasm and brainstorming would clutter this thread as well.

On to your questions - I'm no expert on the spawn mechanics and tend to avoid touching them, but it seems the point you should attack here is the bDeleteEverything bool in RiseAndFall.initBirth():
Code:
[COLOR="Red"]                                bDeleteEverything[/COLOR] = False
                                pCapital = gc.getMap().plot(tCapital[0], tCapital[1])
                                if (pCapital.isOwned()):
                                        if (iCiv == iHuman or not gc.getPlayer(iHuman).isAlive()):
                                                if not (pCapital.isCity() and pCapital.getPlotCity().isHolyCity()):
                                                        [COLOR="Red"]bDeleteEverything[/COLOR] = True
                                                        print ("bDeleteEverything 1")
                                        else:
                                                [COLOR="Red"]bDeleteEverything[/COLOR] = True
                                                for x in range(tCapital[0] - 1, tCapital[0] + 2):        # from x-1 to x+1
                                                        for y in range(tCapital[1] - 1, tCapital[1] + 2):	# from y-1 to y+1
                                                                pCurrent=gc.getMap().plot(x, y)
                                                                if (pCurrent.isCity() and (pCurrent.getPlotCity().getOwner() == iHuman or pCurrent.getPlotCity().isHolyCity())):
                                                                        [COLOR="Red"]bDeleteEverything[/COLOR] = False
                                                                        print ("bDeleteEverything 2")
                                                                        break
                                                                        break
                                print ("bDeleteEverything", bDeleteEverything)
                                if (not gc.getMap().plot(tCapital[0], tCapital[1]).isOwned()):
                                        if (iCiv == iNetherlands or iCiv == iPortugal or (iCiv == iRome and utils.getReborn(iCiv) == 1) or iCiv == iByzantium): #dangerous starts
                                                self.setDeleteMode(0, iCiv)
                                        self.birthInFreeRegion(iCiv, tCapital, tTopLeft, tBottomRight)
                                elif ([COLOR="Red"]bDeleteEverything[/COLOR]):
                                        for x in range(tCapital[0] - 1, tCapital[0] + 2):        # from x-1 to x+1
                                                for y in range(tCapital[1] - 1, tCapital[1] + 2):	# from y-1 to y+1
                                                        self.setDeleteMode(0, iCiv)
                                                        #print ("deleting", x, y)
                                                        pCurrent=gc.getMap().plot(x, y)
                                                        #self.moveOutUnits(x, y, tCapital[0], tCapital[1])
                                                        for iLoopCiv in range(iNumTotalPlayers+1): #Barbarians as well
                                                                if (iCiv != iLoopCiv):
                                                                        utils.flipUnitsInArea(tTopLeft, tBottomRight, iCiv, iLoopCiv, True, False)
                                                        if (pCurrent.isCity()):
                                                                pCurrent.eraseAIDevelopment() #new function, similar to erase but won't delete rivers, resources and features()
                                                        for iLoopCiv in range(iNumTotalPlayers+1): #Barbarians as well
                                                                if (iCiv != iLoopCiv):
                                                                        pCurrent.setCulture(iLoopCiv, 0, True)
                                                        pCurrent.setOwner(-1)
                                        self.birthInFreeRegion(iCiv, tCapital, tTopLeft, tBottomRight)
                                else:                                
                                        self.birthInForeignBorders(iCiv, tTopLeft, tBottomRight, tBroaderTopLeft, tBroaderBottomRight)
Making sure it's never set to True should avoid the gams starting "deleteMode", which erases the units and cities.

However, it would be wise to put another system into place instead, because I really don't know what happens if you try to spawn units on a foreign city plot (Python exception or crash, likely). So I suggest to flip all cities around the spawn plot instead, which can best be done using utils.flipCity(...).

For the research modifiers, they're in C++. You can find them in CivInfos::getResearchPercentByID().
 
That's right, but I'd like to keep this thread free from ideas because the subsequent enthusiasm and brainstorming would clutter this thread as well.

Sure, I just meant that that also could be an idea, to create SUCH a thread, for the same purpose. And thanks a lot for your answer, gonna try it out and see if I can get it to work.
 
I'm interested to see how it turns out :)
 
What do you need to modify in order to add an independent city spaw. (similar to Kiev or Lhasa)
 
I'm interested to see how it turns out :)

You were absolutely right in that it needs some more... finesse :) It succesfully keeps the city from being destroyed on spawn, but the changes also meant that when a city is not prebuilt, the new civ dont flip the tiles in their starting zones as they should, and so end up being exiled. Also, as the turks, when I started as them - autoplaying untill then - all their cities had city ruins as graphic. No gameplay problem, just.. yeah - it wasn't pretty. But of course it's a low priority thing, it's only really important for the Byzantines, and that seems to be wad. People who want to cheat can do it anyway, with WB, so... yeah. But thx for the help anyway - I have a game with a prebuilt Amsterdam now, so I'm a happy camper.
 
What do you need to modify in order to add an independent city spaw. (similar to Kiev or Lhasa)
You could use PyScenario, provided that you use the RFC Epic/Marathon mod-mod.

Other than that, you can mimic what Rhye does in the Barbs.py file in order to add unit/city spawns.
 
I was talking about DOC; could u elaborate on to which files i would need to make the changes?

Thnx
 
I'm guessing that Dawn of Civilization uses the same module for its city spawns, as would most mod-mods.
 
I'm guessing that Dawn of Civilization uses the same module for its city spawns, as would most mod-mods.
I tried modifying the Barbarian.py but to no avail. Is there any other file that I need to change inorder to add an indie spawn
 
You need to edit it correctly, or it won't work. If you enable Python exceptions you should be getting error messages. These exceptions would be the reason it isn't working for you - whether or not you're aware of them.
 
There is one list in Barbarian.py that needs to be modified (the one that says (among other things) where the city will be), and a function that actually spawns the cities. Apart from that, no further modding should be necessary.
 
Well, the module should be named Barbs.py and the coordinates and name are defined as tuple values assigned to constant variables. And the actual spawning action is achieved with a method invocation, using the constant as one of its parameters. This is in turn is found within the body of a Barbs class instance method. Just so that we're clear about this.

Perhaps J. pride could post his edits for the rest of us to see? Any obvious mistakes would be easy enough to spot.
 
Hi Everyone,

First off, I just want to say what a great thread this is! :)


Anyway, can someone please tell me what wrong with the text in the red box! I cannot understand why that castle will not spawn in Damascus!

Thank You!
 

Attachments

  • Error.jpg
    Error.jpg
    216.5 KB · Views: 314
This looks like an odd place for this part of the code. Which method is it?
 
I think it should be self.getTurnForYear(1096)
python is pretty picky about that
 
The Turk, your indentation is whacked up. You have one level too much, to be exact, so deduct 8 blank spaces from every line.

Also, on the third line, it should probably be iNumMajorPlayers. :confused:
 
The Turk, your indentation is whacked up. You have one level too much, to be exact, so deduct 8 blank spaces from every line.

Also, on the third line, it should probably be iNumMajorPlayers. :confused:
You're right, the comment line is really confusing here.

There's no iNumMajorPlayers in SoI, and the ID of the first independent civ equals iNumPlayers.
 
There's no iNumMajorPlayers in SoI, and the ID of the first independent civ equals iNumPlayers.
Yeah, makes sense. I never actually looked at SoI... :p
 
Top Bottom