Search in 'Civ6 - Creation & Customization' for "ExposedMembers.".Is there any way to link/call methods between the UI and the gameplay context? [...] What is the proper solution for this one?
Don't worry, that is simply to drive modders crazy, who are not primarily interested in art style & skins.I never understand why `GetUpgradeResourceCost` is UIContext only...
Thanks, looks like it is what I'm looking for. Now I'm trying to figure out how to get localized modifier description for showing to user.@Zur13 You need to check the modifiers for that unit.
In Better Report Screen, there is a code that does that, so you might wanna take a look at it.
--************************************************************
function GetNumberFromParametersString( str, paramKey )
--local str = "Unit: 262147, Owner: -330, SubType: 1, SubValue: -274492200, Type: 20 Position: 66x39";
--local paramKey = "Owner:";
local startIdx = -1;
local endIdx = -1;
startIdx, endIdx = string.find( str, paramKey .. ".?%-?%d+" ); -- find pattern param + any character + optional minus sign + any number of digits
if startIdx ~= nil and endIdx ~= nil and startIdx >= 0 and endIdx >= 0 then
local res = string.sub( str, startIdx, endIdx ); -- res == "Owner: -330"
if res ~= nil and #res > 0 then
local cutPrefix = string.gsub( res, "%-?%d+" ,"" ); -- cutPrefix == "Owner: "
if cutPrefix ~= nil and #cutPrefix > 0 and ( #cutPrefix + 1 ) <= #res then
res = string.sub( res, #cutPrefix + 1 ); -- res == "-330"
end
if res ~= nil and #res > 0 then
local resNum = tonumber( res );
--print( str, " Found: ", paramKey, resNum );
return resNum;
end
end -- if res ~= nil
else
print( "Not found", startIdx, startIdx );
end -- if startIdx ~= nil
return nil;
end
UPDATE Districts SET Cost = -100
INSERT INTO Types ( Type, Kind )
SELECT 'PROJECT_REMOVE_'||DistrictType, 'KIND_PROJECT'
-- FROM Districts WHERE RequiresPlacement = 1 AND MaxPerPlayer = -1.0 AND OnePerCity = 1;
FROM Districts WHERE RequiresPlacement = 1 AND MaxPerPlayer = -1.0;
INSERT INTO Projects (
ProjectType,
Name,
ShortName,
Description,
Cost,
CostProgressionModel,
CostProgressionParam1,
PrereqDistrict )
SELECT
'PROJECT_REMOVE_'||DistrictType,
CASE WHEN instr(Name, 'LOC_') = 0 THEN 'Remove '||Name ELSE 'LOC_PROJECT_REMOVE'||substr(Name, 4) END,
CASE WHEN instr(Name, 'LOC_') = 0 THEN 'Remove '||Name ELSE 'LOC_PROJECT_REMOVE'||substr(Name, 4) END,
'Removes the district with all its buildings.',
80,
'COST_PROGRESSION_GAME_PROGRESS',
200,
-- 'TECH_ENGINEERING',
-- 'CIVIC_RD_DUMMY_!'||DistrictType,
DistrictType
-- FROM Districts WHERE RequiresPlacement = 1 AND MaxPerPlayer = -1.0 AND OnePerCity = 1;
FROM Districts WHERE RequiresPlacement = 1 AND MaxPerPlayer = -1.0;
-- UPDATE Districts SET cost = 1;
-- UPDATE Buildings SET cost = 1 WHERE IsWonder = 1;
CREATE TABLE "RD_civType_uniqueDistrictType" (
"CivType" TEXT NOT NULL,
"ReplacedDistrictType" TEXT NOT NULL,
"UniqueDistrictType" TEXT NOT NULL);
INSERT INTO RD_civType_uniqueDistrictType ( CivType, ReplacedDistrictType, UniqueDistrictType )
SELECT a.CivilizationType, c.ReplacesDistrictType, b.DistrictType FROM CivilizationTraits AS a, Districts AS b, DistrictReplaces AS c WHERE a.TraitType = b.TraitType AND c.CivUniqueDistrictType = b.DistrictType ;
'LOC_PROJECT_REMOVE'||substr(Name, 4) END,
'Removes the district with all its buildings.',
0,
'COST_PROGRESSION_GAME_PROGRESS',
0,
Could anyone please tell me any way to retrieve the map/game seed from LUA? In Gameplay context if possible.
EDIT: better yet, if it's obtainable from SQL database, it would be great. I checked GlobalParameters but it's not there.
local gameSeed :string = tostring( GameConfiguration.GetValue("GAME_SYNC_RANDOM_SEED") );
local mapSeed :string = tostring( MapConfiguration.GetValue("RANDOM_SEED") );
<Row BuildingType="BUILDING_STAR_FORT" Name="LOC_BUILDING_STAR_FORT_NAME"
Description="LOC_BUILDING_STAR_FORT_DESCRIPTION"
PrereqTech="TECH_SIEGE_TACTICS"
PrereqDistrict="DISTRICT_CITY_CENTER" Cost="305" AdvisorType="ADVISOR_GENERIC"
OuterDefenseHitPoints="100" OuterDefenseStrength="3"/>
<Row Building="BUILDING_STAR_FORT" PrereqBuilding="BUILDING_CASTLE"/>
<Row Tag="LOC_BUILDING_STAR_FORT_NAME">
<Text>Renaissance Walls</Text>
</Row>