doTargetCombatHealth(cid, target, type, min, max, effect[, origin = ORIGIN_SPELL])
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
function onCastSpell(creature, variant, isHotkey)
local min = (creature:getLevel() / 5) + (creature:getMagicLevel() * 4.3) + 32
local max = (creature:getLevel() / 5) + (creature:getMagicLevel() * 7.4) + 48
local positions = combat:getPositions()
for _, position in ipairs(positions)) do
local tile = Tile(position)
if tile then
for _, creature in ipairs(tile:getCreatures()) do
doTargetCombatHealth(0, creature, COMBAT_DEATHDAMAGE, -min, -max)
end
end
end
return true
end
combat:getTargets()
spells.cpp
bool CombatSpell::castSpell(Creature* creature, Creature* target)
get creatures(players) on that target position. If > 1 = stack. Send the combat damage for everyone.
bool CombatSpell::castSpell(Creature* creature, Creature* target)
{
if (scripted) {
LuaVariant var;
if (combat->hasArea()) {
var.type = VARIANT_POSITION;
if (needTarget) {
var.pos = target->getPosition();
} else if (needDirection) {
var.pos = Spells::getCasterPosition(creature, creature->getDirection());
} else {
var.pos = creature->getPosition();
}
} else {
var.type = VARIANT_NUMBER;
var.number = target->getID();
}
return executeCastSpell(creature, var);
}
if (combat->hasArea()) {
if (needTarget) {
combat->doCombat(creature, target->getPosition());
} else {
return castSpell(creature);
}
} else {
combat->doCombat(creature, target);
}
return true;
}
data/scripts/sd_edited.lua
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH)
function onGetFormulaValues(player, level, magicLevel)
local min = (level / 5) + (magicLevel * 1.2) + 7
local max = (level / 5) + (magicLevel * 2.85) + 16
return -min, -max
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
local rune = Spell(SPELL_RUNE)
function rune.onCastSpell(player, variant, isHotkey)
local tile = Tile(variant:getPosition())
if tile then
local topVisibleCreature = tile:getTopVisibleCreature(player)
if topVisibleCreature then
if topVisibleCreature:getId() ~= player:getId() and (not topVisibleCreature:isPlayer() or not topVisibleCreature:getGroup():getAccess()) then
return combat:execute(player, variant)
end
end
local bottomVisibleCreature = tile:getBottomVisibleCreature(player)
if bottomVisibleCreature then
if bottomVisibleCreature:getId() ~= player:getId() and (not bottomVisibleCreature:isPlayer() or not bottomVisibleCreature:getGroup():getAccess()) then
return combat:execute(player, variant)
end
end
end
player:getPosition():sendMagicEffect(CONST_ME_POFF)
player:sendCancelMessage(RETURNVALUE_CANONLYUSETHISRUNEONCREATURES)
return false
end
rune:name("SD Edited")
rune:group("attack")
rune:vocation("sorcerer", "master sorcerer;true", "druid", "elder druid;true")
rune:runeId(2294)
--rune:runeSpellName("exevo sd edited")
rune:charges(1)
rune:id(24)
rune:cooldown(1000)
rune:groupCooldown(1000)
rune:level(60)
rune:magicLevel(14)
rune:mana(1100)
rune:allowFarUse(true)
rune:isPremium(true)
rune:isBlocking(true, false)
rune:register()
data/spells/scripts/attacks/sd_edited.lua
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH)
function onGetFormulaValues(player, level, magicLevel)
local min = (level / 5) + (magicLevel * 1.2) + 7
local max = (level / 5) + (magicLevel * 2.85) + 16
return -min, -max
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function onCastSpell(player, variant, isHotkey)
local tile = Tile(variant:getPosition())
if tile then
local topVisibleCreature = tile:getTopVisibleCreature(player)
if topVisibleCreature then
if topVisibleCreature:getId() ~= player:getId() and (not topVisibleCreature:isPlayer() or not topVisibleCreature:getGroup():getAccess()) then
return combat:execute(player, variant)
end
end
local bottomVisibleCreature = tile:getBottomVisibleCreature(player)
if bottomVisibleCreature then
if bottomVisibleCreature:getId() ~= player:getId() and (not bottomVisibleCreature:isPlayer() or not bottomVisibleCreature:getGroup():getAccess()) then
return combat:execute(player, variant)
end
end
end
player:getPosition():sendMagicEffect(CONST_ME_POFF)
player:sendCancelMessage(RETURNVALUE_CANONLYUSETHISRUNEONCREATURES)
return false
end
data/spells/spells.xml
<rune group="attack" spellid="21" name="SD Edited" id="2294" allowfaruse="1" mana="1100" charges="1" level="60" magiclevel="14" cooldown="1000" groupcooldown="1000" blocktype="solid" script="attack/sd_edited.lua" />
thank you! this wil save me and others time, editing source code.For TFS 1.3+
data/scripts/sd_edited.lua
Lua:local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH) function onGetFormulaValues(player, level, magicLevel) local min = (level / 5) + (magicLevel * 1.2) + 7 local max = (level / 5) + (magicLevel * 2.85) + 16 return -min, -max end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") local rune = Spell(SPELL_RUNE) function rune.onCastSpell(player, variant, isHotkey) local tile = Tile(variant:getPosition()) if tile and tile:getCreatureCount() == 0 then player:getPosition():sendMagicEffect(CONST_ME_POFF) player:sendCancelMessage(RETURNVALUE_CANONLYUSETHISRUNEONCREATURES) return false end return combat:execute(player, variant) end rune:name("SD Edited") rune:group("attack") rune:vocation("sorcerer", "master sorcerer;true", "druid", "elder druid;true") rune:runeId(2294) --rune:runeSpellName("exevo sd edited") rune:charges(1) rune:id(24) rune:cooldown(1000) rune:groupCooldown(1000) rune:level(60) rune:magicLevel(14) rune:mana(1100) rune:allowFarUse(true) rune:isPremium(true) rune:isBlocking(true, false) rune:register()
For TFS 1.2+
data/spells/scripts/attacks/sd_edited.lua
andLua:local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH) function onGetFormulaValues(player, level, magicLevel) local min = (level / 5) + (magicLevel * 1.2) + 7 local max = (level / 5) + (magicLevel * 2.85) + 16 return -min, -max end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") function onCastSpell(player, variant, isHotkey) local tile = Tile(variant:getPosition()) if tile and tile:getCreatureCount() == 0 then player:getPosition():sendMagicEffect(CONST_ME_POFF) player:sendCancelMessage(RETURNVALUE_CANONLYUSETHISRUNEONCREATURES) return false end return combat:execute(player, variant) end
data/spells/spells.xml
XML:<rune group="attack" spellid="21" name="SD Edited" id="2294" allowfaruse="1" mana="1100" charges="1" level="60" magiclevel="14" cooldown="1000" groupcooldown="1000" blocktype="solid" script="attack/sd_edited.lua" />
View attachment 67583
did u told that need a edition in source code? that was what i thinking about... thats the point just with the modifications that Sarah told i dont think it will work correctly...thank you! this wil save me and others time, editing source code.
check again the code and try to test it againdid u told that need a edition in source code? that was what i thinking about... thats the point just with the modifications that Sarah told i dont think it will work correctly...
ps: i want be wrong about it
did u told that need a edition in source code? that was what i thinking about... thats the point just with the modifications that Sarah told i dont think it will work correctly...
ps: i want be wrong about it
it ask for mana to shoot the rune and is not dealing damage players only receive sd effect and blockhiteffectcheck again the code and try to test it again
local base = 150
local variation = 20
local min = math.max((base - variation), ((3 * maglevel + 2 * level) * (base - variation) / 100))
local max = math.max((base + variation), ((3 * maglevel + 2 * level) * (base + variation) / 100))
return -min, -max
end
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH)
function onGetFormulaValues(player, level, magicLevel)
local base = 150
local variation = 20
local min = math.max((base - variation), ((3 * maglevel + 2 * level) * (base - variation) / 100))
local max = math.max((base + variation), ((3 * maglevel + 2 * level) * (base + variation) / 100))
return -min, -max
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
local rune = Spell(SPELL_RUNE)
function rune.onCastSpell(player, variant, isHotkey)
local tile = Tile(variant:getPosition())
if tile then
local topVisibleCreature = tile:getTopVisibleCreature(player)
if topVisibleCreature then
if topVisibleCreature:getId() ~= player:getId() and (not topVisibleCreature:isPlayer() or not topVisibleCreature:getGroup():getAccess()) then
return combat:execute(player, variant)
end
end
local bottomVisibleCreature = tile:getBottomVisibleCreature(player)
if bottomVisibleCreature then
if bottomVisibleCreature:getId() ~= player:getId() and (not bottomVisibleCreature:isPlayer() or not bottomVisibleCreature:getGroup():getAccess()) then
return combat:execute(player, variant)
end
end
end
player:getPosition():sendMagicEffect(CONST_ME_POFF)
player:sendCancelMessage(RETURNVALUE_CANONLYUSETHISRUNEONCREATURES)
return false
end
rune:name("SD Edited")
rune:group("attack")
rune:vocation("sorcerer", "master sorcerer;true", "druid", "elder druid;true")
rune:runeId(2268)
--rune:runeSpellName("exevo sd edited")
rune:charges(1)
rune:id(24)
rune:cooldown(1000)
rune:groupCooldown(1000)
--rune:level(60c)
rune:magicLevel(18)
rune:mana(0)
rune:allowFarUse(true)
rune:isPremium(false)
rune:isBlocking(true, false)
rune:register()
<rune name="Sudden Death" id="3155" allowfaruse="1" charges="1" needtarget="0" maglv="15" blocktype="solid" script="runes/sudden death.lua" />
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH)
function onGetFormulaValues(player, level, maglevel)
local base = 150
local variation = 20
local formula = 3 * maglevel + (2 * level)
local min = (formula * (base - variation)) / 100
local max = (formula * (base + variation)) / 100
return -min, -max
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function onCastSpell(player, variant, isHotkey)
local tile = Tile(variant:getPosition())
if tile then
local topVisibleCreature = tile:getTopVisibleCreature(player)
if topVisibleCreature then
if topVisibleCreature:getId() ~= player:getId() and (not topVisibleCreature:isPlayer() or not topVisibleCreature:getGroup():getAccess()) then
return combat:execute(player, variant)
end
end
local bottomVisibleCreature = tile:getBottomVisibleCreature(player)
if bottomVisibleCreature then
if bottomVisibleCreature:getId() ~= player:getId() and (not bottomVisibleCreature:isPlayer() or not bottomVisibleCreature:getGroup():getAccess()) then
return combat:execute(player, variant)
end
end
end
player:getPosition():sendMagicEffect(CONST_ME_POFF)
player:sendCancelMessage(RETURNVALUE_CANONLYUSETHISRUNEONCREATURES)
return false
end