Tudo que Pissolato postou
-
Quick Loot | TFS 0.4 REV 3996
O problema ocorre porque você remove os itens enquanto ainda está iterando o container. Em servidores OT (especialmente base TFS 0.x / 8.60), quando você remove um item de um container, os índices mudam. Então o loop pula itens e você precisa clicar novamente. Por que aconteceExemplo: Container: slot 0: gold slot 1: sword slot 2: shieldLoop: pega slot 0 → remove gold container vira: slot 0: sword slot 1: shieldloop vai para i = 2 → shield ➡️ sword foi pulada Por isso você precisa clicar várias vezes. Solução corretaSempre remova do último slot para o primeiro. Assim os índices não mudam para os itens que ainda não foram processados. Script corrigidofunction onUse(cid, item, fromPosition, itemEx, toPosition) if getItemAttribute(item.uid, "corpseowner") ~= getPlayerGUID(cid) then return doPlayerSendCancel(cid, "Esse corpo foi morto por outro jogador") end local items = {} local size = getContainerSize(item.uid) -- percorre de trás para frente for i = size - 1, 0, -1 do local it = getContainerItem(item.uid, i) if it.uid > 0 then table.insert(items, {it.itemid, it.type}) doRemoveItem(it.uid) end end if #items > 0 then for k = 1, #items do local playerItem = getPlayerItemById(cid, true, items[k][1]) if playerItem.uid > 0 then local totalType = playerItem.type + items[k][2] if totalType > 100 then doPlayerAddItem(cid, items[k][1], totalType - 100) doTransformItem(playerItem.uid, items[k][1], 100) else doTransformItem(playerItem.uid, items[k][1], totalType) end else doPlayerAddItem(cid, items[k][1], items[k][2]) end end end return true endMelhorias recomendadas (muito importantes)Para OTServer 8.60 eu recomendo também: 1️⃣ evitar limite manual de stackO servidor já controla stack automaticamente. Você pode simplificar MUITO: doPlayerAddItem(cid, items[k][1], items[k][2])Sem precisar de: getPlayerItemById doTransformItem limite 100 2️⃣ Versão muito mais limpaEsta versão já funciona como quick loot real: function onUse(cid, item, fromPosition, itemEx, toPosition) if getItemAttribute(item.uid, "corpseowner") ~= getPlayerGUID(cid) then return doPlayerSendCancel(cid, "Esse corpo foi morto por outro jogador") end local size = getContainerSize(item.uid) for i = size - 1, 0, -1 do local it = getContainerItem(item.uid, i) if it.uid > 0 then doPlayerAddItem(cid, it.itemid, it.type) doRemoveItem(it.uid) end end return true endResultado✔ Clicou no corpo 1 vez ✔ Todos os itens vão para a bag ✔ Nenhum item é pulado ✔ Código muito mais simples Fonte: ChatGPT
- Compilando TFS 1.3 com vídeo-aula
- (Resolvido)[AJUDA] [Error - Npc interface]
-
(Resolvido)[AJUDA] [Error - Npc interface]
Opa! Muito obrigado pela explicação meu caro! Vou executar aqui e te falo, porque deu somente 232 resultados uahuahhuahua... Tentei a opção do link abaixo também: https://otland.net/threads/npcs.22192/ Porém outros muitos erros aconteceram kkkkkkkk já já posto aqui com o resultado! Valeu!! EDIT: como uso o Notepad++ eu vi lá a função de substituir em todos os arquivos, realmente esse notepad é uma ferramente simples e fantástica kkkk ja posto o resultado EDIT2: Este foi o output agora... =,( Voltei as configurações e agora tenho o erro original
-
(Resolvido)[AJUDA] [Error - Npc interface]
Boa noite pessoal, Relutei para não abrir este tópico mas não aguentei... estou o dia procurando uma solução para este erro... Abaixo o output do executável do meu servidor: --------------------------------------------------------------------------------------------------------------------------------- [22/01/2016 18:25:42] The Forgotten Server - Edited By Cyko V8, version 0.3.6 - Edited By Cyko V8 (Crying Damson - Edited By Cyko V8) [22/01/2016 18:25:42] Compiled with GNU C++ version 3.4.5 (mingw special) at Apr 6 2013, 11:07:44. [22/01/2016 18:25:42] A server developed by Elf, slawkens, Talaturen, KaczooH, Lithium, Kiper, Kornholijo. [22/01/2016 18:25:42] Visit our forum for updates, support and resources: http://otland.net. [22/01/2016 18:25:42] >> Loading config (config.lua) [22/01/2016 18:25:42] > Using plaintext encryption [22/01/2016 18:25:42] >> Checking software version... failed checking - malformed file. [22/01/2016 18:25:43] >> Fetching blacklist [22/01/2016 18:25:43] >> Loading RSA key [22/01/2016 18:25:43] >> Starting SQL connection [22/01/2016 18:25:43] >> Running Database Manager [22/01/2016 18:25:44] > No tables were optimized. [22/01/2016 18:25:44] >> Loading items [22/01/2016 18:25:44] >> Loading groups [22/01/2016 18:25:44] >> Loading vocations [22/01/2016 18:25:44] >> Loading script systems [22/01/2016 18:25:45] >> Loading chat channels [22/01/2016 18:25:45] >> Loading outfits [22/01/2016 18:25:45] >> Loading experience stages [22/01/2016 18:25:45] >> Loading monsters [22/01/2016 18:25:45] >> Loading mods... [22/01/2016 18:25:45] > Loading buypremium_command.xml... done. [22/01/2016 18:25:45] > Loading changender_command.xml... done. [22/01/2016 18:25:45] > Loading custommonsters.xml... done. [22/01/2016 18:25:45] > Loading customspells.xml... done. [22/01/2016 18:25:45] > Loading firstitems.xml... done. [22/01/2016 18:25:45] > Loading highscorebook.xml... done. [22/01/2016 18:25:45] > Loading Military Ranks.xml... done. [22/01/2016 18:25:45] > 7 mods were loaded. [22/01/2016 18:25:45] >> Loading map and spawns... [22/01/2016 18:25:49] > Map size: 33407x33023. [22/01/2016 18:25:49] > Map descriptions: [22/01/2016 18:25:49] "Saved with Remere's Map Editor 2.1" [22/01/2016 18:25:49] "No map description available." [22/01/2016 18:26:13] > Map loading time: 28.011 seconds. [22/01/2016 18:26:14] [Warning] NpcSystem: [22/01/2016 18:26:14] Parameter 'keyword_reply1' missing. Skipping... [22/01/2016 18:26:14] [Error - Npc interface] [22/01/2016 18:26:14] data/npc/scripts/default.lua [22/01/2016 18:26:14] Description: [22/01/2016 18:26:14] data/npc/lib/npcsystem/modules.lua:302: attempt to call global 'Npc' (a nil value) [22/01/2016 18:26:14] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/default.lua [22/01/2016 18:26:15] > Data parsing time: 2.028 seconds. [22/01/2016 18:26:21] > Houses synchronization time: 5.508 seconds. [22/01/2016 18:26:27] > Content unserialization time: 5.792 seconds. [22/01/2016 18:26:27] >> Checking world type... PvP [22/01/2016 18:26:27] >> Initializing game state modules and registering services... [22/01/2016 18:26:27] > Global address: 127.0.0.1 [22/01/2016 18:26:27] > Local ports: 7171 7172 [22/01/2016 18:26:27] >> All modules were loaded, server is starting up... [22/01/2016 18:26:27] >> Forgotten 8.60 server Online! -------------------------------------------------------------------------------------------------------------------------------- Estes são os arquivos que imagino que precisem dar uma olhada: data\npc\lib\npcsystem\modules.lua data\npc\scripts\default.lua Se precisarem de mais alguma informação ou arquivo é só pedir. Sou novato nisso, mas adquiri algum conhecimento durante minhas tentativas agradeço de antemão a ajuda de vocês! MUITO OBRIGADO!