SoD files mod like

Just remove “sprites” word from “animation”, “map” etc. and all will be fine.

Removing of sprites, sounds, etc seems to be working ty.

Now, I wonder if there is a way to specify in Json something like a macro or variable so you do not have to write all the time the same string?

eg: animationPath = “factions/castle/townScreen/animations”

{
	"castle" :
	{
		"town" :
		{
			"structures" :
			{
				"extraAnimation": { "animation" : "factions/castle/townScreen/animations/TBCSEXT2.def", "x" : 46,  "y" : 119 },
				"mageGuild1":     { "animation" : "factions/castle/townScreen/animations/TBCSMAGE.def", "x" : 707, "y" : 166, "z" : 1, "border" : "TOCSMAG1.bmp", "area" : "TZCSMAG1.bmp" },
				"mageGuild2":     { "animation" : "factions/castle/townScreen/animations/TBCSMAG2.def", "x" : 706, "y" : 135, "z" : 1, "border" : "TOCSMAG2.bmp", "area" : "TZCSMAG2.bmp" },
				"mageGuild3":     { "animation" : "factions/castle/townScreen/animations/TBCSMAG3.def", "x" : 704, "y" : 107, "z" : 1, "border" : "TOCSM301.bmp", "area" : "TZCSM301.bmp" },
				"mageGuild4":     { "animation" : "factions/castle/townScreen/animations/TBCSMAG4.def", "x" : 704, "y" : 76,  "z" : 1, "border" : "TOCSM401.bmp", "area" : "TZCSM401.bmp" },
				"tavern":         { "animation" : "factions/castle/townScreen/animations/TBCSTVRN.def", "x" : 0,   "y" : 230, "z" : 1, "border" : "TOCSTAV1.bmp", "area" : "TZCSTAV1.bmp" },
				"shipyard":       { "animation" : "factions/castle/townScreen/animations/TBCSDOCK.def", "x" : 478, "y" : 134, "border" : "TOCSDKMS.bmp", "area" : "TZCSDKMS.bmp" },
				"fort":           { "animation" : "factions/castle/townScreen/animations/TBCSCSTL.def", "x" : 595, "y" : 66,  "border" : "TOCSCAS1.bmp", "area" : "TZCSCAS1.bmp" },
				"citadel":        { "animation" : "factions/castle/townScreen/animations/TBCSCAS2.def", "x" : 478, "y" : 66,  "border" : "TOCSCAS2.bmp", "area" : "TZCSCAS2.bmp" },

Mod definitions updated: github.com/krs0/vcmi/tree/Resou … r/Mods/SoD

Next Hurdle: even though I see no differences to HotA mod I get these errors for Castle mod

2017-Feb-04 21:31:37.186417 WARN global [1934] - Data in castle is invalid!
2017-Feb-04 21:31:37.189417 WARN global [1934] - At <root>
	 Error: Unknown entry found: creatures
At <root>
	 Error: Unknown entry found: dwellings
At <root>
	 Error: Unknown entry found: heroClases

EDIT: I have managed to find out what was wrong with the above…

  • Creatures is not in node “Factions” but in .Town
  • dwellings should be listed under the unintuitive “objects” node “objects” : “config/hota/dwellings” ], (why not “mapObjects”)
  • heroClases … well this one was just misspelled (heroClasses), but not in the mod.json but in an inner file.

Next problem. I see some inconsistencies between HotA definition of dwellings and the serialized version i got when I serialized core from code…

So can anyone please check the below definition for a dwelling? When I get an ok I will update all dwellings according to this structure.

(I am not interested in the values, but in the structure itself. EG: is “animation” part of “base”? Is “creatureGeneratorCommon” the name for this node and not dewllings?)

{
	"castle" :
	{
		"dwellings" :
		{
			"guardhouse" : 
			{
				"name" : "Guardhouse",
				"creatures" : 
					
						"pikeman"
					]
				],
				"base" : {
					"animation" : "factions/castle/adventureMap/dwellings/AVGPIKE0.def",
					"mask" : 
						"VVV",
						"VBB",
						"VAA"
					],
					"visitableFrom" : 
						"---",
						"+++",
						"+++"
					]
				},
			},

For reference this is HotA mod…

{
	"core:creatureGeneratorCommon" : {
		"types" : {
			"waterfall" : {
				"name" : "Waterfall",
				"creatures" :  "nymph" ]],
				"templates" : {
					"default" : {
						"animation" : "hota/map/waterfall",
						"mask" :  "VVV", "VVV", "VBA" ]
					}
				}
			},

Ans this is serialized from core…

creatureGeneratorCommon
{
	"base" : {
		"base" : {
			"mask" : 
				"VVV",
				"VBB",
				"VAA"
			],
			"visitableFrom" : 
				"---",
				"+++",
				"+++"
			]
		}
	},
	"handler" : "dwelling",
	"index" : 17,
	"name" : "Creature Generator 1",
	"types" : {
		"airConflux" : {
			"base" : {
				"mask" : 
					"VVV",
					"VBB",
					"VAA"
				],
				"visitableFrom" : 
					"---",
					"+++",
					"+++"
				]
			},
			"creatures" : 
				
					"airElemental"
				]
			],
			"index" : 7,
			"templates" : {
			}
		},

