Tudo que Garou postou
-
Parabéns pra mim \õ
Parabéns
-
O que falta para um servidor de Harry Potter sair do papel?
Programação de um servidor com a temática do Harry Potter, é deveras simples. Acho que o que falta mesmo são spriters, digamos, que queiram fazer parte de uma equipe, e de graça.
-
(Resolvido)Bug NPC de promotion customizado.
Checagem da promotion no lugar errado dá nisso. NPC 1: local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function _onCreatureSay(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid local storage = getCreatureStorage(cid, 2590) if msgcontains(msg, "promotion") then if getPlayerPromotionLevel(cid) == 0 then if storage == -1 then selfSay("So you need a promotion? I can give her for you, but first, give this letter to my brother, he always ask me if I am good, bad, you know...", cid) doCreatureSetStorage(cid, 2590, 0) local item = doPlayerAddItem(cid, 2597, 1) local text = "Querido, como você está? Espero que tenha tratado de sua saúde, mande-me notícias!" doSetItemText(item, text) npcHandler:releaseFocus(cid) elseif storage == 0 then selfSay("I am waiting for you to deliver my letter...", cid) npcHandler:releaseFocus(cid) else selfSay("Hey, you delivered my letter! Thanks, man. Here is your promotion!", cid) doPlayerSetPromotionLevel(cid, 1) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE) npcHandler:releaseFocus(cid) end else selfSay("You already are promoted!", cid) end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, _onCreatureSay) npcHandler:addModule(FocusModule:new()) NPC 2: local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function _onCreatureSay(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid local status = getCreatureStorage(cid, 2590) if msgcontains(msg, "letter") then if status == -1 then selfSay("What? I think you didn't talk with my brother...", cid) elseif status == 0 then if doPlayerRemoveItem(cid, 2590) then selfSay("Hey, thanks, this is my brother's letter. Thank you very much. I am going to tell him about you.", cid) doCreatureSetStorage(cid, 2590, 1) else selfSay("You don't have my brother's letter", cid) end else selfSay("You already gave me my brother's letter", cid) end npcHandler:releaseFocus(cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, _onCreatureSay) npcHandler:addModule(FocusModule:new()) Como eu sou meio engessado, usei doCreatureSetStorage denovo, então sinta-se livre para fazer os ajustes necessários. Abraços.
-
(Resolvido)Magia que custa % de mana
Troque mana por manapercent no spells.xml
-
(Resolvido)Bug NPC de promotion customizado.
O segundo NPC não necessita de ajustes: local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function _onCreatureSay(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid local storage = getCreatureStorage(cid, 2590) if msgcontains(msg, "promotion") then if storage == -1 then if getPlayerPromotionLevel(cid) == 0 then selfSay("So you need a promotion? I can give her for you, but first, give this letter to my brother, he always ask me if I am good, bad, you know...", cid) doCreatureSetStorage(cid, 2590, 0) local item = doPlayerAddItem(cid, 2597, 1) local text = "Querido, como você está? Espero que tenha tratado de sua saúde, mande-me notícias!" doSetItemText(item, text) else selfSay("You already are promoted!", cid) -- No caso de haver outra maneira de promotion (?) end npcHandler:releaseFocus(cid) elseif storage == 0 then selfSay("I am waiting for you to deliver my letter...", cid) npcHandler:releaseFocus(cid) else selfSay("Hey, you delivered my letter! Thanks, man. Here is your promotion!", cid) doPlayerSetPromotionLevel(cid, 1) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE) npcHandler:releaseFocus(cid) end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, _onCreatureSay) npcHandler:addModule(FocusModule:new())
-
(Resolvido)Escolher magias!
*risos* Não editei nada. Obrigado, boa sorte.
-
(Resolvido)O que eu fiz de errado? NPC simples
Pronto, já testei e está funcional. Incrementei o diálogo do NPC também e arrumei o inglês, tive que usar uma tabela para as frases para não precisar toda hora de if e elseif para a linguagem do NPC. Boa sorte. local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end local storages = { 200201, -- Controla o estado da task [Disponibilidade/Em Curso/Terminada] 91001, -- Controla o número de monstros mortos 8971, -- Controla a linguagem do NPC } local sentences = { [1] = { [1] = "Great! A new soul arrived from the {portal}! Welcome, I hope you can help me.", [2] = "Ótimo! Uma nova alma chegou do {portal}! Seja bem-vindo, espero que você possa me ajudar.", }, [2] = { [1] = "A crystal angel came down here, in Aurea, and opened a portal where humans arrive from another dimension to {save} us.", [2] = "Um anjo de cristal desceu aqui, em Aurea, e abriu um portal onde humanos chegam de outra dimensão para nos {salvar}.", }, [3] = { [1] = "We live in a apocalyptic world, in a war of several races... and you can be the {chosen} one!", [2] = "Nós vivemos em um mundo apocalíptico, em uma guerra de várias raças... e você pode ser o {escolhido}!", }, [4] = { [1] = { "Calm down! First we need to train you... you need to help us with simple tasks, until you are strong enough...", "For example, we are facing a {rat} plague, they are coming out of sewers!", }, [2] = { "Acalme-se! Primeiro, precisamos treinar você... você precisa nos ajudar com tarefas simples, até que esteja forte o bastante...", "Como por exemplo, estamos enfrentando uma praga de {ratos}, eles estão saindo dos bueiros!", }, }, [5] = { [1] = "I am glad you can help us, please kill 10 rats, they are in the sewer in front of the store.", [2] = "Estou grato que você pode nos ajudar, por favor mate 10 ratos, eles estão no bueiro na frente da loja.", }, [6] = { [1] = "You already killed 10 rats?", [2] = "Você já matou 10 ratos?", }, [7] = { [1] = { "You have completed the task! Keep this Saber and train until you get Level 8, then talk to the Oracle in the temple.", "He will send you to Aurea, there talk to", }, [2] = { "Você completou a tarefa! Fique com este Sabre e treine até atingir o Level 8, então fale com o Oráculo no templo.", "Ele irá te mandar para Aurea, lá fale com", }, }, [8] = { [1] = "I can hear the rats' noise from here... I think you didn't killed 10 rats...", [2] = "Posso ouvir o barulho dos ratos daqui... Acho que você não matou 10 ratos...", }, [9] = { [1] = "You already completed the task!", [2] = "Você já completou a tarefa!", }, } function _onCreatureSay(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid local language = math.max(getCreatureStorage(cid, storages[3]), 1) -- Por padrão, a linguagem será Inglês (?) if msgcontains(msg:lower(), "task") then if getCreatureStorage(cid, storages[1]) == -1 then -- Task disponível selfSay(sentences[1][language], cid) talkState[talkUser] = 1 elseif getCreatureStorage(cid, storages[1]) == 1 then -- Task em curso selfSay(sentences[6][language], cid) talkState[talkUser] = 5 elseif getCreatureStorage(cid, storages[1]) == 2 then selfSay(sentences[9][language], cid) npcHandler:releaseFocus(cid) end end if talkState[talkUser] == 1 then if msgcontains(msg, "portal") then selfSay(sentences[2][language], cid) talkState[talkUser] = 2 end elseif talkState[talkUser] == 2 then if msgcontains(msg, "save") or msgcontains(msg, "salvar") then selfSay(sentences[3][language], cid) talkState[talkUser] = 3 end elseif talkState[talkUser] == 3 then if msgcontains(msg, "chosen") or msgcontains(msg, "escolhido") then selfSay(sentences[4][language][1], cid) selfSay(sentences[4][language][2], cid) talkState[talkUser] = 4 end elseif talkState[talkUser] == 4 then if msgcontains(msg, "rat") or msgcontains(msg, "ratos") then selfSay(sentences[5][language], cid) doCreatureSetStorage(cid, storages[1], 1) -- Task em curso npcHandler:releaseFocus(cid) end elseif talkState[talkUser] == 5 then if msgcontains(msg, "yes") or msgcontains(msg, "sim") then if getCreatureStorage(cid, storages[2]) >= 10 then -- Checar número de ratos mortos doCreatureSetStorage(cid, storages[1], 2) -- Task finalizada doPlayerAddItem(cid, 2385, 1) selfSay(sentences[7][language][1], cid) selfSay(sentences[7][language][2], cid) else selfSay(sentences[8][language], cid) end end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, _onCreatureSay) npcHandler:addModule(FocusModule:new())
-
(Resolvido)Erro creaturescript onkill gold cath
Como eu testo meus scripts em localhost, não há influência de possíveis gargalos na conexão. Tente com o script abaixo, alterei apenas o tempo do addEvent para um intervalo maior. function autoloot(cid, position, corpseID) if not isPlayer(cid) then return end local corpse = getTileItemById(position, corpseID) if corpse and isContainer(corpse.uid) then local gold = 0 for slot = 1, getContainerSize(corpse.uid) do local item = getContainerItem(corpse.uid, slot) local amount = (item.itemid == 2148 and item.type or (item.itemid == 2152 and item.type * 100 or (item.itemid == 2160 and item.type * 10000)) or 0) if item.uid > 0 then if amount > 0 then gold = gold + amount doRemoveItem(item.uid) end else break end end doPlayerAddMoney(cid, gold) end end function onKill(cid, target) if isPlayer(target) then return true end local position = getCreaturePosition(target) local info = getMonsterInfo(getCreatureName(target)) addEvent(autoloot, 100, cid, position, info.lookCorpse) return true end
-
Code apagando tópico, Falta de ferramentas para postar script
Aqui o não apaga meu tópico e aceita indentação normalmente
-
Bug no script de shop: Char recebe itens infinitamente
Infelizmente, recomendo que você troque o executável do seu servidor. Procure por um TFS (The Forgotten Server), pois acredito que o que você está usando não tem a função necessária para ter um script desse tipo.
-
(Resolvido)Problema com hits da spell
local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat, COMBAT_PARAM_HITCOLOR, 94) setCombatParam(combat, COMBAT_PARAM_EFFECT, 15) setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -2.5, 0, -3.0, 0) local combat2 = createCombatObject() setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat2, COMBAT_PARAM_HITCOLOR, 94) setCombatParam(combat2, COMBAT_PARAM_EFFECT, 15) setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, -2.5, 0, -3.0, 0) local combat3 = createCombatObject() setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat3, COMBAT_PARAM_HITCOLOR, 94) setCombatParam(combat3, COMBAT_PARAM_EFFECT, 15) setCombatFormula(combat3, COMBAT_FORMULA_LEVELMAGIC, -2.5, 0, -3.0, 0) local combat4 = createCombatObject() setCombatParam(combat4, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat4, COMBAT_PARAM_HITCOLOR, 94) setCombatParam(combat4, COMBAT_PARAM_EFFECT, 15) setCombatFormula(combat4, COMBAT_FORMULA_LEVELMAGIC, -2.5, 0, -3.0, 0) local area3 = createCombatArea({ {1, 1, 1}, {1, 3, 1}, {1, 1, 1}, }) setCombatArea(combat3, area3) local area4 = createCombatArea({ {1, 1, 1}, {1, 3, 1}, {1, 1, 1}, }) setCombatArea(combat4, area4) function doSpell(cid, var) local target = getCreatureTarget(cid) if isCreature(target) then local position = getCreaturePosition(target) local toPosition = {x = position.x + 2, y = position.y + 1, z = position.z} doSendMagicEffect(toPosition, 164) addEvent(doCombat, 1, cid, combat, var) addEvent(doCombat, 200, cid, combat2, var) addEvent(doCombat, 800, cid, combat3, positionToVariant(position)) addEvent(doCombat, 1100, cid, combat4, positionToVariant(position)) end end function onCastSpell(cid, var) return doSpell(cid, var) end
-
(Resolvido)Escolher magias!
Eu testei superficialmente, mas acho que funciona. local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end local spells = { ["rage of the skies"] = {price = 5, vocations = {1}, level = 60, storage = 17501}, ["hells core"] = {price = 5, vocations = {1}, level = 60, storage = 17501}, ["eternal winter"] = {price = 5, vocations = {1}, level = 60, storage = 17501}, ["wrath of nature"] = {price = 5, vocations = {1}, level = 60, storage = 17501}, } function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid local moeda = 2157 if msgcontains(msg, "spells") then local text = "Eu vendo essas magias: " local name, values = next(spells, nil) while name do text = text .." {".. name .."}: ".. values.price .." moedas" name, values = next(spells, name) if not name then text = text .."." else text = text .."," end end selfSay(text, cid) elseif spells[msg:lower()] then local spell = msg:lower() if not getPlayerLearnedInstantSpell(cid, spell) then if getPlayerLevel(cid) >= spells[spell].level then if isInArray(spells[spell].vocations, getPlayerVocation(cid)) then if doPlayerRemoveItem(cid, moeda, spells[spell].price) then if getCreatureStorage(cid, spells[spell].storage) == -1 then doPlayerLearnInstantSpell(cid, spell) selfSay("Você aprendeu uma nova magia chamada ".. spell .."!", cid) doCreatureSetStorage(cid, spells[spell].storage, 1) else selfSay("Você aprendeu uma magia desse tipo", cid) end else selfSay("Você não possui ".. spells[spell].price .." ".. getItemNameById(moeda) ..".", cid) end else selfSay("Sua vocação não pode aprender essa magia.", cid) end else selfSay("Você não possui o level necessário para aprender essa magia.", cid) end else selfSay("Você já aprendeu essa magia.", cid) end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
-
(Resolvido)Escolher magias!
Olá, Possível, é sim. Mas seria necessário fazer um pequeno trecho de código, no script de compra de magias (seja NPC, Talkaction, etcétera), para essa verificação se o jogador já comprou magia semelhante a quer comprar.
-
(Resolvido)O que eu fiz de errado? NPC simples
Olá, O erro estava nessa linha npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, "creatureSayCallback") O callback do Jiddo NPC System deve ser chamado como função e não como string, corrija para: npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
-
Bug no script de shop: Char recebe itens infinitamente
Tudo indica que seu servidor não possui a função db.query para executar consultas SQL no banco de dados, o que é por si só é muito estranho. Qual a versão do Tibia do servidor? Usa The Forgotten Server, se sim qual revisão?
-
Problema no pc!
Qual o processador, a memória RAM e o sistema operacional utilizado?
- Puxar/Empurrar (conjunto de spells)
-
Erro de script
Registrou no creaturescripts.xml e colocou a função registerCreatureEvent no login.lua?
-
(Resolvido)Erro creaturescript onkill gold cath
Não se incomode com reputação, não preciso disso. Então, quando falha, dá algum erro no console? Todos os testes que fiz, matando vários Rat, ele foi normal.
-
[AJUDA] Problema no distro quando salva
Perdão, má interpretação do erro da minha parte: ALTER TABLE global_storage ADD world_id INTEGER NOT NULL DEFAULT 0;
-
[AJUDA] Problema no distro quando salva
Execute isso no banco de dados: CREATE TABLE "global_storage" ( "key" INTEGER NOT NULL, "world_id" INTEGER NOT NULL DEFAULT 0, "value" VARCHAR(255) NOT NULL DEFAULT '0', UNIQUE ("key", "world_id") ); Caso seja MySQL, deve ser feito no PHPMyAdmin, caso seja SQLite deve ser feito em programas que abrem arquivos .s3db
-
(Resolvido)Erro creaturescript onkill gold cath
Me diz o nome dos monstros que o loot falha que eu posso simular e estudar o problema.
-
(Resolvido)Erro creaturescript onkill gold cath
function autoloot(cid, position, corpseID) if not isPlayer(cid) then return end local corpse = getTileItemById(position, corpseID) if corpse and isContainer(corpse.uid) then local gold = 0 for slot = 1, getContainerSize(corpse.uid) do local item = getContainerItem(corpse.uid, slot) local amount = (item.itemid == 2148 and item.type or (item.itemid == 2152 and item.type * 100 or (item.itemid == 2160 and item.type * 10000)) or 0) if item.uid > 0 then if amount > 0 then gold = gold + amount doRemoveItem(item.uid) end else break end end doPlayerAddMoney(cid, gold) end end function onKill(cid, target) if isPlayer(target) then return true end local position = getCreaturePosition(target) local info = getMonsterInfo(getCreatureName(target)) addEvent(autoloot, 3, cid, position, info.lookCorpse) return true end
-
Função para arredondar...
A função que eu postei no tópico arrendonda tanto para baixo como para cima, dependendo do número. 4.6 = Retorna 5 4.42 = Retorna 4 4.44 com uma casa decimal = 4.4 4.46 com uma casa decimal = 4.5
-
(Resolvido)Dano Absurdo do nada!
Veja se você alterou algo nas configurações do critical no config.lua, ele é meio problemático.