Spell - [TFS 1.2/1.3] Unnamed spell (looks cool tho)Xeraphus, help me put hit like HELLS CORE for LEVEL AND MAGIC LEVEL type : combat:setFormula(COMBAT_FORMULA_LEVELMAGIC, -10.2, -1046, -10.4, -2073)
function Creature.getPlayer(self)
return Player(self)
end
function onCastSpell(cid, creature, variant)
local player = creature:getPlayer()
if not player then
return false
end
local level = player:getLevel()
local maglevel = player:getMagicLevel()
local damage = {(level / 5) + (maglevel * 4) + 225, (level / 5) + (maglevel * 10) + 300}
sendEffects(player:getId(), config.delay, config.areaEffect, config.distanceEffect)
runSpell(player:getId(), 0, config.rounds, config.delay, config.radius, damage, config.damageType, config.areaEffect, config.distanceEffect)
return true
end
make the values negative in damageWhen i use that :
No have hitpoint.Code:function onCastSpell(cid, creature, variant) local player = creature:getPlayer() if not player then return false end local level = player:getLevel() local maglevel = player:getMagicLevel() local damage = {(level / 5) + (maglevel * 4) + 225, (level / 5) + (maglevel * 10) + 300} sendEffects(player:getId(), config.delay, config.areaEffect, config.distanceEffect) runSpell(player:getId(), 0, config.rounds, config.delay, config.radius, damage, config.damageType, config.areaEffect, config.distanceEffect) return true end
main post updated@Xeraphus you can put when i enter in protection zone, the spell stop rotate in player?
Thanksmain post updated
--[[#######################################################################################]]--
function doAreaCombatDamage(cid, attacker, combatType, position, min, max, effect)
--// Incase the creature disappears within 120-250ms time window
local creature = Creature(cid)
if not creature then
return
end
doAreaCombatHealth(attacker, combatType, position, 0, min, max, effect)
end
local running = {}
local function runSpell(cid, i, j, delay, radius, damage, damageType, areaEffect, distanceEffect)
local player = Player(cid)
--// Player doesn't exist anymore
if not player or Tile(player:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) and bit.band(player:getGroup():getFlags(), PlayerFlag_IgnoreProtectionZone) == 0 then
stopEvent(running[cid])
running[cid] = nil
return
end
--// Maximum rounds complete
if i > j then
stopEvent(running[cid])
running[cid] = nil
return
end
local center = player:getPosition()
local specs = Game.getSpectators(center, false, false, radius.x, radius.x, radius.y, radius.y)
--// Send effects and damage creatures within radius
local args = {nil, cid, damageType, nil, damage.min, damage.max, areaEffect}
for i = 1, #specs do
if specs[i]:isMonster() then
local specPos = specs[i]:getPosition()
args[1] = specs[i]:getId()
args[4] = specPos
center:sendDistanceEffect(specPos, distanceEffect)
addEvent(doAreaCombatDamage, 120 + (center:getDistance(specPos) * 7), unpack(args))
end
end
addEvent(runSpell, delay, cid, i+1, j, delay, radius, damage, damageType, areaEffect, distanceEffect)
end
local offsets = {DIRECTION_WEST, DIRECTION_NORTH, DIRECTION_EAST, DIRECTION_SOUTH}
local function sendEffects(cid, delay, areaEffect, distanceEffect)
local player = Player(cid)
if not player or Tile(player:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) and bit.band(player:getGroup():getFlags(), PlayerFlag_IgnoreProtectionZone) == 0 then
stopEvent(running[cid])
running[cid] = nil
return
end
local pos = player:getPosition()
--// Send distance effects (N/E/S/W) & area effect on player
for i = 1, #offsets do
local fromPos = pos:setDirectionOffset(offsets[i])
local toPos = pos:setDirectionOffset(offsets[i+1] or offsets[1])
fromPos:sendDistanceEffect(toPos, distanceEffect)
end
pos:sendMagicEffect(areaEffect)
running[cid] = addEvent(sendEffects, delay, cid, delay, areaEffect, distanceEffect)
end
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setArea(createCombatArea(AREA_CIRCLE6X6))
function onGetFormulaValues(player, level, maglevel)
local min = (level / 5) + (maglevel * 4.3) + 32
local max = (level / 5) + (maglevel * 7.4) + 48
return -min, -max
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
--[[#######################################################################################]]--
local config = {
damage = {min = -0, max = -0},
rounds = 11, -- number of times the spell loops (effects & damage)
delay = 333, -- ms
radius = {x = 6, y = 6}, -- sqm radius
damageType = COMBAT_PHYSICALDAMAGE,
areaEffect = 1,
distanceEffect = CONST_ANI_THROWINGSTAR,
}
function onCastSpell(creature, var)
local player = creature:getPlayer()
if not player then
return false
end
sendEffects(player:getId(), config.delay, config.areaEffect, config.distanceEffect)
runSpell(player:getId(), 0, config.rounds, config.delay, config.radius, config.damage, config.damageType, config.areaEffect, config.distanceEffect)
combat:execute(creature, var)
for i = 1, 11 do
addEvent(function() combat:execute(creature, var) end, i * 333)
end
return true
end
I rework code for FORMULA, u can change scalling here:
function onGetFormulaValues(player, level, maglevel)
local min = (level / 5) + (maglevel * 4.3) + 32
local max = (level / 5) + (maglevel * 7.4) + 48
return -min, -max
end
For PLAYERS and MONSTERS attack change this line:
if specs:isMonster() then
for this:
if specs:isPlayer() then
Code:--[[#######################################################################################]]-- function doAreaCombatDamage(cid, attacker, combatType, position, min, max, effect) --// Incase the creature disappears within 120-250ms time window local creature = Creature(cid) if not creature then return end doAreaCombatHealth(attacker, combatType, position, 0, min, max, effect) end local running = {} local function runSpell(cid, i, j, delay, radius, damage, damageType, areaEffect, distanceEffect) local player = Player(cid) --// Player doesn't exist anymore if not player or Tile(player:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) and bit.band(player:getGroup():getFlags(), PlayerFlag_IgnoreProtectionZone) == 0 then stopEvent(running[cid]) running[cid] = nil return end --// Maximum rounds complete if i > j then stopEvent(running[cid]) running[cid] = nil return end local center = player:getPosition() local specs = Game.getSpectators(center, false, false, radius.x, radius.x, radius.y, radius.y) --// Send effects and damage creatures within radius local args = {nil, cid, damageType, nil, damage.min, damage.max, areaEffect} for i = 1, #specs do if specs[i]:isMonster() then local specPos = specs[i]:getPosition() args[1] = specs[i]:getId() args[4] = specPos center:sendDistanceEffect(specPos, distanceEffect) addEvent(doAreaCombatDamage, 120 + (center:getDistance(specPos) * 7), unpack(args)) end end addEvent(runSpell, delay, cid, i+1, j, delay, radius, damage, damageType, areaEffect, distanceEffect) end local offsets = {DIRECTION_WEST, DIRECTION_NORTH, DIRECTION_EAST, DIRECTION_SOUTH} local function sendEffects(cid, delay, areaEffect, distanceEffect) local player = Player(cid) if not player or Tile(player:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) and bit.band(player:getGroup():getFlags(), PlayerFlag_IgnoreProtectionZone) == 0 then stopEvent(running[cid]) running[cid] = nil return end local pos = player:getPosition() --// Send distance effects (N/E/S/W) & area effect on player for i = 1, #offsets do local fromPos = pos:setDirectionOffset(offsets[i]) local toPos = pos:setDirectionOffset(offsets[i+1] or offsets[1]) fromPos:sendDistanceEffect(toPos, distanceEffect) end pos:sendMagicEffect(areaEffect) running[cid] = addEvent(sendEffects, delay, cid, delay, areaEffect, distanceEffect) end local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) combat:setArea(createCombatArea(AREA_CIRCLE6X6)) function onGetFormulaValues(player, level, maglevel) local min = (level / 5) + (maglevel * 4.3) + 32 local max = (level / 5) + (maglevel * 7.4) + 48 return -min, -max end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") --[[#######################################################################################]]-- local config = { damage = {min = -0, max = -0}, rounds = 11, -- number of times the spell loops (effects & damage) delay = 333, -- ms radius = {x = 6, y = 6}, -- sqm radius damageType = COMBAT_PHYSICALDAMAGE, areaEffect = 1, distanceEffect = CONST_ANI_THROWINGSTAR, } function onCastSpell(creature, var) local player = creature:getPlayer() if not player then return false end sendEffects(player:getId(), config.delay, config.areaEffect, config.distanceEffect) runSpell(player:getId(), 0, config.rounds, config.delay, config.radius, config.damage, config.damageType, config.areaEffect, config.distanceEffect) combat:execute(creature, var) for i = 1, 11 do addEvent(function() combat:execute(creature, var) end, i * 333) end return true end
please don't queue 11 events at the same time if you aren't 1000000000000000000000000000000000000000% sure they will all execute.I rework code for FORMULA, u can change scalling here:
function onGetFormulaValues(player, level, maglevel)
local min = (level / 5) + (maglevel * 4.3) + 32
local max = (level / 5) + (maglevel * 7.4) + 48
return -min, -max
end
BUT I HAVE PROBLEM script dot send distance effekts to PLAYER, monsters yes but no players i dontknow why
Code:--[[#######################################################################################]]-- function doAreaCombatDamage(cid, attacker, combatType, position, min, max, effect) --// Incase the creature disappears within 120-250ms time window local creature = Creature(cid) if not creature then return end doAreaCombatHealth(attacker, combatType, position, 0, min, max, effect) end local running = {} local function runSpell(cid, i, j, delay, radius, damage, damageType, areaEffect, distanceEffect) local player = Player(cid) --// Player doesn't exist anymore if not player or Tile(player:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) and bit.band(player:getGroup():getFlags(), PlayerFlag_IgnoreProtectionZone) == 0 then stopEvent(running[cid]) running[cid] = nil return end --// Maximum rounds complete if i > j then stopEvent(running[cid]) running[cid] = nil return end local center = player:getPosition() local specs = Game.getSpectators(center, false, false, radius.x, radius.x, radius.y, radius.y) --// Send effects and damage creatures within radius local args = {nil, cid, damageType, nil, damage.min, damage.max, areaEffect} for i = 1, #specs do if specs[i]:isMonster() then local specPos = specs[i]:getPosition() args[1] = specs[i]:getId() args[4] = specPos center:sendDistanceEffect(specPos, distanceEffect) addEvent(doAreaCombatDamage, 120 + (center:getDistance(specPos) * 7), unpack(args)) end end addEvent(runSpell, delay, cid, i+1, j, delay, radius, damage, damageType, areaEffect, distanceEffect) end local offsets = {DIRECTION_WEST, DIRECTION_NORTH, DIRECTION_EAST, DIRECTION_SOUTH} local function sendEffects(cid, delay, areaEffect, distanceEffect) local player = Player(cid) if not player or Tile(player:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) and bit.band(player:getGroup():getFlags(), PlayerFlag_IgnoreProtectionZone) == 0 then stopEvent(running[cid]) running[cid] = nil return end local pos = player:getPosition() --// Send distance effects (N/E/S/W) & area effect on player for i = 1, #offsets do local fromPos = pos:setDirectionOffset(offsets[i]) local toPos = pos:setDirectionOffset(offsets[i+1] or offsets[1]) fromPos:sendDistanceEffect(toPos, distanceEffect) end pos:sendMagicEffect(areaEffect) running[cid] = addEvent(sendEffects, delay, cid, delay, areaEffect, distanceEffect) end local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) combat:setArea(createCombatArea(AREA_CIRCLE6X6)) function onGetFormulaValues(player, level, maglevel) local min = (level / 5) + (maglevel * 4.3) + 32 local max = (level / 5) + (maglevel * 7.4) + 48 return -min, -max end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") --[[#######################################################################################]]-- local config = { damage = {min = -0, max = -0}, rounds = 11, -- number of times the spell loops (effects & damage) delay = 333, -- ms radius = {x = 6, y = 6}, -- sqm radius damageType = COMBAT_PHYSICALDAMAGE, areaEffect = 1, distanceEffect = CONST_ANI_THROWINGSTAR, } function onCastSpell(creature, var) local player = creature:getPlayer() if not player then return false end sendEffects(player:getId(), config.delay, config.areaEffect, config.distanceEffect) runSpell(player:getId(), 0, config.rounds, config.delay, config.radius, config.damage, config.damageType, config.areaEffect, config.distanceEffect) combat:execute(creature, var) for i = 1, 11 do addEvent(function() combat:execute(creature, var) end, i * 333) end return true end