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

Quick Modding Questions Thread

Discussion in 'Civ4 - Creation & Customization' started by kiwitt, Jan 27, 2010.

  1. ProjectMaximus

    ProjectMaximus Chieftain

    Joined:
    Aug 7, 2014
    Messages:
    21
    If I were you, first, I would have a look at Python\Screens\CvMainInterface.py. That's the file responsible for the display of the main screen + the city screen.
    But if you can't change it there, then it was changed in the dll (probably by the mod itself).
    PS: I don't have the mod so it's up to you.



    Hi Isenchine,

    Thank you for the suggestions.
    I went through in CvMainInterface.py and I found this part under the "SCORES" section:

    for i in range( gc.getMAX_PLAYERS() ):
    szName = "ScoreText" + str(i)
    screen.setText( szName, "Background", u"", CvUtil.FONT_RIGHT_JUSTIFY, 996, 622, -0.3, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_CONTACT_CIV, i, -1 )
    screen.hide( szName )

    I think this WIDGET_CONTACT_CIV contains that info what I looking for :yeah:
    so I googled it but there is no any useful info about where it is :confused:

    I checked DLLs too, I found CvGameCoreDLL only in my mod folder and to be honest I have no clue how can I deal with this file type.
     
  2. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    The table display on the right is done via python in that file.
    The hover help text displayed on the left is done in the dll via C++

    You don't touch the dll file itself. Go to the CvGameCoreDLL folder to find the culprit file and edit, then recompile a new dll.
     
  3. ProjectMaximus

    ProjectMaximus Chieftain

    Joined:
    Aug 7, 2014
    Messages:
    21
    Actually there is another issue I wanted to ask about:

    How can I edit the main civ selection screen info text? (pic#1 see Yellow Arrow)

    How can I delete all infos under the names? (pic#2 like this... see Red Arrow)

    Sorry for my question flood...no more...

    :hatsoff:
     

    Attached Files:

  4. ProjectMaximus

    ProjectMaximus Chieftain

    Joined:
    Aug 7, 2014
    Messages:
    21
    Thank you Platyping, I will try as you said... :woohoo:
     
  5. isenchine

    isenchine Empress

    Joined:
    Oct 18, 2010
    Messages:
    1,774
    Location:
    Brussels, Belgium
    As far as I know, you can't change that screen. It is one of the screen designed in the exe and we don't have access to it.

    PS: if you're tempted by working on the dll, here is a very good tutorial on the necessary step of compiling it.
     
  6. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,405
    Gender:
    Male
    Location:
    Leblanc
    It's impossible to change the screen itself, but you can change the info text displayed there (RFC does that, for instance). It's in the DLL though.

    If you want, I can look it up, in case you're willing to compile a new DLL.
     
  7. ProjectMaximus

    ProjectMaximus Chieftain

    Joined:
    Aug 7, 2014
    Messages:
    21
    Hi Leoreth,

    :hatsoff: :bowdown::bowdown::bowdown::bowdown::bowdown:

    Just one minute before your answer I wanted to retreat because this DLL, VC++ are far beyond of my knowledge. I like to /can edit XML and graphics only.

    THANK YOU seriously! :crazyeye:

    Yes, actualy I saw RFC too...
    Well, I have an idea like a common denominator :D
    You can just keep the trait infos in this text box and all the rest can go (see #pic3).

    I'm modding Rise Of Mankind in BTS v3.19.

    Shall I send something to you? How can I assist and make your effort easier? :run:

    Good luck and wish you the best!
    ProjectM
     

    Attached Files:

  8. Angry Bird

    Angry Bird Chieftain

    Joined:
    Mar 23, 2015
    Messages:
    14
    Its works, but without cultural borders...
     
  9. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,405
    Gender:
    Male
    Location:
    Leblanc
    Sorry, what I meant was that I can look up what source files you need to change if you want to compile the DLL yourself. I expect that what you want to do is feasible by just commenting out some lines.

    I don't really want to set up a new DLL project only to recompile a DLL for you, sorry.

    You mean the cultural borders are not updated? Is the tile in culture range of a city that could cover it?
     
  10. ProjectMaximus

    ProjectMaximus Chieftain

    Joined:
    Aug 7, 2014
    Messages:
    21
    To be honest with you I don't even know what is the difference between setting up a new DLL and recompiling a DLL. Both of method I've never done before.

    But yes, yu're absolutely right, I wanted to delete some lines only. I was really suprised when I realised this simple text editing needs serious DLL-SDK-V++ procedure??!
    :confused::aargh::dunno:

    So any kind of :help: I would be much appreciated. :)
     
  11. ProjectMaximus

    ProjectMaximus Chieftain

    Joined:
    Aug 7, 2014
    Messages:
    21
    I meant C++ ... not V++ :hammer2:
     
  12. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,405
    Gender:
    Male
    Location:
    Leblanc
    Okay, I can understand that this is confusing if you are not familiar with programming.

    The thing is, there are programming languages that need to be compiled. That means your computer can only work with the (compiled) machine code - the DLL - but not with the human-readable C++ source code. Compiling simply means turning the source code you've written into a new DLL.

    To do that, you need a compiler. Setting up this compiler environment (which is what is actually meant when people talk about the SDK, although these terms are often confused around here) is kind of tedious, and probably the greatest barrier if you are unfamiliar with this. Once that is done, the only difference to Python is that you have to click "build" after you've done making your changes.

    There is a very good guide by Asaf that covers setting up the SDK. You might want to give it a try.
     
  13. ProjectMaximus

    ProjectMaximus Chieftain

    Joined:
    Aug 7, 2014
    Messages:
    21
    Thank you Leoreth, I have checked the tutorial and understand the method now but I will leave it as it is. :think:
    I just want to modify graphics, xml or python files. If this text is really impossible to modified by any of them, I will come to terms with it.
    [offtopic]
     
  14. clanky4

    clanky4 Emperor

    Joined:
    Jul 11, 2012
    Messages:
    1,262
    Location:
    USA
    Hello I'm trying to make a bit of a mod which adds "one-sided" resource trading. I know that there are some mods which have the AI make extremely one-sided tech trades in their favor.

    What I'm trying to do is pretty much have the AI value the player's resources/gold at double what they would normally value them at when the player is a certain civ.

    As well as trade resources to said civ, even if said civ already has a copy of that resource.

    I presume this would require editing Python or more likely the CvGameCoreDLL. Does anyone know which files/functions control AI resource trading/valuing?

    Thank you for any assistance.
     
  15. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,405
    Gender:
    Male
    Location:
    Leblanc
    I think the best place to start is CvPlayerAI::AI_bonusVal() and CvPlayerAI::AI_bonusTradeVal(). The former is for resources in general (for example also when judging the value of specific tiles or techs that grant access etc.), so you probably want the latter.
     
  16. clanky4

    clanky4 Emperor

    Joined:
    Jul 11, 2012
    Messages:
    1,262
    Location:
    USA
    Would this have the desired effect?

    Code:
    int CvPlayerAI::AI_bonusTradeVal(BonusTypes eBonus, PlayerTypes ePlayer)
    {
    	int iValue;
    
    	FAssertMsg(ePlayer != getID(), "shouldn't call this function on ourselves");
    
    	iValue = AI_bonusVal(eBonus);
    
    	iValue *= ((min(getNumCities(), GET_PLAYER(ePlayer).getNumCities()) + 3) * 30);
    	iValue /= 100;
    
    	iValue *= max(0, (GC.getBonusInfo(eBonus).getAITradeModifier() + 100));
    	iValue /= 100;
    
    [COLOR="Red"]	if (GET_TEAM(GET_PLAYER(ePlayer).getTeam()).getInfoTypeForString("CIVILIZATION_VILLAGE"))
    	{
    		iValue *= 2;
    	}	[/COLOR]
    	
    	return (iValue * GC.getDefineINT("PEACE_TREATY_LENGTH"));
    }
    
    Or would it do the opposite?

    The change I made is in red. Also is that the right way to get the civ type in CoreDLL? It worked in python, but I don't know if it'll work there.
     
  17. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,405
    Gender:
    Male
    Location:
    Leblanc
    If I recall correctly, the current CvPlayer instance is the one evaluating the value, so it is the AI in human/AI interactions. In other words, the one you want to check for. ePlayer is the player being traded to, I don't think you have to consider them.

    The best way to check (your example won't work and I'd be surprised if it did in Python) is probably something along these lines:
    Code:
    if (getCivilizationType() == (CivilizationTypes)GC.getInfoTypeForString("CIVILIZATION_VILLAGE"))
    {
            iValue *= 2;
    }
     
  18. clanky4

    clanky4 Emperor

    Joined:
    Jul 11, 2012
    Messages:
    1,262
    Location:
    USA
    Yep that got it working thanks :goodjob:

    It turned out though that doubling the iValue halved the village's value of resources. Halving the iValue on the other hand made everyone think the Village's resources were worth double :crazyeye:

    I also tested it and it appears to work when playing as the Village civ as well as when the Village civ is an AI. I have no idea how or if it effects AI-AI resource trades though. Anyway here in the functional code in case anyone wants to give an unfair advantage to one civ use it:

    CvPlayerAI.cpp
    line 6797
    Code:
    int CvPlayerAI::AI_bonusTradeVal(BonusTypes eBonus, PlayerTypes ePlayer, int iChange) const
    {
    	int iValue;
    
    	FAssertMsg(ePlayer != getID(), "shouldn't call this function on ourselves");
    
    	iValue = AI_bonusVal(eBonus, iChange);
    
    	iValue *= ((std::min(getNumCities(), GET_PLAYER(ePlayer).getNumCities()) + 3) * 30);
    	iValue /= 100;
    
    	iValue *= std::max(0, (GC.getBonusInfo(eBonus).getAITradeModifier() + 100));
    	iValue /= 100;
    
    	if (GET_TEAM(GET_PLAYER(ePlayer).getTeam()).isVassal(getTeam()) && !GET_TEAM(GET_PLAYER(ePlayer).getTeam()).isCapitulated())
    	{
    		iValue /= 2;
    	}
    
    [COLOR="Red"]	//###Villager
    	if (getCivilizationType() == (CivilizationTypes)GC.getInfoTypeForString("CIVILIZATION_VILLAGE"))
    	{
    		iValue /= 2;
    	}	
    	//###Villager	[/COLOR]	
    	
    	return (iValue * GC.getDefineINT("PEACE_TREATY_LENGTH"));
    }
    
     
  19. ProjectMaximus

    ProjectMaximus Chieftain

    Joined:
    Aug 7, 2014
    Messages:
    21
    Hello,

    This time I'm looking for a solution, how can I set the maximum distance of hearable diplomacy music from a city? (You know when the screen is over the city.)

    A found this settings only in Audio3DScripts:

    <iMinDistanceFromListener>0</iMinDistanceFromListener>
    <iMaxDistanceFromListener>0</iMaxDistanceFromListener>
    <iMinDistanceForMaxVolume>500</iMinDistanceForMaxVolume>
    <iMaxDistanceForMaxVolume>1000</iMaxDistanceForMaxVolume>
    <iMinCutoffDistance>7000</iMinCutoffDistance>
    <iMaxCutoffDistance>7000</iMaxCutoffDistance>

    But diplo music is 2D.

    Actually I would like to hear it only one time when I establish a city or/and when my viewing distance is very close.

    The reason is: I don't want to hear the diplomacy music thousand times during the game but I also don't want to completely switch it off.
    I successfully managed the Looping to "0" but when I slide the screen away and back to the city, it plays again.


    Do you have any suggestion for me?
    :shifty:

    (PS: I hope this settings can be managed without to touch any DLLs:lol:)
     
  20. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,405
    Gender:
    Male
    Location:
    Leblanc
    My intuition is that this will be a DLL thing if you're lucky. If you're unlucky it's locked away in the EXE completely.
     

Share This Page