Code for Ressurection Spell

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
Xanathar
Posts: 629
Joined: Sun Apr 15, 2012 10:19 am
Location: Torino, Italy
Contact:

Re: Code for Ressurection Spell

Post 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.
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com

The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563

My preciousss: http://www.moonsharp.org
User avatar
msyblade
Posts: 792
Joined: Fri Oct 12, 2012 4:40 am
Location: New Mexico, USA
Contact:

Re: Code for Ressurection Spell

Post 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?
Currently conspiring with many modders on the "Legends of the Northern Realms"project.

"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: Code for Ressurection Spell

Post by Batty »

....
Last edited by Batty on Mon Jan 23, 2017 10:22 pm, edited 1 time in total.
User avatar
Xanathar
Posts: 629
Joined: Sun Apr 15, 2012 10:19 am
Location: Torino, Italy
Contact:

Re: Code for Ressurection Spell

Post 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
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com

The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563

My preciousss: http://www.moonsharp.org
User avatar
LordGarth
Posts: 500
Joined: Mon Jun 18, 2012 5:07 pm
Location: Colorado USA

Re: Code for Ressurection Spell

Post 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

}
Dungeon Master and DOOM will live forever.
User avatar
Grimwold
Posts: 511
Joined: Thu Sep 13, 2012 11:45 pm
Location: A Dungeon somewhere in the UK

Re: Code for Ressurection Spell

Post by Grimwold »

Xanathar's version looks great. sorry I wasn't around to help this time... but seems like it's all sorted.
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: Code for Ressurection Spell

Post 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
User avatar
JohnWordsworth
Posts: 1397
Joined: Fri Sep 14, 2012 4:19 pm
Location: Devon, United Kingdom
Contact:

Re: Code for Ressurection Spell

Post 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?
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: Code for Ressurection Spell

Post 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)
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: Code for Ressurection Spell

Post 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 ;)
Post Reply