Ir para conteúdo
  • Cadastre-se

Derivado Ajuda nessa linha do script? apenas 1 linha


Posts Recomendados

gente é o seguinte tem essa linha no script

Deixando Assim >> catchinfo.catch = ballcatch[item.itemid].on      100%Funcional executa apenas o on

Deixando Assim >> catchinfo.catch = ballcatch[item.itemid].on2      100%Funcional executa apenas o on2
OBS: SE EU DEIXAR AS DUAS LINHAS IRA EXECUTAR APENAS 1 DAS 2 LINHAS
esclarecendo tambem que o
on é um efeito e o on2 outro efeito quero que seja executado 1 efeito e depois outro após o termino do primeiro

Quero alterar o final da linha e não estou conseguindo
quero que após executar o on execute em seguida o on2 talvez tenha que colocar um timer

já tentei das seguintes formas mas nem uma deu certo
catchinfo.catch = ballcatch[item.itemid].on,on2

catchinfo.catch = ballcatch[item.itemid].(on,on2)
catchinfo.catch = ballcatch[item.itemid].on.on2
catchinfo.catch = ballcatch[item.itemid].[on.on2]

catchinfo.catch = ballcatch[item.itemid].on+on2

catchinfo.catch = ballcatch[item.itemid].on and on2

local da linha

  Mostrar conteúdo oculto

 

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

Você está declarando uma variável com o valor x e depois declarando a mesma variável com o valor y, logo, a variável vai valer apenas y.

Troca o nome da variável e faz um addEvent (nome da função, tempo, parâmentros da função)

No caso, o tempo está em milésimos, para ser em segundos, coloque tempo * 1000

 

Não dou suporte via PM, crie um tópico caso tenha dúvidas.

Isso previne que outras pessoas com a mesma dúvida criem tópicos desnecessários.

Link para o post
Compartilhar em outros sites
  Em 01/05/2016 em 22:52, Talesigorvr disse:

Você está declarando uma variável com o valor x e depois declarando a mesma variável com o valor y, logo, a variável vai valer apenas y.

Troca o nome da variável e faz um addEvent (nome da função, tempo, parâmentros da função)

No caso, o tempo está em milésimos, para ser em segundos, coloque tempo * 1000

 

Mostrar mais  

será que poderia fazer isso por mim?
não estou conseguindo, sou iniciante em scripts sei apenas o básico do básico vou deixar o script completo espero que possa me ajudar
 

  Mostrar conteúdo oculto


 

Link para o post
Compartilhar em outros sites
local segundoEfeito = 500 -- Tempo que irá aparecer o segundo efeito. [500 = meio segundo]
local ballcatch = {                    --id normal, id da ball shiy
[2394] = {cr = 2, on = 193, off = 192, ball = {11826, 11737}, send = 47, typeee = "normal", boost = "0"},  --alterado v1.9  \/
[2391] = {cr = 6, on = 198, off = 197, ball = {11832, 11740}, send = 48, typeee = "great", boost = "0"},
[2393] = {cr = 10, on = 202, off = 201, ball = {11835, 11743}, send = 46, typeee = "super", boost = "0"},
[2392] = {cr = 15, on = 200, off = 199, ball = {11829, 11746}, send = 49, typeee = "ultra", boost = "0"},
[12617] = {cr = 6, on = 204, off = 203, ball = {10975, 12621}, send = 35, typeee = "saffari", boost = "0"},
[12832] = {cr = 100000, on = 23, off = 24, ball = {12826, 12829}, send = 181, typeee = "dark", boost = "50"},
[15129] = {cr = 100000, on = 23, on2 = 10, off = 24, ball = {12826, 12829}, send = 181, typeee = "flash", boost = "50"},
}
function onUse(cid, item, frompos, item3, topos)
	local item2 = getTopCorpse(topos)
	if item2 == null then
		return true
	end
	if getItemAttribute(item2.uid, "catching") == 1 then
		return true
	end  
	if getItemAttribute(item2.uid, "golden") and getItemAttribute(item2.uid, "golden") == 1 then
		return doPlayerSendCancel(cid, "You can't try to catch a pokemon in the Golden Arena!")   
	end
	local name = string.lower(getItemNameById(item2.itemid))
	name = string.gsub(name, "fainted ", "")
	name = string.gsub(name, "defeated ", "")
	name = doCorrectPokemonName(name)
	local x = pokecatches[name]
	if not x then return true end
	local shinys = {"Shiny Mr. mime", "Shiny Altaria", "Shiny Swampert", "Shiny Weezing", "Shiny Flygon", "Shiny Rhyperior", "Shiny Blaziken", "Shiny Tangela", "Shiny Wailord", "Shiny Aggron", "Shiny Absol", "Shiny Lucario", "Shiny Metagross", "Shiny Yanmega", "Shiny Wobbuffet", "Shiny Scizor", "Shiny Slowking", "Shiny Alakazam", "Shiny Scyther", "Shiny Electivire", "Shiny Magmortar", "Shiny Salamence", "Shiny Magmar", "Shiny Mantine", "Shiny Gyarados", "Shiny Snorlax", "Shiny Onix", "Shiny Electabuzz", "Shiny Pidgeot", "Aerodactyl", "Ditto", "Shiny Gengar"}
	if item.itemid == 12832 and isInArray(shinys, name) then
		doPlayerSendCancel(cid, "Você não pode catar esse pokemon com a master ball!")
		return true
	end
	local storage = newpokedex[name].stoCatch
	if getPlayerStorageValue(cid, storage) == -1 or not string.find(getPlayerStorageValue(cid, storage), ";") then  --alterado v1.9
		setPlayerStorageValue(cid, storage, "normal = 0, great = 0, super = 0, ultra = 0, saffari = 0, dark = 0;, dark = 0;, flash = 0;")             --alterado v1.9
	end
	local owner = getItemAttribute(item2.uid, "corpseowner")
	if owner and isCreature(owner) and isPlayer(owner) and cid ~= owner then   
		doPlayerSendCancel(cid, "You are not allowed to catch this pokemon.")
		return true
	end
	local newidd = isShinyName(name) and ballcatch[item.itemid].ball[2] or ballcatch[item.itemid].ball[1] --alterado v1.9       
	local typeee = ballcatch[item.itemid].typeee
	local boost = ballcatch[item.itemid].boost
	local catchinfo = {}
	catchinfo.rate = ballcatch[item.itemid].cr
	catchinfo.catch = function mandar2Efeitos() ballcatch[item.itemid].on return addEvent(ballcatch[item.itemid].on2, segundoEfeito) end
	catchinfo.fail = ballcatch[item.itemid].off
	catchinfo.newid = newidd                      
	catchinfo.name = doCorrectPokemonName(name)
	catchinfo.topos = topos
	catchinfo.chance = x.chance
	doSendDistanceShoot(getThingPos(cid), topos, ballcatch[item.itemid].send)
	doRemoveItem(item.uid, 1)
	local d = getDistanceBetween(getThingPos(cid), topos)
	if getPlayerStorageValue(cid, 98796) >= 1 and getPlayerItemCount(cid, 12617) <= 0 then  --alterado v1.9
		setPlayerStorageValue(cid, 98796, -1)
		setPlayerStorageValue(cid, 98797, -1)                                              
		doTeleportThing(cid, SafariOut, false)
		doSendMagicEffect(getThingPos(cid), 21)
		doPlayerSendTextMessage(cid, 27, "You spend all your saffari balls, good luck in the next time...")
	end
	addEvent(doSendPokeBall, d * 70 + 100 - (d * 14) , cid, catchinfo, false, false, typeee)
	addEvent(doSendMagicEffect, (d * 70 + 100 - (d * 14)) - 100, topos, 3)
	return true
end

 

Eternera Tibia Server - RPG

Link para o post
Compartilhar em outros sites
  Em 05/05/2016 em 14:56, anderkrox disse:

 

Mostrar mais  

deu este erro

[Error - LuaScriptInterface::loadFile] data/actions/scripts/catch.lua:47: '(' expected near 'mandar2Efeitos'
[05/05/2016 20:46:36] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/catch.lua)
[05/05/2016 20:46:36] data/actions/scripts/catch.lua:47: '(' expected near 'mandar2Efeitos'

 

