Ir para conteúdo

Featured Replies

Postado

.Qual servidor ou website você utiliza como base? 

Otx 8.60

Qual o motivo deste tópico? 

eu tenho uma magia em area que por x tempo ele da 5% de dano da vida maxima ao redor dele por segundo. mas quando o caster anda, ele passa a receber o dano tbm. como eu posso arrumar isso? gostariaque quem conjurou a spell n tomasse dano.


 

Spoiler

 

Você tem o código disponível? Se tiver publique-o aqui: 


 local config = {
    wallArea = {
        {1, 1, 1}, 
        {1, 2, 1},
        {1, 1, 1},
    },
    time = 3,              --Duração da parede.
    cooldown = {60, 10},   --{sucessCooldown, failCooldown},
    chance = 100,           --Chance da spell funcionar.
    storage = 115822,
}

function isWilksble(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)) 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 isPlayer(cid) and getPlayerAccess(cid) < 3 and getPlayerStorageValue(cid, 115822)-os.time() > 1 then
local seetime = getPlayerStorageValue(cid, 115822)-os.time()
local minutes, seconds = math.floor(seetime/60), math.floor(seetime%60)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde "..minutes.." minuto(s) e "..seconds.." segundo(s) para usar novamente!")
return false
end
        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 isWilksble(pos) and not getTileInfo(pos).protection then
                    table.insert(positions, pos)
                end
            end
	    
	    	for k = 1, 25 do
				addEvent(function()
					if isCreature(cid) then
						local pos1 = {x = getPlayerPosition(cid).x + 1, y = getPlayerPosition(cid).y + 1, z = getPlayerPosition(cid).z}
						doSendMagicEffect(pos1, 121)
					end
				end, 1 + ((k-1) * 500))
			end

			for k = 1, 25 do
            if #positions > 0 then
                addEvent(function()
                    for i = 1, #positions do
						local creature = getTopCreature({x = positions[i].x, y = positions[i].y, z = positions[i].z})
						if isPlayer(creature.uid) and creature.uid ~= 0 then
							vida = getCreatureMaxHealth(creature.uid)*0.05
							local posalvo = getCreaturePosition(creature.uid)
							doSendAnimatedText(posalvo, "- 5%." , TEXTCOLOR_RED)	
							doCreatureAddHealth(creature.uid, -vida)
                        end
                    end
                end, 1 + ((k-1) * 500))
            end
            end
        end
    return true
end

 


 

 

Spoiler

	<instant name="Jashin Ni Course" words="Jashin Ni Course" maglv="10" lvl="200" mana="2000" prem="0" exhaustion="0" needlearn="0" script="especial/jashin ni course.lua">
	</instant>

 

 

Postado

@elielder

 

Testa ae:

 

Spoiler

 local config = {
    wallArea = {
        {1, 1, 1}, 
        {1, 2, 1},
        {1, 1, 1},
    },
    time = 3,              --Duração da parede.
    cooldown = {60, 10},   --{sucessCooldown, failCooldown},
    chance = 100,           --Chance da spell funcionar.
    storage = 115822,
}

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)) 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 isPlayer(cid) and getPlayerAccess(cid) < 3 and getPlayerStorageValue(cid, 115822)-os.time() > 1 then
local seetime = getPlayerStorageValue(cid, 115822)-os.time()
local minutes, seconds = math.floor(seetime/60), math.floor(seetime%60)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde "..minutes.." minuto(s) e "..seconds.." segundo(s) para usar novamente!")
return false
end
        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
                    table.insert(positions, pos)
                end
            end
	    
	    	for k = 1, 25 do
				addEvent(function()
					if isCreature(cid) then
						local pos1 = {x = getPlayerPosition(cid).x + 1, y = getPlayerPosition(cid).y + 1, z = getPlayerPosition(cid).z}
						doSendMagicEffect(pos1, 121)
					end
				end, 1 + ((k-1) * 500))
			end

			for k = 1, 25 do
            if #positions > 0 then
                addEvent(function()
                    for i = 1, #positions do
						local creature = getTopCreature({x = positions[i].x, y = positions[i].y, z = positions[i].z})
						if isPlayer(creature.uid) and creature.uid ~= 0 then
							vida = getCreatureMaxHealth(creature.uid)*0.05
							local posalvo = getCreaturePosition(creature.uid)
							doSendAnimatedText(posalvo, "- 5%." , TEXTCOLOR_RED)	
							doCreatureAddHealth(creature.uid, -vida)
                        end
                    end
                end, 1 + ((k-1) * 500))
            end
            end
        end
    return true
end

 

 

Não Testei!

Conteúdos Tragos Por Mim ao Fórum:

Venda de Vocações [Modern Aac] •

• Comando !Saga 

• [Modern Aac] DragonBall 

• Esconder •

• Naruto 2018

• • •

• •

'NtoProject - Breve'

[Show OFF] Disponível

Postado
  • Autor
Spoiler

 

18 horas atrás, D i M i T r E s C u disse:

@elielder

 

Testa ae:

 

  Ocultar conteúdo



 local config = {
    wallArea = {
        {1, 1, 1}, 
        {1, 2, 1},
        {1, 1, 1},
    },
    time = 3,              --Duração da parede.
    cooldown = {60, 10},   --{sucessCooldown, failCooldown},
    chance = 100,           --Chance da spell funcionar.
    storage = 115822,
}

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)) 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 isPlayer(cid) and getPlayerAccess(cid) < 3 and getPlayerStorageValue(cid, 115822)-os.time() > 1 then
local seetime = getPlayerStorageValue(cid, 115822)-os.time()
local minutes, seconds = math.floor(seetime/60), math.floor(seetime%60)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde "..minutes.." minuto(s) e "..seconds.." segundo(s) para usar novamente!")
return false
end
        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
                    table.insert(positions, pos)
                end
            end
	    
	    	for k = 1, 25 do
				addEvent(function()
					if isCreature(cid) then
						local pos1 = {x = getPlayerPosition(cid).x + 1, y = getPlayerPosition(cid).y + 1, z = getPlayerPosition(cid).z}
						doSendMagicEffect(pos1, 121)
					end
				end, 1 + ((k-1) * 500))
			end

			for k = 1, 25 do
            if #positions > 0 then
                addEvent(function()
                    for i = 1, #positions do
						local creature = getTopCreature({x = positions[i].x, y = positions[i].y, z = positions[i].z})
						if isPlayer(creature.uid) and creature.uid ~= 0 then
							vida = getCreatureMaxHealth(creature.uid)*0.05
							local posalvo = getCreaturePosition(creature.uid)
							doSendAnimatedText(posalvo, "- 5%." , TEXTCOLOR_RED)	
							doCreatureAddHealth(creature.uid, -vida)
                        end
                    end
                end, 1 + ((k-1) * 500))
            end
            end
        end
    return true
end

 

 

Não Testei!

 

 

não funcionou, o dano não segue o caster, o dano fica aonde a spell foi solta. ai se eu passo por ela eu tomo dano tbm, só o efeito esta seguindo o caster.

segue prints:
https://prnt.sc/1h2nkoq
https://prnt.sc/1h2nylk
https://prnt.sc/1h2oa1d

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo