Help with mods - questions

It is hardcoded.

{
“type”:“SHOTS”,
“val”:9999
}

Yeah, that’s solution but not for new siege machines in Ammo Cart slot. After destroying such war machine that replaces Ammo Cart, bonuses remain to the end of the battle! @AVS - it can be considered as a bug?

Need more details

fireCart.zip (8.2 KB)
Here’s the example mod. New siege machines available in Inferno increases +50% damage to all shooters in the battle. But - if Fire Cart will be destroyed - it’s logical that damage should back to normal values. Unfortunattelly - bonus lasts till the end of the battle despite cart destroying.

Looks like that there is a bug that dead unit still propagate bonuses.

I have a question regarding some object type: I cannot find any entry for objects of type “decorative object” (index 40) in any of the core config files. Is this intentional? Or have i overlooked something?

Background:
I have converted by now about 600 objects from FredObj manually. But it takes much too long, and i already have one bug somewhere which i cannot find. So i started to write a perl script that does the conversion. When this works, all the 4500 objects will be converted within some seconds. And hopefully without bug. Up to now i converted only objects of type “cactus”, “tree”, “mountain” and so on. Now i started first tests with my script, and the first object was of index 40. But there is no such entry in any of the core config files. So i don’t know what to write here for the group name. If it where a cactus, i’d write “core:cactus”, but what should i write for object with index 40? Many of the FredObj objects are of that type.

I guess index 40 could be unused in original h3, like some unused creature ids. You know, some of fred’s objects don’t fit anywhere, like bridges for example. So, it’s up to you to decide where some fred’s object should be moved. Or maybe ask Fred at HC forum? Or such index40 objects you can configure like new, decorative objects without using “core:” syntax.

Well, at least the Era Def viewer and Def editor know these :slight_smile: And there they are called “decorative object”.
Btw, exactly i stumbled over these bridges :slight_smile:

The script currently depends on evaluating the index and subindex. If i have to move them to somewhere else, i have to do it manually. And i’d like to avoid that. I still have enough work to do manually after conversion, like removing many objects (all objects that belong to other mods), and redefining some others. I have plans to modify all the dragon utopias like the mod “damn utopia”, using those objects from Fred.

Btw (modding suggestion): It would be nice if it would be possible to replace all those one-shot objects like dragon utopias by other objects after defeating them. F.ex. replace them with a dwelling. For dragon utopia replace it with a dragon dwelling. Special type with 4 types of dragons to hire. Same for crypt, shipwreck and the like. Keep the image and change object type. This way these objects would be useful still after beating them.

One more question, this time about “zIndex”. Wiki says that legacy overlay objects have zIndex of 100. Does that mean the higher the value the lower it is rendered (below other objects)?

I have delved a little more into Freds Objects. There are more than one object groups that are unrecognized. Interesting part is: If i create a map with the Era editor and then play it with VCMI, the map works, until there are too many of these objects. Then the game simply gets stuck at the beginning, before showing the map.

I just added these types to the core vcmi objects.json, and the map was playable again :slight_smile:

The unrecognized object groups are:

  • 40 decorative object
  • 185 mountain
  • 114 brush
  • 191 rock
  • 199 trees
  • 138 plant
  • 156 vine
  • 178 lava flow
  • 170 dead vegetation
  • 201 volcanic vent
  • 203 willow trees
  • 188 pine trees
  • 171 flowers
    196 stalagmite

Since some of these names are duplicates, i simply named them like “plant138”, “mountain185” and so on. It would be good to have these in the core config. That would make conversion of FredObj easier.

Random map or vcmi map?

A map created with Era map editor.

The client log shows hundreds of “Unrecognized object” lines. After i added the indexes to the core object.json, most of those messages where gone and the map started well. I still get 3 such messages for index 203 (willow trees). Can’t find the bug. But the map still seems to be o.k.

Could you upload this mod or not ready yet?

It is by far not ready for now.

As long as vcmi has the DEF files, it can show them. The map created with the Era editor has the DEF names included in the map. This is why you can set up objects that look like other objects. This is why these objects are usable at all. So basically the mod currently contains only the DEFs plus some json, that are not important for working for now. You’d need the json files if you want to have these objects in the vcmi editor and/or if you want them in random maps.

