Json configuration for spells

I played some time with current state of spells modding system (and will play it some time today).
I used Warmonger spells mod as base (but it didn’t work properly until i added

			"targetModifier":
			{
				"smart": true	//true: friendly/hostile based on positiveness; false: all targets
			}

to every level block. Cursor in battle didn’t allow to choose creatures to use spells on them without this addings).

As i understand now, user can only use “anim”: so far. And cannot yet use own spell animations. Is this right?

PS When i set “anim” : -1, game crashed on spell with “anim”:-1. So i had to replace -1 by id of some standard spells.

Is work is planned on adding custom summon creatures in distant future? It can use existing SUMMON_EARTH_ELEMENTAL/SUMMON_WATER_ELEMENTAL (for double wide creatures) mechanics. Because we don’t want now to allow filling battle screen with a lot of stacks:-)

Most likely there is a bug. It should work w|o smart targeting but work different. And yes, “smart”: true is now required in almost all cases (non smart spells are Armageddon, Death ripple and may be no more yet).

Some information on future plans is here wiki.vcmi.eu/index.php?title=Use … t_Version2

Custom animation is planned but there no even drafts for it.

1 Like

Thanks for answer.

I have another question.
For timed spells there is “duration” : “N_TURNS” attribute.
If i set it, it’s something about 12 turns until spell is dispelled.
Can this duration be customized in future (to exactly write how many turns spell must work)?

“duration” : “N_TURNS” mean “duration = SpellPower” (with few exceptions). This is original mechanics and should not be altered. If you want smth else, I need detailed feature request to continue discussion.

Oh, i forgot about duration=spell power, sorry…
Maybe later, but now it’s ok with it.

I just found, that animations for spells are listed in battles_graphics.json
So custom spell animations can be used through this file (and number in “anims”). Will try this out.

So place all your new spells animations in root of /Sprites/ directory of your mod.
In their names must not be spaces (change them to “_”).
There must be no subdirectories.

Then you go to battles_graphics.json
and in section "ac_mapping"
add indexed DEFs for your new spells

	"ac_mapping": 
		{ "id": 0, "defnames":  "C10SPW.DEF" ] },
		{ "id": 1, "defnames":  "C03SPA0.DEF" ] },
		{ "id": 2, "defnames":  "C01SPA0.DEF" ] },

....
		{ "id": 82, "defnames":  "C09SPF3.DEF" ] },
		{ "id": 84, "defnames":  "ZMGC02.DEF" ] },

{ "id": 259, "defnames":  "Some_Ench2.def" ] },
{ "id": 260, "defnames":  "Some_missile.def" ] },
{ "id": 261, "defnames":  "Soul_Burn.def" ] },
{ "id": 262, "defnames":  "Sprite_Attack.def" ] },
{ "id": 263, "defnames":  "Sprite_Missile.def" ] }

	]

Then use in your spells configuration “anim” : 261 to use “Sprite_Attack.def” DEF

I have a question. I wanted to make resurrection spell for mechanisms/non-living.
But when I select it in book, VCMI tells me there is no creatures affected by this spell:

{
	"repair":
	{
		"type": "combat", 
		"name": "Repair",
		"school":
		{
			"air": false,
			"earth": true,
			"fire": false,
			"water": false
		},
		"level": 4,
		"power": 30,
		"defaultGainChance": 3, 
		"gainChance":
		{
			"tower": 5
		},
 
		//forgetfulness animation?
		"anim": 227,
 
		"flags" : {"positive": true,"rising":true},
		
		"immunity":{"UNDEAD":true,"NON_LIVING":false},
 
		//flags structure of bonus names,any one of these bonus grants immunity
		"limit":
		{
			"NON_LIVING" : true,
			"SIEGE_WEAPON" : true
		},
 
		//graphics - OPTIONAL; object;
		"graphics":
		{
			"iconBook": "repair/back0.bmp",
			"iconScroll": "repair/back1.bmp",
			"iconScenarioBonus": "repair/back2.bmp",
			"iconEffect": "repair/back3.bmp"
		},

//		"sounds":
//		{
//			"cast":"FORGET"
//		},
		"targetType" : "CREATURE",//_EXPERT_MASSIVE",
 
		"levels":
		{
			"none":
			{
				"description": "Repairs mechanisms, non-living creatures and siege weapons.",
	 
				"cost": 35,
				"power": 25,
				"aiValue": 17,
				"range": "0",
				"targetModifier":{"smart":true},
				"effects":
				{
					"heal":
					{
						"type": "HEALER"
					}
				}
			},
			"basic":
			{
				"description": "Repairs mechanisms, non-living creatures and siege weapons.",
	 
				"cost": 35,
				"power": 27,
				"aiValue": 17,
				"range": "0",
				"targetModifier":{"smart":true},			
								"effects":
				{
					"heal":
					{
						"type": "HEALER"
					}
				}
				},
			"advanced":
			{
				"description": "Repairs mechanisms, non-living creatures and siege weapons.",
	 
				"cost": 35,
				"power": 30,
				"aiValue": 18,
				"range": "0",
				"targetModifier":{"smart":true},
								"effects":
				{
					"heal":
					{
						"type": "HEALER"
					}
				}
			},
			"expert":
			{
				"description": "Repairs mechanisms, non-living creatures and siege weapons.",
	 
				"cost": 35,
				"power": 32,
				"aiValue": 19,
				"range": "0",
				"targetModifier":{"smart":true},
								"effects":
				{
					"heal":
					{
						"type": "HEALER"
					}
				}
			}
		}
	}
 
}

Looks like bug (I think VCMI sees there is no living creatures hurted and ignores NON_LIVING creatures hurted.

1 Like

Another question.
I tried to make spell (offensive), that makes damage and puts creature under other spell (disruptingRay).

I put in

[code]“effects”: {

              "spell":
                {
                    "type": "ENCHANTED",

“subtype”:“spell.disruptingRay”,
“duration”:“N_TURNS”
}
}

But this is not working, when enemy creature takes turn, there is exception throwed out.
Same goes for SPELL_AFTER_ATTACK (didn’t try SPELL_BEFORE_ATTACK).
These bonuses aren’t supported? Or there is another way to put creature under other spell?

This is completely wrong. To add another spell effects U should copy effects. And damage+effect spells are untested, but should work.

OK, i just copy

	"effects" : {
"primarySkill" : {
"val" : -3,
"type" : "PRIMARY_SKILL",
"subtype" : "primSkill.defence",
"valueType" : "ADDITIVE_VALUE",
"duration" : "N_TURNS"
}

and it will work.

[code] And damage+effect spells are untested, but should work.
i tried damage + primary skill reduction, and it worked fine.
Will test spells more today evening.
Compex spells is a good idea realized, thank you very much for your hard work.

And what about Repair spell for resurrecting non-living?
Resurrection has no effects described, as my Repair don’t work:

Or is rising spells not made yet?
And what about DAEMON_SUMMONING feature? If i try it to use as effect in spell, will it work on enemy corpses?

Rising mechanics is hardcoded.

By the way, I found thing seems like a bug.
I have a mod where “depends” is set to “new_spells.mod”.
I forgot to make spells mod enabled, and VCMI is stalled on starting, saying nothing that some mod is missing.
Looks like a bug.

Looks like spells from other spells are working, but only by id. If I use id, than battle is not
freezing. seems like json parser doesn’t parse spells by name to spells by id:

			"advanced":
			{
				"description": "Gives to shooters ability to shoot by explosive shells.",
	 
				"cost": 13,
				"power": 10,
				"aiValue": 9,
				"range": "0",
	
				"targetModifier":{"smart":true},
	 
				"effects":
				{
					"speed":
					{
						"type": "SPELL_LIKE_ATTACK",
						"subtype":21,
						"val":3,
						"duration": "N_TURNS"
					}
				}
			},

I wanted to ask.
Is 0.96 spell modding is the same as of 05.27.2014 version?
Or there were some improvements?
Like adventure spells or summon spells still not work?
PS By adventure spells i mean buff something like spell giving LAND_MOVEMENT bonus until end of turn to hero.

No changes yet.

Will upload updated mod with new spells to Launcher when it’s ready.

I wanted to make “spell” that will give army +1 morale (in 0.97b)

{
	"battleHymnChampions":
	{
		"type": "combat", 
		"name": "Champions March",
		"school":
		{
			"air": false,
			"earth": false,
			"fire": false,
			"water": false
		},
		"level": 1,
		"power": 10,
		
		"defaultGainChance": 3, 
		"gainChance":
		{
			"castle": 7
		},
 
"immunity":{"MIND_IMMUNITY":true},
		"absoluteImmunity":{"NON_LIVING":true,"UNDEAD":true},
 
		"flags" : {"positive": true,"offensive":false,"damage":false},
 		"animation":{
			"affect":"Battle Hymns/Champions/Coin_with_sword.def"]
		},
		//graphics - OPTIONAL; object;
		"graphics":
		{
			"iconBook": "Battle Hymns/Champions/back0.bmp",
			"iconScroll": "Battle Hymns/Champions/back1.bmp",
			"iconScenarioBonus": "Battle Hymns/Champions/back2.bmp",
			"iconEffect": "Battle Hymns/Champions/back3.bmp"
		},
		"sounds":
		{
			//OPTIONAL; resourse path, casting sound
			"cast":"Battle Hymns/Champions/Win"
		},
		
		"targetType": "CREATURE",
 
		"levels":
		{
			"none":
			{
				"description": "Champion March increases army morale by +1.",
	 
				"cost": 2,
				"power": 10,
				"aiValue": 5,
				"range": "X",
	
				//"targetModifier":{"smart":true},
	 
				"effects":
				{
					"attacks":
					{
						"type": "MORALE",
						"val": 1,
				//		"duration": "N_TURNS",
				"propagator":"HERO"
					}
				}
			},
			"basic":
			{
				"description": "Champion March increases army morale by +1.",
	 
				"cost": 2,
				"power": 10,
				"aiValue": 5,
				"range": "X",
	
			//	"targetModifier":{"smart":true},
	 
				"effects":
				{
					"attacks":
					{
						"type": "MORALE",
						"val": 1,
			//			"duration": "N_TURNS"
					"propagator":"HERO"
					}
				}
			},
			"advanced":
			{
				"description": "Champion March increases army morale by +1.",
	 
				"cost": 2,
				"power": 10,
				"aiValue": 5,
				"range": "X",
	
			//	"targetModifier":{"smart":true},
	 
				"effects":
				{
					"attacks":
					{
						"type": "MORALE",
						"val":2,
			//			"duration": "N_TURNS"
					"propagator":"HERO"
					}
				}
			},
			"expert":
			{
				"description": "Champion March increases army morale by +1.",
	 
				"cost": 2,
				"power": 10,
				"aiValue": 5,
				"range": "X",
	
			//	"targetModifier":{"smart":true},
	 
				"effects":
				{
					"attacks":
					{
						"type": "MORALE",
						"val":3,
			//			"duration": "N_TURNS"
					"propagator":"HERO"
					}
				}
			},
		}
	}
 
}

This code didn’t work at all until I added “propagator”:“HERO”.
That’s strange, because creatures have reaction on bonus “Morale”.

But the way, we have section “school”

Is there no “mind” magic?
And this is not very good for future modding (where modding of secondary skills will be added).
I suggest change “air”,“earth”,“fire”,“water” magic schools IDs to secondary skill IDs.
Like

		"school":
		{
			"airMagic": false,
			"earthMagic": false,
			"fireMagic": false,
			"waterMagic": false
		},

For example, I want to make spell, that will require “artillery” skill. Then I will write
“artillery”:true, and levels of spell will depend on level of Artillery skill

PPS There is no duration “ONE_TURN”, duration is calculated from spell power. I wanted to make battle hymns spells work only 1 turn… :mrgreen:

  1. custom duration will be allowed only for scripted spells.
  2. Spell should have at least one school and custom schools are not planned at all yet
  3. need complete mod to try to fix “didn’t work at all until …”
  1. OK, I’ll say it for future. I just throught that set of durations isn’t complete:
PERMANENT 
## ONE_BATTLE //at the end of battle 
## ONE_DAY //at the end of day 
## ONE_WEEK //at the end of week (bonus lasts till the end of week, thats NOT 7 days 
## N_TURNS //used during battles, after battle bonus is always removed 
## N_DAYS 
## UNITL_BEING_ATTACKED //removed after attack and counterattacks are performed 
## UNTIL_ATTACK //removed after attack and counterattacks are performed 
## STACK_GETS_TURN //removed when stack gets its turn - used for defensive stance 
## COMMANDER_KILLED 
  1. It works without selecting any school. But there is a bug during spell book drawing of icons:-)
  2. Will create mod with this spell and send to you.

Thats why Ive said “should” :wink: