Ir para conteúdo
  • Cadastre-se

(Resolvido)SPELL DE TRAP (SEM SER TRAVALYZE)


Ir para solução Resolvido por Fabi Marzan,

Posts Recomendados

.Qual servidor ou website você utiliza como base? 

8.60

 

Boa tarde, preciso de dois SCRIPTS de Trap

Um que o
ALVO fique cercado, porém que não seja de TRAVALYZE
Exemplo:
PRIMEIRA IMAGEM A BAIXO.

 

E no outro SCRIPT que o JOGADOR crie uma prisão de proteção. Para que os inimigos não possam entrar
Exemplo: SEGUNDA IMAGEM A BAIXO.

 

 

 

Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 

1° IMAGEM

KakashiTrap.png

2° IMAGEM

KakashiPrison.png

Editado por raphadoidera (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • Solução

esse e primeiro

local remove_time = 8 -- tempo em segundos para remover as magic wall
local item_id = 12870 -- id da magic wall

function removeItem(posAll)
	for i=1, #posAll do
		for j=0, 255 do
			pos_stack = {x=posAll[i].x,y=posAll[i].y,z=posAll[i].z,stackpos=j}
			removeTile = getThingfromPos(pos_stack)
			if removeTile.itemid == item_id then
				doRemoveItem(removeTile.uid)
			end
		end
	end
end

function onCastSpell(cid, var)



local waittime = 30 -- Tempo de exhaustion em segundos
local storage = 5853 -- Storage de Spell, nunca usar a mesma em outra spell, a menos que não queira usar duas spell juntas!

if exhaustion.check(cid, storage) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Espera "..exhaustion.get(cid, storage).." segundos para usar nuevamente.")
return false
end

local pos = getThingPos(getCreatureTarget(cid))
posTile1 = {x=pos.x+1,y=pos.y+1,z=pos.z,stackpos=1}
posTile2 = {x=pos.x+1,y=pos.y,z=pos.z,stackpos=1}
posTile3 = {x=pos.x+1,y=pos.y-1,z=pos.z,stackpos=1}
posTile4 = {x=pos.x,y=pos.y-1,z=pos.z,stackpos=1}
posTile5 = {x=pos.x-1,y=pos.y-1,z=pos.z,stackpos=1}
posTile6 = {x=pos.x-1,y=pos.y,z=pos.z,stackpos=1}
posTile7 = {x=pos.x-1,y=pos.y+1,z=pos.z,stackpos=1}
posTile8 = {x=pos.x,y=pos.y+1,z=pos.z,stackpos=1}
posAll = {posTile1,posTile2,posTile3,posTile4,posTile5,posTile6,posTile7,posTile8}

for i=1, #posAll do
	if isWalkable(posAll[i]) then
		doCreateItem(item_id, 1, posAll[i])
	end
end 

function dotonprision(cid)
	if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
		local position = {x=getThingPosition(getCreatureTarget(cid)).x+2, y=getThingPosition(getCreatureTarget(cid)).y+1, z=getThingPosition(getCreatureTarget(cid)).z}
		doSendMagicEffect(position, 690)
		local position = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y+1, z=getThingPosition(getCreatureTarget(cid)).z}
		doSendMagicEffect(position, 690)
	end
end

local parameters = {cid = cid, var = var, combat1 = combat1 , combat2 = combat2}
for i = 1, 2 do
	addEvent(function()
		if isCreature(cid) then
			addEvent(dotonprision,100,cid)
			
		end
	end, 1 + ((i-1) * 8000))
end
for i = 1, 1 do
	addEvent(function()
		if isCreature(cid) then
			addEvent(removeItem, remove_time*1000, posAll)
			
		end
	end, 1 + ((i-1) * 8000))
end
exhaustion.set(cid, storage, waittime)

return true
end

 

SEGUNDO

local config = {
    wallArea = {
{1, 1, 1, 1, 1, 1, 1, 1, 1},
{1, 0, 0, 0, 0, 0, 0, 0, 1},
{1, 0, 0, 0, 0, 0, 0, 0, 1},
{1, 0, 0, 0, 0, 0, 0, 0, 1},
{1, 0, 0, 0, 2, 0, 0, 0, 1},
{1, 0, 0, 0, 0, 0, 0, 0, 1},
{1, 0, 0, 0, 0, 0, 0, 0, 1},
{1, 0, 0, 0, 0, 0, 0, 0, 1},
{1, 1, 1, 1, 1, 1, 1, 1, 1},
},
    effect = 3,          --Efeito.
    wallId = 2718,          --ID da parede.
    time = 15,              --Duração da parede.
    cooldown = {5, 5},   --{sucessCooldown, failCooldown},
    chance = 100,           --Chance da spell funcionar.
    storage = 9571,
}
function isWalkable(pos, creature, proj, pz)-- by Nord
    if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
    if getTopCreature(pos).uid > 0 and creature then return false end
    if getTileInfo(pos).protection and pz then return false, true end
    local n = not proj and 3 or 2
    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, n) or hasProperty(tile.uid, 7) then
                return false
            end
        end
    end
    return true
