Help with mods - questions


#1

Hi,

I try to make an artifact that allows the hero to make more experience, lets say 15% as in the example below. As I understand, EXP_MULTIPLIER is the right bonus type to choose. I add the folowing code:

		"bonuses":
		
			{
				"type": "EXP_MULTIPLIER",
				"val" : 15,
				"valueType": "PERCENT_TO_BASE"
			}
		]

While starting, VCMI detects the mod as correct, but when I get the artifact and fight lets say 100 peasants, I still get 100 exp points instead of 115. Am I doing something wrong?


Modding suggestions
Modding suggestions
#2

Try SECONDARY_SKILL_PREMY with learning for hero.

From CGHeroInstance.cpp:

TExpType CGHeroInstance::calculateXp(TExpType exp) const
{
	return exp * (100 + valOfBonuses(Bonus::SECONDARY_SKILL_PREMY, SecondarySkill::LEARNING))/100.0;
}

#3

EXP_MULTIPLIER
##val - percent of additional exp gained by stack / commander (base value 100)

This is bonus not for hero.

By the way, I made artefact with bonus

{
"type":"PRIMARY_SKILL",
"subtype":3,
"val":100,
"valueType":"PERCENT_TO_BASE"

}

and it’s not working. Where I have mistaken?


#4

Yep, that was my initial idea, but I wanted to make an artifact that is universal (does not require hero to have learning). That is why I am asking for this.

Does even funcionality like this exist?


#5

That’s why I provided code sample. It does not check for secondary skill presence, just total bonus value.


#6

Ok, now I undestand, thanks :slight_smile:


#7

Is there a way to make an artifact that turns ‘living’ creatures into ‘undead’ (with the exception of non-living; like golems etc.)? AFAIK there is no limiter on living creatures, I can’t come up with any workaround as well…

		"bonuses":
		
			{
				"type" : "UNDEAD",
				"limiters" :
				
					{
						"type": "HAS_ANOTHER_BONUS_LIMITER",
						"parameters" : "???????"]
					}
				]
			}

#8

There is no LIVING bonus and it may be good idea to add it (Ive seen a comment somewhere in codebase about presence such bonus in WoGs creature exp mechanics).


#9

I mentioned it over half a year ago on the bugtracker right here in the comments, but WARMONGER said it would cause problems… though thinking of it now I would disagree :slight_smile:


#10

BTW. I am also looking for a way to disable ‘UNDEAD’ ability (by an artifact), but nothing seems to work. I tried:

		"bonuses":
		
			{
				"type" : "UNDEAD",
				"val" : null
			}
		]

and

		"bonuses":
		
			{
				"type" : "UNDEAD": null
			}
		]

but both of them do the opposite (make all creatures UNDEAD) - probably null is ignored (?), but at VCMI initialization the mod is not labeled as incorrect… If there was an ‘IS_LIVING’ ability, then I would do it by setting type to ‘IS_LIVING’ and limiting it to ‘UNDEAD’ creatures :stuck_out_tongue:


#11

I didn’t try such thing.
Don’t think it’s possible to remove current bonus ability “UNDEAD” in artefacts.


#12

This is other problem :slight_smile: There is no way to revoke bonus. Also ““type” : “UNDEAD”: null” is syntactically incorrect, no error in log = bug in json parser


#13

Well, I quietly hope you guys add those funcionalities to VCMI :slight_smile:


#14

Oh no, there will be need to manually correct all these jsons of creatures:-) What a pain! :imp:
All creatures by default are “LIVING”. I think there will be mess, if there will be creatures with both LIVING and UNDEAD bonuses.
Maybe it’s better to add bonuses that related to LIVING nature?
Like “AFFECTED_BY_MORALE”,“AFFECTED_BY_LUCK”,“AFFECTED_BY_HEALING”? Is this are all living creatures bonuses?


#15

Or another way i suggested long time ago.
We have DRAGON_NATURE, UNDEAD, NON_LIVING types of bonuses served as limiters.
I suggested adding customized type of limiters.
Like i will add something like

