Help with town editing

Hi, all.

I am a novice modder but long term (~10 years) HoMM player. I set upon making my own custom town for my own use and not to be released as I am using the MDT Forge as framework. All I have done currently is successfully change creatures using other .def files, create custom creature and town portraits, implement custom creature sounds, and add an extra unit. I face no issues with any of those modifications. The trouble now lies within creating an extra unit to be recruited in the town via a new added building. I converted an adventure map def I found to one without a flag and created an area and border for it. Implementing it into the town.json file worked fine and I edited the Building Menu to accomodate for an extra building slot, which worked. I also created an image to be displayed in the slot, which again worked fine.

Screenshot of Build Menu (Gyazo)

Unfortunately, I can’t seem to assign the correct unit to be recruited in the building.

Building it returns an error which is the same in both the console AND in-game:

Error ecountered when building dwelling (bid=44):no creature found (upgrade number 2, level 0!
System message: Server encountered a problem: Error ecountered when building dwelling (bid=44):no creature found (upgrade number 2, level 0!

Clicking on it makes me recruit the Level 1 units (changed from Recruits and Militians to Cultists and Assasins):

Screenshot of Recruitment Screen (Gyazo)

I have no idea how to solve this. I’ve spent a few hours messing around with the .json file for the unit that I have added - Evil Sorceress (which works fine, it’s just trying to get it to be placed in the generator is the issue) -, the town.json file and I even used a text scanning tool to look through the entire \Content\ directory to look for anything that may give me a hint as to how to solve this.

Here is a link to the full .zip file on Dropbox: Dropbox

Key files:
Oblivion Town\content\config\forge\creatures\Lvl8Unit.json
Oblivion Town\content\config\forge\town.json
Oblivion Town\content\sprites\forge\townhall.def

Please do note that I will NOT be releasing this town as it contains content created by the Mod Design Team. This is simply a project I am working on myself to build skill and experience in modding for VCMI. All help is appreciated!

UPDATE 15/4/17 @ 21:17
Proof the unit works in combat with new hero added: Combat Example (Gyazo)

UPDATE 23/5/17 @ 17:13
I got it working! Well, kinda. I left this for a bit but recently downloaded the Amethyst Chinese town and dug around the files. I changed the building ID from 43 or 44 to 50, added a few placeholder spaces in the townhall.def file and I could recruit my Sorceresses! Only issue now is that their building is always built in the town and they are recruited from the Doomknight/Dreadlord Pit (Juggernaut Pit). So glad it’s working, just need to see if I can get them to be recruited separately!

See:
gyazo.com/0387d246e7cfe73f8166f33a8d331d6d
gyazo.com/6b6061a8b4f8577d5880d2b5b43cf7d0

– Marcie

This could be tricky, or even impossible to build 8th level dwelling.
Every building in townscreen has its own ID. Standard townscreen has 44 IDs. id: 0 is for Mage Guild level 1, id: 16 is for blacksmith, id: 43 is for upgrade level 7 dwelling and so on. But in vcmi there’s a algorithm beyond id: 43.
Look:
non upg lvl 1 - id: 30
non upg lvl 2 - id: 31

non upg lvl 7 - id: 36
upg lvl 1 - id: 37
upg lvl 2 - id: 38

upg lvl 7 - id: 43
and now
second upg lvl 1 - id: 44
second upg lvl 2 - id: 45

second upg lvl 4 - id: 47 (like Pirats in Cove)

second upg lvl 7 - id: 50
and next
third upgrade lvl 1 - id: 51

and next fourth upgrade and so on.

As you can see there’s no room for ID for 8th lvl dweling.

I think that you can try to use some empty ID for special dwellings (there’s four special dwellings: special1, special2, special3, special4) Every special has it own ID, but none city use all of them. So, maybe there’s way to “trick” 8th lvl dwelling.

So would simply renaming the building ID from “dwellingLvl8” to “special2” do it? I didn’t really want to, but I may have to replace a building for it to work. Take the Replicator, for example:

special2" : {
	"cost" : { "crystal" : 2, "gems" : 2, "gold" : 2500, "mercury" : 2, "ore" : 5, "sulfur" : 2, "wood" : 10 },
	"description" : "The Replicator allows you to replicate Artifacts (not working yet).",
	"id" : 21,
	"name" : "Replicator",
	"requires" :  "blacksmith" ],
},

Would it be worth me changing this building’s use to recruit another unit, or would that not work either? I also can’t find any file that gives buildings their uses, but I feel that the VCMI engine processes the text files in a specific way. Aghhh I’m stumped!

The more I think about this, I am more sure that it’s impossible to do this, because “special” buildings are empy for now and only command that can be applied under building config is “produce” resources :frowning:

Maybe in the future there will be possible something like:

special2" : {
    "cost" : { "crystal" : 2, "gems" : 2, "gold" : 2500, "mercury" : 2, "ore" : 5, "sulfur" : 2, "wood" : 10 },
    "description" : "The Replicator allows you to replicate Artifacts (not working yet).",
    "id" : 21,
    "name" : "Replicator",
    "recruit" : "8th lvl monster", //example of function to indicate that building is creature generator.
    "requires" :  "blacksmith" ],
},

Ahh, fair enough. Guess I’ll have to put things on hold until the engine is further developed :confused: I haven’t even had the opportunity to test out the dwelling on the map as the VCMI Map Editor just crashes opening a standard vanquish all opponents map! Things don’t look to bright for the near future…

On contrary! VCMI map editor released to public some time ago was in very alpha stage. Now AVS (one of vcmi team head master) ‘silently’ prepare new wersion and I think we’ll get quite stable official version.
By the way, testing dwelling is possible in vcmi, all you need is to dowload good map for test :slight_smile:
Look at the attachment, there’s S-sized map called ABC. Launch game, choose this map, choose Oblivion town as starting town. Then go your hero through the portal. Behing portal you can see all seven dwellings connected to starting town, so in these case, your Oblivion’s external dwellings.
Test Mapa.h3m (6.83 KB)

Ahh thank you! I’ll test it out as soon as I can! It’s been very annoying not being able to see if the dwelling even worked!

As thought, it didn’t work. It’s a lvl 8 dwelling and the standard map editor goes up to lvl 7 in dwellings. The VCMI editor allows me to place the dwelling but the map either doesn’t load in the map select menu in-game, or it crashes when I click it. This happens with any map I edit in the VCMI editor, which is coincidentally the only way for me to place down the dwelling :confused: if you download my mod, could you see if you could get it working? Or is the map editor the same for you?

Even if I release another map editor build right now it will not help, because map format support is not yes finished inside vcmi itself. But you can try special vcmi build from vcmi.arseniyshestakov.com/windows/PR/200/

But you’ve coded external 8lvl dwelling ok in dwellings.json. Without map editor it is hard to test it, but from your side everything is ok. Now you must have lots of luck for random map generator to spawn this building on the map. High lvl external dwellings are rare, but possible. Even in standard H3, Azure Dragon’s dwelling is spawned very rare.

I’ll try this build an let you know how it goes!

I guess I’ll pray to RNGesus for the dwelling to spawn but I don’t think it will as default maps are coded to spawn level 1 - 7 buildings only. I’ll have a look!

It didn’t work, surprise surprise(!) If I could find the code behind the Dungeon’s Creature Portal I could try to work something out similar to that, but even then I don’t know if it’d work…guess I’ll put this on hold until VCMI is developed further to allow for more recruitment!

UPDATE

I got it working! Well, kinda. I left this for a bit but recently downloaded the Amethyst Chinese town and dug around the files. I changed the building ID from 43 or 44 to 50, added a few placeholder spaces in the townhall.def file and I could recruit my Sorceresses! Only issue now is that their building is always built in the town and they are recruited from the Doomknight/Dreadlord Pit (Juggernaut Pit). So glad it’s working, just need to see if I can get them to be recruited separately!

See:
gyazo.com/0387d246e7cfe73f8166f33a8d331d6d
gyazo.com/6b6061a8b4f8577d5880d2b5b43cf7d0

I like the way that crystal palace looks, can’t wait to see the whole town in action :->

I have a week off this week so I’ll be looking to develop this a little further! If I can get it to work, I’ll update the thread! I mean I can link you to a download but idk if I can because I’ve used the same graphics from the MDT Forge team…

no problem. If you run into problems let us know, I’ll be watching this thread :slight_smile:

It’s obvious, because id 50 is hardcoded/reserved for second upgrade of tier7. So technically, your Sorceresses are kind of Dreadnoughts upgrades.

HEY!!! I was thinking about your earlier post about the 8th level dwelling. If you were to create the dwelling as just a random dwelling within your mod, you might be able to get around that problem. there are plenty of mod creatures that are neutral and not necessarily attached to a town…

Anyone have a yea or nay on that??? let us know!

I’ve implemented the dwelling which comes up as a level 7 if you were to put it in using the standard map editor, by which I mean: if you had two Random Lvl 7 generators set to be the same faction as a random town (but select the Oblivion town in game), it has a 50/50 chance to be somewhere to recruit Sorceresses OR Doomknights. Annoyingly, the VCMI Editor just crashes or the game doesn’t allow me to run the VMAP files without crashing upon clicking one in the map select screen so I can’t try anything on a VMAP. That goes even if I get rid of all my mods except the base VCMI folder, so testing for me has been a bit of RNG!

On another note, I’ve added a few spells and artifacts in submods which I can release! Currently the spells are mixed in with Warmonger’s Spells but I can just take them out ^^ and the artifacts seem to be working just fine. I kinda want to make a few more before I release them, though. I’ll keep you posted on those!

I was also wondering if it’d ever be possible to add another school of magic somehow? I’ve browsed the config files and can’t find anything to do with a magic school but I have a spell that’d fit into a “Dark” school or something. Just a thought…

New mods are coming! Cool!

It’s better not mixing spells to not confuse players. It’s better make another spell mod or send your work to Warmonger. If he’ll likes it, maybe he put them to the next New Old Spell update.
But, new mod appraoches!! :slight_smile: