| General | Hosted Sites | Civ5 | CivRev | Civ4Col | Civ4 | Civ3 | Civ2 | Civ1 | Misc | Marketplace |
![]() |
|
|
Welcome to Civilization Fanatics' Center. You are currently viewing our site as a guest which gives you limited access to our site features. By joining our free community, you will be able to participate in the discussions, search the forum, send private messages, vote in polls, upload your own screenshots to the gallery, and access many other special features. Registration is fast, simple and absolutely free, so sign up today! If you have any problems with the registration process or your account login, please contact support. |
|
|||||||
![]() |
|
|
Thread Tools |
|
|
#1 |
|
CCtP Player
Join Date: Jun 2012
Posts: 498
|
Altering City Radius
Would it be possible to alter the city radius through Lua? Nothing in the XML seems to have anything to do with city radius, so I'm hopeful that the Lua has something I can use. I'm working on a component of the Community Call to Power Project in order to allow food importation without needing the DLL, so making the city radius infinite would be an important step in that. I've already made the necessary XML to deal with other factors involved such as the gold cost and yield losses, so I'm not concerned about that now. Nor am I concerned about the UI for now, as I at least need to get this component off the ground.
|
|
|
|
|
|
#2 |
|
King
Join Date: May 2011
Posts: 946
|
Unless the radius is stored in the XML files (did you look at gamedefines?), I do not think so. Still there is something that may be worth a try: using LUA to forcefully make the city work hexes beyond the 3-hex radius. I would not bet on your success but it's worth trying.
To clarifying things up a little... Regarding the API, only two functions are relevant: the one to make the city work a tile (city:something), and the one to assign hexes to a city (plot:SetOwner). There is of course no "radius" concept anywhere in the API.
__________________
Reseed! Preview and regenerate map in-game. Ingame Editor (IGE): An in-game editor for terrain, units, cities, civilizations, etc. Lua and UI reference |
|
|
|
|
|
#3 | |
|
CCtP Player
Join Date: Jun 2012
Posts: 498
|
Quote:
Thank you DonQuiche. But one more question - in which files can these functions be found? |
|
|
|
|
|
|
#4 |
|
King
Join Date: May 2011
Posts: 946
|
The function to toggle the "worked" flag is city:AlterWorkingPlot. The examples are obviously in the city screen. No idea for setowner, though. I suggest you use notepad++ for its formidable "search in all files" feature (ctrl + shift + f), it totally rocks for civ5 modding (and for text edition in general).
Now you could also look at the IGE code, especially IGE_API_Terrain.lua which contains a function named UpdateOwnership. This function is used anytime a resource is set on a hex to prevent two civ5 bugs (one where the new resource is not completely taken into account unless you remove and add again the ownership, another bug that causes perment yield computations errors if you remove the ownership on a hex worked by a city). So this function first stores the plots forcefully worked by the city ("forced plots"), then it removes the "worked" flag from this hex, then it removes ownership and adds it again, then it forces the city to reset worked plots to let the AI decides what it thinks is best now, then it restores forced plots. Which means it uses all the functions you could have to use.
__________________
Reseed! Preview and regenerate map in-game. Ingame Editor (IGE): An in-game editor for terrain, units, cities, civilizations, etc. Lua and UI reference |
|
|
|
|
|
#5 |
|
CCtP Player
Join Date: Jun 2012
Posts: 498
|
I'm new to Lua, so I really don't know how to program it to perform my desired function. I cannot find anywhere the definition of the function AlterWorkingPlot. Last edited by 3335d; Jul 23, 2012 at 01:07 PM. |
|
|
|
|
|
#6 |
|
Prince
Join Date: Jul 2012
Posts: 450
|
New to modding civ 5, what's the difference between Lua and modbuddy? I thought Lua was the language it used.
Anyways, tell me if something comes out of this, its incredibly annoying to have a tile in between 3 of your cities but not workable by any of them. |
|
|
|
|
|
#7 | |
|
King
Join Date: May 2011
Posts: 946
|
Quote:
Lua is indeed the proramming language. Modbuddy is the IDE (integrated environment development). If you don't know what an IDE is, it's basically a code editor with additional features that developers need.
__________________
Reseed! Preview and regenerate map in-game. Ingame Editor (IGE): An in-game editor for terrain, units, cities, civilizations, etc. Lua and UI reference |
|
|
|
|
|
|
#8 |
|
CCtP Player
Join Date: Jun 2012
Posts: 498
|
Never mind, I found a city radius definition in Defines. However, I still have no idea what file it belongs to, only the database. I'll see if it works.
|
|
|
|
|
|
#9 |
|
Mad Scientist
Join Date: Sep 2005
Location: Los Angeles, CA
Posts: 3,062
|
That value sets the minimum spacing between cities. The radius of tiles worked can't be altered until we get the DLL.
__________________
Once upon a time there was the Ages of Man mod set. Then Firaxis broke it. But thanks to the DLL efforts of the community, the mods shall rise again! |
|
|
|
![]() |
| Bookmarks |
|
| Thread Tools | |
|
|