Link para o post
Compartilhar em outros sites
local segundoEfeito = 500 -- Tempo que irá aparecer o segundo efeito. [500 = meio segundo]
local ballcatch = {                    --id normal, id da ball shiy
[2394] = {cr = 2, on = 193, off = 192, ball = {11826, 11737}, send = 47, typeee = "normal", boost = "0"},  --alterado v1.9  \/
[2391] = {cr = 6, on = 198, off = 197, ball = {11832, 11740}, send = 48, typeee = "great", boost = "0"},
[2393] = {cr = 10, on = 202, off = 201, ball = {11835, 11743}, send = 46, typeee = "super", boost = "0"},
[2392] = {cr = 15, on = 200, off = 199, ball = {11829, 11746}, send = 49, typeee = "ultra", boost = "0"},
[12617] = {cr = 6, on = 204, off = 203, ball = {10975, 12621}, send = 35, typeee = "saffari", boost = "0"},
[12832] = {cr = 100000, on = 23, off = 24, ball = {12826, 12829}, send = 181, typeee = "dark", boost = "50"},
[15129] = {cr = 100000, on = 23, on2 = 10, off = 24, ball = {12826, 12829}, send = 181, typeee = "flash", boost = "50"},
}
function onUse(cid, item, frompos, item3, topos)
	local item2 = getTopCorpse(topos)
	if item2 == null then
		return true
	end
	if getItemAttribute(item2.uid, "catching") == 1 then
		return true
	end  
	if getItemAttribute(item2.uid, "golden") and getItemAttribute(item2.uid, "golden") == 1 then
		return doPlayerSendCancel(cid, "You can't try to catch a pokemon in the Golden Arena!")   
	end
	local name = string.lower(getItemNameById(item2.itemid))
	name = string.gsub(name, "fainted ", "")
	name = string.gsub(name, "defeated ", "")
	name = doCorrectPokemonName(name)
	local x = pokecatches[name]
	if not x then return true end
	local shinys = {"Shiny Mr. mime", "Shiny Altaria", "Shiny Swampert", "Shiny Weezing", "Shiny Flygon", "Shiny Rhyperior", "Shiny Blaziken", "Shiny Tangela", "Shiny Wailord", "Shiny Aggron", "Shiny Absol", "Shiny Lucario", "Shiny Metagross", "Shiny Yanmega", "Shiny Wobbuffet", "Shiny Scizor", "Shiny Slowking", "Shiny Alakazam", "Shiny Scyther", "Shiny Electivire", "Shiny Magmortar", "Shiny Salamence", "Shiny Magmar", "Shiny Mantine", "Shiny Gyarados", "Shiny Snorlax", "Shiny Onix", "Shiny Electabuzz", "Shiny Pidgeot", "Aerodactyl", "Ditto", "Shiny Gengar"}
	if item.itemid == 12832 and isInArray(shinys, name) then
		doPlayerSendCancel(cid, "Você não pode catar esse pokemon com a master ball!")
		return true
	end
	local storage = newpokedex[name].stoCatch
	if getPlayerStorageValue(cid, storage) == -1 or not string.find(getPlayerStorageValue(cid, storage), ";") then  --alterado v1.9
		setPlayerStorageValue(cid, storage, "normal = 0, great = 0, super = 0, ultra = 0, saffari = 0, dark = 0;, dark = 0;, flash = 0;")             --alterado v1.9
	end
	local owner = getItemAttribute(item2.uid, "corpseowner")
	if owner and isCreature(owner) and isPlayer(owner) and cid ~= owner then   
		doPlayerSendCancel(cid, "You are not allowed to catch this pokemon.")
		return true
	end
	local newidd = isShinyName(name) and ballcatch[item.itemid].ball[2] or ballcatch[item.itemid].ball[1] --alterado v1.9       
	local typeee = ballcatch[item.itemid].typeee
	local boost = ballcatch[item.itemid].boost
	local catchinfo = {}
	catchinfo.rate = ballcatch[item.itemid].cr
	catchinfo.catch = function mandar2Efeitos(func) ballcatch[item.itemid].on return addEvent(ballcatch[item.itemid].on2, segundoEfeito) end
	catchinfo.fail = ballcatch[item.itemid].off
	catchinfo.newid = newidd                      
	catchinfo.name = doCorrectPokemonName(name)
	catchinfo.topos = topos
	catchinfo.chance = x.chance
	doSendDistanceShoot(getThingPos(cid), topos, ballcatch[item.itemid].send)
	doRemoveItem(item.uid, 1)
	local d = getDistanceBetween(getThingPos(cid), topos)
	if getPlayerStorageValue(cid, 98796) >= 1 and getPlayerItemCount(cid, 12617) <= 0 then  --alterado v1.9
		setPlayerStorageValue(cid, 98796, -1)
		setPlayerStorageValue(cid, 98797, -1)                                              
		doTeleportThing(cid, SafariOut, false)
		doSendMagicEffect(getThingPos(cid), 21)
		doPlayerSendTextMessage(cid, 27, "You spend all your saffari balls, good luck in the next time...")
	end
	addEvent(doSendPokeBall, d * 70 + 100 - (d * 14) , cid, catchinfo, false, false, typeee)
	addEvent(doSendMagicEffect, (d * 70 + 100 - (d * 14)) - 100, topos, 3)
	return true
