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

RFC Modding Central

Discussion in 'Rhye's and Fall Modmods' started by Linkman226, Aug 29, 2011.

  1. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    33,860
    Gender:
    Male
    Location:
    Leblanc
    I believe the text bit is in CvDLLWidgetData.parseHurryHelp(), in particular this part:
    Code:
    		iHurryAngerLength = pHeadSelectedCity->hurryAngerLength((HurryTypes)(widgetDataStruct.m_iData1));
    
    		if (iHurryAngerLength > 0)
    		{
    			szBuffer.append(NEWLINE);
    			szBuffer.append(gDLL->getText("TXT_KEY_MISC_ANGER_TURNS", GC.getDefineINT("HURRY_POP_ANGER"), (iHurryAngerLength + pHeadSelectedCity->getHurryAngerTimer())));
    		}
    Apparently it simply doesn't take the modifications in your part of the code into account.
     
  2. srpt

    srpt Deist

    Joined:
    May 10, 2010
    Messages:
    2,038
    Location:
    Toronto
    having a problem with a UHV victory screen display.

    here is the code:

    Spoiler :
    Code:
    		elif iPlayer == iKhazars:
    			if iGoal == 0: 
    				bSuccess = True
    				cityList = PyPlayer(iKhazars).getCityList()
    				for pCity in cityList:
    					if not pCity.GetCy().isHasReligion(con.iJudaism):
    						bSuccess = False
    				aHelp.append(self.getIcon(bSuccess) + 'Judaism in every city')


    I've used print statements to check that its getting the right cities and it is, but the results seem almost random. it will print the coordinates of a city, saying that the city has a religion it doesn't have for example. the victory condition itself works fine.
     
  3. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    33,860
    Gender:
    Male
    Location:
    Leblanc
    The code is correct, maybe your definition of the religion constants is wrong? The IDs should follow the appearance of the religions in the XML.
     
  4. srpt

    srpt Deist

    Joined:
    May 10, 2010
    Messages:
    2,038
    Location:
    Toronto
    no I checked that. Judaism is #0 in both Conts.py and Religions.xml.

    I just tried it with 3 cities with no religions and the code only indentified 2 of them as not having judaism... and when I WB Judaism into all three it says none of them have it.
     
  5. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    33,860
    Gender:
    Male
    Location:
    Leblanc
    Maybe try to check the goal in another way? Count the number of cities that have Judaism and compare it to the number of cities, for example.

    I really don't see what's wrong here but maybe a different approach helps to narrow down the problem.
     
  6. srpt

    srpt Deist

    Joined:
    May 10, 2010
    Messages:
    2,038
    Location:
    Toronto
    about the civ re-naming, I thought I would move my question over here since I'm no longer really asking about SoI mechanics.

    here you can see the civ is dead when the name change is supposed to occur:

    Spoiler :
    Code:
    if not gc.getPlayer(iLoopCiv).isAlive() and iGameTurn > sd.getLastTurnAlive(iLoopCiv) + utils.getTurns(iThreshold):
    					pCiv = gc.getPlayer(iLoopCiv)
    					if tRespawnCiv[iLoopCiv] != -1:
    						pCiv.setCivilizationType(tRespawnCiv[iLoopCiv])
    						print "setting civ desc, civ:", iLoopCiv, "desc:", tRespawnCiv[iLoopCiv]
    						#pCiv.setLeader(con.tRebirthLeaders[iCiv][0])
    					self.resurrection(iGameTurn, iLoopCiv, iThreshold)
    					bFound = True
    					break


    iLoopCiv is not alive when setCivilizationType is called, is it?
     
  7. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    33,860
    Gender:
    Male
    Location:
    Leblanc
    Yeah, the civ shouldn't be active at that point. It's strange that it doesn't work for you since it's completely viable in DoC. I don't use the resurrection method, though, maybe it's worth a look what I do and don't do compared to it.
     
  8. srpt

    srpt Deist

    Joined:
    May 10, 2010
    Messages:
    2,038
    Location:
    Toronto
    of course it would be something like this: the WBS was overriding everything. I have no idea how I ended up with that stuff set in the WBS, but like I said when I started this I had no clue what I was doing.
     
  9. srpt

    srpt Deist

    Joined:
    May 10, 2010
    Messages:
    2,038
    Location:
    Toronto
    I'm getting the city ruins on conditional spawn bug that was also present in DoC with the Byzantines for a while. can Leoreth let me know what fixed it in the end? its driving me crazy. my code is straight from SoI and includes the pre-spawning catapult.
     
  10. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    33,860
    Gender:
    Male
    Location:
    Leblanc
    Ugh, I hate that bug. Iirc I've fixed this by trial and error and can't remember what ultimately was responsible, because I really wanted to forget that episode. Sorry :(

    Can you imagine anything that's different in your situation than in SoI?

    My best guess is that you spawn units on the city tile before the city is properly flipped, or change the plot owner before the city owner or vice versa, something like that.
     
  11. Cetrix

    Cetrix Merovingian

    Joined:
    Mar 28, 2008
    Messages:
    267
    Location:
    Regnum Francorum
    Hello there, I try to learn how to mod in civ and RFC, this thread is very usefull.

    I wonder how to make a collapsed civ to reborn as a news civ, for example in DoC Rome => Italians with new stability map, UHV, and stuff. Is it a new civ, or some tricks to recode the collapse civ ? And how to do ?
     
  12. srpt

    srpt Deist

    Joined:
    May 10, 2010
    Messages:
    2,038
    Location:
    Toronto
    which mod do you want to do this in?

    the general way I would approach this is to find an example of what you want that is already there (ie another civ that respawns) and copy it. Notepad++ can be very good for this since you can do things like open all the python files at once and search "iItaly" or "respawn" or whatever across all of them.
     
  13. Cetrix

    Cetrix Merovingian

    Joined:
    Mar 28, 2008
    Messages:
    267
    Location:
    Regnum Francorum
    Actually it's for your mod, for personnal use and testing. I want to make vandals (carthage), ostrogoths (dacia) and visigoths (celts) playable with their own UHV, stability map, UU... in the 220AD scenario.

    The core of civs seems to be in consts.py. Have to learn more files.
     
  14. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    33,860
    Gender:
    Male
    Location:
    Leblanc
    Well, not to curb your motivation but if you've never modded anything that's a quite complicated aspect to start with.

    Anyway, to start, you need to know there's a difference between players and civilizations. You can understand players as "slots" for civilizations to fill in, like in a normal BtS every civ can fill one of the eight (or whatever) player slots.

    Most aspects that make a civ different in BtS, like UU, UB, leaders, unit sounds etc. are tied to the Civilization. You can easily change a player's civilization before it respawns, and all the associated changes take effect.

    However, most RFC features are tied to the player, not the civilization it has. This means the game needs some other way to tell if a player is reborn or not (so it can see if it's Rome or Italy, for example). I've solved this by modifying players in the DLL by adding the "reborn" attribute and corresponding methods "isReborn()" etc.

    Then I've made two stability/city name maps for every civ, and the one that's used depends on the reborn status of the civ. UHV and UP can be handled simply by using "if pPlayer.isReborn()" before the relevant bits of code.



    SoI does it a little different. It's using a global city name map, the province system allows it to handle the stable areas easily via Python, and respawned civs are unplayable and don't have UHVs. So there you don't need to do the complicated things I've mentioned above, simply changing a player's civilization is enough. But you won't be able to pull off a complete change of the civ like Rome -> Italy.

    Edit: missed your comment above. RFC Classical World is based on SoI, so my last paragraph applies. You'd need to make the DLL changes I mentioned above to make it work there.
     
  15. srpt

    srpt Deist

    Joined:
    May 10, 2010
    Messages:
    2,038
    Location:
    Toronto
    making a respawn into a playable civ is different. so far no one has come up with a good way of making respawns playable, so the general rule now is if you have a respawn it has to be the first instance of it. when I first started working on Judah it was going to be a respawn, then I realised it would be too much fun to make them playable, so I just added another civ slot.

    probably the easiest way for you to start messing around with that stuff would be just change the respawns into regualr civs. make the 220AD start a totally separate mod and scrap the Celts, Dacians and Carthage.

    changing their spawn dates, home provinces etc. is not that hard, but you do need to be able to compile a DLL? have you done that before?

    also, non-playable respawns can always be played if you tag them as playable in WB (the map) file and play another civ that starts before them and then switch when they come up, like Italy and Iran in DoC.

    @merijn_v1: the Dacian flag is really great!

    and I wish I could type as fast as Leoreth
     
  16. Cetrix

    Cetrix Merovingian

    Joined:
    Mar 28, 2008
    Messages:
    267
    Location:
    Regnum Francorum
    The only modding I did was on Hearts of Iron, Europa Universalis... but it's not C++ and I don't know how to compile a DLL. For now.

    Hopefully... there is a guide.

    Srpt, I really like your mod. Frustrating not to be enough skilled to help and modmod myself for fun.
     
  17. srpt

    srpt Deist

    Joined:
    May 10, 2010
    Messages:
    2,038
    Location:
    Toronto
    just start small. I knew nothing when I started. for compiling, start by recompiling something without changing anything in it. start with this guide first though.
     
  18. srpt

    srpt Deist

    Joined:
    May 10, 2010
    Messages:
    2,038
    Location:
    Toronto
    I'm trying to troubleshoot this birthConditional bug wherein the civ spawns just fine but the capital looks like city ruins.

    the code says it spawns a catapult to revive the player before flipping the city:

    Spoiler :
    Code:
    # pre-spawn a catapult to revive the player
    				#gc.getPlayer(iCiv).revive() # forces alive status
    				#print ("revived")
    				pCatapult = utils.makeUnit(iCatapult, iCiv, (iCatapultX, iCatapultY), 1)
    				print ("catapult: ", pCatapult.getName())


    so I decided I wanted to actually see this catapult so I just did this:

    Spoiler :
    Code:
    # pre-spawn a catapult to revive the player
    				#gc.getPlayer(iCiv).revive() # forces alive status
    				#print ("revived")
    				pCatapult = utils.makeUnit(iCatapult, iCiv, (iCatapultX, iCatapultY), 1)
    				if pCatapult:
    					return
    				print ("catapult: ", pCatapult.getName())


    thinking it would just spawn me a catapult and then stop. but instead I got a settler. right civ, right plot, wrong unit. and I can't find any piece of python that spawns a settler as a utility. so I guess this settler is being made by the dll autoplay?

    actually that return statement interrupts the autoplay for other civs as well, not just the ones with a conditional spawn.

    but anyway where's the catapult? why didn't it spawn?
     
  19. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    33,860
    Gender:
    Male
    Location:
    Leblanc
    I'm lost here, unfortunately.
     
  20. srpt

    srpt Deist

    Joined:
    May 10, 2010
    Messages:
    2,038
    Location:
    Toronto
    I am spawning units in an independent city on the birth of a neighboring civ, to make the city harder to capture. the units appear, but then disappear on the next turn. whats happening? is the AI disbanding them for some reason? this happens after the new civ declares war by entering the independents territory.
     

Share This Page