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

[UI]DiploWillard - Easier City-States management from one window

Discussion in 'Civ5 - Mod Components' started by Onni, Oct 9, 2010.

  1. Onni

    Onni Chieftain

    Joined:
    Oct 9, 2010
    Messages:
    82
    This mod has been merged with CivWillard. Please disable this one and use that in the future...

    With this mod you can manage City-states and see their data in an easy single screen. You will have a handy small button on your screen to open it at any time. Button even keeps you informed when your next ally or friend City-state is about to expire.

    This is my first Civilization mod and for that reason I wanted to see what can be accomplish with the SDK's and API. Therefore I tried to make the mod as dynamic and modular as possible so it's easy to build on it in the future. This also enabled me to give the end user much more power to optimize the mod to their liking. As no Civ core files are changed or required this mod should be compatible with any other mod.

    • no dependencies (on other mods or core files)
    • handy button to open/close the window (right click to open options)
    • useful turn counter for the next City-State influence level change
    • configurable big tooltip for less important info needs
    • user-friendly controls for data and window management




    Credits:
    to Afforess, killmeplease and Whys for the awesome job on the serialize & deserialize functions discussed here. :king:

    Version history:
    V6.0
    • hotfix: button was behind CityWillards button
    V5.0
    • added better options statistic selection dropdowns
    • added right clicking name centers the view to the city-state
    • added option to use mini-skin
    • added configurable big tooltip
    • added ability to create and rename views
    • added all options are saved individually for every view
    • added right clicking the main button opens options
    • added shorter names for city-states
    • fixed decimal number sorting
    • fixed better window positioning
    • fixed scrollbar not always showing
    V4.0
    • fixed smoother window and button positioning
    • fixed window and button reset not saving bug
    • fixed wrong color for enemy City-states bug
    • fixed visible DiploWillard version number on the window
    Even older version history:
    Spoiler :

    v3.0
    • fixed a game freezing bug
    • added better performance for the whole mod
    • added new stat (combined food/culture/military bonus)
    v2.0
    • fixed 120+ influence counter bug
    • added Protected column
    • added options screen (custom colors, custom columns, etc.)
    • added saving of user settings
    v1.0
    • initial version
     

    Attached Files:

  2. Afforess

    Afforess The White Wizard

    Joined:
    Jul 31, 2007
    Messages:
    12,239
    Location:
    Austin, Texas
    Game:GetScriptData and Game:SetScriptData allows Lua to save and retrieve a string. With some manipulation, you can convert most information into a large string of data, save it, then retrieve it when needed.
     
  3. Onni

    Onni Chieftain

    Joined:
    Oct 9, 2010
    Messages:
    82
    Cheers mate! :goodjob:
     
  4. marekb

    marekb Warlord

    Joined:
    Jun 4, 2006
    Messages:
    229
    Very nice mod. :)

    Two issues: the button seems to stay on top of city-screen. It should be an easy task modify this, but I couldn't find how to do this.

    I was trying to change "ally" and "friend" colors to have them as in city-state icons (ie. green for friend and cyan for ally). I modified GG.GetColor(atWar, infLevel), this changed the name colors but icon colors remain as before.
     
  5. Shevek

    Shevek Prince

    Joined:
    Mar 8, 2002
    Messages:
    463
    Location:
    Berlin
    Very nice, love it. Thanks a bunch for this.
     
  6. Onni

    Onni Chieftain

    Joined:
    Oct 9, 2010
    Messages:
    82
    You could propably hide the button in city-screen with this event attachment:
    Events.SerialEventEnterCityScreen.Add( hide_function )
    I only have GG.OnToggle function there so maybe wrap that in a new hide function? For me this was a non-issue, since I preferred the button at the bottom, but if you move it then it can of course get in a way.

    The City-state name is an xml-label and the icon an xml-image. That's why changing their colors works a bit different. Haven't yet figured any other than manual way to convert the predefined color tags (e.g. [COLOR_POSITIVE_TEXT]) to tables that are used with the xml-images. :( But you can do this manually in that GG.GetColor function by editing the table value after color tag.

    Just setting up an options screen. Since now I can actually save these settings then maybe I'll add some of these there?
     
  7. Onni

    Onni Chieftain

    Joined:
    Oct 9, 2010
    Messages:
    82
    Hmm. This doesn't seem to work. When I try to run the command it gives an error message:
    "Runtime Error: [string "_cmdr = {Game:GetScriptData("test")}"]:1: NYI"
    NYI = Not Yet Implemented ?

    It does work with pPlayer:GetScriptData. But the user needs to save the game to store it and even then it works only with that save game.

    Right now I'm thinking about using that pPlayer:GetScriptData and some sort of parameter string copy&paste solution for new games? Any better ideas? :)
     
  8. marekb

    marekb Warlord

    Joined:
    Jun 4, 2006
    Messages:
    229
    Thanks, I will try to figure it out.

    There is some issue with turns to status change. If IP for city-state is grater then 120 then the number of turns to 120IP threshold is shown, not the number of turns to the ally-friendship threshold.
     
  9. n0rdi

    n0rdi Chieftain

    Joined:
    Dec 17, 2007
    Messages:
    8
    I love it :D
     
  10. Onni

    Onni Chieftain

    Joined:
    Oct 9, 2010
    Messages:
    82
    Version 2.0 is now available.

    Found a solution for saving those user settings thanks to the discussion going on here. For this mods needs using "Modding.OpenUserData()" function was just perfect. :)
     
  11. Ktulu

    Ktulu Warlord

    Joined:
    Dec 10, 2002
    Messages:
    140
    Location:
    BC, Canada
    First great mod. However I think there may be a problem with your newest version. I haven't had any freezes until this morning. The game will freeze up after about a dozen turns (saved game or new game). I installed a few mods this morning so the first thing I tried was to play a vanilla game to make sure the freezing was the result of a mod... vanilla game worked fine with no freezes. So I started some trial an error by disabling mods one by one and I think I've narrowed down the problem to your mod. I've disabled it and now have played past 50 turns with no issues.

    Has anyone else had issues with V2.0?
     
  12. Onni

    Onni Chieftain

    Joined:
    Oct 9, 2010
    Messages:
    82
    Thanks for the heads up! I haven't experienced this myself, but I'll look into this and get back as soon as there are any news. If anybody else is having these kind of problems then please let me know?
     
  13. lounahtic

    lounahtic Chieftain

    Joined:
    Oct 12, 2010
    Messages:
    14
    great mod... i've been wanting a better way to keep track of the city states...

    i do have one suggestion though, might just be me nitpicking, but have you considered collapsing the food/culture/turns till new units into one column? dunno what you would call it, maybe B for benefits... but since a city state will only give you one thing, either food, culture or units... it seems a waste of space to have 3 columns for those things...
     
  14. marekb

    marekb Warlord

    Joined:
    Jun 4, 2006
    Messages:
    229
    This kind of City-state window should be in vanilia. Great mod.

    I observed the same as Ktulu. Yesterday the game crashed every few turn, always when starting my turns. I have though it was due to large number of units, but today I started a new game and every turn game friezes or a little when starting my turns and after some it crashes. I switched off your mod, and freezes are gone and I played ~20 turns without problems.
     
  15. lounahtic

    lounahtic Chieftain

    Joined:
    Oct 12, 2010
    Messages:
    14
    yea same problem here... froze at turn 17....
     
  16. Perkus

    Perkus Prince

    Joined:
    Oct 16, 2010
    Messages:
    316
    Location:
    Ontario, Canada
    Wow, what a kick-ass mod! I just about melted when I saw the "move button", "move window", and resize height in the options! Is this really crashing on everyone? What a shame...

    Minor bug: The WAR COLOR doesn't seem to be working for me. I am at war with Edinburgh, -60 rating, and it shows up using the NEUTRAL color instead...

    Hope you can figure out why it's dying.
     
  17. Onni

    Onni Chieftain

    Joined:
    Oct 9, 2010
    Messages:
    82
    Version 3.0 is now available.

    My apologies for the game freezing bug. :blush: I tracked it down to be caused by lua events that I had attached to the main update function. Nothing wrong with the event, but I hadn't really stress-tested this mod before. After that test I had my hands full in fixing my mistakes. I have so slow computer myself and so many windows opened that I really didn't notice anything out of the ordinary before. ;)

    This was a great idea so I implemented it with the fix. Thanks Lounahtic!
     
  18. Onni

    Onni Chieftain

    Joined:
    Oct 9, 2010
    Messages:
    82
    Thanks. I'll look into this in the next update.
     
  19. Perkus

    Perkus Prince

    Joined:
    Oct 16, 2010
    Messages:
    316
    Location:
    Ontario, Canada
    Cool! But this is weird: I went to look for it in the Downloads section here under Modpacks. v3.0 isn't showing up, v2.0 is gone. I figured you pulled it, or moved it. But when I Search for "Willard" it tells me it's in Civ5-Modpacks! Huh?

    Found it through the game's browser though. The WAR COLOR thing is blatantly reproducible, I think, I didn't do anything special to make it happen again. Wasn't sure if I did something weird the first time.

    Another minor thing: It still says v1.0 in the corner of the main window!
     
  20. Kanin

    Kanin Chieftain

    Joined:
    Mar 17, 2007
    Messages:
    28
    Nice mod, i like it!

    The button looks and behave odd though. There is a square background just below the button, and since all other civ5 buttons are round, yours look out of place. Even when I move the button to other position, the ugly background still follows. Also when I mouse over the button, it moves upward a tiny distance. All other buttons stays in the same place when being mouse overed. There is no tooltip when mouseing over your button. Although this isn't needed, it would be neat if your button behaved and acted just like all other buttons.
     

Share This Page