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

Modmodding Q&A Thread

Discussion in 'Rhye's and Fall - Dawn of Civilization' started by Leoreth, Dec 14, 2013.

  1. Alexius08

    Alexius08 Emperor

    Joined:
    May 28, 2010
    Messages:
    1,124
    After saving my edits to UnitNameEventManager.py, I'm getting the following error message in the beginning of autoplay:

    Am I missing something here?
     
  2. Leoreth

    Leoreth Friend Next Door Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,963
    Gender:
    Male
    Location:
    Faraway
    You mean when you edit the file while the game is opened?

    That's normal. The thing is that when you change a file, the entire Python environment will be reloaded with the new code. This deletes all data currently in memory. BugData is the module that handles saved data, I made it aware of this so that saved data will be reloaded at that point.

    Note that this isn't a perfect solution: editing a Python file does not save the data in memory beforehand, so you might load an older state that had been saved at some point (usually along with an autosave).
     
  3. Alexius08

    Alexius08 Emperor

    Joined:
    May 28, 2010
    Messages:
    1,124
    I'm still getting the message even after exiting and relaunching the game without changing anything in the code. It didn't show up when I switched to the develop branch before starting the game, though.
     
  4. Louis the XIV

    Louis the XIV Sun King

    Joined:
    Jun 23, 2020
    Messages:
    822
    Gender:
    Male
    Location:
    Court of Versailles
    I was hoping someone could tell me in which file can I edit the starting plots of civs in original RFC? I'm not sure if this thread is only for DoC questions but I would appreciate it if anyone could tell me.
     
  5. Leoreth

    Leoreth Friend Next Door Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,963
    Gender:
    Male
    Location:
    Faraway
    Not having seen your code, I am not sure what might have caused this then.

    Not sure, but I would try Consts.py first, maybe RiseAndFall.py.
     
  6. Louis the XIV

    Louis the XIV Sun King

    Joined:
    Jun 23, 2020
    Messages:
    822
    Gender:
    Male
    Location:
    Court of Versailles
    I am already familiar with both of the files you suggested and haven't seen anything yet. Do you think it's in the Game Core dll?
     
  7. merijn_v1

    merijn_v1 Black Belt

    Joined:
    Dec 29, 2008
    Messages:
    5,888
    Location:
    The city of the original vlaai
    In vanilla RFC it is in Const.py. Search for "tCapitals".
     
  8. Louis the XIV

    Louis the XIV Sun King

    Joined:
    Jun 23, 2020
    Messages:
    822
    Gender:
    Male
    Location:
    Court of Versailles
    How can I get the vanilla version of RFC? And also why would it be different then in the BTS version?
    EDIT: Nevermind it's also in the BTS Version. Thanks!
     
  9. MacAurther

    MacAurther Chieftain

    Joined:
    Feb 2, 2013
    Messages:
    27
    Hi! I am pretty new to modding DoC (and CIV) so I have a basic question I'm trying to figure out to learn the structure of the mod better (and sorry if it has been asked elsewhere):

    In the original Rhye's and Fall, I think each Civ that had a later start than the start of the scenario had a Catapult somewhere on the map so that when turns were autoplaying, the player would not receive the message that they were defeated. I do not see any such loading units in the scenario file (all that's there for 3000 BC are Egypt and Babylonia, who start at the beginning of the scenario) for later civs. Can someone point me to the mechanism that prevents the player from losing during the auto turns while they are waiting to begin? Thanks!
     
  10. Louis the XIV

    Louis the XIV Sun King

    Joined:
    Jun 23, 2020
    Messages:
    822
    Gender:
    Male
    Location:
    Court of Versailles
    Everything that makes Rhye's and Fall is in the python files and in the dll. If I'm not mistaken the year that makes the civilization spawn is in Assets/Python/consts.py.
    The file which says how many units spawn in in Rise.py, same folder as consts.
    Also make sure not to edit the original file or if you want to edit the original make a copy of it!
     
  11. Leoreth

    Leoreth Friend Next Door Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,963
    Gender:
    Male
    Location:
    Faraway
    Can you tell us what you want to achieve?
     
  12. bluepotato

    bluepotato Warlord

    Joined:
    Dec 11, 2018
    Messages:
    295
    I described how the autoplay mechanism functions here. A small correction to that post is that in RFC (and DoC) it isn't unit no. 0 that is spawned in reviveActivePlayer, but rather a catapult - not that this really changes anything, it's still needlessly complex.
     
  13. MacAurther

    MacAurther Chieftain

    Joined:
    Feb 2, 2013
    Messages:
    27
    That post is very helpful, thanks! That makes a lot of sense, and glad to see the catapult is still around.

    What I am trying to achieve is just to have some custom Civilizations I made work with autoplay, which they currently aren't with my code. I assume I made a silly mistake somewhere, but I can dig for that on my own. I was interested in finding the roots of this system, and doTurn() seems to be it. Thanks for the help!
     
  14. Louis the XIV

    Louis the XIV Sun King

    Joined:
    Jun 23, 2020
    Messages:
    822
    Gender:
    Male
    Location:
    Court of Versailles
    Well, adding a new custom civilization in mods like RFC is a bit more complicated then just editing some python files.
    You have to edit a lot of the C++ and H files in the DLL to add your new civ to all the entries, and then in consts you will also need to edit all the other ID's so they don't interfere with your custom civs UU and UB.
    If you want to add a new civ to RFC I suggest using this guide https://forums.civfanatics.com/threads/rfc-koreans.396903/ at the bottom of it is a txt file in which are all the details of all the files you need to edit to add a new civ.
     
    MacAurther and Leoreth like this.
  15. MacAurther

    MacAurther Chieftain

    Joined:
    Feb 2, 2013
    Messages:
    27
    Understood :). I personally have used Leoreth's guide https://forums.civfanatics.com/threads/guide-adding-a-civilization-to-doc-updated.561840/, and have already edited the dll, xml, and python somewhat extensively, but I probably have a bug somewhere. Everything else is working (I can play as Egypt and switch to my new Civ when it spawns, for example), but autoloading a civ without a unit present on the map from Turn 0 doesn't work; it just sits on the DoM text without advancing, and when you press Escape the player is defeated. I don't expect solutions from the little detail I am giving, but I also don't want to ask someone else to look through my entire codebase for bugs, so I was just looking for a better understanding of the system for myself. Thanks for the tips!
     
    Louis the XIV likes this.
  16. merijn_v1

    merijn_v1 Black Belt

    Joined:
    Dec 29, 2008
    Messages:
    5,888
    Location:
    The city of the original vlaai
    When I created my civs, I had this error too. I don't know anymore what the exact problem was, but I'm fairly sure it was a python error. (But don't quote me on this) I hope this narrows down the location of the bug a bit.

    Using the guide you mention is the good one, as it is specifically written for adding civs to DoC. But in some cases it is a bit outdated. (Especially after the code rewrite)
    Small trivia: Jarkov (the writer of the guide linked in Louis' post) was the first person (probably outside Rhye) to add a civ to RFC. Before that there were also a few civ mods, but those replaced an already existing civ by a new one.
     
    Last edited: Jan 12, 2021
  17. Leoreth

    Leoreth Friend Next Door Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,963
    Gender:
    Male
    Location:
    Faraway
    It was Jarkov's guide that helped me add the first proper civilisation to DoC (which was Byzantium). Before, I could only do the "x respawns as y" thing that is currently still being used by Iran, Mexico and Colombia.
     
  18. MacAurther

    MacAurther Chieftain

    Joined:
    Feb 2, 2013
    Messages:
    27
    Here's a basic question:
    I have a "player" object in Python: for example, as obtained by an event callback:
    player = gc.getPlayer(kTriggeredData.ePlayer)

    Now I want to get the capital coordinates for that player, as defined in Areas.py. I can't do:
    Areas.getCapital(player)
    Because getCapital is expecting an integer, not a player object.

    So is there an easy way to obtain the Python "iPlayer" integer from a player object? Something akin to player.getCivilizationType(), but for the PlayerTypes enum.

    I may be misunderstanding something fundamentally, and let me know if there's a better way. Still getting used to the way everything is laid out.
     
  19. KeeperOT7Keys

    KeeperOT7Keys did nothing wrong

    Joined:
    Jul 10, 2013
    Messages:
    351
    Gender:
    Male
    Location:
    Mugla, Turkey
    I am not a pro like Leoreth but, don't most hooks provide the iplayer instead of pplayer anyways? Usually you want to convert from iplayer to the pplayer afaik.


    if there is no built in method I guess you can iterate over all player ids, and check if that id returns the same pplayer object:


    for iPlayer in xrange(gc.getMAX_PLAYERS()):
    pPlayer = gc.getPlayer(iPlayer)
    if pPlayer is myPlayer:...


    (Although I am not sure whether player objects can be compared using 'is' or == operators)
     
    MacAurther likes this.
  20. merijn_v1

    merijn_v1 Black Belt

    Joined:
    Dec 29, 2008
    Messages:
    5,888
    Location:
    The city of the original vlaai
    player.getID() should do the job.
     
    MacAurther likes this.

Share This Page