Page 2 of 3

Re: Code for Ressurection Spell

Posted: Sun Nov 25, 2012 6:59 pm
by Xanathar

Code: Select all


function raiseDead()
	local conditions = { "poison", "diseased", "paralyzed", "haste", "rage", "fire_shield", "shock_shield", "poison_shield", "frost_shield", "invisibility" }

	for i = 1, 4 do
		local c = party:getChampion(i)

		if (c:getStat("health") == 0) then
			for _, cond in ipairs(conditions) do
				c:setCondition(cond, 0)
			end 
			c:setStat("health", 1)
		end
		
	end
end
Living ones are unaffected. Dead ones are freed from all conditions (good and bad) and brought back to life at 1HP.

Re: Code for Ressurection Spell

Posted: Sun Nov 25, 2012 7:28 pm
by msyblade
Wow Xanathar! this is Perfect for an Altar. Aka "Altar of Vi". Use"Remains_of_" that you must sacrifice on the altar to recover a character. Wouldn't it be cool if we could spawn "remains_of_yourdeadcharacter" upon death, and use those on the altar?

Re: Code for Ressurection Spell

Posted: Sun Nov 25, 2012 8:14 pm
by Batty
....

Re: Code for Ressurection Spell

Posted: Sun Nov 25, 2012 8:25 pm
by Xanathar
I think we need a item:setUIName("name") function to do that. Would be a good function to ask for next time petri gets beer.
Or we cheat, and rename the champions instead :D

Re: Code for Ressurection Spell

Posted: Sun Nov 25, 2012 8:37 pm
by LordGarth
Thx a bunch. I had to change it a little

This works perfect. You will have to get your own rez sound though.

defineSpell{
name = "rez_spell",
uiName = "Ressurection",
runes = "BDEFH",
skill = "spellcraft",
level = 0,
manaCost = 10,
onCast = function(caster, x, y, direction, skill)
local conditions = { "poison", "diseased", "paralyzed", "haste", "rage", "fire_shield",

"shock_shield", "poison_shield", "frost_shield", "invisibility" }

for i = 1, 4 do
local c = party:getChampion(i)

if (c:getStat("health") == 0) then
for _, cond in ipairs(conditions) do
c:setCondition(cond, 0)
end
c:setStat("health", 1)
end
playSound("rezsound")
party:playScreenEffect("teleport_screen")
hudPrint(caster:getName() .. " Casted Ressurection")
end
end

}

Re: Code for Ressurection Spell

Posted: Sun Nov 25, 2012 8:39 pm
by Grimwold
Xanathar's version looks great. sorry I wasn't around to help this time... but seems like it's all sorted.

Re: Code for Ressurection Spell

Posted: Sun Nov 25, 2012 8:44 pm
by Batty
Xanathar wrote:
I think we need a item:setUIName("name") function to do that. Would be a good function to ask for next time petri gets beer.
Or we cheat, and rename the champions instead :D
:lol:

Code: Select all

if party:getChampion(i):getSex() == "male" then
   hudPrint("You have died. Your name is now Bob")
end
if party:getChampion(i):getSex() == "female" then
   hudPrint("You have died. Your name is now Susan")
end

Re: Code for Ressurection Spell

Posted: Sun Nov 25, 2012 10:13 pm
by JohnWordsworth
Could you make X items 'Human Remains', 'Minotaur Remains', etc and make them of type Scroll, and then set the scroll text to be "The remains of " .. champ:getName(); when you spawn them?

Re: Code for Ressurection Spell

Posted: Sun Nov 25, 2012 11:02 pm
by Batty
JohnWordsworth wrote:Could you make X items 'Human Remains', 'Minotaur Remains', etc and make them of type Scroll, and then set the scroll text to be "The remains of " .. champ:getName(); when you spawn them?
Nice! I think that's good enough for me, I might dump the dead champ's inventory on the floor too. (still want :setUIName() though)

Re: Code for Ressurection Spell

Posted: Mon Nov 26, 2012 12:42 pm
by akroma222
Nice one! Will definitely include this :)
It is hard to pass judgement on balance without knowing the context (the dungeon mod)..
If the dungeon is hard and brutal enough to need it, then go for it!
Personally I am looking forward to difficult boss battles, where reviving dead champions mid battle will be a must ;)