[GS] Affecting a globalparametters (e.g. Natural Wonder Distance) via Advanced Option

__jack__

Warlord
Joined
Dec 29, 2009
Messages
141
Hi,

I would like to affect AssignStartPlot() without altering the original lua file for maximum compatibility.
The distance used is coming from GlobalParameters.START_DISTANCE_MAJOR_NATURAL_WONDER

This is stored in \Data\GlobalParameters.xml so the easy way would be to modify that file by a replacement (or sql).

Now what I would like to do is build a slider in the UI under advanced option that would be replacing this value ?

So I could get a slider using a Config.xml

<Row ParameterId="Slider" Name="LOC_SLIDER_NAME" Description="LOC_SLIDER_DESC" Domain="SliderRange" DefaultValue="2" ConfigurationGroup="Game" ConfigurationId="Distance" GroupId="AdvancedOptions" Hash="0" SortIndex="2900" />

But then how can I tie it to an existing parameters and then ensure it would be overriden ?
 
You would not actually be able to affect the values contained within the Database. You would have to send the data from the set-up menus into the map generation lua file(s) and then you would almost certainly need a new version of AssignStartingPlots in order to get the map generation files(s) to use the new data-type.

Lua cannot alter the contents of the game databases.
 
Hum... that's a bummer. So I guess the only path is a SQL to modify the original XML file. I would have love to put some more flexibility in there
 
You would not actually be able to affect the values contained within the Database. You would have to send the data from the set-up menus into the map generation lua file(s) and then you would almost certainly need a new version of AssignStartingPlots in order to get the map generation files(s) to use the new data-type.

Lua cannot alter the contents of the game databases.
Actually, is there a way in the Advanced Option to create a slider with the default value would change based on the resources parameters ?
e.g. Abondant would change the slider to 5 if picked, Sparse to -5 ?
 
You still have to send the selection from the Advanced Options menu to the map generation file(s). And you would still need a custom version of AssignStartingPlots (& etc) in order to get the map generation routines to pay any attention for Wonder placement to the current state of the Abundant/Sparse/Legendary slider.

Using SQL isn't going to cure anything, btw. XML code is auto-translated by the game into SQL commands before the code is added into the game's databases, so there's no "magic" you get by using SQL in this case. The database is generated entirely based upon what is in the XML and SQL files of the base game, the expansions and DLC, and any mods which are active. Lua does not enter into this. Once the database is generated for a game session it is locked. Lua commands can read the data in the database but not alter it in any way, and once the database is generated there's no way to make an SQL or XML file suddenly activate and make alterations while in-game (or in map generation) to the contents of the database.
 
Yeah... I was thinking about making hidden sliders defaulting to specific values if a particular option is selected and then call it via GameConfiguration in a lua gameplay script... Problem is: I can do it with maps using Key 1 and Key 2 but for resources and domain I can't get it to work unfortunately.

I understood editing core database is off the table once the game has started - unfortunately.
 
Top Bottom