Modding FAQ

How do I add new proper names for towns without replacing the pre-existing ones?

This is what I’ve got so far:

{
	"core:necropolis" :
	{
		"town" :
		{
			"names" : 
				// original names
				"Haunt's Wind",
				"Cessacioun",
				"Agony",
				"Sanctum",
				"Terminus",
				"Blackquarter",
				"Death's Gate",
				"Grave Raven",
				"Dark Cloud",
				"Coldsoul",
				"Coldreign",
				"Dark Eternal",
				"Ghostwind",
				"Blight",
				"Shadow Keep",
				"Worm Warren",
				// new names
				"Eljudnir", // The hall of Hel (the ruler of the dead in Norse mythology) in Niflheim; Source: Kevin Crossley-Holland, "The Norse Myths", 1980, p. 241.
				"Hvergelmir", // Spring in Niflheim from which the eleven rivers known as Elivagar flow; Source: Kevin Crossley-Holland, "The Norse Myths", 1980, p. 245.
				"Nastrond" // Place in Helheim (realm within Niflheim ruled by Hel) where a hall for evil-doers lies; Source: Kevin Crossley-Holland, "The Norse Myths", 1980, p. 248.
			],
		}
	}
}

This does the job, but isn’t optimal, since I have to repeat the original names. Is there a way to add new names to the “names” array instead of redefining it entirely?

I think it’s logical. You want to add names and the end of the existing list, so you you must copy/paste previous names and add yours at the end. On contrary - if you want to change third name for example, you copy entire list and change only this third name.

This is how json files are interpreted - named items (in quotation marks) replace the old ones. This way you can for instance clear entire list :wink:

All we could do here is to change town format so that every name would be separate item, without the list.

Ah, I see :frowning: Thanks for the explanation though!

The thing is that I wanted to make my mod 100% open-source.

Each name being a separate item sounds too cumbersome - how about adding a “new_names” array instead, which would add names to the “names” array instead of replacing the whole thing?

I hope vcmi team will keep the changes to modding format to minimum, only adding new fields :mrgreen:

Than change all names, rewriting standart names written in proprietary lods:-)

From few reasons I’m looking a way to add my creature +1 attack per turn during battle (so atack is +1 to base in first turn, +2 to base in second, +3 in third and so on…). I thought it’s possible only via new special spell.
So I wrote such creature ability:

			"casts" :
			{
				"type" : "CASTS",
				"val" : 20
			},
			"attackBooster":
			{
			"type" : "ENCHANTER",
			"subtype" : "spell.attackBooster",
			"val" : 1,
			"addInfo" : 1
			}

And here’s my spell atackBooster:

		"levels":
		{
			"base":
			{
				"power": 10,
				"aiValue": 20,
				"range": "0",
				"targetModifier":
				{
					"smart": false
				}
			},
			"none":
			{
				"description": "Attack",
	 
				"cost": 0,
				"effects":
				{
					"plusOneAttack":
					{
						"type": "PRIMARY_SKILL",
						"duration": "N_TURNS"],
						"val" : 1,
						"subtype" : "primSkill.attack",
						"valueType" : "ADDITIVE_VALUE"
					}
				}
			},
			"basic":
			{
				"description": "Attack",	 
				"cost": 0,
	 
				"effects":
				{
					"plusOneAttack":
					{
						"type": "PRIMARY_SKILL",
						"duration": "N_TURNS"],
						"val" : 1,
						"subtype" : "primSkill.attack",
						"valueType" : "ADDITIVE_VALUE"
					}
				}
			},
			"advanced":
			{
				"description": "Attack",
	 
				"cost": 0,
	 
				"effects":
				{
					"plusOneAttack":
					{
						"type": "PRIMARY_SKILL",
						"duration": "N_TURNS"],
						"val" : 1,
						"subtype" : "primSkill.attack",
						"valueType" : "ADDITIVE_VALUE"
					}
				}
			},
			"expert":
			{
				"description": "Attack",
	 
				"cost": 0,

				"effects":
				{
					"plusOneAttack":
					{
						"type": "PRIMARY_SKILL",
						"duration": "N_TURNS"],
						"val" : 1,
						"subtype" : "primSkill.attack",
						"valueType" : "ADDITIVE_VALUE"
					}
				}
			}

But, +1 attack is granted only fist turn, which is lame, becaure I can give my creature +1 attack permament. Is there any way to give prograssive +1 attack per turn?

Hmm, change duration from “N_TURNS” to “PERMANENT”? The disruption ray spell works quite similar.

Doesn’t work either :frowning:

I’ll leave it here to not left it just on slack: DISRUPTING_RAY is heavily hardcoded.
For now VCMI can’t handle duplicate bonuses.

Reasonable amount of work would be needed to make it work.

By the way, I have a question.
If i’ll set

{
"type":"SPELL_IMMUNITY",
"subtype":"spell.visions"
}

to hero, will it be immune to Visions spell?

No. Immunity for Vision is never checked.

No immunities do not work on adventure spells.

I wanted to introduce HotA’s Warehouses into VCMI. So I’ve written code:

{
	"warehouses" :{	
		"name": "Warehouses",
		"handler": "oncePerWeek",
		"types" : {
			"crystalWarehouse" : {
				"name": "Warehouse of Crystal",
				"producedResources" : "crystal",
				"producedValue" : 6,
				"rmg" : {
					"value"		: 500,
					"rarity"	: 70
				},
				"templates" : {
					"avwrhscr" : { "animation" : "avwrhscr", 
					"visitableFrom" :  "---", "+++", "+++" ], 
					"mask" : "0VV","VVV","VBA"], 
//					"allowedTerrains": "sand"]
					}					
				}
			}			
		}	
	}
}

In random maps object appears, can be visited but doesn’t produce anything… Any ideas what is wrong?

Nothing is wrong, adding objects with new properties is not supported.

But I suggested the example from wiki:
wiki.vcmi.eu/index.php?title=Obj … ype_format

In town section code “produce” is working, so I thought that “producedResources” and “producedValue” work too…

Handler “oncePerWeek” has no configuration. It used only for MYSTICAL_GARDEN, WINDMILL, WATER_WHEEL

For new objects please try to use “configurable” handler, it is undocumented though.

The code located here: github.com/vcmi/vcmi/blob/devel … or.cpp#L47

Keep in mind that someday this code might be finished, refactored and current not-supported mods might stop working.

Noted that, thank you both guys!

Hi again!
I’ve found over the net a pack with new custom boat sprites. I’ve wanted to make mod that adds these sprites to the ‘core’ of existing boat graphics and allow game to randomly choose these ones in the moment of buiyng. So I’ve wriiten such code:

{
	"core:boat" : {
		"base" : {
			"base" : {
				"visitableFrom" :  "+++", "+-+", "+++" ],
				"mask" :  "VVV", "VAV" ]
			}
		},
		"types" : {
			"evil" : { 
				"templates" : {
					"AB01_.def" : 
					{ "animation" : "AB01_.def", //original h3 evil def
					  "editorAnimation": "avxboat0.def"
					},
					"boat07.def" :
					{ "animation" : "boat07.def",
					  "editorAnimation": "boat07ed.def"
					},
					"boat10.def" : 
					{ "animation" : "boat10.def",
					  "editorAnimation": "boat10ed.def"
					},
					"boat11.def" : 
					{ "animation" : "boat11.def",
					  "editorAnimation": "boat11ed.def"
					},
					"boat20.def" : 
					{ "animation" : "boat20.def",
					  "editorAnimation": "boat20ed.def"
					},
					"boat0a.def" : 
					{ "animation" : "boat0a.def",
					  "editorAnimation": "boat0aed.def"
					},
					"boat0c.def" : 
					{ "animation" : "boat0c.def",
					  "editorAnimation": "boat0ced.def"
					},
					"boat0f.def" : 
					{ "animation" : "boat0f.def",
					  "editorAnimation": "boat0fed.def"
					},
					"boat0l.def" : 
					{ "animation" : "boat0l.def",
					  "editorAnimation": "boat0led.def"
					}	
				}
			},	
			"good" : {
				"templates" : {
					"AB02_.def" : 
					{ "animation" : "AB02_.def", //original h3 good def
					  "editorAnimation": "avxboat1.def"
					},
					"boat00.def" : 
					{ "animation" : "boat00.def",
					  "editorAnimation": "boat00ed.def"
					},
					"boat01.def" : 
					{ "animation" : "boat01.def",
					  "editorAnimation": "boat01ed.def"
					},
					"boat02.def" : 
					{ "animation" : "boat02.def",
					  "editorAnimation": "boat02ed.def"
					},
					"boat04.def" : 
					{ "animation" : "boat04.def",
					  "editorAnimation": "boat04ed.def"
					},
					"boat06.def" : 
					{ "animation" : "boat06.def",
					  "editorAnimation": "boat06ed.def"
					},
					"boat09.def" : 
					{ "animation" : "boat09.def",
					  "editorAnimation": "boat09ed.def"
					},
					"boat0i.def" : 
					{ "animation" : "boat0i.def",
					  "editorAnimation": "boat0ied.def"
					},
					"boat0j.def" : 
					{ "animation" : "boat0j.def",
					  "editorAnimation": "boat0jed.def"
					},
					"boat0m.def" : 
					{ "animation" : "boat0m.def",
					  "editorAnimation": "boat0med.def"
					}
				}
			},	
			"neutral" : {
				"templates" : {
					"AB03_.def" : 
					{ "animation" : "AB03_.def", //original h3 neutral def
					  "editorAnimation": "avxboat2.def"
					},
					"boat03.def" : 
					{ "animation" : "boat03.def",
					  "editorAnimation": "boat03ed.def"
					},
					"boat05.def" : 
					{ "animation" : "boat05.def",
					  "editorAnimation": "boat05ed.def"
					},
					"boat08.def" : 
					{ "animation" : "boat08.def",
					  "editorAnimation": "boat08ed.def"
					},
					"boat0b.def" : 
					{ "animation" : "boat0b.def",
					  "editorAnimation": "boat0bed.def"
					},
					"boat0d.def" : 
					{ "animation" : "boat0d.def",
					  "editorAnimation": "boat0ded.def"
					},
					"boat0e.def" : 
					{ "animation" : "boat0e.def",
					  "editorAnimation": "boat0eed.def"
					},
					"boat0g.def" : 
					{ "animation" : "boat0g.def",
					  "editorAnimation": "boat0ged.def"
					},
					"boat0h.def" : 
					{ "animation" : "boat0h.def",
					  "editorAnimation": "boat0hed.def"
					},
					"boat0k.def" : 
					{ "animation" : "boat0k.def",
					  "editorAnimation": "boat0ked.def"
					}					
				}
			}	
		}
	}
}

New sprites appear in the editor map (see screenshot) but in game there aren’t any changes - when I buy the boat - standard h3 defs are show :frowning: Did not I understand what is “template” command for?
:frowning: