View Full Version : [UI]DiploWillard - Easier City-States management from one window
Onni Oct 08, 2010, 10:26 PM This mod has been merged with CivWillard (http://forums.civfanatics.com/showthread.php?t=405111). 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
http://forums.civfanatics.com/attachment.php?attachmentid=272236&d=1289511406
http://forums.civfanatics.com/attachment.php?attachmentid=272243&d=1289511604
http://forums.civfanatics.com/attachment.php?attachmentid=272238&d=1289511406
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:
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
Afforess Oct 08, 2010, 10:37 PM If anybody knows how to save options between different games then please do tell?
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.
Onni Oct 08, 2010, 11:29 PM 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.
Cheers mate! :goodjob:
marekb Oct 09, 2010, 05:46 AM 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.
Shevek Oct 09, 2010, 02:08 PM Very nice, love it. Thanks a bunch for this.
Onni Oct 10, 2010, 04:14 AM 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.
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?
Onni Oct 10, 2010, 06:36 AM 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.
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? :)
marekb Oct 10, 2010, 11:40 AM 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?
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.
n0rdi Oct 10, 2010, 11:44 AM I love it :D
Onni Oct 16, 2010, 07:03 AM Version 2.0 is now available.
Found a solution for saving those user settings thanks to the discussion going on here (http://forums.civfanatics.com/showthread.php?t=391102). For this mods needs using "Modding.OpenUserData()" function was just perfect. :)
Ktulu Oct 16, 2010, 11:50 AM 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?
Onni Oct 16, 2010, 02:01 PM 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?
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?
lounahtic Oct 16, 2010, 03:32 PM 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...
marekb Oct 17, 2010, 03:13 AM 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.
lounahtic Oct 17, 2010, 05:03 PM yea same problem here... froze at turn 17....
Perkus Oct 17, 2010, 06:53 PM 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.
Onni Oct 17, 2010, 07:11 PM 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. ;)
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...
This was a great idea so I implemented it with the fix. Thanks Lounahtic!
Onni Oct 17, 2010, 07:13 PM 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...
Thanks. I'll look into this in the next update.
Perkus Oct 17, 2010, 07:40 PM 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!
Kanin Oct 17, 2010, 08:21 PM 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.
Onni Oct 18, 2010, 06:11 AM 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?
The v3.0 is uploaded here, but it's still waiting for the approval. It's unfortunate that the whole download page for the mod gets offline when you update the file. I'm sure it will be back soon.
Onni Oct 18, 2010, 06:21 AM 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.
It's actually the same button that you can find on top of the help-pages (Civilopedia). It's meant to be sitting at the bottom of the screen so the look and feel is as it should be. I'm quessing that one day people might have many mod-buttons that will be visible all the time. Bottom row seemed to be a good place to put them?
gnosisQ Oct 18, 2010, 04:46 PM Thanks for the update, I couldn't figure out what had happened, was going through and disabling mods when I found the v3 update.
Great tool, love the customizations, keep up the good work!
marekb Oct 19, 2010, 02:47 AM Version 3 works perfectly. Thanks.
lounahtic Oct 19, 2010, 12:55 PM thanks for adding my request... and for v3.... 300+ turns and still no crash... hands down one of my favorite mod.. +2 cookie points for you...
Perkus Oct 19, 2010, 05:59 PM One minor quibble: if you current allegiance is 0, it shouldn't be showing 2.00 as my allegiance change (I'm greek, so that's doubled), it should just be 0. And is it easy to get rid of the decimal places unless they're necessary?
Onni Oct 19, 2010, 08:20 PM One minor quibble: if you current allegiance is 0, it shouldn't be showing 2.00 as my allegiance change (I'm greek, so that's doubled), it should just be 0. And is it easy to get rid of the decimal places unless they're necessary?
I left the allegiance change number there, even if it's not actually changing, so that people would always know what the change rate is. This is especially useful in the beginning when your deciding who your first city-state friend will be. Hostile personality City-states tend to give less bang for your bucks. :mischief:
Decimals are quite necessary because there can be major changes to that rate which can only be noticed through decimals.
heinous_hat Oct 19, 2010, 09:50 PM Only good things to say about this so far. The consolidated info is quite a bit more agreeable than drilling down into multiple screens and searching tooltips to discover needed data. I also like the method you're using to avoid this being a static screen where one is locked out of the world view.
One question: Did I imagine the last 4 columns being in a previous version (resources, status, allies and protected). Or is that screenshot what you're working on currently?
Perkus Oct 20, 2010, 12:28 AM Decimals are quite necessary because there can be major changes to that rate which can only be noticed through decimals.
I'm aware of that, but some of the time the rate will be an even number, it could display just 2 instead of 2.00 at those times. It would just look a little less cluttered, is all.
Onni Oct 20, 2010, 07:41 AM One question: Did I imagine the last 4 columns being in a previous version (resources, status, allies and protected). Or is that screenshot what you're working on currently?
Those stats are already in the mod. It's just that they are not shown by default. You can add them yourself by going to the options page and checking one of the dropdown boxes on the right side of the screen.
Montov Oct 20, 2010, 09:18 AM Excellent mod. v2 was indeed buggy, but no problem with v3.
Very handy. Besides the luxury displayer, this is the most useful mod there is. Very flexible with the options.
I did notice that v1.0 is still mentioned. ;)
Also, a small request, is it possible to have a X button at the topright of the window to close it? I find the small 'close' text a little annoying/small.
heinous_hat Oct 20, 2010, 09:15 PM Those stats are already in the mod. It's just that they are not shown by default. You can add them yourself by going to the options page and checking one of the dropdown boxes on the right side of the screen.
Lol. Found that, thanks :) I thought the options were all toggles, but it's a drop down.
lichen8566 Oct 21, 2010, 01:23 AM Good mod. I think the original UI is really not good enough.
lichen8566 Oct 21, 2010, 04:35 AM Hi, I made some position tweaks about your mod, that places the UI in the better place. I wish you can apply these code. I have already tested them.
File: DiploWillard.xml
Line: 9
<Button ID="MainButton" Anchor="C,B" Size="49,50" Offset="200,0" Texture="CivilopediaTopButtonsCities.dds" ToolTip="City-StatesList">
Line: 14
<Grid ID="MainWindow" Size="390,420" Anchor="C,C" Offset="0,0" Style="Grid9DetailFive140" ConsumeMouse="1">
File: DiploWillardWind.lua
Line: 289
Controls.MainWindow:SetAnchor("C,C")
Controls.MainWindow:SetOffsetVal(0, 0)
Controls.MainButton:SetAnchor("C,B")
Controls.MainButton:SetOffsetVal(200, 0)
And I noticed that the current method of moving main window and button has a little offset. It makes a bad user experience. I'm trying to change it to a better method.
lichen8566 Oct 21, 2010, 05:29 AM I found the problem. The reason of the incorrect moving position is you add and subtract the wrong values. And I made a little change for moving bottom button. That's the code I changed below:
File: DiploWillardWind.lua
Line: 238
function GG.ProcessInput( uiMsg, wParam, lParam )
if GG.updateOptions then --used to force update options screen on actions
if( uiMsg == MouseEvents.MouseMove ) then
Controls.MainWindow:SetHide(false)
GG.UpdateDisplay()
GG.updateOptions = false
end
end
if GG.moveMode then --move main window
Controls.MainWindow:SetHide(false) --was temporarily hidden to get mouse movements registered
if( uiMsg == MouseEvents.MouseMove ) then
x, y = UIManager:GetMousePos()
Controls.MainWindow:SetAnchor("L,T")
Controls.MainWindow:SetOffsetVal(x+1, y) -- +1 to avoid clicking the element
end
if( uiMsg == MouseEvents.LButtonUp ) then
x, y = UIManager:GetMousePos()
Controls.MainWindow:SetAnchor("L,T")
Controls.MainWindow:SetOffsetVal(x+1, y) -- -1 to help position on top and left edges
GG.S.Settings.windowX = x+1
GG.S.Settings.windowY = y
GG.moveMode = false
end
end
if GG.moveMode2 then --move main button
if( uiMsg == MouseEvents.MouseMove ) then
x, y = UIManager:GetMousePos()
Controls.MainButton:SetAnchor("L,B")
Controls.MainButton:SetOffsetVal(x+1, 0) -- +1 to avoid clicking the element
end
if( uiMsg == MouseEvents.LButtonUp ) then
x, y = UIManager:GetMousePos()
Controls.MainButton:SetAnchor("L,B")
Controls.MainButton:SetOffsetVal(x+1, 0) -- -1 to help position on top and left edges
GG.S.Settings.buttonX = x+1
GG.S.Settings.buttonY = 0
GG.moveMode2 = false
Controls.MainWindow:SetHide(false)
end
end
end
File: DiploWillardPara.lua
Line: 76
Controls.MainButton:SetAnchor("L,B")
Controls.MainButton:SetOffsetVal(GG.S.Settings.but tonX, 0)
Onni Oct 21, 2010, 07:25 AM Also, a small request, is it possible to have a X button at the topright of the window to close it? I find the small 'close' text a little annoying/small.
I decided to go for the close button instead of X button, because the games standard windows also use that one. I think this is just one of those things that some people like and others don't. :crazyeye:
Onni Oct 21, 2010, 07:46 AM Hi, I made some position tweaks about your mod, that places the UI in the better place. I wish you can apply these code. I have already tested them.
And I noticed that the current method of moving main window and button has a little offset. It makes a bad user experience. I'm trying to change it to a better method.
I found the problem. The reason of the incorrect moving position is you add and subtract the wrong values. And I made a little change for moving bottom button. That's the code I changed below:
Thanks for the suggestions, but the window positions are also one of those things that everybody have their own preferences. That's why everybody can now position them how ever they like.
I made a compromise with the +10 offset (instead of +1) when moving those windows. +1 required you to be absolutely still when you pressed that mouse button and that lead to too many "miss-clicks". If there only were a simple command to make that main window [ConsumeMouse="0"] it would have made that solution much easier? :confused:
Montov Oct 21, 2010, 10:35 AM I decided to go for the close button instead of X button, because the games standard windows also use that one. I think this is just one of those things that some people like and others don't. :crazyeye:
That's ok. :)
However, I noticed when 2 city states declared war on me (because I was at war with their allied civ), they didn't have the red color that I left as the default color for war. Allied city states does have the correct color.
lichen8566 Oct 21, 2010, 01:16 PM Thanks for the suggestions, but the window positions are also one of those things that everybody have their own preferences. That's why everybody can now position them how ever they like.
I made a compromise with the +10 offset (instead of +1) when moving those windows. +1 required you to be absolutely still when you pressed that mouse button and that lead to too many "miss-clicks". If there only were a simple command to make that main window [ConsumeMouse="0"] it would have made that solution much easier? :confused:
I not mean that the add/subtract values are too small, I mean you use the wrong sign operator. In your original code, you add 10 at the begining of draging, and subtract 10 at the end. Did you notice that every time you drag the window, the had window been put 20 pixels far from the cursor pos.
gruven Oct 21, 2010, 03:26 PM I'm not seeing the war color show up either. City states at war with me are in the neutral color.
gnosisQ Oct 21, 2010, 03:41 PM Great stuff Onni,
Noticed an issue last night, not sure if it's related to a conflict or not and would like your input.
I've only met three city-states but the app shows that they're all at war. I assume with me?
http://img256.imageshack.us/img256/7409/diplowillard.jpg- Met Tikol first, and everything looked fine in the DiploWillard
- Went to war with Monty and the Aztecs, they were not allied with any city-states
- Met the other two city-states
- Bought Tikol's alliance to help me finish off Monty. (You can see that they are allied and generating culture for me)
- Destroyed the Aztecs
- Noticed that all city-states showed they were at war
This is the default Diplomacy window (Rio wants me to war with Cuzco, Tikol wants a great Artist)http://img98.imageshack.us/img98/9517/citystates.jpgAfter these images were taken I progressed a little further, I am now allied with Cuzco as well but the DiploWillard screen still shows them all at WAR.
Haven't met another city-state as of yet, but I'll report back when I do (playing TSL and am stuck in the Americas)
Here's a list of all active mods for my current game;
Note: I'm running Shigg's Earth and not the Tectonics map-scripthttp://img191.imageshack.us/img191/7485/activemods.jpg
Perkus Oct 21, 2010, 05:17 PM This should fix all the problems with the War Color:
Open DiploWillardData.lua, very first function, GG.GetMinorCivData, replace the line
_T[iMinorCiv].atWar = _PlayerTeam:IsAtWar(iOtherTeam)
with:
_T[iMinorCiv].atWar = _PlayerTeam:IsAtWar(iMinorCiv)
IOtherTeam is an undefined local variable. When GG.GetColor() decides which color to display, 'atwar' is checked first, and because it's passing in an undefined value, the result could be almost anything. Because it's checked first, it can color all the city states incorrectly.
It fixed the one problem I have saved, at least.
gnosisQ Oct 21, 2010, 08:38 PM Thanks for the quick reply Perkus,
That did the trick, DiploWillards looking great :)
lichen8566 Oct 22, 2010, 09:00 AM Bug report: The military city-state can not show the correct number of turns until the next unit which gives to you. I'm not sure this bug whether occurs or not when the city-state is your ally.
Perkus Oct 22, 2010, 11:04 AM @lichen8566:
I believe the tooltip on that column already acknowledges that, it's 1-3 turns off, because it's impossible to calculate exactly given the info provided, which strips off fractions of turns that are used internally in calculations. Or that's how I understood it.
@Onni:
Could you add a way of listing the disposition (hostile/friendly/neutral) of each city-state? I consider this fairly essential info in deciding which ones to invest money in. I realize it's reflected to some extent in the decay rate shown, but it should be there, really.
Onni Oct 23, 2010, 02:42 AM Version 4.0 is now available.
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
I not mean that the add/subtract values are too small, I mean you use the wrong sign operator. In your original code, you add 10 at the begining of draging, and subtract 10 at the end. Did you notice that every time you drag the window, the had window been put 20 pixels far from the cursor pos.
I found a solution to get rid of this whole offset thing. Now those windows and buttons should place at the exact position where you place them.
This should fix all the problems with the War Color:
Open DiploWillardData.lua, very first function, GG.GetMinorCivData, replace the line
_T[iMinorCiv].atWar = _PlayerTeam:IsAtWar(iOtherTeam)
with:
_T[iMinorCiv].atWar = _PlayerTeam:IsAtWar(iMinorCiv)
IOtherTeam is an undefined local variable. When GG.GetColor() decides which color to display, 'atwar' is checked first, and because it's passing in an undefined value, the result could be almost anything. Because it's checked first, it can color all the city states incorrectly.
It fixed the one problem I have saved, at least.
Thanks Perkus! This did indeed fix those problems.
Bug report: The military city-state can not show the correct number of turns until the next unit which gives to you. I'm not sure this bug whether occurs or not when the city-state is your ally.
The game API only gives a fixed number on how many turns there are between military unit gifts. It doesn't tell when the next gift is due. Of course this could be calculated, but I've no plans to implement this, because it would require major work on the saving functionality.
@Onni:
Could you add a way of listing the disposition (hostile/friendly/neutral) of each city-state? I consider this fairly essential info in deciding which ones to invest money in. I realize it's reflected to some extent in the decay rate shown, but it should be there, really.
Maybe I'll look into this in the future?
Thalassicus Oct 23, 2010, 06:12 AM Thank you for this! I don't know how I missed it... great mod! :)
Kanin Oct 25, 2010, 10:09 PM Sort order is wrong. Science column sort 10 before 9.
Button is still wrong type for main screen. The button you used is only used at top of civilopedia, and then not as button but more like a tab, where change of position makes sense as indicator of what page you read in the civilopedia. The main screen has a different type of buttons, all behaving like buttons do in other software. Your button stand out in a bad way. If you do not want change it, at least please post here how we can get rid of it manually.
Onni Oct 26, 2010, 06:41 AM Sort order is wrong. Science column sort 10 before 9.
Button is still wrong type for main screen. The button you used is only used at top of civilopedia, and then not as button but more like a tab, where change of position makes sense as indicator of what page you read in the civilopedia. The main screen has a different type of buttons, all behaving like buttons do in other software. Your button stand out in a bad way. If you do not want change it, at least please post here how we can get rid of it manually.
Thanks I'll fix the science column in the future.
You can change the button icon by modifying this bolded value in DiploWillard.xml:
<!-- Button to open/close the main window -->
<Button ID="MainButton" Anchor="C,B" Size="49,50" Offset="200,0" Texture="CivilopediaTopButtonsCities.dds" ToolTip="City-StatesList">
<Label ID="ButtonText" Hidden="0" Anchor="C,C" Offset="0,4" Font="TwCenMT20" FontStyle="Stroke"/>
</Button>
Gazebo Nov 03, 2010, 11:52 AM Thanks for the suggestions, but the window positions are also one of those things that everybody have their own preferences. That's why everybody can now position them how ever they like.
I made a compromise with the +10 offset (instead of +1) when moving those windows. +1 required you to be absolutely still when you pressed that mouse button and that lead to too many "miss-clicks". If there only were a simple command to make that main window [ConsumeMouse="0"] it would have made that solution much easier? :confused:
Onni,
Is there a way to call up (via LUA) the influence totals of a rival civ, or is that information locked out by default? I'd like to add a LUA script to my mod showing a player the influence of a rival civ in a CS so they can know if they should send a diplo unit or not.
Thanks!
G
Onni Nov 03, 2010, 03:52 PM Onni,
Is there a way to call up (via LUA) the influence totals of a rival civ, or is that information locked out by default? I'd like to add a LUA script to my mod showing a player the influence of a rival civ in a CS so they can know if they should send a diplo unit or not.
Thanks!
G
You can do that with this command:
Players[iMinorCiv]:GetMinorCivFriendshipWithMajor(iMajorCiv)
eg. Players[22]:GetMinorCivFriendshipWithMajor(2)
My desing principle is to only show information that you could get from the vanilla Civ, so that there is no "cheating". But here's something that you might find helpful while your debugging your own mod. Warning: This code enables you to see all Major civilization information towards City-states and is thus cheating. So use it in your own discretion.
In file DiploWillardData.lua replace the GG.GetMinorCivData - function with this one:
function GG.GetMinorCivData()
--keynameTooltip -> automatic tooltip for keyname
--keynameSort -> this key will be used in sorting instead of keyname
local _T = {}
for iMajorCiv = 0, GameDefines.MAX_MAJOR_CIVS-1, 1 do
local _majorId = iMajorCiv
local _Player = Players[ _majorId ]
local _playerTeamId = _Player:GetTeam()
local _PlayerTeam = Teams[_playerTeamId];
for iMinorCiv = GameDefines.MAX_MAJOR_CIVS, GameDefines.MAX_CIV_PLAYERS-1, 1 do
local idMinMaj = iMinorCiv.."_"..iMajorCiv
local minorCivData = {}
local _MinorCiv = Players[iMinorCiv]
local _MinorCivTeamId = _MinorCiv:GetTeam()
if( _MinorCiv:IsMinorCiv()
and _playerTeamId ~= _MinorCivTeamId
and _PlayerTeam:IsHasMet( _MinorCivTeamId )
and _MinorCiv:IsAlive() ) then
_T[idMinMaj] = {}
_T[idMinMaj].majorName = Locale.ConvertTextKey(_Player:GetCivilizationShort DescriptionKey())
_T[idMinMaj].id = _MinorCiv:GetMinorCivType()
_T[idMinMaj].atWar = _PlayerTeam:IsAtWar(iMinorCiv)
_T[idMinMaj].infValue = _MinorCiv:GetMinorCivFriendshipWithMajor(_majorId)
_T[idMinMaj].infLevel = _MinorCiv:GetMinorCivFriendshipLevelWithMajor(_maj orId)
_T[idMinMaj].infChange = GG.DoPercent(_MinorCiv:GetFriendshipChangePerTurnT imes100(_majorId), 100)
_T[idMinMaj].infTurns = GG.GetTurnsForStatus(_T[idMinMaj].infValue, _T[idMinMaj].infChange, _T[idMinMaj].atWar)
_T[idMinMaj].bonusCult = _MinorCiv:GetCurrentCultureBonus(_majorId)
_T[idMinMaj].bonusScie = GG.DoPercent(_MinorCiv:GetCurrentScienceFriendship BonusTimes100(_majorId), 100)
_T[idMinMaj].bonusFood = _MinorCiv:GetCurrentOtherCityFoodBonus(_majorId)
_T[idMinMaj].bonusMili = _MinorCiv:GetCurrentSpawnEstimate(_majorId)
_T[idMinMaj].bonusAll = GG.GetBonusAll(_T[idMinMaj].bonusCult, _T[idMinMaj].bonusFood, _T[idMinMaj].bonusMili)
_T[idMinMaj].quest = _MinorCiv:GetActiveQuestForPlayer(_majorId)
_T[idMinMaj].questData1 = _MinorCiv:GetQuestData1(_majorId)
_T[idMinMaj].questData2 = _MinorCiv:GetQuestData2(_majorId)
_T[idMinMaj].ally = GG.GetAlly(_MinorCiv)
_T[idMinMaj].protected = GG.GetProtected(iMinorCiv, _PlayerTeam)
_T[idMinMaj].personality = GG.GetPersonality(_MinorCiv:GetPersonality(), 1)
_T[idMinMaj].personalityTooltip = GG.GetPersonality(_MinorCiv:GetPersonality(), 2)
_T[idMinMaj].resources,
_T[idMinMaj].resourcesTooltip = GG.GetResources(_MinorCiv, iMinorCiv)
_T[idMinMaj].capital = _MinorCiv:GetCapitalCity()
_T[idMinMaj].color,
_T[idMinMaj].color2 = GG.GetColor(_T[idMinMaj].atWar, _T[idMinMaj].infLevel)
_T[idMinMaj].name,
_T[idMinMaj].nameSort = GG.GetName(_T[idMinMaj].id, _T[idMinMaj].atWar, _T[idMinMaj].color)
_T[idMinMaj].trait = _MinorCiv:GetMinorCivTrait()
_T[idMinMaj].traitTooltip = GG.GetTraitTooltip(_T[idMinMaj].trait)
_T[idMinMaj].traitIcon = GG.GetTraitIcon(_T[idMinMaj].trait, _T[idMinMaj].color)
end --if( _MinorCiv:IsMinorCiv() and
end --for iMinorCiv =
end --for iMajorCiv = 0
return _T
end
And in DiploWillardPara.lua file add this row to the GG.CreateMinorCivSettings - function:
table.insert(_T, {l="[ICON_FOOD][ICON_CULTURE][ICON_WAR] / All bonuses", h="[ICON_FOOD][ICON_CULTURE][ICON_WAR]", tt="Food, culture or military bonus", "bonusAll", 80, "MinorCivColInstance"})
--NEW CODE BEGIN
table.insert(_T, {l="MajorName", h="MajorName", tt="Major name", "majorName", 120, "MinorCivColInstanceL"})
--NEW CODE END
-- table.insert(_T, {l="", h="", tt="", "", 50, "MinorCivColInstance"})
After these changes you should add (in the actual game) the new "MajorName" column to see which major civilization information you are looking at.;)
Gazebo Nov 03, 2010, 06:57 PM Thanks Onni. I will give this a try.
Onni Nov 11, 2010, 06:54 AM @Onni:
Could you add a way of listing the disposition (hostile/friendly/neutral) of each city-state? I consider this fairly essential info in deciding which ones to invest money in. I realize it's reflected to some extent in the decay rate shown, but it should be there, really.
I couldn't find this disposition info for City-states. Not sure if there is such thing for them? I know that their personality effects the decay rate. And if you declare wars too much for the City-states then all of their decay rates are effected. So no such stat coming...unless somebody finds a way to prove that there is a disposition for City-states? :confused:
Perkus Nov 11, 2010, 11:50 AM It's shown every time you click on a minor civ city banner. I guess the game calls it "personality." Is it not simply this here? (From CityStateDiploPopup.lua):
local iPersonality = pPlayer:GetPersonality();
if (iPersonality == MinorCivPersonalityTypes.MINOR_CIV_PERSONALITY_FRI ENDLY)
etc.
Onni Nov 11, 2010, 01:28 PM It's shown every time you click on a minor civ city banner. I guess the game calls it "personality." Is it not simply this here? (From CityStateDiploPopup.lua):
local iPersonality = pPlayer:GetPersonality();
if (iPersonality == MinorCivPersonalityTypes.MINOR_CIV_PERSONALITY_FRI ENDLY)
etc.
If it's that then you can already find it from the mod.
Perkus Nov 11, 2010, 02:28 PM Hmm, I looked for it before, didn't see it. Will check again. Thanks.
Onni Nov 11, 2010, 02:47 PM Version 5.0 is now available.
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
One thing that really bugged me was that you couldn't center your view on the City-states (unless you had notification for that City-state). I always had to go manually look for them. Now you do this by right clicking the City-state name.
I also tried to improve the options pages statistics selection by creating a new dropdown. Here are couple of it's undocumented functions:
left click old stat twice to insert a new empty row
right click old stat twice to delete a row
left click a new stat in the dropdown to overwrite the current stat
right click a new stat in the dropdown to insert a new stat
Onni Nov 11, 2010, 03:20 PM I've now also added a cheat version of DiploWillard. I didn't upload it to the ModHub, but only to this threads OP (http://forums.civfanatics.com/showthread.php?t=389937). That mod is otherwise exactly the same as DiploWillard except that you can see all Major civilization relationships towards City-states. I hope this will have some value to at least other modders.
http://forums.civfanatics.com/attachment.php?attachmentid=272247&d=1289513942
Gazebo Nov 11, 2010, 11:31 PM I've now also added a cheat version of DiploWillard. I didn't upload it to the ModHub, but only to this threads OP (http://forums.civfanatics.com/showthread.php?t=389937). That mod is otherwise exactly the same as DiploWillard except that you can see all Major civilization relationships towards City-states. I hope this will have some value to at least other modders.
http://forums.civfanatics.com/attachment.php?attachmentid=272247&d=1289513942
Onni,
You're awesome. I've been putting off adding in the code you told me about last week- this is exactly what I need for CSD testing.
Montov Nov 13, 2010, 02:52 AM Nice, the miniskin for the city states. I noticed you used the CityWillard as a baseline, which had the unfortunate effect that the small button is now overlapping the CityWillard button. Also, the tab says "Cities" in stead of City states. :P
But with the movable button it is no problem, maybe confusing at first.
Onni Nov 13, 2010, 05:47 AM Version 6.0 is now available.
hotfix: button was behind CityWillards button
Nice, the miniskin for the city states. I noticed you used the CityWillard as a baseline, which had the unfortunate effect that the small button is now overlapping the CityWillard button. Also, the tab says "Cities" in stead of City states. :P
But with the movable button it is no problem, maybe confusing at first.
My apologies for this unfortunate mistake and thanks Montov for reporting it. I try to remember to fix that Cities tag next time.
Onni Dec 27, 2010, 04:13 AM This mod has been merged with CivWillard (http://forums.civfanatics.com/showthread.php?t=405111). Please disable this one and use that in the future...
|
|