User Tools

Site Tools


asset-override

Asset Override

All game assets (and other mods assets) can be override by mods, partially or totally.

The mod:override function should be used for that purpose.

Overriding specific values

balancing.lua
myMod:override({
	Id = "DEFAULT_BALANCING",
	InitialFamilyCount = 1,
	MinimumHappinessForLeaving = 30
})

In this example, we only override the InitialFamilyCount and the MinimumHappinessForLeaving of Foundation default Balancing.

By doing so, you allow other mods to modify other values of the default balancing.

List OVERRIDE / APPEND

By default, overriding a property of type List will completely replace the list with your value(s):

villages.lua
-- Override default village list
myMod:override({
	Id = "VILLAGE_LIST_DEFAULT",
	TradingVillageList = {
		"VILLAGE_AVIGNON"
	}
})

In that example, the TradingVillageList will only contains the new village Avignon.

But you can decide to append values to the list instead of overriding:

villages.lua
-- Override default village list
myMod:override({
	Id = "VILLAGE_LIST_DEFAULT",
	TradingVillageList = {
		Action = "APPEND", -- Append the following value to the existing list
		"VILLAGE_AVIGNON"
	}
})

In that case, the TradingVillageList will contains all villages from the game and Avignon.

The list will also include all villages added by other active mods. (unless one of theme completely override the List after your mod append its villages).

FBX asset override

You can now override the materials generated from textures when you import a 3D model. This can be useful for example to enable Alpha Test for models created with Blender. All materials of a model can be found in a virtual directory under your model's file.

For example, in the Example 01 mod, there is a 3D model named fountain.fbx in the directory models, and this model uses a texture named FountainColor.png.

The material can be found at the path [path to the FBX file]/Materials/[name of the texture without extension]. In Example 01, here is how to enable alpha test on a material:

buildings.lua
-- File path is "models/fountain.fbx" and texture name is "FountainColor.png"
mod:registerAssetId("models/fountain.fbx/Materials/FountainColor", "FOUNTAIN_COLOR_MATERIAL")
mod:override({
    Id = "FOUNTAIN_COLOR_MATERIAL",
    HasAlphaTest = true
})
  • Removing specific items from a list
asset-override.txt · Last modified: 2019/09/26 17:09 by maxime

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki