Need some help with modding

Sooo,
Lately i have been working on my own castle in VCMI. I’ve done graphics and when i was heading to programming, i realized that i forgot to do tavern and blacksmith :sweat_smile:. So i thought that i will use my 2 horde buildings for it, but i also realized that i need these buildings to buff my creatures. So there’s go a question: Can i assign horde’s buildings function to a tavern, or a blacksmith (or to other buildings), but that they won’t lose their function?

Rather not. Horde buildings have hardcoded “id” and those ids tell the same that building works as ‘horde’. Tavern and blacksmith have their own hardcoded ids.
One more thing - special buildings are not working in vcmi yet :frowning:

But, could I make that e.g. blacksmith (or, e.g. upgraded dwelling) increases population of unit? It doesn’t need to be identified by horde. It is possible to make that some buildings make me e.g. gold each day, so i thought that this would be possible :frowning:

Nooo, customizing hardcoded building is almost impossible (except giving resource) - definitelly it’s better to add tavern/blacmisth graphics to the townscreen.

Ohhhhh, i am too lazy to do thatttt, but thanks anyway :slight_smile:.

I’m curious about your castle, could you show us?

Of cause you can. You can make horde with empty animation and area, border, and make it requare tavern or blacksmith, and add “auto”:true to it in building section. When you buy tavern or blacksmith, it will be built automatically and will work as invisible horde.

1 Like

OMG, i didn’t thought about that. Thank you very match!
And i can send here some screenshots :slight_smile:


It’s not so good, but i will be changing a lot of things, like marketplace and library, and some of background.

3 Likes

looks interesting but needs more sharpness of colors

Looks very promising!

I need some help with modding too. I’ve modified a hero with new bonus. And during loading i get an error:

File CONFIG/SPECIAL/HEROES/SPECIAL is not a valid JSON file!
At line 45, position 13 error: Separator expected
At line 45, position 13 warning: Not all file was parsed!

The offending line is:

						"type" : "GROWS_WITH_LEVEL",

The complete bonus is:

					{
						"type" : "CREATURE_GROWTH",
						"subtype" : 0,
						"propagator": "VISITED_TOWN_AND_VISITOR",
						"updater" : {
							"type" : "GROWS_WITH_LEVEL",
							"parameters" : [ 20 ],
						}
					},

I must have overlooked something. But i have no idea what. Any idea? It had already worked, but i lost the original file. So i rebuilt it. But since then i have this bug.

The last coma after [20] is not needed. But the issue might not be in this line only. Better put the whole .json in some software with syntax highlight, such as VSCode.

Maybe using Propagator and Updater in one bonus causes such error?

Thanks for responding.

I know that the comma is not needed. I have it because i also tried reordering the lines. But this did not help.

I’m using an editor with syntax highlighting. And there seems to be no error. I will now rebuild the file line by line and so hopefully find what’s going wrong.

There is some other error message. Not related to my mod. I don’t know what to do witht this:

File CONFIG/DEFAULTTEMPLATES/CROSS3 is not a valid JSON file!
At line 1, position 0 error: Not a valid UTF-8 file

Where can i find this file? I have searched for it and cannot find it.

I have now partially rebuilt this file with only this single hero, and although i just copied every single line i now do not get an error message. No idea what happened.

So the hero specialty is for now:

		"specialty#override" : [
			{
				"bonuses" : [
					{
						"subtype" : "core:skill.leadership",
						"type" : "SECONDARY_SKILL_PREMY",
						"updater" : "TIMES_HERO_LEVEL",
						"val" : 5,
					},
					{
						"type" : "SECONDARY_SKILL_PREMY",
						"subtype" : "core:skill.diplomacy",
						"updater" : "TIMES_HERO_LEVEL",
						"val" : 5,
					},
					{
						"type" : "SECONDARY_SKILL_PREMY",
						"subtype" : "core:skill.estates",
						"updater" : "TIMES_HERO_LEVEL",
						"val" : 5,
						"valueType" : "PERCENT_TO_BASE"
					},
					{
						"type" : "CREATURE_GROWTH",
						"subtype" : 0,
						"valueType" : "BASE_VALUE",
						"propagator": "VISITED_TOWN_AND_VISITOR",
						"updater" : {
							"type" : "GROWS_WITH_LEVEL",
							"parameters" : [ 20 ]
						}
					},
				]
			}
		],

But as far as i understand this, this should result in a +1 growth for level 1 creatures. I get the hero name mentioned in the growth dialogue, but the value is 0. I levelled the hero to level 2, but still the value is 0. I can add a “val” : 1, and get this shown, but that does not increase with level, it stays at 1. So something with the updater is wrong here.

Nothing. Old version of CROSS3 template has header in cyrilic. Cyrilic letters are not UTF-8, that’s why you get warning. But it doesn’t affect the game.

"valueType" : "BASE_VALUE",
This is wrong, should be BASE_NUMBER. Or just leave empty for default, which is ADDITIVE_VALUE.

The formula is here: vcmi/HeroBonus.cpp at develop · vcmi/vcmi · GitHub

int newVal = (valPer20 * steps + 19) / 20;
And yes, it should give value of 1 for level 1, 2 for level 2 and so on.

It is very possible that this updater doesn’t work well with propagator, the Bonus System is quite convoluted at this point and might need a revamp.

Hi,

ok, i corrected the bug. Still the same. I had it empty before, but empty has the same result. So it seems to be the updater which is not working here.

And yes, the bonus system might be overhauled. There are quite many inconsistencies. For example the special crystal generation for the crystal dragon. This is nonsense. There is already a resource generation bonus, which can generate any resource. This bonus is applicable to a skill, to a hero as specialty (still need to test the updater here), but it does nothing applied to creatures. If this would be applicable to creatures, it would be easy and straightforward to implement the peasant tax paying.

BTW: What does the “stacking” field mean, and what values are allowed here?

BTW, since i’m already on suggestions for future release: I’d recommend modifying the faction selection for random castles. Of course the settings in the map should have priority, but for pure random castles:

First, make a list of all new (non core) factions which are native to the terrain where the castle is on. If list is non-empty, take one of this list. And done.

Next, make a list of all core factions which are native to that terrain. If list is non-empty, take one of these. Done.

Next, make a list of all new factions. If list is non-empty, take one of these.

Last, take one of the core factions randomly.

This way the map would look better, and it would be more logical to play with. And it might even be possible to make campaigns with random castles. Just carefully choose the locations, and the active mods (factions).