Page 2 of 2

Re: a script to trigger when a rune is cast

Posted: Thu Nov 13, 2014 4:29 pm
by Karinas23
Created 4 versions of the spell and they all work great. Though i guess the way these are defined the spell will only work on the 1 tile and nowhere else since theyre reliant on the tiles ID ?
SpoilerShow
defineSpell{
name = "karinafire_spell",
uiName = "Dispell Fire Seal",
requirements = {"fire_magic", 5},
gesture = 521,
manaCost = 5,
icon = 0,
spellIcon = 0,
description = "A spell to open doors sealed with a Fire Element Seal",
onCast = function(champion, x, y, direction, elevation, skillLevel)
customSpellScript.script.karinaSpellCast1(champion, x, y, direction, elevation, skillLevel)
end,
}

defineSpell{
name = "karinaair_spell",
uiName = "Dispell Air Seal",
requirements = {"air_magic", 5},
gesture = 563,
manaCost = 5,
icon = 0,
spellIcon = 0,
description = "A spell to open doors sealed with an Air Element Seal",
onCast = function(champion, x, y, direction, elevation, skillLevel)
customSpellScript.script.karinaSpellCast2(champion, x, y, direction, elevation, skillLevel)
end,
}

defineSpell{
name = "karinas_spell",
uiName = "Dispell Water Seal",
requirements = {"water_magic", 5},
gesture = 589,
manaCost = 5,
icon = 0,
spellIcon = 0,
description = "A spell to open doors sealed with a Water Element Seal",
onCast = function(champion, x, y, direction, elevation, skillLevel)
customSpellScript.script.karinaSpellCast3(champion, x, y, direction, elevation, skillLevel)
end,
}

defineSpell{
name = "karinas_spell",
uiName = "Dispell Earth Seal",
requirements = {"earth_magic", 5},
gesture = 547,
manaCost = 5,
icon = 0,
spellIcon = 0,
description = "A spell to open doors sealed with an Earth Element Seal",
onCast = function(champion, x, y, direction, elevation, skillLevel)
customSpellScript.script.karinaSpellCast4(champion, x, y, direction, elevation, skillLevel)
end,
}

Re: a script to trigger when a rune is cast

Posted: Thu Nov 13, 2014 5:16 pm
by Prozail
It depends on how you want to design things. The following spelldefinition will open any door that has the Word "fireseal" in it's ID like "door_wooden_fireseal_1" when the party is standing in front of it.

Code: Select all


defineSpell{
	name = "dispel_fire_seal",
	uiName = "Dispell Fire Seal",
	requirements = {"concentration", 1},
	gesture = 521,
	manaCost = 5,
	icon = 0,
	spellIcon = 0,
	description = "A spell to open doors sealed with a Fire Element Seal.",
	onCast = function(champion, x, y, direction, elevation, skillLevel)
		local dx,dy = getForward(direction)
		for i in party.map:entitiesAt(x+dx, y+dy) do
				if i.id:match("fireseal") then
					if i.door and i.door:isClosed() then
						i.door:open()
						playSound("level_up")
						return
					end
				end
		end
		--no door found?? check our own square.. (doors are between squares.)
		for i in party.map:entitiesAt(x, y) do
			if i.id:match("fireseal") then
				if i.door and i.door:isClosed() then
					i.door:open()
					playSound("level_up")
					return
				end
			end
		end
	end,
}

Edit: Fixed a slight bug.

Re: a script to trigger when a rune is cast

Posted: Thu Nov 13, 2014 5:35 pm
by akroma222
Ahh nice work Prozail, that is a much more versatile version!!

Re: a script to trigger when a rune is cast

Posted: Thu Nov 13, 2014 7:12 pm
by Karinas23
Thats much more efficient and doesnt require the ingame script either thank you very much