It’s not inconsistence. HotA is a mod, so we must “core:” creatureGeneratorCommon schema to add new dwellings to ‘database’.

I think that your third code is most proper code and animation part must be in the same part of base with masks.

I have not understood how object templates should work.
So now I have 2 versions like below. Which one to use?

{
	"creatureGeneratorCommon" :
	{
		"guardhouse" : 
		{
			"name" : "Guardhouse",
			"creatures" : 
				
					"pikeman"
				]
			],
			"base" : {
				"animation" : "factions/castle/adventureMap/dwellings/AVGPIKE0.def",
				"mask" : 
					"VVV",
					"VBB",
					"VAA"
				],
				"visitableFrom" : 
					"---",
					"+++",
					"+++"
				]
			},
		},
{
	"creatureGeneratorCommon" :
	{
		"guardhouse" : 
		{
			"name" : "Guardhouse",
			"creatures" : 
				
					"pikeman"
				]
			],
			"templates" : 
			{
				"default" : 
				{
					"animation" : "factions/castle/adventureMap/dwellings/AVGPIKE0.def",
					"mask" : 
						"VVV",
						"VBB",
						"VAA"
					],
					"visitableFrom" : 
						"---",
						"+++",
						"+++"
					]
				}
			}
		},

In Hero Classes “commander” is needed.

Error: Required entry commander is missing

Since this is not SoD, could this be made optional?

I’m not familiar with refactoring vcmi config files. When I want to change, I always use “core:creatureGeneratorCommon” commands. All you have to know about object format, you’ll read there: wiki.vcmi.eu/index.php?title=Object_Format
I guess it’s best for you it’s trial-and-errors method. It’s best for me :slight_smile: Or browse various existing mods to see how it works under diffirent conditions.

In vcmi you can play maps using commanders or stack experience without WoG mod.

Modules:
“STACK_EXPERIENCE”, “STACK_ARTIFACTS”, “COMMANDERS” are disabled by default, player can enable them by change “false” to “true” in defaultMods.json file and play SoD maps with these features. I can’t see any reason to alter this handy functionality.

For Castle town buildings I have

				"horde2" : null,
				"horde2Upgr" : null,
				"mageGuild5" : null,
				"special4" : null
At /town/buildings/horde2
	 Error: Required entry id is missing
At /town/buildings/horde2Upgr
	 Error: Required entry id is missing
At /town/buildings/mageGuild5
	 Error: Required entry id is missing
At /town/buildings/special4
	 Error: Required entry id is missing

How to fix this?

You can safely delete this code.