Maps created with the Era editor contain only objects that are part of core. At least it could not include any other. For H3 orioginal, WoG and Era objects with unknown IDs are no problem. They simply do not have any functionality. For VCMI it is basically the samew, but limited to objects configured in the core. But there is no problem with configuring these objects with a static handler. This does not change any functionality, so vcmi has no problem with that.

I simply added these in the core config, and it worked out of the box. Except those 3 “Unrecognized objects”, although i have configured them.

Here is the part of the config/objects/generic.json, which i have modified:

/// Decorations
"decorativeObject"					: { "index" :40, "handler": "static", "types" : { "object" : { "index" : 0} } },
"brush"							: { "index" :114, "handler": "static", "types" : { "object" : { "index" : 0} } },
"rock191"						: { "index" :191, "handler": "static", "types" : { "object" : { "index" : 0} } },
"trees199"						: { "index" :199, "handler": "static", "types" : { "object" : { "index" : 0} } },
"cactus"						: { "index" :116, "handler": "static", "types" : { "object" : { "index" : 0} } },
"canyon"						: { "index" :117, "handler": "static", "types" : { "object" : { "index" : 0} } },
"crater"						: { "index" :118, "handler": "static", "types" : { "object" : { "index" : 0} } },
"deadVegetation"				: { "index" :119, "handler": "static", "types" : { "object" : { "index" : 0} } },
"flowers"						: { "index" :120, "handler": "static", "types" : { "object" : { "index" : 0} } },
"flowers171"						: { "index" :171, "handler": "static", "types" : { "object" : { "index" : 0} } },
"frozenLake"					: { "index" :121, "handler": "static", "types" : { "object" : { "index" : 0} } },
"hole"							: { "index" :124, "handler": "static", "types" : { "object" : { "index" : 0} } },
"kelp"							: { "index" :125, "handler": "static", "types" : { "object" : { "index" : 0} } },
"lake"							: { "index" :126, "handler": "static", "types" : { "object" : { "index" : 0} } },
"lavaFlow"						: { "index" :127, "handler": "static", "types" : { "object" : { "index" : 0} } },
"lavaLake"						: { "index" :128, "handler": "static", "types" : { "object" : { "index" : 0} } },
"mushrooms"						: { "index" :129, "handler": "static", "types" : { "object" : { "index" : 0} } },
"log"							: { "index" :130, "handler": "static", "types" : { "object" : { "index" : 0} } },
"mandrake"						: { "index" :131, "handler": "static", "types" : { "object" : { "index" : 0} } },
"moss"							: { "index" :132, "handler": "static", "types" : { "object" : { "index" : 0} } },
"mound"							: { "index" :133, "handler": "static", "types" : { "object" : { "index" : 0} } },
"mountain"						: { "index" :134, "handler": "static", "types" : { "object" : { "index" : 0} } },
"mountain185"						: { "index" :185, "handler": "static", "types" : { "object" : { "index" : 0} } },
"oakTrees"						: { "index" :135, "handler": "static", "types" : { "object" : { "index" : 0} } },
"outcropping"					: { "index" :136, "handler": "static", "types" : { "object" : { "index" : 0} } },
"pineTrees"						: { "index" :137, "handler": "static", "types" : { "object" : { "index" : 0} } },
"plant138"				: { "index" :138, "handler": "static", "types" : { "object" : { "index" : 0} } },
"pineTrees188"				: { "index" :188, "handler": "static", "types" : { "object" : { "index" : 0} } },
"riverDelta"					: { "index" :143, "handler": "static", "types" : { "object" : { "index" : 0} } },
"rock"							: { "index" :147, "handler": "static", "types" : { "object" : { "index" : 0} } },
"sandDune"						: { "index" :148, "handler": "static", "types" : { "object" : { "index" : 0} } },
"sandPit"						: { "index" :149, "handler": "static", "types" : { "object" : { "index" : 0} } },
"shrub"							: { "index" :150, "handler": "static", "types" : { "object" : { "index" : 0} } },
"skull"							: { "index" :151, "handler": "static", "types" : { "object" : { "index" : 0} } },
"stump"							: { "index" :153, "handler": "static", "types" : { "object" : { "index" : 0} } },
"trees"							: { "index" :155, "handler": "static", "types" : { "object" : { "index" : 0} } },
"volcano"	: {
	"index" : 158,
	"handler": "static",
	"base" : {
		"sounds" : {
			"ambient" : ["LOOPVOLC"]
		}
	},
	"types" : {
		"object" : {
			"index" : 0
		}
	}
},
"reef"							: { "index" :161, "handler": "static", "types" : { "object" : { "index" : 0} } },
"lakeDUPLICATE"					: { "index" :177, "handler": "static", "types" : { "object" : { "index" : 0} } },
"treesDUPLICATE"				: { "index" :199, "handler": "static", "types" : { "object" : { "index" : 0} } },
"desertHills"					: { "index" :206, "handler": "static", "types" : { "object" : { "index" : 0} } },
"dirtHills"						: { "index" :207, "handler": "static", "types" : { "object" : { "index" : 0} } },
"grassHills"					: { "index" :208, "handler": "static", "types" : { "object" : { "index" : 0} } },
"roughHills"					: { "index" :209, "handler": "static", "types" : { "object" : { "index" : 0} } },
"subterraneanRocks"				: { "index" :210, "handler": "static", "types" : { "object" : { "index" : 0} } },
"stalagmite196"					: { "index" :196, "handler": "static", "types" : { "object" : { "index" : 0} } },