end
function getPosfromArea(cid, area)    --by Dokmos
    icenter = math.floor(table.getn(area)/2)+1
    jcenter = math.floor(table.getn(area[1])/2)+1
    center = area[icenter]
    ivar = table.getn(area)
    jvar = table.getn(area[1])
    i = table.getn(area)^2
    j = table.getn(area[1])^2
    local mydir = isCreature(getCreatureTarget(cid)) and getCreatureDirectionToTarget(cid, getCreatureTarget(cid)) or getCreatureLookDir(cid)
    setPlayerStorageValue(cid, 21101, -1)
    if center[jcenter] == 3 then
        if mydir == 0 then
            signal = {-1,1,1,2}
        elseif mydir == 1 then
            signal = {1,-1,2,1}
        elseif mydir == 2 then
            signal = {1,-1,1,2}
        elseif mydir == 3 then
            signal = {-1,1,2,1}
        end
    else
        signal = {-1,1,1,2}
    end
    POSITIONS = {}  
    P = 0      
    repeat
        pvar = {0,0}
        I = area[ivar]
        J = I[jvar]
        i = i-1
        j = j-1
        if J == 1 then
            if jvar < jcenter then  
                pvar[signal[3]] = signal[1]*math.abs((jcenter-jvar)) 
            elseif jvar > jcenter then  
                pvar[signal[3]] = signal[2]*math.abs((jcenter-jvar)) 
            end             
            if ivar < icenter then  
                pvar[signal[4]] = signal[1]*math.abs((icenter-ivar)) 
            elseif ivar > icenter then
                pvar[signal[4]] = signal[2]*math.abs((icenter-ivar))
            end
        end    
        if jvar > 1 then
            jvar = (jvar-1)
        elseif ivar > 1 then
            jvar = table.getn(area[1])
            ivar = (ivar-1)
        end  
        local pos = getThingPos(cid)
        local areapos = {x=pos.x+(pvar[1]),y=pos.y+(pvar[2]),z=pos.z}  
        if pos.x ~= areapos.x or pos.y ~= areapos.y then
            P = P+1
            POSITIONS[P] = areapos
        end  
    until i <= 0 and j <= 0
    return POSITIONS
end
function onCastSpell(cid)
    if getPlayerStorageValue(cid, config.storage) > os.time() then
        doPlayerSendCancel(cid, "Wait "..getPlayerStorageValue(cid, config.storage) - os.time().." second(s).")
		doCreatureSay(cid, "Voce precisa aguardar para usar novamente!!.", TALKTYPE_MONSTER)
    else
        if math.random(1, 100) > config.chance then
            doPlayerSendCancel(cid, "Your spell failed.")
            doSendAnimatedText(getThingPos(cid), "FAIL!", 215)
            setPlayerStorageValue(cid, config.storage, os.time() + config.cooldown[2])
        else
            local positions = {}
            setPlayerStorageValue(cid, config.storage, os.time() + config.cooldown[1])
            for _, pos in pairs(getPosfromArea(cid, config.wallArea)) do
                if isWalkable(pos) and not getTileInfo(pos).protection then
                    doCreateItem(config.wallId, 1, pos)
                    doSendMagicEffect(pos, config.effect)
                    table.insert(positions, pos)
                end
            end
            if #positions > 0 then
                addEvent(function()
                    for i = 1, #positions do
                        local item = getTileItemById(positions[i], config.wallId).uid
                        if item > 0 then
                            doRemoveItem(item)
                        end
                    end
                end, config.time * 1000)
            end
        end
    end
    return true
end

 

