SoD files mod like

Even if you’ll find them it will be Delphi source. Not sure how useful it will be for C++ program.

You’ve already “renamed” them by moving into subdirectories. Mod that replaces “PIKEATTK.wav” won’t replace “castle/PIKEATTK.wav” or "castle/pikeman/PIKEATTK.wav"
And I’m mostly talking about such completely cryptic names like “TPTHBKCS.bmp”.

Can you tell me what that name means without checking how it looks like? Hint - this image is used in town screen.

JsonNode objects can be serialized via “<<” operator:

JsonNode data;
std::cout << data;

You have already extracted game files, why bother?
You can copy CRPORT.def (or how it named) or similar files to each monster folder and then address only single frame from it.

I was under the impression it will replace the files. But you are right, so I was wondering anyway… why the extra “castle stuff” (forgot the English word)? Why not dump all resources at the same level? I can think only about using name duplicates. eg:

cove/content/cofig/cove

why not

cove/content/config/

Let me see I have exactly 2 days experience with H3 files so… without looking into file… TownPictureTownHallBacKgroundCaStle.bmp? I am not that convinced about CS. I do not want to say that the names are ok like they are by any measure. For now I will try to finish just moving them and then maybe look into modifying the names. (But off-course we can discus it meantime).

That would be the workaround :). (if splitting files is not working).

At the end of CCreatureHandler::loadLegacyData() i dump the json creature info into a random logger like this:

	BOOST_FOREACH(auto node, h3Data)
	{
		logGlobal->traceStream() << "\n" << node;
	}

The Paths to creature sounds and graphics are not inside yet?. Is there another point where I can get the whole deal?

Some more questions:
1- Cove creatures do not have: “troopCountLocationOffset” is it needed? what is this?
2- Cove creatures do not have:

"name" : {
		"plural" : "Pikemen",
		"singular" : "Pikeman"
	},

3- In CRANIM.TXT Walk animation time for Pikeman is 1.15 when I serialize json from code it is set/rounded to 1.

They do, all localized names are kept in separate file for convenience.

It’s for table with number of units in stack. I do not use it.

krs,
Some explanation of mod directory structure:

<name of mod>
    mod.json 
    Content/ - directory that acts similar to H3 root. In future will be replaced with .zip archive
        Data/
          ...     - represents our directory structure, based on H3 structure. Check config/filesystem.json to see how VCMI generates filesystem from H3 data
        Sprites/ 
            <mod name>/ - one more subdirectory to avoid conflicts between mods. Files placed directly in Sprites (or any other directory on that leve) will override files from H3 or other mods.

So if you will place everything in Content/Data … Content/Sprites directories directly without renaming it will replace H3 files as you want to.

But:

  1. This means that you must use plain filesystem without subdirectories (unless you’ll split everything into separate mod). Won’t add much to ease of use or readability.
  2. Placing everything in this way may result in mod conflicts (if 2 mods add same file). Certainly not good example for modders.

1- During my initial import all values equal to 0 were removed. This is why some fields may be missing from config.
And frankly I can’t say for sure what that field is. It comes from H3 data and right now unused in vcmi.

2- They have. See separate text.json file (or something like that)
3- Could be bug. Will check.

Ivan suggested I look into CCreatureHandler::load(). I could not find that one but I figure all data should be in place by ContentHandler::loadMod().

From there I found 2 separate places with data:

  • original (from H3)
  • mod data (from config).

Problems:

4 - I cannot find abilities text anywhere.
5 - If anyone could hot-fix the “serialization bug” It will help a lot.

6 - Names for creatures for cove are in creature-texts. Is it because of localization?

By combining the 2 I think I have now the whole thing: This is an example for pikeman. Hope is complete, I intend to use this ordering for all other creatures. (so if anyone has any remarks regarding it please do it now :slight_smile: ).

