Modding FAQ

Question: is now for adventure map objects I cannot change standard text appearing?
I want to make Water Wheel - like object (Farm, subid object of Water Wheel), but to change text, that is showed when visiting.

As I remember, bonuses for war machines worked in >0.96
In 0.97 I add hero:

	"lightcastleSiegeMaster1" : 
	{
		"class" : "lightcastleSiegeMastert",
		"female" :false,
"spellbook" :
			
		
		],

		"texts" :
		{
			"name" : "Mint",
"biography":"NO_TEXT",
			"specialty" :
			{
				"description" : "Ballista +1 shot and health bonus",
				"tooltip" : "Ballista +1 shot and health bonus",
				"name" : "Ballista +1 shot and health bonus"
			}
		},
		"images" :
		{
			"specialtySmall" : "lightcastle-heroes/ballista_32",
			"specialtyLarge" : "lightcastle-heroes/ballista_44",
			"large" : "lightcastle-heroes/siege-large/scout1.bmp",
			"small" : "lightcastle-heroes/siege-small/scout1.bmp"
		},
		"army" :
		
			{
				"creature" :"lightcastleCompanyAgent",
				"max" :22,
				"min" : 18
			},
			{
				"creature" :"ballista",
				"max" :1,
				"min" : 1
			}
		],
		"skills" :
		
			{
				"level" : "advanced",
				"skill" : "artillery"
			}
		],
		
		"specialty":
		
			{
				"bonuses":
				
					{
						"type": "ADDITIONAL_ATTACK",
						"val":1,
						"limiters":
						
							{
								"type": "CREATURE_TYPE_LIMITER",
								"parameters" : "ballista", true]
							}
						]
					},
					{
						"type": "STACK_HEALTH",
						"val":700,
						"limiters":
						
							{
								"type": "CREATURE_TYPE_LIMITER",
								"parameters" : "ballista", true]
							}
						]
					}
				]
			}
		]
	},

and nothing happens - ballista doesn’t get +1 shot and hit points +700.
Is it a bug? Or i’m doing something wrong?

Hi is it possible to blacksmith produce two war machines? I’m trying this:
“warMachine” : “ballista”,
but, it’s don’t work.

Now it’s impossible.

Hi guys. I’m newbe.

I’ve installed latest 9,7c version with some basic mods (like wog and Hota) instaled automaticly.

I tried to modify mods a little bit. Tried change some “def” graphics but the problem is: I can’t find those mods and def folders. Tried to find in “Mods” folder but without succeed.

In game everything works fine. I’ve got commanders, I’ve got new Hota city- and that is very cool. Problem is: I cant find def graphics for mods…

I’ll be very glad for any help…

I think, I have found right folder in: documents and settings/My games- folder. Try to replace some defs…

Edit: Ok. Problem solved. Everything work’s fine…

As i can see in sources
github.com/vcmi/vcmi/blob/devel … ructor.cpp
JSON configuration for new/modified standard map objects is already implemented.
But there are no examples how how to use these features.
Have someone messed with adding new rewardable objects?
Can help be added to Wiki?

Does VCMI support recruiting multiple units from one building in town? I want one building upgrade to add two possible units to buy, same as upgrades in heroes 5: tribes of the east, looks like it does not work.

Because you must do two buildings for 2 units.
Like “building43” is upgrade for “building36”, you add it to hallSlots and assign it “redDragon” on 7th level.
Then you add “building50”, in “structures” write “requires”: “building43”], “mode”:“auto”.
then don’t write it to hallSlots, but assign “blackDragon” to 3rd unit of level 7.
When 43 building builds, 50 building will be built automatically.

Example:
BUILDINGS.JSON

 "building43":                {
                    "id": 43,
                    "upgrades": "building36",
"requires" : "allOf" , "building2"]],
                    "cost": {
                        "gold": 10000,
                        "ore": 15,
                        "sulfur": 20
                    },
"description" : "Black Tower allows to recruit Red and Black Dragons.",
					"name" : "Black Tower"
                },

 "building50":                {
                    "id": 50,
                    "mode": "auto",
                     "upgrades":"building43",
                    "cost": {
                        "gold": 10000,
                        "ore": 15,
                        "sulfur": 20
                    },
"description" : "Black Tower allows to recruit Red and Black Dragons.",
					"name" : "Black Tower"
                }
 

FACTIONS.JSON

"hallSlots":"villageHall","townHall","cityHall","capitol"],"fort","citadel","castle"],"building5"],"building16"]],"building14","building15"],"building0","building1","building2","building3","building4"],"building21"],"building22"]],"building17"],"building23"],"building18","building19"]],"building30","building37"],"building31","building38"],"building32","building39"],"building33","building40"]],"building34","building41"],"building35","building42"],"building36","building43","building50"]]],

"creatures": "level1","level1Upgrade" ],
 "level2","level2Upgrade"],
"level3","level3Upgrade"],
"level4","level4Upgrade"],
"level5","level5Upgrade"],
 "level6","level6Upgrade"],
 "greenDragon","redDragon","blackDragon" ]],

Have no one here experienced modding rewardable objects? :angry:

I tried to construct JSON from sources reading on GitHub, I got this object (I tried to recreate full structure of “rewards”), but it don’t work (when visiting him on map I got only 1 empty message with OK button.
Where I am wrong?

{
    //"core:learningStone": {
        "someHistoryMuseum": {
            "handler": "oncePerHero",
            "name": "Museum Level 1",
            "types": {
                "ModernSomeMuseum01": {
                    //"soundID": 1,
                    "resetDuration": 0,
                    "canRefuse": true,
                    "onSelectMessage": "You must pay 200 gold to visit exposition of this museum of history.",
                    "onVisitedMessage": "You already had visited this museum in past and have no time or wish to visit it again.",
                    "onEmptyMessage": "This museum was closed due to budget shorting, and now only wind blows in these walls.",
                    "rewards": 
                        {
                            "dice": 1.0,
                            "appearChance": {
                                "min": 25,
                                "max": 30
                            },
                            "limiter": {
                                //"numOfGrants": 0,
                                //"dayOfWeek": 0,
                                //"minLevel": 1,
                                "resources": {
                                    "gold": 200
                                },
                                //"primary": {
                                    "attack": 0,
                                    "defence": 0,
                                    "spellPower": 0,
                                    "knowledge": 0
                                },
                                //"secondary": {
                                    "necromancy": "basic"
                                },
                                //"artifacts": 
                                    
                                ],
                                //"creatures": 
                                    
                                ],
                                
                            },
                            //"resources": {
                                "gold": 100
                            },
                            "gainedExp": 1000,
                            //"gainedLevels": 0,
                            //"manaPoints": 0,
                            //"manaPercentage": 0,
                            //"movePoints": 0,
                            //"movePercentage": 0,
                            //"primary": {
                                "attack": 0,
                                "defence": 0,
                                "spellPower": 0,
                                "knowledge": 0
                            },
                            //"secondary": {
                                {
                                    "skill": "necromancy",
                                    "level": "basic"
                                }
                            },
                            //"artifacts": 
                                
                            ],
                            //"spells": 
                                
                            ],
                            //"creatures": 
                                
                            ],
                            "message": "You have visited museum exposition, and now your knowledge of the world is getting up.",
                            "selectChance": 60,
                            
                        },
                        {
                            "dice": 1.0,
                            "appearChance": {
                                "min": 25,
                                "max": 30
                            },
                            "limiter": {
                                //"numOfGrants": 0,
                                //"dayOfWeek": 0,
                                //"minLevel": 1,
                                "resources": {
                                    "gold": 200
                                },
                                //"primary": {
                                    "attack": 0,
                                    "defence": 0,
                                    "spellPower": 0,
                                    "knowledge": 0
                                },
                                //"secondary": {
                                    "necromancy": "basic"
                                },
                                //"artifacts": 
                                    
                                ],
                                //"creatures": 
                                    
                                ],
                                
                            },
                            //"resources": {
                                "gold": 100
                            },
                            "gainedExp": 1500,
                            //"gainedLevels": 0,
                            //"manaPoints": 0,
                            //"manaPercentage": 0,
                            //"movePoints": 0,
                            //"movePercentage": 0,
                            //"primary": {
                                "attack": 0,
                                "defence": 0,
                                "spellPower": 0,
                                "knowledge": 0
                            },
                            //"secondary": {
                                "necromancy": "basic"
                            },
                            //"artifacts": 
                                
                            ],
                            //"spells": 
                                
                            ],
                            //"creatures": 
                                
                            ],
                            "message": "You have visited museum exposition, and now your knowledge of the world is getting up.",
                            "selectChance": 60,
                            
                        },
                        {
                            "dice": 1.0,
                            "appearChance": {
                                "min": 25,
                                "max": 30
                            },
                            "limiter": {
                                //"numOfGrants": 0,
                                //"dayOfWeek": 0,
                                //"minLevel": 1,
                                "resources": {
                                    "gold": 200
                                },
                                //"primary": {
                                    "attack": 0,
                                    "defence": 0,
                                    "spellPower": 0,
                                    "knowledge": 0
                                },
                                //"secondary": {
                                    "necromancy": "basic"
                                },
                                //"artifacts": 
                                    
                                ],
                                //"creatures": 
                                    
                                ],
                                
                            },
                            //"resources": {
                                "gold": 100
                            },
                            "gainedExp": 1200,
                            //"gainedLevels": 0,
                            //"manaPoints": 0,
                            //"manaPercentage": 0,
                            //"movePoints": 0,
                            //"movePercentage": 0,
                            //"primary": {
                                "attack": 0,
                                "defence": 0,
                                "spellPower": 0,
                                "knowledge": 0
                            },
                            //"secondary": {
                                "necromancy": "basic"
                            },
                            //"artifacts": 
                                
                            ],
                            //"spells": 
                                
                            ],
                            //"creatures": 
                                
                            ],
                            "message": "You have visited museum exposition, and now your knowledge of the world is getting up.",
                            "selectChance": 60,
                            
                        },
                        {
                            "dice": 1.0,
                            "appearChance": {
                                "min": 25,
                                "max": 30
                            },
                            "limiter": {
                                //"numOfGrants": 0,
                                //"dayOfWeek": 0,
                                //"minLevel": 1,
                                "resources": {
                                    "gold": 200
                                },
                                //"primary": {
                                    "attack": 0,
                                    "defence": 0,
                                    "spellPower": 0,
                                    "knowledge": 0
                                },
                                //"secondary": {
                                    "necromancy": "basic"
                                },
                                //"artifacts": 
                                    
                                ],
                                //"creatures": 
                                    
                                ],
                                
                            },
                            //"resources": {
                                "gold": 100
                            },
                            "gainedExp": 800,
                            //"gainedLevels": 0,
                            //"manaPoints": 0,
                            //"manaPercentage": 0,
                            //"movePoints": 0,
                            //"movePercentage": 0,
                            //"primary": {
                                "attack": 0,
                                "defence": 0,
                                "spellPower": 0,
                                "knowledge": 0
                            },
                            //"secondary": {
                                "necromancy": "basic"
                            },
                            //"artifacts": 
                                
                            ],
                            //"spells": 
                                
                            ],
                            //"creatures": 
                                
                            ],
                            "message": "You have visited museum exposition, and now your knowledge of the world is getting up.",
                            "selectChance": 60,
                            
                        },
                        
                    ],
                    "name": "Museum Level 1",
                    "rmg": {
                        "zoneLimit": 3333,
                        "value": 500,
                        "rarity": 80
                    },
                    "templates": {
                        "138F": {
                            "animation": "test/objects/someMuseum/138F",
                            "visitableFrom": 
                                "---",
                                "+++",
                                "+++"
                            ],
                            "mask": 
                                "VVVVVV",
                                "BBBBBV",
                                "BBBBBB",
                                "VABBVV"
                            ],
                            "allowedTerrains": 
                                "grass",
                                "rough",
                                "dirt"
                            ]
                        },
                        
                    },
                    
                },
                
            }
        }
    }

I don’t think these are implemented yet.

At first please provide valid json file. Also please remove commented junk.

It’s not commented junk. It’s constructor of possible values object can have (to uncomment needed fields and make use in next object):slight_smile:

Cleared it with help of jsonlint.com:

{
    "someHistoryMuseum": {
        "handler": "oncePerHero",
        "name": "Museum Level 1",
        "types": {
            "ModernSomeMuseum01": {
                "resetDuration": 0,
                "canRefuse": true,
                "onSelectMessage": "You must pay 200 gold to visit exposition of this museum of history.",
                "onVisitedMessage": "You already had visited this museum in past and have no time or wish to visit it again.",
                "onEmptyMessage": "This museum was closed due to budget shorting, and now only wind blows in these walls.",
                "rewards": 
                    {
                        "dice": 1,
                        "appearChance": {
                            "min": 25,
                            "max": 30
                        },
                        "limiter": {
                            "resources": {
                                "gold": 200
                            }
                        },
                        "gainedExp": 1000,
                        "message": "You have visited museum exposition, and now your knowledge of the world is getting up.",
                        "selectChance": 60
                    },
                    {
                        "dice": 1,
                        "appearChance": {
                            "min": 25,
                            "max": 30
                        },
                        "limiter": {
                            "resources": {
                                "gold": 200
                            }
                        },
                        "gainedExp": 1700,
                        "message": "You have visited museum exposition, and now your knowledge of the world is getting up.",
                        "selectChance": 60
                    },
                    {
                        "dice": 1,
                        "appearChance": {
                            "min": 25,
                            "max": 30
                        },
                        "limiter": {
                            "resources": {
                                "gold": 200
                            }
                        },
                        "gainedExp": 1300,
                        "message": "You have visited museum exposition, and now your knowledge of the world is getting up.",
                        "selectChance": 60
                    },
                    {
                        "dice": 1,
                        "appearChance": {
                            "min": 25,
                            "max": 30
                        },
                        "limiter": {
                            "resources": {
                                "gold": 200
                            }
                        },
                        "gainedExp": 1500,
                        "message": "You have visited museum exposition, and now your knowledge of the world is getting up.",
                        "selectChance": 60
                    }
                ],
                "name": "Museum Level 1",
                "rmg": {
                    "zoneLimit": 3333,
                    "value": 500,
                    "rarity": 80
                },
                "templates": {
                    "138F": {
                        "animation": "test/objects/someMuseum/138F",
                        "visitableFrom": 
                            "---",
                            "+++",
                            "+++"
                        ],
                        "mask": 
                            "VVVVVV",
                            "BBBBBV",
                            "BBBBBB",
                            "VABBVV"
                        ],
                        "allowedTerrains": 
                            "grass",
                            "rough",
                            "dirt"
                        ]
                    }
                }
            }
        }
    }
}

You have same dice range 25-30 on all rewards - this means that you have 5% chance to get all rewards, and 95% to get nothing.

Hmm, IMO the range should be just set as absolute value and their total should be calculated by engine - not neccessarily sum up to 100%.

What dice should i set to get minimum 25% chance?

If you want 4 rewards with 25% probability each (only 1 reward at time), set “dice”: 1 for all and min-max to 0-25, 26-50 etc.
Or you may set different “dice” and identical chance 0-25, then you get 25% chance for each reward independently.

I didn`t say anything about sum

Yes, but currently user is asked to calculate incremental sum on his own. So if you decide to change one value, you need to change another accordingly.

Thanks for explanation. This idea requires think over more. One question is how to define “empty” reward: explicitly for each dice? Or leave sum hardcoded to 100 and only change range to probability.