mana spells
mana spells
Hi everyone,
does anyone knows how to script a spells who gives energy to one character or the party?
does anyone knows how to script a spells who gives energy to one character or the party?
-
Ryeath_Greystalk
- Posts: 366
- Joined: Tue Jan 15, 2013 3:26 am
- Location: Oregon
Re: mana spells
You can use the modifyStat function to do that
party:getChampion(1):modifyStat("energy", 20) would add 20 energy to the character in slot 1.
I used this feature quite a bit in my mod as part of the setting and reviving from the unconscious stat but with the health stat. I would use the getStatMax for health, calculate a percentage of that, set the characters health to that amount using the modifyStat and then disable the character to make them unconscious and when I enabled them again they had the exact percentage of health I wanted them to revive with.
-- edit: Just re read your post and you said spell, not script. Ignore all that stuff I said.
party:getChampion(1):modifyStat("energy", 20) would add 20 energy to the character in slot 1.
I used this feature quite a bit in my mod as part of the setting and reviving from the unconscious stat but with the health stat. I would use the getStatMax for health, calculate a percentage of that, set the characters health to that amount using the modifyStat and then disable the character to make them unconscious and when I enabled them again they had the exact percentage of health I wanted them to revive with.
-- edit: Just re read your post and you said spell, not script. Ignore all that stuff I said.
- Dr.Disaster
- Posts: 2876
- Joined: Wed Aug 15, 2012 11:48 am
Re: mana spells
With spell being basically defined by scripts you have been on the right track. Komag has something similar in Master Quest (a spell to cast healing on all characters) so it should be pretty similar.Ryeath_Greystalk wrote:-- edit: Just re read your post and you said spell, not script. Ignore all that stuff I said.
Re: mana spells
This spell will give energy to the party
defineSpell{
name = "manacharge",
uiName = "Mana Charge",
skill = "spellcraft",
level = 16,
runes = "ACGI",
manaCost = 90,
onCast = function(caster, x, y, direction, skill)
local heal_amount = math.random(300,350)/1+skill
for i=1,4 do
party:getChampion(i):modifyStat("energy", heal_amount)
end
playSound("energy")
party:playScreenEffect("teleport_screen")
hudPrint(caster:getName() .. " Charged the party by " .. heal_amount .. " points")
end,
}
You can change the skill and level and manacost also the playsound to what you need it to be.
LordGarth
defineSpell{
name = "manacharge",
uiName = "Mana Charge",
skill = "spellcraft",
level = 16,
runes = "ACGI",
manaCost = 90,
onCast = function(caster, x, y, direction, skill)
local heal_amount = math.random(300,350)/1+skill
for i=1,4 do
party:getChampion(i):modifyStat("energy", heal_amount)
end
playSound("energy")
party:playScreenEffect("teleport_screen")
hudPrint(caster:getName() .. " Charged the party by " .. heal_amount .. " points")
end,
}
You can change the skill and level and manacost also the playsound to what you need it to be.
LordGarth
Dungeon Master and DOOM will live forever.
Re: mana spells
thanks all for the reply
I have already a healing spells, but I didnt know the command lines for energy to modify it.
me <- trying the spells
I have already a healing spells, but I didnt know the command lines for energy to modify it.
me <- trying the spells
Re: mana spells
works great, thanks!
is is possible that the caster didnt gain energy?
actually that looks like a unlimited amount of energy, as the caster is "charged" too
is is possible that the caster didnt gain energy?
actually that looks like a unlimited amount of energy, as the caster is "charged" too
Re: mana spells
You can vary the mana cost and the energy gained. The 300 and 350 is what can be altered to change the amount of energy gained.
LordGarth
LordGarth
Dungeon Master and DOOM will live forever.
Re: mana spells
I think it will be ok
I have try it at low level character, and all energy of the party was restored, but a a higher level it is not the same.
or maybe I will do what you do, lower the total amount of energy.
thanks for the help!
I have try it at low level character, and all energy of the party was restored, but a a higher level it is not the same.
or maybe I will do what you do, lower the total amount of energy.
thanks for the help!
- JohnWordsworth
- Posts: 1397
- Joined: Fri Sep 14, 2012 4:19 pm
- Location: Devon, United Kingdom
- Contact:
Re: mana spells
I think for this kind of spell to work game-mechanics wise, you should aim to have the caster expend 30 Mana and then the other 3 party members each gain 10 Mana. Ie. It's "Mana Neutral". Maybe you could go a little higher (Cost 30, gives back 15 to the other party members), but if it's too high - then it's easy for a couple of mages just to keep casting the spell to have infinite mana.
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
Re: mana spells
In my game it is needed because the spells cost so much and there is alot of hard combat. Especially in my sequel the monsters are very difficult and there is alot of them.
Lots of scary new ones.
LordGarth
Lots of scary new ones.
LordGarth
Dungeon Master and DOOM will live forever.