end

 

Eternera Tibia Server - RPG

Link para o post
Compartilhar em outros sites
  Em 05/05/2016 em 23:54, anderkrox disse:

 

Mostrar mais  

[Error - LuaScriptInterface::loadFile] data/actions/scripts/catch.lua:47: '(' expected near 'mandar2Efeitos'
[05/05/2016 20:56:03] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/catch.lua)
[05/05/2016 20:56:03] data/actions/scripts/catch.lua:47: '(' expected near 'mandar2Efeitos'

mesma coisa continua o erro

Link para o post
Compartilhar em outros sites

function mandar2Efeitos()
    ballcatch[item.itemid].on
    ballcatch[item.itemid].on2
end

local ballcatch = {                    --id normal, id da ball shiy
[2394] = {cr = 2, on = 193, off = 192, ball = {11826, 11737}, send = 47, typeee = "normal", boost = "0"},  --alterado v1.9  \/
[2391] = {cr = 6, on = 198, off = 197, ball = {11832, 11740}, send = 48, typeee = "great", boost = "0"},
[2393] = {cr = 10, on = 202, off = 201, ball = {11835, 11743}, send = 46, typeee = "super", boost = "0"},
[2392] = {cr = 15, on = 200, off = 199, ball = {11829, 11746}, send = 49, typeee = "ultra", boost = "0"},
[12617] = {cr = 6, on = 204, off = 203, ball = {10975, 12621}, send = 35, typeee = "saffari", boost = "0"},
[12832] = {cr = 100000, on = 23, off = 24, ball = {12826, 12829}, send = 181, typeee = "dark", boost = "50"},
[15129] = {cr = 100000, on = 23, on2 = 10, off = 24, ball = {12826, 12829}, send = 181, typeee = "flash", boost = "50"},
}
function onUse(cid, item, frompos, item3, topos)
    local item2 = getTopCorpse(topos)
    if item2 == null then
        return true
    end
    if getItemAttribute(item2.uid, "catching") == 1 then
        return true
    end  
    if getItemAttribute(item2.uid, "golden") and getItemAttribute(item2.uid, "golden") == 1 then
        return doPlayerSendCancel(cid, "You can't try to catch a pokemon in the Golden Arena!")   
    end
    local name = string.lower(getItemNameById(item2.itemid))
    name = string.gsub(name, "fainted ", "")
    name = string.gsub(name, "defeated ", "")
    name = doCorrectPokemonName(name)
    local x = pokecatches[name]
    if not x then return true end
    local shinys = {"Shiny Mr. mime", "Shiny Altaria", "Shiny Swampert", "Shiny Weezing", "Shiny Flygon", "Shiny Rhyperior", "Shiny Blaziken", "Shiny Tangela", "Shiny Wailord", "Shiny Aggron", "Shiny Absol", "Shiny Lucario", "Shiny Metagross", "Shiny Yanmega", "Shiny Wobbuffet", "Shiny Scizor", "Shiny Slowking", "Shiny Alakazam", "Shiny Scyther", "Shiny Electivire", "Shiny Magmortar", "Shiny Salamence", "Shiny Magmar", "Shiny Mantine", "Shiny Gyarados", "Shiny Snorlax", "Shiny Onix", "Shiny Electabuzz", "Shiny Pidgeot", "Aerodactyl", "Ditto", "Shiny Gengar"}
    if item.itemid == 12832 and isInArray(shinys, name) then
        doPlayerSendCancel(cid, "Você não pode catar esse pokemon com a master ball!")
        return true
    end
    local storage = newpokedex[name].stoCatch
    if getPlayerStorageValue(cid, storage) == -1 or not string.find(getPlayerStorageValue(cid, storage), ";") then  --alterado v1.9
        setPlayerStorageValue(cid, storage, "normal = 0, great = 0, super = 0, ultra = 0, saffari = 0, dark = 0;, dark = 0;, flash = 0;")             --alterado v1.9
    end
    local owner = getItemAttribute(item2.uid, "corpseowner")
    if owner and isCreature(owner) and isPlayer(owner) and cid ~= owner then   
        doPlayerSendCancel(cid, "You are not allowed to catch this pokemon.")
        return true
    end
    local newidd = isShinyName(name) and ballcatch[item.itemid].ball[2] or ballcatch[item.itemid].ball[1] --alterado v1.9       
    local typeee = ballcatch[item.itemid].typeee
    local boost = ballcatch[item.itemid].boost
    local catchinfo = {}
    catchinfo.rate = ballcatch[item.itemid].cr
    catchinfo.catch = mandar2Efeitos()
    catchinfo.fail = ballcatch[item.itemid].off
    catchinfo.newid = newidd                      
    catchinfo.name = doCorrectPokemonName(name)
    catchinfo.topos = topos
    catchinfo.chance = x.chance
    doSendDistanceShoot(getThingPos(cid), topos, ballcatch[item.itemid].send)
    doRemoveItem(item.uid, 1)
    local d = getDistanceBetween(getThingPos(cid), topos)
    if getPlayerStorageValue(cid, 98796) >= 1 and getPlayerItemCount(cid, 12617) <= 0 then  --alterado v1.9
        setPlayerStorageValue(cid, 98796, -1)
        setPlayerStorageValue(cid, 98797, -1)                                              
        doTeleportThing(cid, SafariOut, false)
        doSendMagicEffect(getThingPos(cid), 21)
        doPlayerSendTextMessage(cid, 27, "You spend all your saffari balls, good luck in the next time...")
    end
    addEvent(doSendPokeBall, d * 70 + 100 - (d * 14) , cid, catchinfo, false, false, typeee)
    addEvent(doSendMagicEffect, (d * 70 + 100 - (d * 14)) - 100, topos, 3)
    return true
