• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

TFS 1.0 Chain Spell && Arcane Missile

Codinablack

Dreamer
Content Editor
Joined
Dec 26, 2013
Messages
2,124
Solutions
14
Reaction score
1,518
Location
USA
GitHub
Codinablack
Greetings Otland. I come in request of an up to date chain spell such as chain lighting from http://otland.net/threads/gesior-noob-spells-collection.8019/

Second request is for a spell that is like diablo 3's arcane missile, where the missiles (animations) come out from the side of the player then meet together at target to do damage... I have seen it on some servers, I have even seen it in youtube video's but I can't find a code for how to do it anywhere...
 
For 0.3.6+
Didn't excepted the code can be so short for it. My WoW Arcane Missile's file are ten times much larger.

Code:
local minMissiles = 2

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -0.1, 0, -0.3, 0)

local function doBolt(cid, var, tar, pos, check)
    if check >= 7 then
        doSendDistanceShoot(pos, getCreaturePosition(tar), 37)
        doCombat(cid, combat, var)
    else
        check = check + 1
        local a, b = math.random(-1,1), math.random(-1,1)
        local npos = {x = pos.x + a, y = pos.y +b, z = pos.z}  
        -- doSendMagicEffect(npos, CONST_ME_ENERGYAREA)
        doSendDistanceShoot(pos, npos, 37)
        addEvent(doBolt, 100, cid, var, tar, npos, check)
    end
    return true
end

function onCastSpell(cid, var)
    local mlv = getPlayerMagLevel(cid)
    for i = 1, (minMissiles + math.floor(mlv/20)) do
        doBolt(cid, var, getCreatureTarget(cid), getCreaturePosition(cid), 0)
    end
    return true
end
 
Thank you very very much! You actually just made some things clear to me with this spell too! I have been confused about parameters for home made functions for a while now, but now I get it! This spell has helped me very much sir! Thank's man I appreciate it!
 
Use this to declare the second target:
Code:
local t = getSpectators(pos, 3, 3, false)
local secondtarget = nil
if t > 0 then
    secondtarget = t[math.random(1, #t)]
end

It says getSpectators returns a table, not numbers...

Code:
(Unknown scriptfile)
data/spells/scripts/attack/arcanemissile.lua:14: attempt to compare number with
table
stack traceback:
        [C]: in function '__lt'
 
Back
Top