//These are WoG objects? They are not available in H3
"frozenLakeDUPLICATE"			: { "index" :172, "handler": "static", "types" : { "object" : { "index" : 0} } },
"oakTreesDUPLICATE"			: { "index" :186, "handler": "static", "types" : { "object" : { "index" : 0} } },
"plant"					: { "index" :189, "handler": "static", "types" : { "object" : { "index" : 0} } },
"vine156"				: { "index" :156, "handler": "static", "types" : { "object" : { "index" : 0} } },
"lavaFlow178"				: { "index" :178, "handler": "static", "types" : { "object" : { "index" : 0} } },
"deadVegetation170"			: { "index" :170, "handler": "static", "types" : { "object" : { "index" : 0} } },
"willowTrees203"			: { "index" :203, "handler": "static", "types" : { "object" : { "index" : 0} } },
"volcanicVent201"			: { "index" :201, "handler": "static", "types" : { "object" : { "index" : 0} } }

The added entries have a number at the end of the name, to avoid conflicting names. The 3 “Unrecognized objects” are of ID 203. But as you can see, they are included here.

It seems as if VCMI can handle some amount of unrecognized objects, but only up to some amount. If there are too many of them VCMI cannot handle that.

If it would be possible to include these IDs in the core config, that would make converting FredObj to VCMI much easier. And it does not hurt. It does not conflict with any< standard map or with VCMI as-is.

I think i found at least the reason of these 3 unrecognized objects in the client log:

2018-Nov-03 11:34:11.569756 WARN global [7f519e028700] - No templates found for 203:1001

It seems that there are 3 objects with a strange subindex.

@AVS Transparent png are supported in battle spell animations?
EDIT: yes, I managed to find out how!

I have problems with setting up two artifacts - both don’t work :confused:

  1. I want to have artifact that block casting level 1 spell by enemy hero.
    My trial:
"type" : "BLOCK_MAGIC_BELOW",
"val" : 2,
"valueType" : "INDEPENDENT_MIN" or MAX
"effectRange" : "ONLY_ENEMY_ARMY",
"propagator": "BATTLE_WIDE"
  1. I want to have artifacts that steals 250 gold/day from all enemy players. My code also doesn’t work.
  	{
  		"subtype" : "resource.gold",
  		"type" : "GENERATE_RESOURCE",
  		"val" : -250,
  		"effectRange" : "ONLY_ENEMY_ARMY"
  	}

What do I do wrong?

  1. Should work, maybe there is bug with ONLY_ENEMY_ARMY, does other bonuses with this range work?

  2. If ONLY_ENEMY_ARMY work as it should, then this bonus would affect enemy only during battle. Looks like something like ENEMY_PROPAGATOR(not exist) would be handy for such cases.
    You can try to achive what you want with two bonuses, first with GLOBAL_EFFECT propagator and negative val, and second with PLAYER_PROPAGATOR/TEAM_PROPAGATOR and positive val. But this need to be testes.

Sometimes works, sometimes not. I’ll write more later!

ONLY_ENEMY_ARMY works only in battle and only for creatures.