Spell [TFS 1.2/1.3] Unnamed spell (looks cool tho)

make more spells like this?

  • yes

    Votes: 48 92.3%
  • no

    Votes: 4 7.7%

  • Total voters
    52

Aeronx

Active Member
Joined
Dec 17, 2015
Messages
708
Reaction score
91
Just came here to post both bugs >.<!
Great spells but it hits through walls and doesnt work on players.
 

Shadow_

Active Member
Joined
Jun 2, 2018
Messages
362
Reaction score
73
Location
Cairo, Egypt
i have fixed the script it was sending effects on players in protection zones and wasn't attacking players and i have added formula with magic level and level
Lua:
--[[#######################################################################################]]--
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(cid) or specs[i]:isPlayer(cid) then
       local tile = Tile(specs[i]:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE)
       if tile then
       stopEvent(running[cid])
       running[cid] = nil
       return true
       end
           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 config = {
   rounds = 80, -- number of times the spell loops (effects & damage)
   delay = 160, -- ms
   radius = {x = 3, y = 3}, -- sqm radius
   damageType = COMBAT_DEATHDAMAGE,
   areaEffect = CONST_ME_MORTAREA,
   distanceEffect = CONST_ANI_SUDDENDEATH,
}
function onCastSpell(cid, creature, variant)
    local player = Player(cid)
    if not player then
        return false
    end
    local level = player:getLevel()
    local maglevel = player:getMagicLevel()
    local a = (level / 5) + (maglevel * 4) + 225
    local b = (level / 5) + (maglevel * 10) + 300
    local damage = {min = -a, max = -b}
    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
 

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,553
Reaction score
140
Location
Lublin, Poland
Hello.
Anyone could update this to 1.0?
Because i have two problems with this spell:
- Random effects appear when hit the target (i dont know why)
- The "SD" shooting animation is not going around the character (CONST_ANI_SUDDENDEATH)(like on preview), only the effect (CONST_ME_MORTAREA) is going :/
 

God Of Pain

Member
Joined
Aug 3, 2017
Messages
531
Reaction score
16
got bored and wanted to try to make my first non-utility spell
only works on monsters, fully configurable (config is at the bottom)
demonstration: http://xera.s-ul.eu/C95HkX4x
Lua:
--[[#######################################################################################]]--
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 config = {
   damage = {min = -10, max = -15},
   rounds = 80, -- number of times the spell loops (effects & damage)
   delay = 160, -- ms
   radius = {x = 3, y = 3}, -- sqm radius
   damageType = COMBAT_DEATHDAMAGE,
   areaEffect = CONST_ME_MORTAREA,
   distanceEffect = CONST_ANI_SUDDENDEATH,
}

function onCastSpell(creature, variant)
   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)
   return true
end
ths spell for monster please
 

Aeronx

Active Member
Joined
Dec 17, 2015
Messages
708
Reaction score
91
You can adapt it pretty easily to work on monsters without much work
 

Thorn

Excellent OT User
Joined
Sep 24, 2012
Messages
2,174
Reaction score
844
Location
Chile
hello! is it possible to make monsters use this spell? i tried adding it to monsters but doesnt work, also, how can i remove the magiceffect it reproduces on top of myself?
 

eddanboy

CDev.
Joined
Apr 15, 2012
Messages
39
Reaction score
3
Location
Sweden
Greetings,

I am getting this error, I know this is an old thread, but does anyone understand it? My scripter is at work and I want to get it working :)

Code in spoiler.
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(cid) or specs[i]:isPlayer(cid) then
       local tile = Tile(specs[i]:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE)
       if tile then
       stopEvent(running[cid])
       running[cid] = nil
       return true
       end
           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 config = {
   rounds = 80, -- number of times the spell loops (effects & damage)
   delay = 160, -- ms
   radius = {x = 3, y = 3}, -- sqm radius
   damageType = COMBAT_DEATHDAMAGE,
   areaEffect = CONST_ME_MORTAREA,
   distanceEffect = CONST_ANI_SUDDENDEATH,
}
function onCastSpell(cid, creature, variant)
    local player = Player(cid)
    if not player then
        return false
    end
    local level = player:getLevel()
    local maglevel = player:getMagicLevel()
    local a = (level / 5) + (maglevel * 4) + 225
    local b = (level / 5) + (maglevel * 10) + 300
    local damage = {min = -a, max = -b}
    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
 

Apollos

Dude who does stuff
Joined
Apr 22, 2009
Messages
737
Reaction score
450
Location
United States
Greetings,

I am getting this error, I know this is an old thread, but does anyone understand it? My scripter is at work and I want to get it working :)

Code in spoiler.
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(cid) or specs[i]:isPlayer(cid) then
       local tile = Tile(specs[i]:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE)
       if tile then
       stopEvent(running[cid])
       running[cid] = nil
       return true
       end
           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 config = {
   rounds = 80, -- number of times the spell loops (effects & damage)
   delay = 160, -- ms
   radius = {x = 3, y = 3}, -- sqm radius
   damageType = COMBAT_DEATHDAMAGE,
   areaEffect = CONST_ME_MORTAREA,
   distanceEffect = CONST_ANI_SUDDENDEATH,
}
function onCastSpell(cid, creature, variant)
    local player = Player(cid)
    if not player then
        return false
    end
    local level = player:getLevel()
    local maglevel = player:getMagicLevel()
    local a = (level / 5) + (maglevel * 4) + 225
    local b = (level / 5) + (maglevel * 10) + 300
    local damage = {min = -a, max = -b}
    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
Solution on the first page of this thread..
Spell - [TFS 1.2/1.3] Unnamed spell (looks cool tho) (https://otland.net/threads/tfs-1-2-1-3-unnamed-spell-looks-cool-tho.250299/#post-2434929)
 

eddanboy

CDev.
Joined
Apr 15, 2012
Messages
39
Reaction score
3
Location
Sweden
Thank you, I found this, had posted that code into another position.lib file. :)

Edit: It works now, but crashes the client casting it, however, it does not crash my other client (MC on beta) and the spell does cast.
 

Zarkank

New Member
Joined
Apr 25, 2017
Messages
24
Reaction score
1
excuse
But here is not the error in TFS but the magic does not work, nothing happens
 
Top