Editado por Fabi Marzan (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Eu queria dois trap parecido um que criei em todo local e só a vocation que cria consegue andar nas árvores e os Target fica preso e a outra e criar 3 trap no Target tipo ir criando grande, medio e pequeno até fechar teria como ?

Link para o post
Compartilhar em outros sites
19 horas atrás, Fabi Marzan disse:

esse e primeiro


local remove_time = 8 -- tempo em segundos para remover as magic wall
local item_id = 12870 -- id da magic wall

function removeItem(posAll)
	for i=1, #posAll do
		for j=0, 255 do
			pos_stack = {x=posAll[i].x,y=posAll[i].y,z=posAll[i].z,stackpos=j}
			removeTile = getThingfromPos(pos_stack)
			if removeTile.itemid == item_id then
				doRemoveItem(removeTile.uid)
			end
		end
	end
end

function onCastSpell(cid, var)



local waittime = 30 -- Tempo de exhaustion em segundos
local storage = 5853 -- Storage de Spell, nunca usar a mesma em outra spell, a menos que não queira usar duas spell juntas!

if exhaustion.check(cid, storage) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Espera "..exhaustion.get(cid, storage).." segundos para usar nuevamente.")
return false
end

local pos = getThingPos(getCreatureTarget(cid))
posTile1 = {x=pos.x+1,y=pos.y+1,z=pos.z,stackpos=1}
posTile2 = {x=pos.x+1,y=pos.y,z=pos.z,stackpos=1}
posTile3 = {x=pos.x+1,y=pos.y-1,z=pos.z,stackpos=1}
posTile4 = {x=pos.x,y=pos.y-1,z=pos.z,stackpos=1}
posTile5 = {x=pos.x-1,y=pos.y-1,z=pos.z,stackpos=1}
posTile6 = {x=pos.x-1,y=pos.y,z=pos.z,stackpos=1}
posTile7 = {x=pos.x-1,y=pos.y+1,z=pos.z,stackpos=1}
posTile8 = {x=pos.x,y=pos.y+1,z=pos.z,stackpos=1}
posAll = {posTile1,posTile2,posTile3,posTile4,posTile5,posTile6,posTile7,posTile8}

for i=1, #posAll do
	if isWalkable(posAll[i]) then
		doCreateItem(item_id, 1, posAll[i])
	end
end 

function dotonprision(cid)
	if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
		local position = {x=getThingPosition(getCreatureTarget(cid)).x+2, y=getThingPosition(getCreatureTarget(cid)).y+1, z=getThingPosition(getCreatureTarget(cid)).z}
		doSendMagicEffect(position, 690)
		local position = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y+1, z=getThingPosition(getCreatureTarget(cid)).z}
		doSendMagicEffect(position, 690)
	end
end

local parameters = {cid = cid, var = var, combat1 = combat1 , combat2 = combat2}
for i = 1, 2 do
	addEvent(function()
		if isCreature(cid) then
			addEvent(dotonprision,100,cid)
			
		end
	end, 1 + ((i-1) * 8000))
end
for i = 1, 1 do
	addEvent(function()
		if isCreature(cid) then
			addEvent(removeItem, remove_time*1000, posAll)
			
		end
	end, 1 + ((i-1) * 8000))
end
exhaustion.set(cid, storage, waittime)

return true
end

 

SEGUNDO


local config = {
    wallArea = {
{1, 1, 1, 1, 1, 1, 1, 1, 1},
{1, 0, 0, 0, 0, 0, 0, 0, 1},
{1, 0, 0, 0, 0, 0, 0, 0, 1},
{1, 0, 0, 0, 0, 0, 0, 0, 1},
{1, 0, 0, 0, 2, 0, 0, 0, 1},
{1, 0, 0, 0, 0, 0, 0, 0, 1},
{1, 0, 0, 0, 0, 0, 0, 0, 1},
{1, 0, 0, 0, 0, 0, 0, 0, 1},
{1, 1, 1, 1, 1, 1, 1, 1, 1},
},
    effect = 3,          --Efeito.
    wallId = 2718,          --ID da parede.
    time = 15,              --Duração da parede.
    cooldown = {5, 5},   --{sucessCooldown, failCooldown},
    chance = 100,           --Chance da spell funcionar.
    storage = 9571,
}
function isWalkable(pos, creature, proj, pz)-- by Nord
    if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
    if getTopCreature(pos).uid > 0 and creature then return false end
    if getTileInfo(pos).protection and pz then return false, true end
    local n = not proj and 3 or 2
    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, n) or hasProperty(tile.uid, 7) then
                return false
            end
        end
    end
    return true
