Healing spell code

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
User avatar
LordGarth
Posts: 500
Joined: Mon Jun 18, 2012 5:07 pm
Location: Colorado USA

Re: Healing spell code

Post by LordGarth »

Healing spell that also removes wounds and does not ressurect dead champions.



defineSpell{
name = "healingwave",
uiName = "Healing Wave",
skill = "water_magic",
requirements = { "water_magic", 5 },
icon = 71,
spellIcon = 4,
gesture = 25896,
manaCost = 80,

description = "Conjures a wave of Healing of Light that heals the party.",

onCast = function(champion, x, y, direction, elevation, skillLevel)
local dX,dY = getForward(party.facing) --Directional offsets
if party.map:isWall(party.x+dX, party.y+dY, party.elevation) then
dX,dY = 0,0 --Targets Party's cell if cast on a wall
end
--spell cast and tagged for the champion who cast it.
spawn("earthheal", party.level, party.x, party.y, party.facing, party.elevation)
local heal_amount = math.random(125,175)
hudPrint(champion:getName() .. " Healed the party by " .. heal_amount .. " points to each champion")
for i=1,4 do
local c = party.party:getChampion(i)
if (c:getBaseStat("health") > 0) then
party.party:getChampion(i):modifyBaseStat("health", heal_amount)
party.party:getChampion(i):removeCondition("head_wound")
party.party:getChampion(i):removeCondition("chest_wound")
party.party:getChampion(i):removeCondition("leg_wound")
party.party:getChampion(i):removeCondition("feet_wound")
party.party:getChampion(i):removeCondition("right_hand_wound")
party.party:getChampion(i):removeCondition("left_hand_wound")
else
party.party:getChampion(i):modifyBaseStat("health", 0)
end

playSound("heal_party")
end
end

}
Dungeon Master and DOOM will live forever.
Post Reply