LE
tfs 0.3.4/0.3.6

[Error] Bunshin no jutsu com setcreaturename

Por LeoTK, 02 de jun. de 2016 em Scripts

resolvido
script
3
1.8k
LeoTKL
02 de junho de 2016 às 19:48

iae pessoal então como o título já diz estou tentando colocar a função setcreaturename na magia bunshin no jutsu do meu servidor que cria uma clone porém não estou conseguindo coloco tudo certo mas não faz alteração script do jutsu

 

  Ocultar conteúdo

function onCastSpell(cid, var)
local from,to = {x=962, y=885, z=7},{x=973, y=892, z=7} -- começo e final do mapa
local from2,to2 = {x=979, y=901, z=7},{x=991, y=905, z=7} -- começo e final do mapa
local playerpos = getPlayerPosition(cid)
local cloth = getCreatureOutfit(cid)
local health = getCreatureHealth(cid)
local maxhealth = getCreatureMaxHealth(cid)
local MaximoSummon = 2

local summons = getCreatureSummons(cid)
if isInRange(getCreaturePosition(cid), from, to) or isInRange(getCreaturePosition(cid), from2, to2) then
doPlayerSendCancel(cid, "Você não pode usar Summons Aqui!")
return FALSE
end

if(table.maxn(summons) < MaximoSummon) then
local clone = doCreateMonster("Clone", playerpos)
doConvinceCreature(cid, clone)
setCreatureMaxHealth(clone, maxhealth)
doCreatureAddHealth(clone, health)
doSetCreatureOutfit(clone, cloth, -1)
doSendMagicEffect(playerpos, 2)
setCreatureName(Clone, "Clone"..getCreatureName(cid).."Clone", "a "..getCreatureName(cid).."Clone")
return TRUE
end

end

 

 

problema resolvido optei por esta script

 

Spoiler

local function isWalkable(pos)
    if getTileThingByPos(pos).itemid == 0 then
        return false
    end
    for i = 0, 255 do
        pos.stackpos = i
        local tile = getTileThingByPos(pos)
        if tile.itemid ~= 0 and not isCreature(tile.uid) then
            if hasProperty(tile.uid, 2) or hasProperty(tile.uid, 7) then
                return false
            end
        end
    end
    return true
end

function onCastSpell(cid, var)
    local anyPos, pos = {x = 0, y = 0, z = 0}, getCreaturePosition(cid)
    local toPos = {
        {x = pos.x + 1, y = pos.y, z = pos.z},
        {x = pos.x - 1, y = pos.y, z = pos.z},
        {x = pos.x, y = pos.y + 1, z = pos.z},
        {x = pos.x, y = pos.y - 1, z = pos.z}
    }

    local maxSummons = 4
    if maxSummons - #getCreatureSummons(cid) > 0 then
        for i = 1, maxSummons - #getCreatureSummons(cid) do
            if not isWalkable(toPos) then
                toPos = pos
            end
            doCombatAreaHealth(0, 0, anyPos, 0, 0, 0, 255)
            doCreateItem(460, 1, anyPos)
            local bunshin = doCreateMonster("Clone", anyPos)
            doConvinceCreature(cid, bunshin)
            setCreatureMaxHealth(bunshin, getCreatureMaxHealth(cid))
            doCreatureAddHealth(bunshin, getCreatureHealth(cid))
            doSetCreatureOutfit(bunshin, getCreatureOutfit(cid), -1)
            setCreatureName(bunshin, getCreatureName(cid), "a " .. getCreatureName(cid))
            doTeleportThing(bunshin, toPos)
            doSendMagicEffect(toPos, 2)
        end
    else
        return false
    end
    return true
end

 

Editado Junho 2 por Brunds

DanihcvD
02 de junho de 2016 às 20:38

Tópico movido para dúvidas / pedidos resolvidos.

1 ano depois...
17 de novembro de 2017 às 18:44

Nas source parceiro !!