end

Editado por anderkrox (veja o histórico de edições)

Eternera Tibia Server - RPG

Link para o post
Compartilhar em outros sites
  Em 05/05/2016 em 23:59, anderkrox disse:

 

Mostrar mais  

outro erro agora
[Error - LuaScriptInterface::loadFile] data/actions/scripts/catch.lua:3: '=' expected near 'ballcatch'
[05/05/2016 21:23:37] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/catch.lua)
[05/05/2016 21:23:37] data/actions/scripts/catch.lua:3: '=' expected near 'ballcatch'

Link para o post
Compartilhar em outros sites

O problema não é o conhecimento, o problema é que trata-se de script de Pokemon, e isso ai não é o único script para solucionar teu problema. Tem funções que estão em bibliotecas, por exemplo esse ballCatch.

Eternera Tibia Server - RPG

Link para o post
Compartilhar em outros sites
  Em 09/05/2016 em 10:55, anderkrox disse:

O problema não é o conhecimento, o problema é que trata-se de script de Pokemon, e isso ai não é o único script para solucionar teu problema. Tem funções que estão em bibliotecas, por exemplo esse ballCatch.

Mostrar mais  

me desculpe eu pensei que apenas esse script seria suficiente pois pensei que era algo ali naquela unica linha vamos la vou postar o script e o systema

o ballcatch é apenas um local sendo que 2394 é o id do item o cr a chance de dar catch, o On um efeito o on2 outro efeito, o off outro efeito o send é o misseli o typee é o tipo de pokeball

Script
 

  Mostrar conteúdo oculto



e aqui esta o systema
 

  Mostrar conteúdo oculto

 

Editado por wevertonvrb (veja o histórico de edições)
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.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Conteúdo Similar

    • Por LeoTK
      Salve galera neste tópico irei postar algumas prints do mapa do servidor para quem queira acompanhar e quem sabe até utilizar de inspiração para mapear o seu NTO.
       
      #Att 11/08/2022

       
       
       
       
      Konoha (Em Desenvolvimento)
       
       
       
       
    • Por DiigooMix
      Como o título já diz, será que alguém possui sprite do hitto e se possível as transformações dele?
    • Por OmegaZero
      Olá gostaria que alguém me ajudasse com uma "scripting" não sei se é pela mesma, seria o seguinte uma determinada arma teria a chance de dar double hit e não sei oque fazer alguem poderia ajudar?

      OBS:não sei se é o local correto se não for mova, desculpe
    • Por Madarasenju
      Olá galera do Tibia King, queria por uns npc's no meu server que não tem função de trade nem nada do tipo, queria que eles só andassem como enfeite, Rep+ Pra quem me ajudar... grato desde já.
    • Por SilenceRoot
      A magia é assim o você usa a a magia e ela ficará ativado por 10 segundos, até que o inimigo lance a primeira magia ou todos de uma vez, quando ele lançar a primeira magia, ele não lhe acertará ou seja esquivando dela, e logo em seguida será teletransportado aleatoriamente ao redor do inimigo que usou.
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo