[NFP] Changes to modding with May 2020 patch

Deliverator

Graphical Hackificator
Joined
Feb 12, 2008
Messages
4,813
Location
London, UK
This is to collect useful information in one place.

* Asset Previewer: The first bit of good news for modders is that Unit Attachments are working again in the Asset Previewer. (This was broken in the September 2019 patch). :)
Spoiler :
upload_2020-5-21_9-38-50.png


* Asset Previewer: Alt-LMB-drag now rotates the camera. Ctrl-LMB-drag rotates the Lighting direction.

* Asset Editor: You can now (re)import Textures to your project with the same name as existing Textures at they will be overwritten. :)

* Audio must now be located under Platforms/Windows/Audio/<audio files> not just /Audio/<audio files> in the Modbuddy project so that it gets built out to Platforms/Windows/Audio/.

* Lua: Seems there is finally a MakePeaceWith method available in Lua.
 
Last edited:
* Also looks like you can reload Config DB without restarting the game using the "Load Database" button from the Civ selection screen.
That's part of YnAMP to cache (parts of) the gameplay database to get access to TSL and all available CS from the Setup Screen.

It incidentally reload the Config DB, as it does that by launching a quick game in WB mod. It's hidden once the DB is loaded and unmodified, if you find it useful you could make it permanent with a one line change in YnAMP AdvancedSetupScreen.Lua, comment out or remove that line:
Code:
Controls.LoadDataYnAMP:SetHide(true)

But depending on the mods you're using, it may be faster to restart the game if they change a lot of stuff in the gameplay DB.

And while I'm here, attached the diff for those who may want to analyse it.
 

Attachments

They left a map file for the GameCore_XP2_FinalRelease.dll, you may not have to do a lua dump or search all the future scenario files to get the new exposed functions.

Seems there is finally a MakePeaceWith method available in Lua
Code:
  0001:006a1f10       ?lMakePeaceWith@IPlayerDiplomacy@Lua@GameCore@@KAHPEAUlua_State@@@Z 00000001806a2f10 f i Lua_IPlayerDiplomacy.obj

There may be a few new things for AI in the Red Death files BTW.
 
Modded Leader speech audio seems to have been broken by the patch somehow. :(

Edit: Only affects some Leaders it seems. Sukritact's Narai works but his Robespierre doesn't. We think it might be that the Wwise Speech bus no longer works.

Edit2: Found the fix for Leader audio - it must now be located under Platforms/Windows/Audio/<audio files> not just /Audio/<audio files> in the Modbuddy project. Surprise changes fun!
 
Last edited:
UnitAbilities table has been altered to
Code:
CREATE TABLE "UnitAbilities" (
        "UnitAbilityType" TEXT NOT NULL,
        "Name" LocalizedText,
        "Description" LocalizedText,
        "Inactive" BOOLEAN NOT NULL CHECK (Inactive IN (0,1)) DEFAULT 0,
        "ShowFloatTextWhenEarned" BOOLEAN NOT NULL CHECK (ShowFloatTextWhenEarned IN (0,1)) DEFAULT 0,
        "Permanent" BOOLEAN NOT NULL CHECK (Permanent IN (0,1)) DEFAULT 1,
        PRIMARY KEY(UnitAbilityType));
Note the new column called "Permanent".

I assume this is meant to help with the issue where a unit would lose an ability from upgrading.
Code:
        <Row>
            <ModifierId>BARRACKS_TRAINED_UNIT_XP_MODIFIER</ModifierId>
            <ModifierType>MODIFIER_SINGLE_CITY_GRANT_ABILITY_FOR_TRAINED_UNITS</ModifierType>
            <Permanent>true</Permanent>
        </Row>
        <Row>
            <ModifierId>STABLE_TRAINED_UNIT_XP_MODIFIER</ModifierId>
            <ModifierType>MODIFIER_SINGLE_CITY_GRANT_ABILITY_FOR_TRAINED_UNITS</ModifierType>
            <Permanent>true</Permanent>
        </Row>
        <Row>
            <ModifierId>ARMORY_TRAINED_UNIT_XP_MODIFIER</ModifierId>
            <ModifierType>MODIFIER_SINGLE_CITY_GRANT_ABILITY_FOR_TRAINED_UNITS</ModifierType>
            <Permanent>true</Permanent>
        </Row>
They're granting an Ability now rather than directly attaching a modifier. I don't remember whether in an earlier patch this was changed but that earlier patch did not fix the "poof" issue. In the original release of the game, Barracks, Stable, Lighthouse, etc., were all directly attaching modifiers to units trained in the city.

Hopefully this will cure all those issues for mod-makers as well where they wanted a modifier to be retained when the original unit was upgraded, but firaxis was never able to fix the issue with Modifiers that were directly attached to units goimg "poof" when the unit was upgraded. So the best route would now appear to be not to directly attach modifiers to units, but to attach UnitAbilities instead in nearly all cases.

--------------------------------------------------------------------------------------------------------

For table Modifiers:
Code:
CREATE TABLE "Modifiers" (
        "ModifierId" TEXT NOT NULL,
        "ModifierType" TEXT NOT NULL,
        "RunOnce" BOOLEAN NOT NULL CHECK (RunOnce IN (0,1)) DEFAULT 0,
        "NewOnly" BOOLEAN NOT NULL CHECK (NewOnly IN (0,1)) DEFAULT 0,
        "Permanent" BOOLEAN NOT NULL CHECK (Permanent IN (0,1)) DEFAULT 0,
        "Repeatable" BOOLEAN CHECK (Repeatable IN (0,1)) DEFAULT 0,
        "OwnerRequirementSetId" TEXT,
        "SubjectRequirementSetId" TEXT,
        "OwnerStackLimit" INTEGER,
        "SubjectStackLimit" INTEGER,
        PRIMARY KEY(ModifierId),
        FOREIGN KEY (OwnerRequirementSetId) REFERENCES RequirementSets(RequirementSetId) ON DELETE CASCADE ON UPDATE CASCADE,
        FOREIGN KEY (SubjectRequirementSetId) REFERENCES RequirementSets(RequirementSetId) ON DELETE CASCADE ON UPDATE CASCADE);
Column "Repeatable" appears to have been added, according to Gedemon's "diff" file.

Only place where Repeatable seems to be used by Firaxis in a Modifier:
Code:
<Row>
	<ModifierId>BERMUDA_TRIANGLE_TELEPORT</ModifierId>
	<ModifierType>MODIFIER_UNIT_TELEPORT</ModifierType>
	<Permanent>true</Permanent>
	<Repeatable>true</Repeatable>
	<OwnerRequirementSetId>BERMUDA_TRIANGLE_REQUIREMENTS</OwnerRequirementSetId>
	<SubjectRequirementSetId>UNIT_ENTERS_BERMUDA_TRIANGLE</SubjectRequirementSetId>
</Row>
 
Modding.IsModEnabled is much slower than before, don't use it in a loop.

It was causing heavy lag in YnAMP setup screen.
 
I find the following change super interesting - a new behavior node type.
<Row NodeType="LUA Script Condition" NodeId="70" ShapeId="2">
<Description>Run a lua script function that returns a boolean value. Only the player is passed in to the script</Description>
</Row>
<Row DataName="Script Function" DefnId="0" DataType="string" NodeType="LUA Script Condition" UserData="True" />
It is used in Red Death AI tree:
<Row NodeType="LUA Script Condition" NodeId="5" TreeName="Civ Royale Behavior" />
<Row DefnId="0" NodeId="5" TreeName="Civ Royale Behavior" DefaultData="CivRoyale_SmallSafeZone" />
However, I cannot find any "CivRoyale_SmallSafeZone" in any Lua scripts, so I have no idea how this is supposed to work.
 
Back
Top Bottom