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. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    32,869
    Location:
    DE/NL/FR
    Does an example help? Because we have this small mod here, which only adds a religion.

    If not: Names and civilopedia entries are in the XML\GameInfo\ReligionInfo.xml, and these are again references to entries in the XML\Text folder.
    For the icons: There are 2 types.
    The easy one is the button, which is also referenced in the ReligionInfo.xml. You will need a grey button (for the case the religion is not yet founded), which has to be in the same place, and needs to have the same name, with a _d attached (e.g. shinto.dds and shinto_d.dds).
    The others are in the Assets\res\fonts\gamefont.tga. These symbols have to be in the same order like in the XML, first the religions, then the corporations.
    Don't edit that file by hand, do it with this tool.

    In case that's too fast, then post again (sorry, it's morning and I have to leave for work in a few minutes).

    :yup:
     
  2. Darkshadows9776

    Darkshadows9776 Chieftain

    Joined:
    Jan 15, 2013
    Messages:
    12
    Okay so I think I have this all figured out, just one more thing. How do I make the background on the religion images transparent? I have a white background behind the images that I need to get rid of.
     
  3. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    32,869
    Location:
    DE/NL/FR
    Which image? In the gamefonts, or the button?
     
  4. Darkshadows9776

    Darkshadows9776 Chieftain

    Joined:
    Jan 15, 2013
    Messages:
    12
    The buttons
     
  5. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    32,869
    Location:
    DE/NL/FR
    The alpha channel of the buttons have to be white, and you have to save them as DDS DXT3, then it should work.
    If you have no clue what I'm talking about: Tutorials for buttons can be found here and here.
     
  6. Darkshadows9776

    Darkshadows9776 Chieftain

    Joined:
    Jan 15, 2013
    Messages:
    12
    Okay I did that, didn't work. I still keep getting the white background even with a white alpha channel and saving as DDS DXT3 with DXTBmp. I tried it with a .png and a .bmp file and both still gave me a white background
     
  7. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    32,869
    Location:
    DE/NL/FR
    *facepalm* sorry, dumbness from my side: The alpha channel needs to be transparent, which means totally black (DXTBmp will show that as white if you reopen the button, therefore that screwup).
     
  8. Darkshadows9776

    Darkshadows9776 Chieftain

    Joined:
    Jan 15, 2013
    Messages:
    12
    Okay I made the alpha channel black, and now the image won't even appear in the game. I tried it with the same two image types and it doesn't work
     
  9. God-Emperor

    God-Emperor Deity

    Joined:
    Jul 18, 2009
    Messages:
    3,551
    Location:
    Texas
    Don't make the entire image's alpha channel black or it will all be transparent (and therefore be completely invisible). Just the parts you want to be transparent should have a black alpha channel, the rest should be white (you can maybe make a pixel here and there be gray if you want a blended edge or something).

    (It is black = transparent and white = visible because it is actually the level of opacity. Black = 0 opacity and 0 opacity is the same as full transparency. White = 255 opacity and that is as opaque as you can get since it is an 8 bit unsigned integer that only goes up to 255 for each channel.)
     
  10. Darkshadows9776

    Darkshadows9776 Chieftain

    Joined:
    Jan 15, 2013
    Messages:
    12
    Okay thank you, I managed to get the images to actually work.

    Thanks both of you for your help
     
  11. MikyMighty

    MikyMighty Chieftain

    Joined:
    Jan 31, 2013
    Messages:
    1
    Hello,

    how can i change the background picture (the globe) to my own creation?

    Thank you.
    greetings
    MM
     
  12. Zlatko

    Zlatko CIW

    Joined:
    Apr 1, 2010
    Messages:
    713
    Location:
    Solar System
  13. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,708
    Location:
    UK
    hey guys just incase anyone wanted it, here is the code for range combat expeirience from Realism Invictus, if anyone ever takes this to the next level and makes the experience defineable in more detail, like wound and kill or anything like that I would love to know about it!

    Unit.cpp
    Spoiler :

    Code:
    	//set damage but don't update entity damage visibility
    	pDefender->setDamage(iUnitDamage, getOwnerINLINE(), false);
    
    [COLOR="Red"]	// MOD - START - Ranged Combat Experience
    	// Note: Ranged attacks provide the same amount of experience as a withdrawl
    	changeExperience(GC.getDefineINT("EXPERIENCE_FROM_WITHDRAWL"), pDefender->maxXPValue(), true, pPlot->getOwnerINLINE() == getOwnerINLINE(), !pDefender->isAnimal());
    	// MOD - END - Ranged Combat Experience[/COLOR]
    
    	if (pPlot->isActiveVisible(false))
    	{
    		// Range strike entity mission
    		CvMissionDefinition kDefiniton;
    		kDefiniton.setMissionTime(GC.getMissionInfo(MISSION_RANGE_ATTACK).getTime() * gDLL->getSecsPerTurn());
    		kDefiniton.setMissionType(MISSION_RANGE_ATTACK);
    		kDefiniton.setPlot(pDefender->plot());
    		kDefiniton.setUnit(BATTLE_UNIT_ATTACKER, this);
    		kDefiniton.setUnit(BATTLE_UNIT_DEFENDER, pDefender);
    		gDLL->getEntityIFace()->AddMission(&kDefiniton);
     
  14. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    32,869
    Location:
    DE/NL/FR
    To something static (-> image)?
    Go to the Next War folder.
    Copy the folder Assets\Art\Interface\Main Menu to your mod (same folder structure of course).
    Copy the file XML\Art\CIV4MainMenus.xml to your mod.
    Go back to the Main Menu folder, and replace the Next_War_Main_Menu.dds with whatever image you want to have (in .dds format).


    I'm not sure where they are linked, but the images are .dds files, which are located in Art\movies\era, and follow the scheme Era00-Ancient.dds, Era01-Classical.dds, and so on (number +1 plus name of era).
    Creating such a file at the right path in your mod will override the default files.
     
  15. ChaosSlayer

    ChaosSlayer King

    Joined:
    Feb 3, 2011
    Messages:
    608
    Hello again ;)

    what program can I use to view/edit .dds files?

    oh and the one to view .bik movies please?

    thanks!
     
  16. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,708
    Location:
    UK
    GIMP will do .dds
    I don't know about bink, I did once upon a time, google should turn up something free
     
  17. ChaosSlayer

    ChaosSlayer King

    Joined:
    Feb 3, 2011
    Messages:
    608
    OK installed gimp - it refuses to read dds files :confused:
     
  18. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    32,869
    Location:
    DE/NL/FR
    There are plugins for GIMP and Photoshop, paint.net should do it by default, and DXTBmp is probably the easiest one to use.

    For the bik files, you should just use the player from the developers, see here.
     
  19. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    28,349
    Gender:
    Male
    Location:
    Las Vegas
    Well, I already took withdrawal experience to another level in C2C and it's now based on a base number (such as it is in your example) modified by the odds of withdrawal (more difficult withdrawal = more experience and vice versa).

    Very simple really, just add this function:
    Code:
    int CvUnit::getExperiencefromWithdrawal(int iWithdrawalProbability)
    {
    	int iExpBase = GC.getDefineINT("EXPERIENCE_FROM_WITHDRAWL");
    
    	int iInversePercentage = 100 - iWithdrawalProbability;
    
    	int iExperienceTotal = (iExpBase * iInversePercentage)/100;
    
    	return (std::max(1, iExperienceTotal));
    }
    And replace all other references to "GC.getDefineINT("EXPERIENCE_FROM_WITHDRAWL"):
    with a call to getExperiencefromWithdrawal(oddsofwithdrawalvariable)

    When I do decide to move on the quick project to enact some experience from bombard, I'd have to figure out what the 'odds' value would stem from (I believe there's an accuracy check for a lot of types of bombardment in our mod) but that method you showed is quite easily done, yes. Thanks for sharing that though... helps to see what other modders have come up with when going about a project.

    There's a number of places in C2C that would utilize something along these lines, including Archery bombard. I'd also like to review and ponder whether it should be awarded for bombardment against city defenses, even though its an auto-hit procedure (maybe just 1 exp in such a case based on a Global value... but even that seems a bit much... I dunno yet.)
     
  20. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,708
    Location:
    UK
    yeah, someone has made a bombard experience mod in the modcomps, but range combat is a big part of my fallout mod, as both guns and melee have to be vaible combat choices right the way through the game (just as in the fallout games) so getting experience from ranged attacks was a must! We experimented trying to modify the code to do a few more things, like not award exp if no damage was done, but we were unable to get the effect to change from it's starting form. (But this is a lot better than nothing so I am happy)
     

Share This Page