• 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!

Ccript converting tfs 1.2

Ancienciq

New Member
Joined
May 4, 2017
Messages
9
Reaction score
0
Hello can someone help me with converting this script to tfs 1.2?
LUA:
  function onDeath(cid, corpse, deathList)
    if(isPlayer(cid) == true) then
    for _, pos in pairs(getArea(getCreaturePosition(cid), 1, 1)) do
        doSendMagicEffect(pos, 65)
        end
        doCreatureSay(cid, getCreatureName(cid) .. " killed by " .. getCreatureName(deathList[1]) .. " [R.I.P]", TALKTYPE_ORANGE_1)
    end
    return true
end[code]
 
Hello can someone help me with converting this script to tfs 1.2?
LUA:
  function onDeath(cid, corpse, deathList)
    if(isPlayer(cid) == true) then
    for _, pos in pairs(getArea(getCreaturePosition(cid), 1, 1)) do
        doSendMagicEffect(pos, 65)
        end
        doCreatureSay(cid, getCreatureName(cid) .. " killed by " .. getCreatureName(deathList[1]) .. " [R.I.P]", TALKTYPE_ORANGE_1)
    end
    return true
end[code]
See if this works
LUA:
function getArea(p, x, y)
    local t = {}
    for i = (p.x - x), (p.x + x) do
        for j = (p.y - y), (p.y + y) do
            table.insert(t, {x = i, y = j, z = p.z})
        end
    end
    return t
end

-- i've omitted the last couple of parameters because we aren't using them
function onDeath(creature, corpse, killer)
    if creature:isPlayer() and killer:isPlayer() then
        local position = creature:getPosition()
        local text = creature:getName() .. " killed by " .. killer:getName() .. " [R.I.P]"
        for _, pos in pairs(getArea(position, 1, 1)) do
            -- effect 65 is CONST_ME_STEPSVERTICAL
            pos:sendMagicEffect(CONST_ME_STEPSVERTICAL)
            creature:say(text, TALKTYPE_MONSTER_SAY, false, nil, pos)
        end
    end
    return true
end
 
when i kill it gives this error
LUA:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/tfws_creaturescripts/death.lua:onDeath
data/creaturescripts/scripts/tfws_creaturescripts/death.lua:18: attempt to call method 'sendMagicEffect' (a nil value)
stack traceback:
        [C]: in function 'sendMagicEffect'
        data/creaturescripts/scripts/tfws_creaturescripts/death.lua:18: in function <data/creaturescripts/scripts/tfws_creaturescripts/death.lua:12>


when delete line 18 it works but like this : Check this screenshot!
 
Last edited:
LUA:
function getArea(p, x, y)
    local t = {}
    for i = (p.x - x), (p.x + x) do
        for j = (p.y - y), (p.y + y) do
            table.insert(t, {x = i, y = j, z = p.z})
        end
    end
    return t
end
b5f.jpg

I don't think the script in OP post did what he wanted
What exactly DO you want Ancienciq?
It's better just to tell us
Anyway here you are,
I think this is what you want:
LUA:
local function A(p)
    local t = {}
    for i = -1,1 do
        for j = -1,1 do
            table.insert(t, p + {x = i } + {y = j})
        end
    end
    return t
end
-- i've omitted the last couple of parameters because we aren't using them
function onDeath(creature, corpse, killer)
    if creature:isPlayer() and killer:isPlayer() then
        local position = creature:getPosition()
        local text = creature:getName() .. " killed by " .. killer:getName() .. " [R.I.P]"
        for _, pos in pairs(A(position)) do
            -- effect 65 is CONST_ME_STEPSVERTICAL
            pos:sendMagicEffect(CONST_ME_STEPSVERTICAL)
        end
        creature:say(text, TALKTYPE_MONSTER_SAY, false, nil, position)
    end
    return true
end
 
Last edited:
b5f.jpg

I don't think the script in OP post did what he wanted
What exactly DO you want Ancienciq?
It's better just to tell us
Anyway here you are,
I think this is what you want:
LUA:
local function A(p)
    local t = {}
    for i = -1,1 do
        for j = -1,1 do
            table.insert(t, p + {x = i } + {y = j})
        end
    end
    return t
end
-- i've omitted the last couple of parameters because we aren't using them
function onDeath(creature, corpse, killer)
    if creature:isPlayer() and killer:isPlayer() then
        local position = creature:getPosition()
        local text = creature:getName() .. " killed by " .. killer:getName() .. " [R.I.P]"
        for _, pos in pairs(A(position)) do
            -- effect 65 is CONST_ME_STEPSVERTICAL
            pos:sendMagicEffect(CONST_ME_STEPSVERTICAL)
        end
        creature:say(text, TALKTYPE_MONSTER_SAY, false, nil, position)
    end
    return true
end
very well named function name and argument
 
very well named function name and argument
Hey it works :p
It isn't likely to bother OP since he was looking for a plug and play script anyway
and I made it local so it shouldn't interfere with anything else right?
 
thanks @Aled i changed it a little bit becouse this const me stepvertial was showing all around character

LUA:
local function A(p)
    local t = {}
    for i = -1,1 do
        for j = -1,1 do
            table.insert(t, p + {x = i } + {y = j})
        end
    end
    return t
end
-- i've omitted the last couple of parameters because we aren't using them
function onDeath(creature, corpse, killer)
    if creature:isPlayer() and killer:isPlayer() then
        local position = creature:getPosition()
        local text =   " rekt by " .. killer:getName() 
        for _, pos in pairs(A(position)) do
            -- effect 65 is CONST_ME_STEPSVERTICAL
            --pos:sendMagicEffect(CONST_ME_STEPSVERTICAL)
        end
        creature:say(text, TALKTYPE_MONSTER_SAY, false, nil, position)

    end
    return true
end [code]
 
thanks @Aled i changed it a little bit becouse this const me stepvertial was showing all around character

LUA:
local function A(p)
    local t = {}
    for i = -1,1 do
        for j = -1,1 do
            table.insert(t, p + {x = i } + {y = j})
        end
    end
    return t
end
-- i've omitted the last couple of parameters because we aren't using them
function onDeath(creature, corpse, killer)
    if creature:isPlayer() and killer:isPlayer() then
        local position = creature:getPosition()
        local text =   " rekt by " .. killer:getName()
        for _, pos in pairs(A(position)) do
            -- effect 65 is CONST_ME_STEPSVERTICAL
            --pos:sendMagicEffect(CONST_ME_STEPSVERTICAL)
        end
        creature:say(text, TALKTYPE_MONSTER_SAY, false, nil, position)

    end
    return true
end [code]
well thats what the script in your original post did :P
if you don't want any magic effects then all you need is
LUA:
function onDeath(creature, corpse, killer)
    if creature:isPlayer() and killer:isPlayer() then
        local position = creature:getPosition()
        local text =   " rekt by " .. killer:getName()
        creature:say(text, TALKTYPE_MONSTER_SAY, false, nil, position)
    end
    return true
end
 
Back
Top