Is it possible to add the mage's willpower to spell damage they do?
Thx,
LG
Willpower added to spell damage
Willpower added to spell damage
Dungeon Master and DOOM will live forever.
Re: Willpower added to spell damage
Hi,
In native LoG, you can add the following code:
The problem is that the fireball will be spawned one square ahead.
Now if you have my new spells framework installed (shameless plug) you can instead do :
simpler syntax and you get the fireball to launch from the party square.
In native LoG, you can add the following code:
Code: Select all
onCastSpell = function(champion, spellName)
if spellName == "fireball" then
local dx, dy = getForward(party.facing)
local willpower = caster:getStat("willpower")
spawn("fireball", party.level, party.x+dx, party.y+dy, party.facing_:setAttackPower(30+willpower)
end
end
Now if you have my new spells framework installed (shameless plug) you can instead do :
Code: Select all
onCastSpell = function(champion, spellName)
if spellName == "fireball" then
local willpower = caster:getStat("willpower")
exsp.spellCast("fireball", 30+willpower, caster:getOrdinal())
end
end
Re: Willpower added to spell damage
Is there some code I could add to the defineObject of the spell or under define spell?
LG
LG
Dungeon Master and DOOM will live forever.
Re: Willpower added to spell damage
Sure, it works too, either of the following ones.
BUT!!!!
I realized that with the normal spawn, you won't get experience points calculated correctly for the caster... while with EXSP any spell cast by the party, default or custom, will always carry the ordinal and if it damages a monster, experience will be correctly awarded.
Your post also gave me the idea to simplify my syntax for exsp.spellCast, in the next update (v1.3.2, which also supports the new grimrock 1.3.6) you'll be able to just send the caster object as in the code above and it calculates the ordinal automatically.
Code: Select all
defineSpell{
name = "fireball",
...all fireball properties...
onCast = function(caster,x,y,direction,skill)
local dx, dy = getForward(direction)
local willpower = caster:getStat("willpower")
spawn("fireball", party.level, x+dx, y+dy, direction):setAttackPower(30+willpower)
end,
}
defineSpell{
name = "fireball",
...all fireball properties...
onCast = function(caster,x,y,direction,skill)
local willpower = caster:getStat("willpower")
exsp.spellCast("fireball", caster, 30+willpower)
end,
end,
}I realized that with the normal spawn, you won't get experience points calculated correctly for the caster... while with EXSP any spell cast by the party, default or custom, will always carry the ordinal and if it damages a monster, experience will be correctly awarded.
Your post also gave me the idea to simplify my syntax for exsp.spellCast, in the next update (v1.3.2, which also supports the new grimrock 1.3.6) you'll be able to just send the caster object as in the code above and it calculates the ordinal automatically.
Last edited by Diarmuid on Thu Dec 20, 2012 7:56 pm, edited 1 time in total.
Re: Willpower added to spell damage
Under defineObject can I have attackPower = (30+willpower),
LG
LG
Dungeon Master and DOOM will live forever.
Re: Willpower added to spell damage
I haven't tried, but probably no, as these are definitions, not scripts. You'll probably get a "number expected", got something error... You can always try and tell us how it goes 