{
	"pikeman":
	{
		"faction" : "castle",
		"level" : 1,
		"upgrades": "halberdier"],
		"cost" :
		{
			"gold" : 60
		},
		"speed" : 4,
		"hitPoints" : 10,
		"attack" : 4,
		"defense" : 5,
		"damage" :
		{
			"min" : 1,
			"max" : 3
		},
		"doubleWide" : false,
		"growth" : 14,
		"horde" : 0,
		"aiValue" : 80,
		"fightValue" : 100,
		"advMapAmount" :
		{
			"min" : 20,
			"max" : 50
		},
		"abilities":
		{
			"cavalryChargeImmunity" :
			{
				"type" : "CHARGE_IMMUNITY"
			}
		},
		"graphics" :
		{
			"animation" : "castle/battle/CPKMAN.def",
			"map" : "castle/map/AvWPike.def",
			"iconSmall" : "castle/iconsSmall/xxxxx.bmp",
			"iconLarge" : "castle/iconsBig/xxxxx.bmp",
			"timeBetweenFidgets" : 1,
			"animationTime" :
			{
				"walk" : 1.15,
				"attack" : 1,
				"flight" : 1
			}
		},
		"sound" :
		{
			"attack" : "castle/PIKEATTK.wav",
			"defend" : "castle/PIKEDFND.wav",
			"killed" : "castle/PIKEKILL.wav",
			"move" : "castle/PIKEMOVE.wav",
			"wince" : "castle/PIKEWNCE.wav"
		}
	}
}

Oups. Correct name is CCreatureHandler::loadObject(). Function has two overloads, one is used for mod objects another for H3 objects.

  1. CrTraits.txt (last field in row) and config/creature/*.json files
  2. Yes.

You mean something like this in the file castle-creatures/content/config/castle/creatureTexts.json?

{	"pikeman":
	{
	"name" :
 {
		"plural" : "Pikemen",
		"singular" : "Pikeman"
	},
		"abilityText" : "<actual ability text>"
	}
}

Yes. Not necessary to put it into creature-text.json. Actually you may remove this localization file entirely - there is already better way to translate something without replacing files in mods.

  1. Floating point values bug should be fixed :slight_smile:

So i just do not care about abilityText and Name entries?

These entries must be present in config but not necessary in separate file. Move them into main part of config:

 {
     "pikeman": 
     { 
         "name" : 
         { 
                  "plural" : "Pikemen", 
                  "singular" : "Pikeman" 
         }, 
         "abilityText" : "<actual ability text>"
         "faction" : "castle", 
         "level" : 1,
          ...

Ok I will move those texts to main creature config.

I am still missing this information from the serialized data. Any ideas where it is available (in code)?

  1. "
map" : "castle/map/AvWPike.def",
 			"iconSmall" : "castle/iconsSmall/xxxxx.bmp",
			"iconLarge" : "castle/iconsBig/xxxxx.bmp"

For 2) I know the icons are clumped together, but temporarily isn’t there a way to do something like

"iconBig" : TWCRPORT.def,
 "index" : "100".
  1. there is an “index” : , in every creature config file. what is that? (“Private field to break things, do not use.”)
  1. Difficult one. In H3 this field is not a part of creature data but completely separate. (objects.txt IIRC). VCMI does not have proper way to add adventure map objects right now so this field was added as some kind of workaround.

So even if you’ll get name for adventure map image for creature it won’t be used as long as entry exists in objects.txt

  1. Yes. I wrote that before: “:”, e.g. “TWCRPORT:100”. For creatures that have their icons in TWCRPORT already (all H3 creatures) you should leave this field empty - vcmi will pick correct image based on index.

  2. Numeric ID of object. Used to add some hardcoded features (e.g. special building in towns) and to match our data with H3 part: line with this creature in crtraits.txt, icon index for the creature and so on.

Yes. Because using it it mods will only break things :slight_smile:
More precisely - each ID may be used only once. Since you’re moving data from our configs to mods this won’t change - instead of using it in our config files it will be used by mod.

This is what I get when serializing archangels abilityText:

	"abilityText" : "+1 morale.  Hates Devils.\

Resurrects allies.",

There is a newline somewhere. What is the escape sequence in json? Can this be hotfixed?

Finishes castle-creatures. Here is how they look. (Only .jsons and folder structure attached)

For actual moving of files in the right places. A function will parse the json for each creature, take the relative paths from there and move the appropriate files.
castle-creatures.zip (12 KB)

Now on heroes…

  1. how to translate
		"specialties" : 
			{
				"info" : 0,
				"subtype" : 41,
				"type" : 6,
				"val" : 3
			}
		],

to “specialty”". For EG:

"specialty": //estate bonus
		
			{
				"bonuses":
				
					{
						"type": "GENERATE_RESOURCE",
						"subtype": "resource.crystal",
						"val": 1
					}
				]
			}
		]
  1. I could not identify specialtyLarge / specialtySmall images. Can someone point me to them?

  2. I see no entry for hero artifacts or special creatures (catapult, balista, first aid).