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

New to modding, trying to edit the emigration mod for civ 5. Need help.

Discussion in 'Civ5 - Creation & Customization' started by Tim_the_Texan, Mar 6, 2016.

  1. Tim_the_Texan

    Tim_the_Texan Chieftain

    Joined:
    Mar 6, 2016
    Messages:
    7
    There's an awesome mod on Steam called Emigration. It utilizes local city happiness (and other factors) to create a "prosperity value" for each city. It then has citizens immigrate from a city with lower prosperity values to higher prosperity values. It's a great mod, very well balanced, and you need to check it out.
    However one thing which I thought it has been missing is the inclusion of religions. When one citizen from an all Christian city A moves to all Muslim city B, it still shows that city B has no christian followers. I wanted to fix that.

    I have no modding experience or knowledge but I'm a pretty quick learner. So after some youtube videos and a lot of guess and check, I was about to add the code needed to add the features I want. But there is one problem - it's not working.
    I'm not sure what I'm doing wrong. I'm editing the lua and xml files directly in notepad. I'm able to get the mod to work properly when I just change little things like values. However when I put my entire code in, the mod loads but there is no more emigration.

    I assume there is some error in my code which prevents it from compiling correctly. But since I have no experience with lua I have no idea what that error could be. And it's not any easier using notepad (I couldn't figure out how to open the existing mod in ModBuddy).

    So basically, can someone look at my code and tell me what's wrong?
    ...also, what's the best way to share the code with you all?
     
  2. Klisz

    Klisz King

    Joined:
    Aug 18, 2014
    Messages:
    804
  3. Tim_the_Texan

    Tim_the_Texan Chieftain

    Joined:
    Mar 6, 2016
    Messages:
    7
    Ok well I couldn't figure out how to send a lua file, so I just saved it as a text file and uploaded it. You're looking at the file entitled Emigration.lua in the emigration mod. I only added changes to the function MoveCitizen. I put in comments which show where the changes start and stop. I found all the functions refering to religions on the site http://modiki.civfanatics.com/index.php?title=ReligionType_(Civ5_Type) .

    Also, I found a math error in my formula for converting religions. I'll fix it later, but I don't think that would have affected whether the code compiles or not.
     

    Attached Files:

  4. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,544
    Location:
    Near Portsmouth, UK
    Firstly, enable logging (see first link in my sig) and check the lua.log file for errors.

    If you can't fix those and/or it's still not working, we need the entire modded mod, not just one file from it (link above, or the second one in my sig)
     
  5. Tim_the_Texan

    Tim_the_Texan Chieftain

    Joined:
    Mar 6, 2016
    Messages:
    7
  6. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,544
    Location:
    Near Portsmouth, UK
    Nope. Because a) that assumes that you really haven't made any other (inadvertent) changes and/or we make exactly the same edits you did and b) requires us to do more work.

    Always zip up what you have on your disk and attach that - as then we are 100% sure that we have an exact copy of what you have
     
  7. Amnesiac9

    Amnesiac9 Chieftain

    Joined:
    Feb 13, 2016
    Messages:
    15
    Just zip the entire mod file after building it, and upload the zip here.
     
  8. Tim_the_Texan

    Tim_the_Texan Chieftain

    Joined:
    Mar 6, 2016
    Messages:
    7
    Ok it works now! Thanks for showing me how to debug the code Whoward. In the end there were syntax errors, mispellings, and some math errors. I also was looking at a out of date reference which said there were only 11 religions not 13. Now it seems to run properly and the notification popup tells you which religion is immigrating into your city as as well as which city it's from.

    There are still a couple errors which I have no idea about, but they're from parts of the code which I don't think I did anything to.

    Well here's the modded mod. The code is really ugly, it works. Any comments on it would be much appreciated. Again thanks for the help!
     

    Attached Files:

Share This Page