Page 2 of 21
Re: New Spells >> show them off here
Posted: Thu Oct 04, 2012 12:10 pm
by Grimwold
Heal Character - lowest percentage health
(now with different Runes)
requires spellcraft level 16, costs 20 mana and heals a single character with the lowest percentage health by 2 to 4 times the level of the caster.
Code: Select all
-- Character Healing Spell
defineSpell{
name = "healing",
uiName = "Healing",
skill = "spellcraft",
level = 16,
runes = "BF",
manaCost = 20,
onCast = function(caster, x, y, direction, skill)
local heal_amount = math.random(2,4)*skill
local character_to_heal = 5
local least_health = 10000
local max_health = 10000
local percentage_health = 100
local champName = "No-one"
for j=1,4 do
if party:getChampion(j):getEnabled() and party:getChampion(j):isAlive()
then
if party:getChampion(j):getStat("health") / party:getChampion(j):getStatMax("health") * 100 < percentage_health
then
least_health = party:getChampion(j):getStat("health")
max_health = party:getChampion(j):getStatMax("health")
percentage_health = least_health / max_health * 100
character_to_heal = j
end
end
end
if (character_to_heal < 5)
then
champName = party:getChampion(character_to_heal):getName()
party:getChampion(character_to_heal):modifyStat("health", heal_amount)
end
-- hudPrint(champName .. " has " .. tostring(least_health) .. " of " .. tostring(max_health))
hudPrint(champName .. " was healed.")
playSound("heal_party")
party:playScreenEffect("frostburst")
end,
}
Re: New Spells >> show them off here
Posted: Thu Oct 04, 2012 12:25 pm
by Neikun
When I need to text things, I use my handy xpsnail
Code: Select all
cloneObject{
name = "xpsnail",
baseObject = "snail",
health = 1,
exp = 9999999,
}
Re: New Spells >> show them off here
Posted: Thu Oct 04, 2012 12:37 pm
by Grimwold
Neikun wrote:When I need to text things, I use my handy xpsnail
Code: Select all
cloneObject{
name = "xpsnail",
baseObject = "snail",
health = 1,
exp = 9999999,
}
Thanks for that. very handy. Although I've just discovered you can modify characters using the console.
open console
type e.g.
party:getChampion(4):addSkillPoints(25)
Re: New Spells >> show them off here
Posted: Thu Oct 04, 2012 12:44 pm
by Komag
whoa, didn't know that one! that's much more direct and straightforward than setting up the xpsnail type of thing
Re: New Spells >> show them off here
Posted: Thu Oct 04, 2012 12:46 pm
by Grimwold
Combined Healing Spell
(now with different Runes)
Requires spellcraft level 16... heals party member with the lowest percentage health by 2,3,or 4 times skill of caster
After spellcraft level 24 ... heals whole party by 1.5,1.75 or 2 times level of caster
Code: Select all
-- Party Healing spell
defineSpell{
name = "healing",
uiName = "Healing",
skill = "spellcraft",
level = 16,
runes = "BF",
manaCost = 20,
onCast = function(caster, x, y, direction, skill)
local character_to_heal = 5
local least_health = 10000
local max_health = 10000
local percentage_health = 100
local champName = "No-one"
if skill < 24
then
local heal_amount = math.random(2,4)*skill
for j=1,4 do
if party:getChampion(j):getEnabled() and party:getChampion(j):isAlive()
then
if party:getChampion(j):getStat("health") / party:getChampion(j):getStatMax("health") * 100 < percentage_health
then
least_health = party:getChampion(j):getStat("health")
max_health = party:getChampion(j):getStatMax("health")
percentage_health = least_health / max_health * 100
character_to_heal = j
end
end
end
if (character_to_heal < 5)
then
champName = party:getChampion(character_to_heal):getName()
party:getChampion(character_to_heal):modifyStat("health", heal_amount)
end
-- hudPrint(champName .. " has " .. tostring(least_health) .. " of " .. tostring(max_health))
hudPrint(champName .. " was healed by " .. caster:getName())
else
local heal_amount = math.random(6,8) /4 *skill
for i=1,4 do
party:getChampion(i):modifyStat("health", heal_amount)
end
hudPrint(caster:getName() .. " healed the party")
end
playSound("heal_party")
party:playScreenEffect("frostburst")
end,
}
Re: New Spells >> show them off here
Posted: Fri Oct 05, 2012 3:09 am
by Trap
very cool, good job ;p
Re: New Spells >> show them off here
Posted: Fri Oct 05, 2012 8:33 pm
by Merethif
Really impressive!
Personally I'd make this spell comes with Staff Defence rather the Spellcraft though, as I always see healing as a spell suitable for those armoured, well protected, first row magic-users (cleric/druid types). Also I really do think that Staff Defence need some love too
Anyway I'm looking forward for your further creations.
Re: New Spells >> show them off here
Posted: Fri Oct 05, 2012 10:01 pm
by Blichew
Fan of Knives
Credits go to JohnWordsworth who had a problem with this one
spellcraft level and/or mana cost need to be adjusted
Code: Select all
defineSpell{
name = "knives",
uiName = "Fan of Knives",
skill = "spellcraft",
level = 1,
runes = "AC",
manaCost = 5,
onCast = function(champ, x, y, direction, skill)
local dx,dy = getForward(party.facing)
local x,y = party.x + dx, party.y + dy
if party.facing == 0 or party.facing == 2 then
for modif = -0.5,0.5,0.1 do
shootProjectile("throwing_knife", party.level, x+modif, y, party.facing, 12+(modif*2), 1.5, 1, 0, 0, 0, 1, false, true)
end
else
for modif = -0.5,0.5,0.1 do
shootProjectile("throwing_knife", party.level, x, y+modif, party.facing, 12+(modif*2), 1.5, 1, 0, 0, 0, 1, false, true)
end
end
end
}
Re: New Spells >> show them off here
Posted: Sat Oct 06, 2012 1:59 am
by Lollgramoth
There is actually a posability to target a single Hero out of your group.
If the spell is cast, it gives you an Item onto the mouse. If this item is found in the hand slots of a Hero or in his inventory he gets healed by the amount the spell said. The items need to get back to the right Positions. And after all the mess is cleared, it would appear that everything happend at it should. There is no blank spot where the leftclick has no effect, so it allways will be in the hands or in the inventory. Have fun.
I tried that, but the game crashes without warning if you spawn an item in a spell or if you call a function which spawns an item out of a spell.
What do I do wrong?
The code:
Code: Select all
-- Character Healing Spell
defineSpell{
name = "healing",
uiName = "Healing",
skill = "spellcraft",
level = 1,
runes = "EF",
manaCost = 20,
onCast = function(caster, x, y, direction, skill)
local healIcon = spawn(healwave_item)
end,
}
Re: New Spells >> show them off here
Posted: Sat Oct 06, 2012 2:39 pm
by Bucnasti
I created a replacement for the light spell. It creates a stationary light object in the player square which lasts for 30 seconds, if the spell is recast it deletes the existing object and creates a new one. Makes the light spell useful but not a permanent solution.
Mage Light
Code: Select all
defineSpell{
name = "light",
uiName = "Magic Light",
skill = "spellcraft",
level = 5,
runes = "BE",
manaCost = 15,
onCast = function()
if findEntity("spell_light") then
print("spell light exists, destroying")
spell_light:destroy()
spell_light_timer:destroy()
end
print("spawning a new spell_light")
spawn("spell_torchlight", party.level, party.x, party.y, party.facing, "spell_light")
spawn("timer", party.level, party.x, party.y, party.facing, "spell_light_timer")
playSound("generic_spell")
spell_light_timer:setTimerInterval(30)
spell_light_timer:addConnector("activate", "spell_light", "deactivate")
spell_light_timer:activate()
end,
}