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

    Zlatko CIW

    Joined:
    Apr 1, 2010
    Messages:
    713
    Location:
    Solar System
    Just set damage to both units to 100 and you are done. Some example from my mod.

    You can found a lots of python examples in my mod and PLAY them, it's very interesting. RECONSTRUCTION THREAD.

    And i suggest you to download platyping megapack and gigapack you really can found a lots of examples there and this can help you too CIV 4 PYTHON API :)

    Code:
    		if pLoser.isHasPromotion(gc.getInfoTypeForString("PROMOTION_HARMONY_POISON")):
    			if pWinner.getDamage() >= 80:
    				pWinner.setDamage(100, false)
    				CyInterface().addMessage(iPlayerWinner,true,10,CyTranslator().getText("TXT_HARMONY_POISON",(pWinner.getName(),)),'',0,'',-1, -1, -1, true,true)
    				CyInterface().addMessage(iPlayerLoser,true,10,CyTranslator().getText("TXT_HARMONY_POISON",(pWinner.getName(),)),'',0,'',-1, -1, -1, true,true)
    				pPlayerLoser.changeCombatExperience(1)
    
     
  2. Merkava120

    Merkava120 Oberleutnant

    Joined:
    Feb 2, 2013
    Messages:
    312
    Location:
    Not Turkey
    Thanks, I tried it (see below), but it's still not doing anything when I move a unit over a land mine.

    Code:
    for i in range(pPlot.getNumUnits()):
    			pOtherUnit = pPlot.getUnit(i)
    			if pOtherUnit.getUnitType() == gc.getInfoTypeForString('UNIT_LAND_MINE'):
    				pOtherUnit.setDamage(100,false)
    				iRnd = CyGame().getSorenRandNum(100,"Land Mine")
    				pUnit.setDamage(iRnd, false)
     
  3. VCrakeV

    VCrakeV Chieftain

    Joined:
    Aug 22, 2014
    Messages:
    313
    Is there a xml file that allows you to edit leader influence/attitude values?

    Sent from my SM-G903W using Tapatalk
     
  4. vincentz

    vincentz Programmer

    Joined:
    Feb 4, 2009
    Messages:
    3,547
    Gender:
    Male
    Location:
    Denmark
    Civ4LeaderheadInfos.xml
     
  5. Mouthwash

    Mouthwash Escaped Lunatic

    Joined:
    Sep 26, 2011
    Messages:
    8,884
    Location:
    Hiding
    How to I make a wonder disable/block the construction of another particular wonder?
     
  6. Dancing Hoskuld

    Dancing Hoskuld Warlord

    Joined:
    Jul 5, 2004
    Messages:
    23,286
    Gender:
    Male
    Location:
    Canberra, Australia
    You need to use the python call back for "can construct".

    First turn it on in the PythonCallbackDefines.XML file found in the Assets\XML folder.

    Then code the python, I think Platyping has an example in his code somewhere. I can't find my own example at the moment. It is a function called canConstruct if I remember correctly. Basically if the building wanted to construct is the particular wonder then count the number of the blocker buildings (this is a single call) the player has and if it is not zero return true otherwise return false.
     
  7. Dancing Hoskuld

    Dancing Hoskuld Warlord

    Joined:
    Jul 5, 2004
    Messages:
    23,286
    Gender:
    Male
    Location:
    Canberra, Australia
    Is it safe to assume that the Python call onBeginPlayerTurn happens before onCityDoTurn for each city of the player?

    I want a player level test on something happening and if it does then have something possible happen in each of that player's cities.

    Further does onBeginGameTurn happen before or after the onBeginPlayerTurn?
     
  8. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    4,114
    It took some code reading, search and tracing through both cpp and python to figure this one out, but yeah, it does appear that onBeginPlayerTurn happens before onCityDoTurn.

    This one turned out to be even more complex to track, but the same goes. onBeginGameTurn is called before onBeginPlayerTurn.

    Be aware that the call order is in the DLL and as such can be changed by a mod. I have no idea why anybody would want to do that, but it's technically possible.
     
  9. Dancing Hoskuld

    Dancing Hoskuld Warlord

    Joined:
    Jul 5, 2004
    Messages:
    23,286
    Gender:
    Male
    Location:
    Canberra, Australia
    Thank you. I did a few tests and traces just in Python after posting and got the same results. Confirmation from a dll perspective helps a lot.
     
  10. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Actually, this should be simple to understand. BPT is start of each player, while BGT is start of that round. Naturally, BGT has to go before the first player takes his turn.
     
  11. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    4,114
    Yeah it's simple to understand and it is as I would have expected and it also matches my initial impression from the code. However my goal was to be able to point to each line in the code relevant to this and from that state the order with 100% accuracy. This is less trivial and the worst part is CvPlayer::doTurn, as it should be called from CvGame::doTurn() if the code follows naming conventions. However the ability to play at the same time in multiplayer makes this specific part of the code somewhat harder to read and CvPlayer::doTurn is surprisingly not even called from CvGame. It involves some stuff regarding setting the player's turn active and in this process doTurn is called from within CvPlayer. AFAIK it's the only class, which calls doTurn on itself.
     
  12. ChaosSlayer

    ChaosSlayer Chieftain

    Joined:
    Feb 3, 2011
    Messages:
    587
    Greetings!

    I am trying to create a new type of invisible units - for example I want to make Paratroopers invisible, while giving Gunship detection vs them.

    I have examined how Submarine/Destroyer works and I see these tags:

    <Invisible>INVISIBLE_SUBMARINE</Invisible>
    <SeeInvisible>INVISIBLE_SUBMARINE</SeeInvisible>


    Question is - where does INVISIBLE_SUBMARINE determined? how does game knows what to do with it? Can go there and create new invisibility tag for a different type of units?

    Thank You!
     
  13. Thorvald of Lym

    Thorvald of Lym A Little Sketchy

    Joined:
    Nov 21, 2005
    Messages:
    8,089
    Location:
    A Palace north of Oslo
    It's entirely possible and I've done it myself. Two other keys you need are <InvisibleInfo> (see Civ4InvisibleInfos.xml [BTS] or Civ4BasicInfos.xml [Vanilla/Warlords] in BasicInfos) and a TXT_KEY_ definition for display in the Civilopedia (Firaxis organizes them in GameText_Objects).
     
  14. dacubz145

    dacubz145 Chieftain

    Joined:
    Jun 21, 2010
    Messages:
    3,730
    Location:
    Windy City
    Got a new computer, so I may just be forgetting a step

    Whenever I put in a debug DLL the mod doesn't load. It doesn't crash or anything, but the mod just never loads. I'm using just the regular debug DLL available on this site. If I remove the DLL, it loads perfectly fine. Any ideas??
     
  15. ChaosSlayer

    ChaosSlayer Chieftain

    Joined:
    Feb 3, 2011
    Messages:
    587

    thank you so much! I think I got it working ! ;)
     
  16. ChaosSlayer

    ChaosSlayer Chieftain

    Joined:
    Feb 3, 2011
    Messages:
    587
    Another question.

    About Flank attack.
    I have certain units doing Flank attacks vs some Siege units. Problem is that I have many different siege units and listing them all is cumbersome.
    So instead of listing Catapult, Trebuchet, Cannon, etc.
    I would like just to say: Flank Attack vs Siege units and be done with it.

    Any ideas?
    Thanks! =)
     
  17. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    4,114
    I can't tell why it fails when it used to work, but I can say that I have had really bad luck using debug DLLs compiled by other people. However if I compile them myself, then they work just fine. Considering that a debug DLL is not really useful without the debugger and that the debugger doesn't work unless the compiler works, I have yet to see a good reason to use debug DLLs compiled by other people.

    If you aim to get assert messages to test your xml changes, then you should get an assert DLL, not a debug DLL. The difference is that the assert DLL is optimized, and while it's slower than release, it's still much faster than a debug one. Debug is really only for attaching the debugger to keep an eye on what the game does at runtime.
     
  18. dacubz145

    dacubz145 Chieftain

    Joined:
    Jun 21, 2010
    Messages:
    3,730
    Location:
    Windy City
    Turns out, I can't load any mod with a DLL (just only tried debug since restarting game). Any idea why I wouldn't be allowed to load games with DLLs? I'm actually on the same computer I used to mod on (got a new hard drive so had to reinstall game) so I'm not sure why they won't even load?
     
  19. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    4,114
    I think there are two things, which can have happened:

    1: civ can't read the DLL
    This would be a file permission issue. I can't tell why it accepts other other files and not the DLL if this is the case.

    2: some security prevents loading 3rd party DLL files
    Steam has some anti hacking/cheating stuff, which prevents using a debugger. Maybe it can even prevent reading the DLL. I recall something about the newest version removing direct IP connection and some mod support. It should be possible to switch to the previous version inside steam.

    If you have the disc version, try reinstalling outside program files (like C:\games). That will solve most file permission problems. If it's the steam version, then seek help from somebody with experience with that version.
     
  20. God-Emperor

    God-Emperor Chieftain

    Joined:
    Jul 18, 2009
    Messages:
    3,551
    Location:
    Texas
    Did you apply the patch to get Civ up to the last version, 3.19 for BtS? The DLL and .exe should match versions, so if the DLL in the mod was build for BtS 3.19 then the game needs to be at 3.19.
     

Share This Page