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

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,055
    Gender:
    Male
    Location:
    Leblanc
    Is there a Python event to be handled when the Python code is read again?
     
  2. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,055
    Gender:
    Male
    Location:
    Leblanc
    In case anyone else is wondering about that, if you use BUG, there is a "PythonReloaded" event you can hook up to that is fired every time the game refreshes and reinitialises the Python code.
     
  3. Merkava120

    Merkava120 Oberleutnant

    Joined:
    Feb 2, 2013
    Messages:
    380
    Gender:
    Male
    Location:
    Socially distant
    How do you get a graphical effect to continually loop?? (I feel like it should be obvious...)
     
  4. Merkava120

    Merkava120 Oberleutnant

    Joined:
    Feb 2, 2013
    Messages:
    380
    Gender:
    Male
    Location:
    Socially distant
    No, wait, I know how to do it. In CvEventManager there is a function called "update" that you can put looping/constant things in. So a looping graphical effect could be done by putting triggerEffect in update().

    Edit: it seems that the function you should use is onGameUpdate()
     
    Last edited: Jul 15, 2020
  5. ProjectMaximus

    ProjectMaximus Chieftain

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

    In my modding of ROM AND2 I would like to do exactly the same thing what you've mentioned in this post. I have done the TechIcon size, TechName position and TechPanel button positions so far.

    Have you found the way of widening TechPanels in this mode? I would like to do roughly 1.5x wide on each (same size on all).
    By the way, I would increase the text font size as well a bit.
    Can you (or anyone) help me?
     
  6. rtt4a

    rtt4a Prince

    Joined:
    Mar 3, 2009
    Messages:
    482
    Hi all, can somebody tell me what this python error log means..? I

    Traceback (most recent call last):
    File "CvScreensInterface", line 442, in pediaMain
    File "SevoPediaMain", line 263, in pediaJump
    File "SevoPediaMain", line 322, in showContents
    File "SevoPediaMain", line 552, in placeNationalWonders
    File "SevoPediaMain", line 834, in placeItems
    RuntimeError: unidentifiable C++ exception
    ERR: Python function pediaMain failed, module CvScreensInterface
     
    Last edited: Jul 29, 2020
  7. Zeta Nexus

    Zeta Nexus Deity

    Joined:
    Jan 23, 2014
    Messages:
    3,818
    Gender:
    Male
    Location:
    In a constant brainstorm...
    Where can I find and edit the text marked with yellow?
    upload_2020-7-30_9-56-42.png
     
  8. Zeta Nexus

    Zeta Nexus Deity

    Joined:
    Jan 23, 2014
    Messages:
    3,818
    Gender:
    Male
    Location:
    In a constant brainstorm...
    Actually I have totally forgot about it. :lol:
    I tried it this morning but with only partial success (increased the tech icon size but it covers tech name and unblockable content).
    Can you share your file, your changes?
     
  9. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,519
    Gender:
    Male
    Location:
    Canberra, Australia
    I looked at my versions of SevoPedia but the line numbers don't line up. It usually means there is something wrong with what is being displayed. It is probably not a wrong sized icon or two items with the same name, as those cause other problems:lol:. I would need to see that python module (SevoPediaMain.py) to be able to help more.
     
  10. rtt4a

    rtt4a Prince

    Joined:
    Mar 3, 2009
    Messages:
    482
    Hi, heres main.py if you really have time to check:) this error cause pedia not working (building and techs) and trying to use it will crash game.. also if try to star game it will open without UI.
     

    Attached Files:

  11. ProjectMaximus

    ProjectMaximus Chieftain

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

    There is a good news, I finished completely my TechTree (see uploaded CvTechChooser.py file and some pics). :)

    I used Note++.

    1. TechName
    Line 417: (szTechID, szTechRecord, szTechString, CvUtil.FONT_LEFT_JUSTIFY, iX + 6 + X_INCREMENT*2, iY + 6, -0.1, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_TECH_TREE, i, -1)
    Line 1146: (szTechID, sPanel, szTechString, CvUtil.FONT_LEFT_JUSTIFY, iX + 6 + X_INCREMENT*2, iY + 6, -0.1, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_TECH_TREE, i, -1)

    2. TechIcon size & TechName positioning
    Line 422: (szTechButtonID, szTechRecord, gc.getTechInfo(i).getButton(), iX + 6, iY + 6, TEXTURE_SIZE*2, TEXTURE_SIZE*2, WidgetTypes.WIDGET_TECH_TREE, i, -1, False)
    Line 1146: (szTechID, sPanel, szTechString, CvUtil.FONT_LEFT_JUSTIFY, iX + 6 + X_INCREMENT*2, iY + 6, -0.1, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_TECH_TREE, i, -1)

    3. TechPanel button positions
    Line 425: (screen, i, X_START+ X_INCREMENT*2, iX, iY - 3, szTechRecord)

    4. TechPanel lenghtening
    Line 107, 256, 263, 267, 1079, 1084: BOX_INCREMENT_WIDTH = 30

    5. I changed the colours of all era and the colour of selecting requested tech.
    If you don't like my style, just ignore this part or you can adjust the numbers in RGB system:

    Line 373: (szTechRecord, 255, 255, 0) - yellow for current research
    Line 376: (szTechRecord, 255, 0, 0) - red for researching tech

    Line 383: (szTechRecord, 96, 42, 30) - Ancient
    Line 386: (szTechRecord, 50, 55, 2) - Classical
    Line 389: (szTechRecord, 0, 96, 18) - Medieval
    Line 392: (szTechRecord, 0, 74, 74) - Renaissance
    Line 395: (szTechRecord, 0, 55, 85) - Industrial
    Line 398: (szTechRecord, 0, 0, 122) - Modern
    Line 401: (szTechRecord, 124, 0, 130) - Future

    then the same in

    Line 1152: (szTechRecord, 255, 255, 0) - yellow for current research
    Line 1154: (szTechRecord, 255, 0, 0) - red for researching tech

    Line 1160: (szTechRecord, 96, 42, 30) - Ancient
    Line 1163: (szTechRecord, 50, 55, 2) - Classical
    Line 1166: (szTechRecord, 0, 96, 18) - Medieval
    Line 1169: (szTechRecord, 0, 74, 74) - Renaissance
    Line 1172: (szTechRecord, 0, 55, 85) - Industrial
    Line 98: (szTechRecord, 0, 0, 122) - Modern
    Line 401: (szTechRecord, 124, 0, 130) - Future
     

    Attached Files:

    lfgr and Zeta Nexus like this.
  12. LPlate2

    LPlate2 Warlord

    Joined:
    Dec 27, 2018
    Messages:
    112
    Hi,

    I’m trying to cycle through the yields and get the yield value on some plots.
    I’m currently trying,
    Code:
    for i in range(YieldTypes.NUM_YIELD_TYPES):
       plotYield = pPlot.getYield(i)
    This is now giving me a, “ this constructor takes no arguments” error.
    In CyPlot.h, the function is
    int getYield(YieldTypes eIndex).

    How do I get this to work?
     
  13. bluepotato

    bluepotato Warlord

    Joined:
    Dec 11, 2018
    Messages:
    212
    Looks like getYield expects a YieldTypes enum type. So I think you could use something like
    Code:
    pPlot.getYield(YieldTypes(i))
    (but I haven't tested that so I might be wrong.)
     
  14. LPlate2

    LPlate2 Warlord

    Joined:
    Dec 27, 2018
    Messages:
    112
    Thanks, worked
     

Share This Page