New Spells >> show them off here
Re: New Spells >> show them off here
I would like to make up a leech spell that heals the party based on damage done by the spell.
Any ideas on how to do that.
Thx,
LG
Any ideas on how to do that.
Thx,
LG
Dungeon Master and DOOM will live forever.
Re: New Spells >> show them off here
lool ...
I was just about to post this question too :p
I was just about to post this question too :p
Re: New Spells >> show them off here
I can combine a new attack spell with a healing spell. But it would heal the party all the time, whether the attack spell even hit a monster or not.
LG
LG
Dungeon Master and DOOM will live forever.
Re: New Spells >> show them off here
I agree you could do a healing effect at the same time as the damage effect, but that would heal whether or not the spell actually dealt damage.
It might be possible to combine the spell with an onDamage monster hook that checks to see what the source of the damage was.. if it's the spell then it triggers the healing.
It might be possible to combine the spell with an onDamage monster hook that checks to see what the source of the damage was.. if it's the spell then it triggers the healing.
Puzzle Frameworks - http://www.grimrock.net/forum/viewtopic.php?f=14&t=4564
Magic Pack - https://www.nexusmods.com/grimrock/mods/70
Area of Effect Spell System - http://www.grimrock.net/forum/viewtopic ... 150#p44382
Magic Pack - https://www.nexusmods.com/grimrock/mods/70
Area of Effect Spell System - http://www.grimrock.net/forum/viewtopic ... 150#p44382
Re: New Spells >> show them off here
To manage the hit and heal spell, you could tell the spell easy enough to heal the party....regardless of damage dealt, but to heal based on the damage done by the spell....
Now that is something that I'd be keen to see!! Surely this is manageable... experimentation time!
I am working on a Smite Undead spell and also Recharge Item spell at the moment, sharing time soon....
Now that is something that I'd be keen to see!! Surely this is manageable... experimentation time!
I am working on a Smite Undead spell and also Recharge Item spell at the moment, sharing time soon....
Labyrinth of Lies (viewtopic.php?f=14&t=4400)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Re: New Spells >> show them off here
For the Leech spell, I'm currently envisioning the use of a variable "leech = false". When the leech spell is cast, the variable is set to true and a short duration timer is spawned... when the timer activates the variable is set to false again, giving a short window of opportunity for testing if a monster is damaged.
Tied in with that would be an onDamage() hook attached to all monsters that could be leeched from (not necessarily all monsters)... when the monster is damaged a script would check if "leech = true" and if so, it would reset "leech = false" and activate a healing based on the amount of damage that the monster received.
The only issue I can see with this method might be if you cast the leech without hitting a monster, and then dealt damage to a monster by some other means before the timer had reset the variable... that way you could get healing to the value of the other attack... would be a tricky manoeuvre to pull off! Especially if we got the timer duration down really small.. like a fraction of a second.
When I get chance I'm going to write up scripts for this spell as described. I think it should be restricted to dealing damage directly in front of the party (to make it easier to code) and I may even restrict it further by requiring that the mage be in the front of the party!!
Tied in with that would be an onDamage() hook attached to all monsters that could be leeched from (not necessarily all monsters)... when the monster is damaged a script would check if "leech = true" and if so, it would reset "leech = false" and activate a healing based on the amount of damage that the monster received.
The only issue I can see with this method might be if you cast the leech without hitting a monster, and then dealt damage to a monster by some other means before the timer had reset the variable... that way you could get healing to the value of the other attack... would be a tricky manoeuvre to pull off! Especially if we got the timer duration down really small.. like a fraction of a second.
When I get chance I'm going to write up scripts for this spell as described. I think it should be restricted to dealing damage directly in front of the party (to make it easier to code) and I may even restrict it further by requiring that the mage be in the front of the party!!
Puzzle Frameworks - http://www.grimrock.net/forum/viewtopic.php?f=14&t=4564
Magic Pack - https://www.nexusmods.com/grimrock/mods/70
Area of Effect Spell System - http://www.grimrock.net/forum/viewtopic ... 150#p44382
Magic Pack - https://www.nexusmods.com/grimrock/mods/70
Area of Effect Spell System - http://www.grimrock.net/forum/viewtopic ... 150#p44382
Re: New Spells >> show them off here
OK here's my working leech spell...
Leech
Currently based on Spellcraft and requiring a skill level of 2 (needs to be tweaked for balancing)... it will deal "50" damage to anything in the square directly infront of the party, and if a monster that can be leeched from (currently all monsters) is damaged, the caster will heal an amount equal to the damage dealt.
spells.lua
monsters.lua
NOTE - if you already use an onDamage hook, you will need to modify the monster definitions to look at both your own script and the leech script.
script entity called leech_spell_script
The cooldown on the leech effect is 0.1 second and I don't think it is possible to misuse the spell in that time.
I haven't included the requirement for the mage to be in the front of the party, but I could add it if people think it is useful.
Leech
Currently based on Spellcraft and requiring a skill level of 2 (needs to be tweaked for balancing)... it will deal "50" damage to anything in the square directly infront of the party, and if a monster that can be leeched from (currently all monsters) is damaged, the caster will heal an amount equal to the damage dealt.
spells.lua
Code: Select all
-- Leech Spell
defineSpell{
name = "Leech",
uiName = "Leech",
skill = "spellcraft",
level = 2,
runes = "DH",
manaCost = 30,
onCast = function(caster, x, y, direction, skill)
return leech_spell_script.leechSpell(caster,x,y,direction,skill)
end,
}
Code: Select all
local monstersList = {"crab","crowern","cube","goromorg","green_slime","herder","herder_big","herder_small","herder_swarm","ice_lizard","ogre","scavenger","scavenger_swarm","shrakk_torr","skeleton_archer","skeleton_archer_patrol","skeleton_patrol","skeleton_warrior","snail","spider","tentacles","uggardian","warden","wyvern"
}
for i=1,# monstersList do
cloneObject{
name = monstersList[i],
baseObject = monstersList[i],
onDamage = function(self,damage,damageType)
return leech_spell_script.checkLeech(self,damage)
end,
}
end
script entity called leech_spell_script
Code: Select all
leech = false
leech_caster_ord = 1
-- find the champion ID from the ordinal number --
function findChampionByOrdinal(ord)
for ch = 1,4 do
if party:getChampion(ch):getOrdinal() == ord then
return party:getChampion(ch)
end
end
end
function leechSpell(caster,x,y,dir,skill)
leech_caster_ord = caster:getOrdinal()
local leech_timer = findEntity("leech_timer")
if leech_timer ~= nil then
leech_timer:destroy()
end
spawn("timer", party.level, party.x, party.y, party.facing, "leech_timer")
:setTimerInterval(0.1)
:activate()
:addConnector("activate","leech_spell_script","resetLeech")
local dx,dy = getForward(party.facing)
-- hudPrint("Leech set")
leech = true
local originator = 2 ^ (leech_caster_ord+1)
damageTile(party.level,party.x+dx,party.y + dy,party.facing,originator+1, 'physical',50)
end
function resetLeech()
leech = false
hudPrint("There is nothing to Leech health from")
leech_timer:deactivate()
end
function checkLeech(self,damage)
if leech == true then
leech = false
-- hudPrint("Heal Now")
leech_timer:deactivate()
champion = findChampionByOrdinal(leech_caster_ord)
champion:modifyStat("health", damage)
playSound("heal_party")
party:playScreenEffect("damage_screen")
end
end
I haven't included the requirement for the mage to be in the front of the party, but I could add it if people think it is useful.
Puzzle Frameworks - http://www.grimrock.net/forum/viewtopic.php?f=14&t=4564
Magic Pack - https://www.nexusmods.com/grimrock/mods/70
Area of Effect Spell System - http://www.grimrock.net/forum/viewtopic ... 150#p44382
Magic Pack - https://www.nexusmods.com/grimrock/mods/70
Area of Effect Spell System - http://www.grimrock.net/forum/viewtopic ... 150#p44382
Re: New Spells >> show them off here
Freeze Monster
My fourth and final "... Monster" spell. This one deals virtually no damage, but is guaranteed to freeze an enemy. I had wanted to do it as a burstSpell so it would only affect the space in front of the party, but the hardcoded freeze mechanism only seems to work with a projectileSpell, so it ended up as a ranged spell instead. The Freeze duration is stepped depending on skill: 1-10 freezes for 5 seconds, 11 - 20 for 10 seconds, 21 - 30 for 15 seconds and 31+ for 20 seconds.
spells.lua
objects.lua
My fourth and final "... Monster" spell. This one deals virtually no damage, but is guaranteed to freeze an enemy. I had wanted to do it as a burstSpell so it would only affect the space in front of the party, but the hardcoded freeze mechanism only seems to work with a projectileSpell, so it ended up as a ranged spell instead. The Freeze duration is stepped depending on skill: 1-10 freezes for 5 seconds, 11 - 20 for 10 seconds, 21 - 30 for 15 seconds and 31+ for 20 seconds.
spells.lua
Code: Select all
-- Freeze Monster Spell
defineSpell{
name = "freeze_monster",
uiName = "Freeze Monster",
skill = "ice_magic",
level = 5,
runes = "FI",
manaCost = 40,
onCast = function(caster, x, y, direction, skill)
local duration_array = {"freeze05","freeze10","freeze15","freeze20"}
local duration_index = math.ceil(skill/10)
if duration_index > 4 then
duration_index = 4
end
local dx,dy = getForward(direction)
spawn(duration_array[duration_index],party.level,x+dx,y+dy,direction)
end,
}
Code: Select all
defineObject{
name = "freeze05",
class = "ProjectileSpell",
particleSystem = "frostbolt",
hitParticleEffect = "frostbolt_hit",
lightColor = vec(0.25, 0.5, 1),
lightBrightness = 15,
lightRange = 7,
lightHitBrightness = 40,
lightHitRange = 10,
launchSound = "frostburst",
projectileSound = "frostbolt",
hitSound = "frostbolt_hit",
projectileSpeed = 7.5,
attackPower = 0,
damageType = "cold",
freezeChance = 100,
freezeDuration = 5,
--cameraShake = true,
tags = { "spell" },
}
cloneObject{
name = "freeze10",
baseObject = "freeze05",
freezeDuration = 10,
}
cloneObject{
name = "freeze15",
baseObject = "freeze05",
freezeDuration = 15,
}
cloneObject{
name = "freeze20",
baseObject = "freeze05",
freezeDuration = 20,
}
Puzzle Frameworks - http://www.grimrock.net/forum/viewtopic.php?f=14&t=4564
Magic Pack - https://www.nexusmods.com/grimrock/mods/70
Area of Effect Spell System - http://www.grimrock.net/forum/viewtopic ... 150#p44382
Magic Pack - https://www.nexusmods.com/grimrock/mods/70
Area of Effect Spell System - http://www.grimrock.net/forum/viewtopic ... 150#p44382
Re: New Spells >> show them off here
UPDATED 29 Nov.
CHANGES AND FIXES:
Fixed mixup of required skill for Ritual of Light and Summon Darkness
UPDATED 26 Nov.
CHANGES AND FIXES:
Improved Detect Monster, now detects all monsters and gives you "infravision", detecting their location
Added some spell sounds
Added a new particle effect for Detect Monster
UPDATED 24 Nov.
CHANGES AND FIXES:
Corrected bugs pointed out by Grimwold
Added Arrowshield (works against all forms of ranged attacks)
Streamlined in-game script
Some balance changes.
Added notes for the spells
I hereby present my first magic system expansion.
Purpose:
Planned spells: At least 2 more in these schools, plus eventually 1 each for the existing schools, and a new school with 4 spells.
Planned schools of magic: Shaman spell tree (based on staves) for a Minotaur mage, which uses HP to cast spells rather than mana, and gives combat bonuses only.
School types, all requirements should be somewhat higher than the elemental spell trees since these are more powerful:
PLEASE NOTE: You can not be both light and dark, you have to choose once you cast the ritual. Choose wisely!
Light Magic=Blessings, cost all available mana, gives bigger benefits the more mana spent. Part of the Staves skills.
Dark Magic=Curses, cost party HP, increasing with skill and effect. Part of the Staves skills.
Spellcraft=Utility spells, and rituals to choose light or dark.
SPELLS:
DISCLAIMER:
I am aware that the spells might be unbalanced right now. Some thought has gone into balancing them, but I need your help to test and give input. I plan to expand this as a complete magic expansion, feel free to add suggestions. Many scripts can be streamlined, new icons/textures included. All this will be added in the next release. Bugs might still be in there. Feel free to use the code as you like, give credit if you're nice
HUGE THANKS TO:
Grimwold and Komag for scripting help and great scripts
Lark for his excellent "Function findEntities" script
The new spells thread
And Almost Human, Terve and thanks!
BELOW ARE WHAT YOU NEED TO GET IT WORKING:
Put this in spells.lua (inludes needed non-spell entities such as two wands and light-entities):
flatlines_script (name a in-game Lua script flatlines_script and paste this)
CHANGES AND FIXES:
Fixed mixup of required skill for Ritual of Light and Summon Darkness
UPDATED 26 Nov.
CHANGES AND FIXES:
Improved Detect Monster, now detects all monsters and gives you "infravision", detecting their location
Added some spell sounds
Added a new particle effect for Detect Monster
UPDATED 24 Nov.
CHANGES AND FIXES:
Corrected bugs pointed out by Grimwold
Added Arrowshield (works against all forms of ranged attacks)
Streamlined in-game script
Some balance changes.
Added notes for the spells
I hereby present my first magic system expansion.
Purpose:
- To expand the original spell options with three new sets of spells that fit into the original game
- Spells are meant to be balanced with the original spells
- Expanding the use of magic in new ways, not just more damage/healing spells
- New ways of paying for spells in health and mana with new risks and rewards (and eventually also paying with items, not yet implemented)
- Trying to be lore-friendly and in line with game-mechanics
Planned spells: At least 2 more in these schools, plus eventually 1 each for the existing schools, and a new school with 4 spells.
Planned schools of magic: Shaman spell tree (based on staves) for a Minotaur mage, which uses HP to cast spells rather than mana, and gives combat bonuses only.
School types, all requirements should be somewhat higher than the elemental spell trees since these are more powerful:
PLEASE NOTE: You can not be both light and dark, you have to choose once you cast the ritual. Choose wisely!
Light Magic=Blessings, cost all available mana, gives bigger benefits the more mana spent. Part of the Staves skills.
Dark Magic=Curses, cost party HP, increasing with skill and effect. Part of the Staves skills.
Spellcraft=Utility spells, and rituals to choose light or dark.
SPELLS:
SpoilerShow
DARK MAGIC (staves):
Caliginous Curse (dark, level 16) Done. Surrounding squares are cursed with HP loss at the cost of HP, damage increases with skill.
Vengeful Curse (dark, level 8 ) Done. Group Rage for skill*seconds, at cost of HP. (includes lowered evasion, risky but deadly)
Summon Darkness (invisibility through a dark cloud level 20) Done. Invisibility for skill*seconds, surrounded by complete darkness for roughly 30 seconds at cost of HP. Not as good as real invisibility since you can't see.
Curse of Life (requires skull, level 35) TODO. Secret!
LIGHT Magic (staves):
Holy Vigor (level 12) done. Gives group haste for (available mana)seconds, drains all mana
Calm monster (level 16) calms all monsters on the level, will only attack if they see you.
Arrowshield (level 22) gives a precentage based chance to deflect arrows. Deflection chance is equal to skill level, and the spell lasts for twice your current energy. Drains all mana.
Resurrection (Light 44) TODO (also a boring/unbalancing concept, might add secret spell here...)
Spellcraft utility spells:
Dark & Light Ritual: (staff level 5) Done. Sacrifice a whitewood wand to choose the light or dark spell path once. Needed to use the Dark/Light spells.
Mana Shield (staff level 18) Done. (gives group armor equal to mana, costs all available mana, lasts skill*seconds)
Detect monster (staff level 8) Done. (briefly lights up monsters on the entire level)
Create portal (staff 40) Done. (creates a portal to the last place you cast it)
Caliginous Curse (dark, level 16) Done. Surrounding squares are cursed with HP loss at the cost of HP, damage increases with skill.
Vengeful Curse (dark, level 8 ) Done. Group Rage for skill*seconds, at cost of HP. (includes lowered evasion, risky but deadly)
Summon Darkness (invisibility through a dark cloud level 20) Done. Invisibility for skill*seconds, surrounded by complete darkness for roughly 30 seconds at cost of HP. Not as good as real invisibility since you can't see.
Curse of Life (requires skull, level 35) TODO. Secret!
LIGHT Magic (staves):
Holy Vigor (level 12) done. Gives group haste for (available mana)seconds, drains all mana
Calm monster (level 16) calms all monsters on the level, will only attack if they see you.
Arrowshield (level 22) gives a precentage based chance to deflect arrows. Deflection chance is equal to skill level, and the spell lasts for twice your current energy. Drains all mana.
Resurrection (Light 44) TODO (also a boring/unbalancing concept, might add secret spell here...)
Spellcraft utility spells:
Dark & Light Ritual: (staff level 5) Done. Sacrifice a whitewood wand to choose the light or dark spell path once. Needed to use the Dark/Light spells.
Mana Shield (staff level 18) Done. (gives group armor equal to mana, costs all available mana, lasts skill*seconds)
Detect monster (staff level 8) Done. (briefly lights up monsters on the entire level)
Create portal (staff 40) Done. (creates a portal to the last place you cast it)
I am aware that the spells might be unbalanced right now. Some thought has gone into balancing them, but I need your help to test and give input. I plan to expand this as a complete magic expansion, feel free to add suggestions. Many scripts can be streamlined, new icons/textures included. All this will be added in the next release. Bugs might still be in there. Feel free to use the code as you like, give credit if you're nice
HUGE THANKS TO:
Grimwold and Komag for scripting help and great scripts
Lark for his excellent "Function findEntities" script
The new spells thread
And Almost Human, Terve and thanks!
BELOW ARE WHAT YOU NEED TO GET IT WORKING:
Put this in spells.lua (inludes needed non-spell entities such as two wands and light-entities):
Code: Select all
cloneObject{
name = "wand_of_darkness",
baseObject = "whitewood_wand",
uiName = "Wand of Darkness",
description = "A wand that channels the forces of death and darkness necessary for Dark Magic.",
}
cloneObject{
name = "wand_of_light",
baseObject = "whitewood_wand",
uiName = "Wand of Light",
description = "A wand that channels the forces of life and light necessary for Light Magic.",
}
defineSpell{
name = "curse",
uiName = "Caliginous Curse",
skill = "staves",
level = 16,
runes = "DEH",
manaCost = 10,
onCast = function(champ, x, y, direction, skill)
if champ:getItem(7) ~= nil and champ:getItem(7).name == "wand_of_darkness" or champ:getItem(8) ~= nil and champ:getItem(8).name == "wand_of_darkness" then
hudPrint(champ:getName().." pulls life force to strengthen the spell")
damageTile(party.level, party.x, party.y, party.facing, 1, "physical", (5+(skill/2)))
spawn("curseburst", party.level, party.x, party.y-1, party.facing)
spawn("curseburst", party.level, party.x+1, party.y, party.facing)
spawn("curseburst", party.level, party.x, party.y+1, party.facing)
spawn("curseburst", party.level, party.x-1, party.y, party.facing)
damageTile(party.level, party.x, party.y-1, party.facing, 188, "physical", math.random(1,10)*(skill*2))
damageTile(party.level, party.x-1, party.y, party.facing, 188, "physical", math.random(1,10)*(skill*2))
damageTile(party.level, party.x, party.y+1, party.facing, 188, "physical", math.random(1,10)*(skill*2))
damageTile(party.level, party.x+1, party.y, party.facing, 188, "physical", math.random(1,10)*(skill*2))
party:playScreenEffect("party_crush")
else
hudPrint("You are not schooled in the Dark Arts")
return false
end
end,
}
----SUMMON DARKNESS
defineSpell{
name = "cursedark",
uiName = "Summon Darkness",
skill = "staves",
level = 20,
runes = "CDEH",
manaCost = 10,
onCast = function(champ, x, y, direction, skill)
if champ:getItem(7) ~= nil and champ:getItem(7).name == "wand_of_darkness" or champ:getItem(8) ~= nil and champ:getItem(8).name == "wand_of_darkness" then
spawn("darkburst", party.level, party.x, party.y, party.facing)
damageTile(party.level, party.x, party.y, party.facing, 1, "physical", (5+(skill/2)))
for slot=1,4 do
if party:getChampion(slot) ~= nil then
party:getChampion(slot):setCondition("invisibility", skill);
end
end
else
hudPrint("You are not schooled in the Dark Arts")
return false
end
end
}
---RITUAL OF LIGHT
defineSpell{
name = "lritual",
uiName = "Ritual of Light",
skill = "spellcraft",
level = 1,
runes = "ABCEGI",
manaCost = 5,
onCast = function(casty)
if casty:getItem(8) ~= nil then
if casty:getItem(8).name == "whitewood_wand" then
casty:removeItem(8)
casty:insertItem(8,spawn("wand_of_light"))
playSound("generic_spell")
hudPrint("You have chosen Light as your guide")
end
elseif casty:getItem(7) ~= nil then
if casty:getItem(7).name == "whitewood_wand" then
casty:removeItem(7)
casty:insertItem(7,spawn("wand_of_light"))
playSound("generic_spell")
hudPrint("You have chosen Light as your guide")
else hudPrint("You have to cast Ritual of Light while holding a whitewood wand")
end
else
hudPrint("You have to cast Ritual of Light while holding a whitewood wand")
return false
end
end,
}
----RITUAL OF DARKNESS
defineSpell{
name = "Dritual",
uiName = "Ritual of Darkness",
skill = "spellcraft",
level = 1,
runes = "ACEGHI",
manaCost = 5,
onCast = function(casty)
if casty:getItem(8) ~= nil then
if casty:getItem(8).name == "whitewood_wand" then
casty:removeItem(8)
casty:insertItem(8,spawn("wand_of_darkness"))
playSound("generic_spell")
hudPrint("You have chosen the Dark Arts as your path")
end
elseif casty:getItem(7) ~= nil then
if casty:getItem(7).name == "whitewood_wand" then
casty:removeItem(7)
casty:insertItem(7,spawn("wand_of_darkness"))
playSound("generic_spell")
hudPrint("You have chosen the Dark Arts as your path")
else hudPrint("You have to cast Ritual of Darkness while holding a whitewood wand")
end
else
hudPrint("You have to cast Ritual of Darkness while holding a whitewood wand")
return false
end
end,
}
----VENGEFUL CURSE
defineSpell{
name = "curserage",
uiName = "Vengeful Curse",
skill = "staves",
level = 8,
runes = "AEH",
manaCost = 10,
onCast = function(champ, x, y, direction, skill)
if champ:getItem(7) ~= nil and champ:getItem(7).name == "wand_of_darkness" or champ:getItem(8) ~= nil and champ:getItem(8).name == "wand_of_darkness" then
damageTile(party.level, party.x, party.y, party.facing, 1, "physical", (5+(skill/2)))
for slot=1,4 do
if party:getChampion(slot) ~= nil then
party:getChampion(slot):setCondition("rage", skill);
end
end
else
hudPrint("You are not schooled in the Dark Arts")
return false
end
end
}
----HOLY VIGOR
defineSpell{
name = "holyvigor",
uiName = "Holy Vigor",
skill = "staves",
level = 12,
runes = "BCE",
manaCost = 10,
onCast = function(champ, x, y, direction, skill)
if champ:getItem(7) ~= nil and champ:getItem(7).name == "wand_of_light" or champ:getItem(8) ~= nil and champ:getItem(8).name == "wand_of_light" then
local cenergy = champ:getStat("energy")
champ:modifyStat("energy", -200)
for slot=1,4 do
if party:getChampion(slot) ~= nil then
party:getChampion(slot):setCondition("haste", cenergy);
end
end
else hudPrint("You are not a true follower of the Light")
return false
end
end
}
-----CALM MONSTER
defineSpell{
name = "Calm",
uiName = "Calm",
skill = "staves",
level = 16,
runes = "BEF",
manaCost = 25,
onCast = function(champ)
if champ:getItem(7) ~= nil and champ:getItem(7).name == "wand_of_light" or champ:getItem(8) ~= nil and champ:getItem(8).name == "wand_of_light" then
return flatlines_script.calmmonster(champ)
else hudPrint("You are not a true follower of the Light")
return false
end
end,
}
--- ARROWSHIELD v2
cloneObject{
name = "party",
baseObject = "party",
onProjectileHit = function()
return flatlines_script.arrowshieldcheck()
end
}
defineSpell{
name = "RROWTest",
uiName = "Arrow Shield",
skill = "staves",
level = 22,
runes = "ABGH",
manaCost = 1,
onCast = function(champ, skill)
if champ:getItem(7) ~= nil and champ:getItem(7).name == "wand_of_light" or champ:getItem(8) ~= nil and champ:getItem(8).name == "wand_of_light" then
if findEntity("arrowshieldobj") ~= nil then
findEntity("arrowshieldobj"):destroy()
end
currenergy = champ:getStat("energy")
champ:modifyStat("energy", -200)
playSound("generic_spell")
spawn("timer", party.level, party.x, party.y, party.facing, "arrowshieldobj")
:addConnector("activate", "flatlines_script", "resetarrowshield")
:setTimerInterval(currenergy*2)
:activate()
else hudPrint("You are not a true follower of the Light")
return false
end
end,
}
defineParticleSystem{
name = "arrowshielded",
emitters = {
-- fog
{
spawnBurst=true,
emissionRate = 1,
emissionTime = 0,
maxParticles = 1,
boxMin = {0, 0,0},
boxMax = { 0, 0, 0},
sprayAngle = {0,360},
velocity = {10,10},
objectSpace = true,
texture = "assets/textures/particles/glow.tga",
lifetime = {0.3,0.3},
colorAnimation = true,
color0 = {10, 10, 10},
color1 = {2, 0.352941, 0.803922},
opacity = 0.02,
fadeIn = 0,
fadeOut = 0.05,
size = {22, 22},
gravity = {0,0,0},
airResistance = 0.1,
rotationSpeed = 0,
blendMode = "Additive",
},
}
}
---- MANASHIELD
defineSpell{
name = "ManaShield",
uiName = "Mana Shield",
skill = "spellcraft",
level = 18,
runes = "BDEF",
manaCost = 1,
onCast = function(champ)
return flatlines_script.manashield(champ)
end,
}
defineParticleSystem{
name = "manashielded",
emitters = {
-- fog
{
emissionRate = 10,
emissionTime = 40,
maxParticles = 1000,
boxMin = {-0.5, 0.0,-0.5},
boxMax = { 0.5, 2.5, 0.5},
sprayAngle = {0,360},
velocity = {0.1,0.2},
objectSpace = true,
texture = "assets/textures/particles/fog.tga",
lifetime = {3,3},
color0 = {0.152941, 0.352941, 0.803922},
opacity = 0.5,
fadeIn = 2.2,
fadeOut = 2.2,
size = {1.5, 1.5},
gravity = {0,0,0},
airResistance = 0.1,
rotationSpeed = 0.3,
blendMode = "Additive",
},
-- stars
{
emissionRate = 200,
emissionTime = 40,
maxParticles = 1000,
boxMin = {-0.6, 0.3,-0.6},
boxMax = { 0.6, 2.5, 0.6},
sprayAngle = {0,360},
velocity = {0.2,0.2},
objectSpace = true,
texture = "assets/textures/particles/teleporter.tga",
lifetime = {3,3},
color0 = {3.0,3.0,3.0},
opacity = 1,
fadeIn = 0.1,
fadeOut = 0.1,
size = {0.05, 0.13},
gravity = {0,0,0},
airResistance = 0.1,
rotationSpeed = 2,
blendMode = "Additive",
}
}
}
----TELEPORT
defineSpell{
name = "portal",
uiName = "Portal",
skill = "spellcraft",
level = 40,
runes = "BDFH",
manaCost = 70,
onCast = function()
return flatlines_script.telly()
end
}
---DETECT MONSTER
defineSpell{
name = "DetectMonster",
uiName = "Detect Monster",
skill = "spellcraft",
level = 8,
runes = "BFG",
manaCost = 13,
onCast = function(champ)
return flatlines_script.detectmonster(champ)
end,
}
defineParticleSystem{
name = "DetectMonster",
emitters = {
-- glow
{
emissionRate = 1,
emissionTime = 0,
spawnBurst = true,
maxParticles = 1,
boxMin = {0,0,0},
boxMax = {0,0,0},
sprayAngle = {0,0},
velocity = {0,0},
texture = "assets/textures/particles/glitter_silver.tga",
lifetime = {10, 10},
colorAnimation = false,
color0 = {1, 0.1, 0.1},
-- color1 = {0.1, 1, 0.1},
-- color2 = {0.1, 0.1, 1},
opacity = 1,
fadeIn = 1,
fadeOut = 1,
size = {3, 3},
gravity = {0,0,0},
airResistance = 1,
rotationSpeed = 1,
blendMode = "Additive",
depthBias = -10,
}
}
}
---NEEDED FOR CALIGINOUS CURSE
defineObject{
name = "curseburst",
class = "ProjectileSpell",
lightColor = vec(0.5, 0.5, 0.5),
particleSystem = "curse_fireP",
hitParticleEffect = "curse_fireP",
lightPosition = vec(0, 0, 0),
lightBrightness = 1000,
lightRange = 3,
castShadow = true,
hitSound = "poison_cloud",
launchSound = "poison_cloud",
lightHitBrightness = -1000,
lightHitRange = 5,
projectileSound = "poison_cloud",
attackPower = 0,
damageType = "physical",
projectileSpeed = 100000,
--cameraShake = true,
tags = { "spell" },
}
defineObject{
name = "darkburst",
class = "ProjectileSpell",
lightColor = vec(0, 0, 0),
particleSystem = "dark_fireP",
hitParticleEffect = "dark_fireP",
lightPosition = vec(0, 0, 0),
lightBrightness = -1000,
lightRange = 30,
castShadow = true,
hitSound = "poison_cloud",
launchSound = "poison_cloud",
lightHitBrightness = -1000,
lightHitRange = 30,
projectileSound = "poison_cloud",
attackPower = 0,
damageType = "physical",
projectileSpeed = 0,
--cameraShake = true,
tags = { "spell" },
}
defineParticleSystem{
name = "curse_fireP",
emitters = {
-- glow}
{
spawnBurst = false,
emissionRate = 0,
emissionTime = 0,
maxParticles = 0,
boxMin = {0,0,-0.1},
boxMax = {0,0,-0.1},
sprayAngle = {30,45},
velocity = {3,3},
texture = "assets/textures/particles/glow.tga",
lifetime = {5, 5},
colorAnimation = false,
color0 = {0.5, 0.5, 0.5},
opacity = 0.1,
fadeIn = 0,
fadeOut = 2,
size = {0, 0},
gravity = {0,-4,0},
airResistance = 0,
rotationSpeed = 2,
blendMode = "Translucent",
depthBias = -0.002,
}
}
}
defineParticleSystem{
name = "dark_fireP",
emitters = {
-- glow}
{
spawnBurst = false,
emissionRate = 40,
emissionTime = 0,
maxParticles = 100,
boxMin = {-20,0,-20},
boxMax = {20,0,20},
sprayAngle = {0,360},
velocity = {1,1},
texture = "assets/textures/particles/glow.tga",
lifetime = {25, 35},
colorAnimation = false,
color0 = {0, 0, 0},
opacity = 1,
fadeIn = 5,
fadeOut = 5,
size = {100, 100},
gravity = {0,0,0},
airResistance = 2,
rotationSpeed = 1,
blendMode = "Translucent",
depthBias = -0.002,
}
}
}
Code: Select all
--arrowshield
function arrowshieldcheck(Champ)
if findEntity("arrowshieldobj") == nil then
return true
else
for p = 1,4 do
if party:getChampion(p):getSkillLevel("spellcraft") ~=nil then
if math.random(1, 50) <= party:getChampion(p):getSkillLevel("spellcraft") then
party:playScreenEffect("arrowshielded")
playSound("swipe_bow")
return false
end
else
return true
end
end
end
end
function resetarrowshield()
if findEntity("arrowshieldobj") ~= nil then
findEntity("arrowshieldobj"):destroy()
playSound("generic_spell")
end
end
--teleport
function telly()
if findEntity("Telly1") ~=nil then
spawn("teleporter", party.level, party.x, party.y, party.facing, "Telly2")
:setTeleportTarget(Telly1.x, Telly1.y, party.facing)
:setTriggeredByParty(true)
:setTriggeredByMonster(false)
:setTriggeredByItem(false)
:setChangeFacing(false)
:setInvisible(false)
:setSilent(true)
:setHideLight(true)
:setScreenFlash(false)
:activate()
spawn("timer", party.level, party.x, party.y, party.facing, "Telly1_timer")
:setTimerInterval(0.1)
:addConnector("activate", "flatlines_script", "Telly1Destroy")
:activate()
hudPrint("Marked A")
elseif findEntity("Telly2") ~=nil then
spawn("teleporter", party.level, party.x, party.y, party.facing, "Telly1")
:setTeleportTarget(Telly2.x, Telly2.y, party.facing)
:setTriggeredByParty(true)
:setTriggeredByMonster(false)
:setTriggeredByItem(false)
:setChangeFacing(false)
:setInvisible(false)
:setSilent(true)
:setHideLight(true)
:setScreenFlash(false)
:activate()
spawn("timer", party.level, party.x, party.y, party.facing, "Telly2_timer")
:setTimerInterval(0.1)
:addConnector("activate", "flatlines_script", "Telly2Destroy")
:activate()
hudPrint("Marked B")
else
spawn("teleporter", party.level, party.x, party.y, party.facing, "Telly1")
:setTeleportTarget(party.x, party.y, party.facing)
:setTriggeredByParty(false)
:setTriggeredByMonster(false)
:setTriggeredByItem(false)
:setChangeFacing(false)
:setInvisible(false)
:setSilent(true)
:setHideLight(true)
:setScreenFlash(false)
hudPrint("Marked A 1")
end
return true
end
function Telly1Destroy()
Telly1:destroy()
Telly1_timer:destroy()
end
function Telly2Destroy()
Telly2:destroy()
Telly2_timer:destroy()
end
--Manashield
-- set initial base_energy value (this variable used for 'resetting' the protection)
base_energy = 0
-- modify protection value
function modifyProtection(modifier)
for slot=1,4 do
if party:getChampion(slot) ~= nil then
party:getChampion(slot):modifyStatCapacity("protection", modifier)
party:getChampion(slot):modifyStat("protection", modifier)
-- hudPrint("max protection " .. tostring(party:getChampion(slot):getStatMax("protection")))
end
end
end
-- check for and destroy mana timer
function checkManaTimer()
local mana_timer_entity = findEntity("manaShieldTimer")
if mana_timer_entity ~= nil then
mana_timer_entity:destroy()
end
end
-- cast mana shield code
function manashield(Champ)
checkManaTimer()
base_energy = Champ:getStat("energy")
hudPrint("The mana shield strengthens armor by " .. base_energy)
-- hudPrint("base energy = " .. tostring(base_energy))
spawn("timer",party.level,0,0,0,"manaShieldTimer")
:addConnector("activate", "flatlines_script", "resetProtection")
:setTimerInterval(40)
:activate()
Champ:setStat("energy", 0)
party:playScreenEffect("manashielded")
modifyProtection(base_energy)
end
function resetProtection()
modifyProtection(-base_energy)
checkManaTimer()
end
--Calm monster
function calmmonster()
local monsters = findAllCalm(party.level, party.x, party.y, {":setAIState"}, "all", false, false, false)
for _, monster in ipairs(monsters) do
monster:setAIState("guard")
end
end
function findAllCalm(level, x, y, keys, all, surrounding, facing, facingUs)
local answers, r, dx, dy, entity, match, _ = {}, 0
all = all == "all"
local any = not all
if surrounding then r = 1 end
if facing then
dx, dy = getForward(self.facing)
x, y = x + dx, y + dy
end
if keys == nil then keys = {"*"} end
for entity in allEntities(party.level) do
match = true
for _, value in ipairs(keys) do
if value == "*" then pass = true
elseif string.sub(value, 1, 1) == ":" then pass = entity[(string.sub(value, 2))] ~= nil
else pass = string.find(entity.name, value) ~= nil end
if all then match = pass and match
else match = pass end
if (match and any) or ((not match) and all) then break end
end
if match then
dx, dy = getForward(entity.facing)
if (not facingUs) or (facingUs and entity.x + dx == self.x and entity.y + dy == self.y) or (self.x == entity.x and self.y == entity.y) then
answers[# answers + 1] = entity
end
end
end
return answers
end
--Detect Monster
function detectmonster()
local monsters = findAllDetect(party.level, party.x, party.y, {":setAIState"}, "all", false, false, false)
for _, monster in ipairs(monsters) do
spawn("fx", monster.level, monster.x, monster.y, monster.facing)
:setParticleSystem("DetectMonster")
:translate(0, 2, 0)
end
playSound("generic_spell")
end
function findAllDetect(level, x, y, keys, all, surrounding, facing, facingUs)
local answers, r, dx, dy, entity, match, _ = {}, 0
all = all == "all"
local any = not all
if surrounding then r = 1 end
if facing then
dx, dy = getForward(self.facing)
x, y = x + dx, y + dy
end
if keys == nil then keys = {"*"} end
for entity in allEntities(party.level) do
match = true
for _, value in ipairs(keys) do
if value == "*" then pass = true
elseif string.sub(value, 1, 1) == ":" then pass = entity[(string.sub(value, 2))] ~= nil
else pass = string.find(entity.name, value) ~= nil end
if all then match = pass and match
else match = pass end
if (match and any) or ((not match) and all) then break end
end
if match then
dx, dy = getForward(entity.facing)
if (not facingUs) or (facingUs and entity.x + dx == self.x and entity.y + dy == self.y) or (self.x == entity.x and self.y == entity.y) then
answers[# answers + 1] = entity
end
end
end
return answers
end
Last edited by flatline on Thu Nov 29, 2012 4:57 pm, edited 7 times in total.
Re: New Spells >> show them off here
Brilliant!!! Testing spells now, feedback asap!!
Labyrinth of Lies (viewtopic.php?f=14&t=4400)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)