It seems that all creature dwellings have the same “visitableFrom” and “mask” definitions.
It looks pointless what I have done… that is to repeat these lines for each and every single dwelling.

"visitableFrom" :  "---", "+++", "+++" ],
                "mask" :  "VVV", "VBB", "VAA" ]

Can someone review the definition below? I am concerned about the “template” : “default” part. And about the “name” : “Creature Generator 1”, part

{
	"creatureGeneratorCommon" :
	{
		"handler": "dwelling",
        "name" : "Creature Generator 1",
		"base" : 
		{
			"base" : 
			{
				"visitableFrom" :  "---", "+++", "+++" ],
				"mask" :  "VVV", "VBB", "VAA" ]
			}
		},
		"types" : 
		{
			"guardhouse" : 
			{
				"name" : "Guardhouse",
				"creatures" : 
					
						"pikeman"
					]
				],
				"templates" : 
				{
					"default" : 
					{
						"animation" : "factions/castle/adventureMap/dwellings/AVGPIKE0.def",
					}
				}
			},
			"archersTower" : 
			{
.....................................

I miss Ivan :frowning:

I suggest you manually define masks (yellow, red and transparent squares) for every dwelling (“visitableFrom” may stay as base for every dwelling). Look: castle’s dwellings have various masks.


For example - mask for Halbardiers’ dwelling is “VVV”, “VBV”, “VBA” ] , for Angels’ dwelling is “VVVV”, “VBAV” ], for monks’ dwelling is “VVV”, “VVV”, “VBA” ] and so on.

And browse this mod:
mediafire.com/file/bcocv2lmt … k_v1.0.zip
There you can find hundreds configured new objects. Maybe something makes you things clearer.

VCMI copies all dwelling masks from Guardhouse (first on the list). The problem is that Random Dwellings objects may become inaccessible if different mask is picked:
bugs.vcmi.eu/view.php?id=900

This is what was puzzling me. Why the serialized version of dwellings from VCMI looks the same for all buildings.

I will leave the files with the Guardhouse masks for now. Once I have something working I will try to update those.

One question tough… From the screenshot above, it looks like the editor has this information already. Can I get this information from the editor somehow?

Quite opposite. First you must manually write masks, then editor reads them and shows appriopate yellow/red squares. Writing mask is reletive easy, only some practise.

But standard h3 dwellings have configured masks, that’s way can be readable from editor.

Then the question is… where can I get those masks from? Can I obtain them in a serialized form?

I can only tell you how I write masks.

I have bmp file with my adventure map objects. I open Def maker, load this bmp in it and click reposition tab.

So you can see 20 square parts in four rows. Each row has 5 squares.
And you have three mask parameters.
V - visible, transparent square
B - blocked square (red in map editor)
A - visitable by hero square (yellow in map editor)

So first square in first row is visible - V
second square - visible - V

fifth square - visible - V

Mask for first row is then: VVVVV

Second row:
first square - V
second square - blocked/red - B (or V, you must decide and then test proper visibility in game)
third square - B
fourth square - B (or V, reason as above)
fifth square - V

So mask for second row is: VBBBV

analogically mask for third row should be: VABBV
a fourth row: VVVVV

so your code is:

"mask" : 
                "VVVVV",
                "VBBBV",
                "VABBV",
                "VVVVV"
            ], 

As you see, it’s no simple way to obtain masks, you must make them patienty. I think maybe someday someone write handy tool for easy mask design like Object Editor Tool for ERA platform.

But, if you open SoD map editor and place SoD dwelings on the ground, you can easily “read” all visible, red and yellow squares and easily write proper masks by yourself.

And here’s example of inproper mask configuration - in game cactuses are cut and don’t display correctly.

Thank you for the explanation on how to get them from def files. Maybe the above example could be linked into/from wiki?

But if they exist already in code for SoD objects, that means that at some point in the code I can get them out serialized in json file. So I do not have to build them by hand.

@Warmonger Is there any place I can get them in code or are they really copies of Guardhouse?