"limiters":{"types": {

"DEMON" :  {        
        {
             "abilities":
                  {
                      "fireImmunity":{"type":"FIRE_IMMUNITY",
                     "lessDamageFromSpellFireball":{   
                        "type":"MORE_DAMAGE_FROM_SPELL",
                       "val":-50,
                       "subtype":"spell.fireball"
                     }
}

                }
         }

    }

}

and if in creature json we see “type”:“DEMON”, VCMI will automatically assign this set of abilities to it.
Same can go for “LIVING” creature. Add list of abilities incorporated, and then

"abilityToBeLiving":{"type":"LIVING","limiter":"UNDEAD"}

#16

I think you don’t understand what “Limiter” is in first place. Limiter, as the name suggests, limits propagation of boonuses over bonus system tree to some specific cases. It defines no additional behavior for anything.


#17

Im afraid U dont understand what Limiter is.
What U suggest should be called Bonus (of Ability) Preset. However, I like the idea and will implement it in next version of “BonusType config”.


#18

Maybe it’s so. It’s more about template for creature abilities in my post.
For example, user may want to add custom limiter “IS_DEMON”. Then he describes “DEMON” template of abilities.


#19

Want to brag.
Made VCMI to change appearances for Castle Town depending on terrains (forum.acidcave.net/topic.php?TID=2393, Sower work).
It is easy, you must only not forget to replace original templates (village,fort,citadel,castle,capitol) by new only grass templates.

{
	"core:castle" : {
		"town" : {
			"mapObject" : {
				"filters" : {
					"village_dirt": "noneOf",  "fort" ]  ],
					"fort_dirt" :  "allOf",  "fort" ],  "noneOf",  "citadel" ] ] ],
					"citadel_dirt" :  "allOf",  "citadel" ],  "noneOf",  "castle" ] ] ],
					"castle_dirt" :  "allOf",  "castle" ],  "noneOf",  "capitol" ] ] ],
					"capitol_dirt" :  "allOf",  "castle"  ],  "capitol"  ] ],
					
					
					"village": "noneOf",  "fort" ]  ],
					"fort" :  "allOf",  "fort" ],  "noneOf",  "citadel" ] ] ],
					"citadel" :  "allOf",  "citadel" ],  "noneOf",  "castle" ] ] ],
					"castle" :  "allOf",  "castle" ],  "noneOf",  "capitol" ] ] ],
					"capitol" :  "allOf",  "castle"  ],  "capitol"  ] ],
					
					"village_lava": "noneOf",  "fort" ]  ],
					"fort_lava" :  "allOf",  "fort" ],  "noneOf",  "citadel" ] ] ],
					"citadel_lava" :  "allOf",  "citadel" ],  "noneOf",  "castle" ] ] ],
					"castle_lava" :  "allOf",  "castle" ],  "noneOf",  "capitol" ] ] ],
					"capitol_lava" :  "allOf",  "castle"  ],  "capitol"  ] ],
					
					"village_rough": "noneOf",  "fort" ]  ],
					"fort_rough" :  "allOf",  "fort" ],  "noneOf",  "citadel" ] ] ],
					"citadel_rough" :  "allOf",  "citadel" ],  "noneOf",  "castle" ] ] ],
					"castle_rough" :  "allOf",  "castle" ],  "noneOf",  "capitol" ] ] ],
					"capitol_rough" :  "allOf",  "castle"  ],  "capitol"  ] ],
					
					"village_sand": "noneOf",  "fort" ]  ],
					"fort_sand" :  "allOf",  "fort" ],  "noneOf",  "citadel" ] ] ],
					"citadel_sand" :  "allOf",  "citadel" ],  "noneOf",  "castle" ] ] ],
					"castle_sand" :  "allOf",  "castle" ],  "noneOf",  "capitol" ] ] ],					
					"capitol_sand" :  "allOf",  "castle"  ],  "capitol"  ] ],
					
					"village_snow": "noneOf",  "fort" ]  ],
					"fort_snow" :  "allOf",  "fort" ],  "noneOf",  "citadel" ] ] ],
					"citadel_snow" :  "allOf",  "citadel" ],  "noneOf",  "castle" ] ] ],
					"castle_snow" :  "allOf",  "castle" ],  "noneOf",  "capitol" ] ] ],		
					"capitol_snow" :  "allOf",  "castle"  ],  "capitol"  ] ],
					
					"village_subterra": "noneOf",  "fort" ]  ],
					"fort_subterra" :  "allOf",  "fort" ],  "noneOf",  "citadel" ] ] ],
					"citadel_subterra" :  "allOf",  "citadel" ],  "noneOf",  "castle" ] ] ],
					"castle_subterra" :  "allOf",  "castle" ],  "noneOf",  "capitol" ] ] ],	
					"capitol_subterra" :  "allOf",  "castle"  ],  "capitol"  ] ],
					
					"village_swamp": "noneOf",  "fort" ]  ],
					"fort_swamp" :  "allOf",  "fort" ],  "noneOf",  "citadel" ] ] ],
					"citadel_swamp" :  "allOf",  "citadel" ],  "noneOf",  "castle" ] ] ],
					"castle_swamp" :  "allOf",  "castle" ],  "noneOf",  "capitol" ] ] ],						
					"capitol_swamp" :  "allOf",  "castle"  ],  "capitol"  ] ],
					},
				"templates" : {
					"village_dirt": {"allowedTerrains":"dirt"], "animation" : "newlook_castle/CastleDirtHall.def"},
					"fort_dirt" : {"allowedTerrains":"dirt"], "animation" : "newlook_castle/CastleDirtCastle1.def"},
					"citadel_dirt" : {"allowedTerrains":"dirt"], "animation" : "newlook_castle/CastleDirtCastle2.def"},
					"castle_dirt" : {"allowedTerrains":"dirt"], "animation" : "newlook_castle/CastleDirtCastle3.def"},
					"capitol_dirt" : {"allowedTerrains":"dirt"], "animation" : "newlook_castle/CastleDirtCastle3F.def"},

					"village": {"allowedTerrains":"grass"], "animation" : "newlook_castle/CastleGrassHall.def"},
					"fort" : {"allowedTerrains":"grass"], "animation" : "newlook_castle/CastleGrassCastle1.def"},
					"citadel" : {"allowedTerrains":"grass"], "animation" : "newlook_castle/CastleGrassCastle2.def"},
					"castle" : {"allowedTerrains":"grass"], "animation" : "newlook_castle/CastleGrassCastle3.def"},
					"capitol" : {"allowedTerrains":"grass"], "animation" : "newlook_castle/CastleGrassCastle3F.def"},

					"village_lava": {"allowedTerrains":"lava"], "animation" : "newlook_castle/CastleLavaHall.def"},
					"fort_lava" : {"allowedTerrains":"lava"], "animation" : "newlook_castle/CastleLavaCastle1.def"},
					"citadel_lava" : {"allowedTerrains":"lava"], "animation" : "newlook_castle/CastleLavaCastle2.def"},
					"castle_lava" : {"allowedTerrains":"lava"], "animation" : "newlook_castle/CastleLavaCastle3.def"},
					"capitol_lava" : {"allowedTerrains":"lava"], "animation" : "newlook_castle/CastleLavaCastle3F.def"},

					"village_rough": {"allowedTerrains":"rough"], "animation" : "newlook_castle/CastleRoughHall.def"},
					"fort_rough" : {"allowedTerrains":"rough"], "animation" : "newlook_castle/CastleRoughCastle1.def"},
					"citadel_rough" : {"allowedTerrains":"rough"], "animation" : "newlook_castle/CastleRoughCastle2.def"},
					"castle_rough" : {"allowedTerrains":"rough"], "animation" : "newlook_castle/CastleRoughCastle3.def"},
					"capitol_rough" : {"allowedTerrains":"rough"], "animation" : "newlook_castle/CastleRoughCastle3F.def"},

					"village_sand": {"allowedTerrains":"sand"], "animation" : "newlook_castle/CastleSandHall.def"},
					"fort_sand" : {"allowedTerrains":"sand"], "animation" : "newlook_castle/CastleSandCastle1.def"},
					"citadel_sand" : {"allowedTerrains":"sand"], "animation" : "newlook_castle/CastleSandCastle2.def"},
					"castle_sand" : {"allowedTerrains":"sand"], "animation" : "newlook_castle/CastleSandCastle3.def"},
					"capitol_sand" : {"allowedTerrains":"sand"], "animation" : "newlook_castle/CastleSandCastle3F.def"},

					"village_snow": {"allowedTerrains":"snow"], "animation" : "newlook_castle/CastleSnowHall.def"},
					"fort_snow" : {"allowedTerrains":"snow"], "animation" : "newlook_castle/CastleSnowCastle1.def"},
					"citadel_snow" : {"allowedTerrains":"snow"], "animation" : "newlook_castle/CastleSnowCastle2.def"},
					"castle_snow" : {"allowedTerrains":"snow"], "animation" : "newlook_castle/CastleSnowCastle3.def"},
					"capitol_snow" : {"allowedTerrains":"snow"], "animation" : "newlook_castle/CastleSnowCastle3F.def"},

					"village_swamp": {"allowedTerrains":"swamp"], "animation" : "newlook_castle/CastleSwampHall.def"},
					"fort_swamp" : {"allowedTerrains":"swamp"], "animation" : "newlook_castle/CastleSwampCastle1.def"},
					"citadel_swamp" : {"allowedTerrains":"swamp"], "animation" : "newlook_castle/CastleSwampCastle2.def"},
					"castle_swamp" : {"allowedTerrains":"swamp"], "animation" : "newlook_castle/CastleSwampCastle3.def"},
					"capitol_swamp" : {"allowedTerrains":"swamp"], "animation" : "newlook_castle/CastleSwampCastle3F.def"},

					"village_subterra": {"allowedTerrains":"subterra"], "animation" : "newlook_castle/CastleSubterraHall.def"},
					"fort_subterra" : {"allowedTerrains":"subterra"], "animation" : "newlook_castle/CastleSubterraCastle1.def"},
					"citadel_subterra" : {"allowedTerrains":"subterra"], "animation" : "newlook_castle/CastleSubterraCastle2.def"},
					"castle_subterra" : {"allowedTerrains":"subterra"], "animation" : "newlook_castle/CastleSubterraCastle3.def"},
					"capitol_subterra" : {"allowedTerrains":"subterra"], "animation" : "newlook_castle/CastleSubterraCastle3F.def"},					
				}
			}
		}
	}
}

Some color disruption of castle looks is some bug in VCMI (common to HOTA mod - they used system colors for graphics)



#20

Hello everyone.

I tried to make an ability that could effectively jam the spellcasting of other creatures. Problem is, it affects only the maximum casts of the stack, not its current one so it’s practically useless.

E.g. Fairy Dragon has a line displaying “Spells: 5”. After being hit with this effect it changes to “Spells: 2 (5)”. So it decreased his maximum casts and nothing else. He will still doll out all 5 of his magical beatings like nothing happened.

Here’s how it’s written:

	"jammer":
	{
	"type" : "CASTS",
	"val" : -3, 
	"valueType" : "ADDITIVE_VALUE",
	"duration" : "N_TURNS",
	},

Any suggestions?