end
function getPosfromArea(cid, area)    --by Dokmos
    icenter = math.floor(table.getn(area)/2)+1
    jcenter = math.floor(table.getn(area[1])/2)+1
    center = area[icenter]
    ivar = table.getn(area)
    jvar = table.getn(area[1])
    i = table.getn(area)^2
    j = table.getn(area[1])^2
    local mydir = isCreature(getCreatureTarget(cid)) and getCreatureDirectionToTarget(cid, getCreatureTarget(cid)) or getCreatureLookDir(cid)
    setPlayerStorageValue(cid, 21101, -1)
    if center[jcenter] == 3 then
        if mydir == 0 then
            signal = {-1,1,1,2}
        elseif mydir == 1 then
            signal = {1,-1,2,1}
        elseif mydir == 2 then
            signal = {1,-1,1,2}
        elseif mydir == 3 then
            signal = {-1,1,2,1}
        end
    else
        signal = {-1,1,1,2}
    end
    POSITIONS = {}  
    P = 0      
    repeat
        pvar = {0,0}
        I = area[ivar]
        J = I[jvar]
        i = i-1
        j = j-1
        if J == 1 then
            if jvar < jcenter then  
                pvar[signal[3]] = signal[1]*math.abs((jcenter-jvar)) 
            elseif jvar > jcenter then  
                pvar[signal[3]] = signal[2]*math.abs((jcenter-jvar)) 
            end             
            if ivar < icenter then  
                pvar[signal[4]] = signal[1]*math.abs((icenter-ivar)) 
            elseif ivar > icenter then
                pvar[signal[4]] = signal[2]*math.abs((icenter-ivar))
            end
        end    
        if jvar > 1 then
            jvar = (jvar-1)
        elseif ivar > 1 then
            jvar = table.getn(area[1])
            ivar = (ivar-1)
        end  
        local pos = getThingPos(cid)
        local areapos = {x=pos.x+(pvar[1]),y=pos.y+(pvar[2]),z=pos.z}  
        if pos.x ~= areapos.x or pos.y ~= areapos.y then
            P = P+1
            POSITIONS[P] = areapos
        end  
    until i <= 0 and j <= 0
    return POSITIONS
end
function onCastSpell(cid)
    if getPlayerStorageValue(cid, config.storage) > os.time() then
        doPlayerSendCancel(cid, "Wait "..getPlayerStorageValue(cid, config.storage) - os.time().." second(s).")
		doCreatureSay(cid, "Voce precisa aguardar para usar novamente!!.", TALKTYPE_MONSTER)
    else
        if math.random(1, 100) > config.chance then
            doPlayerSendCancel(cid, "Your spell failed.")
            doSendAnimatedText(getThingPos(cid), "FAIL!", 215)
            setPlayerStorageValue(cid, config.storage, os.time() + config.cooldown[2])
        else
            local positions = {}
            setPlayerStorageValue(cid, config.storage, os.time() + config.cooldown[1])
            for _, pos in pairs(getPosfromArea(cid, config.wallArea)) do
                if isWalkable(pos) and not getTileInfo(pos).protection then
                    doCreateItem(config.wallId, 1, pos)
                    doSendMagicEffect(pos, config.effect)
                    table.insert(positions, pos)
                end
            end
            if #positions > 0 then
                addEvent(function()
                    for i = 1, #positions do
                        local item = getTileItemById(positions[i], config.wallId).uid
                        if item > 0 then
                            doRemoveItem(item)
                        end
                    end
                end, config.time * 1000)
            end
        end
    end
    return true
end

 

Obrigado !

Link para o post
Compartilhar em outros sites
Em 25/09/2020 em 21:24, H3ITORR disse:

Como o nto ultimate fez pro hashirama então?

eu acho que é um item normal onde todos pode passar por cima e entao ele criou em movements um scirpt que só hashirama possar andar.

 

Algo assim:

Spoiler

function onStepIn(cid, item, position, fromPosition)
if isMonster(cid) then
doTeleportThing(cid, fromPosition, true)
end

if getPlayerVocationName(cid) == "Hashirama" then
doSendMagicEffect(position, 131)
else
doTeleportThing(cid, fromPosition)
end
return true
end

 

 

Editado por BangxD (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
19 minutos atrás, BangxD disse:

eu acho que é um item normal onde todos pode passar por cima e entao ele criou em movements um scirpt que só hashirama possar andar.

Como eu poderia fazer esse movements?

Acho que só o player não a vocation tlgd 

Link para o post
Compartilhar em outros sites
Agora, H3ITORR disse:

Como eu poderia fazer esse movements?

Acho que só o player não a vocation tlgd 

Melhor cria outro topico, porque esse ja foi resolvido.

 

Algo assim:

Spoiler

function onStepIn(cid, item, position, fromPosition)
if isMonster(cid) then
doTeleportThing(cid, fromPosition, true)
end

if getPlayerVocationName(cid) == "Hashirama" then
doSendMagicEffect(position, 131)
else
doTeleportThing(cid, fromPosition)
end
return true
end

 

 

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo