Tudo que Mateus Robeerto postou
-
(Resolvido)Como colocar exhausted em actions e talkactions?
Claro aqui passo a passo. Definir Variáveis: Comece definindo as variáveis necessárias. Você precisará de uma variável para representar a duração do cooldown (em segundos) e outra variável para armazenar a última vez que a ação foi realizada para cada jogador. local cooldown = 10 local lastActionTime = {} Verificar Tempo de Recarga: Antes de permitir que a ação seja executada, verifique se passou tempo suficiente desde a última vez que a ação foi executada. Se a diferença de tempo for menor que a duração do resfriamento, você impedirá a ação. local currentTime = os.time() local lastTime = lastActionTime[cid] or 0 if currentTime - lastTime < cooldown then doCreatureSay(cid, "COLOQUE AQUI MSG QUE VC QUISER.", TALKTYPE_ORANGE_1) return true end Atualizar tempo de espera: se a ação for permitida, atualize o horário da última ação para o horário atual. lastActionTime[cid] = currentTime Executar ação: agora você pode prosseguir para executar a ação pretendida. Por exemplo, deduzir dinheiro, conceder um item, enviar uma mensagem, etc. local cost = 20 if doPlayerRemoveMoney(cid, cost) == TRUE then else doCreatureSay(cid, "voce nao tem dinheiro.", TALKTYPE_ORANGE_1) end Return true: Por fim, certifique-se de retornar true no final da função para indicar que a ação foi tratada. return true fim só isso O sistema mencionado por King Laker também funciona. function onSay(cid, words, param) local exhaust = 5 local storage = 5839 if exhaustion.check(cid, storage) then exhaustion.set(cid, storage, exhaust) if doPlayerRemoveMoney(cid, 20) == TRUE then local bp = doPlayerAddItem(cid, 1988, 1) doSendMagicEffect(getCreaturePosition(cid), 13) doCreatureSay(cid, "Voce comprou uma backpack.", TALKTYPE_ORANGE_1) else doCreatureSay(cid, "Voce nao tem dinheiro.", TALKTYPE_ORANGE_1) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF) end end end Obs: Depende dos scripts, pode ser mais fácil ou difícil fazer alterações, mas você consegue adaptar tanto o cooldown quanto o exhaustion em qualquer script. BOA SORTE! 😉
-
(Resolvido)Como colocar exhausted em actions e talkactions?
1: local cooldown = 10 -- Cooldown in seconds local lastSearchTime = {} local sellTable = { [2498] = 40000, [2475] = 6000, [2491] = 5000, [7402] = 5000, [2462] = 4000, [2663] = 500, [2458] = 35, [2459] = 30, [2645] = 400000, [2195] = 40000, [2472] = 100000, [2492] = 60000, [2466] = 30000, [2487] = 20000, [2476] = 5000, [2656] = 15000, [2500] = 2500, [2463] = 400, [2465] = 200, [2464] = 100, [2470] = 80000, [2488] = 15000, [2477] = 6000, [2647] = 500, [2487] = 100, [2514] = 80000, [2520] = 40000, [2534] = 25000, [2536] = 8000, [2537] = 4000, [2519] = 5000, [2528] = 4000, [2515] = 200, [2518] = 1500, [2525] = 100, [2390] = 150000, [2408] = 100000, [2400] = 90000, [2393] = 10000, [2407] = 6000, [2396] = 4000, [2392] = 3000, [2409] = 1500, [2383] = 800, [2377] = 400, [2413] = 70, [2406] = 30, [2376] = 25, [2414] = 10000, [2431] = 90000, [2427] = 7500, [2432] = 10000, [2430] = 2000, [2387] = 200, [2381] = 200, [2378] = 100, [2388] = 20, [2391] = 6000, [2421] = 90000, [2436] = 1000, [2434] = 2000, [2423] = 200, [2417] = 60, [2398] = 30, } function on_search_container(cid, uid) local currentTime = os.time() local lastTime = lastSearchTime[cid] or 0 if currentTime - lastTime < cooldown then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Please wait before searching again.") return end lastSearchTime[cid] = currentTime local size = getContainerCap(uid) for slot = (size - 1), 0, -1 do local item = getContainerItem(uid, slot) if item.uid > 0 then if sellTable[item.itemid] then doPlayerAddMoney(cid, sellTable[item.itemid]) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sold ".. getItemNameById(item.itemid) .." for ".. sellTable[item.itemid] .." gold.") doRemoveItem(item.uid, 1) elseif isContainer(item.uid) then on_search_container(cid, item.uid) end end end end function onSay(cid, words, param, channel) on_search_container(cid, getPlayerSlotItem(cid, CONST_SLOT_BACKPACK).uid) return true end 2: local cooldown = 5 local lastPurchaseTime = {} function onSay(cid, words, param) local currentTime = os.time() local lastTime = lastPurchaseTime[cid] or 0 if currentTime - lastTime < cooldown then doCreatureSay(cid, "Please wait before making another purchase.", TALKTYPE_ORANGE_1) return true end lastPurchaseTime[cid] = currentTime local cost = 20 if doPlayerRemoveMoney(cid, cost) == true then local bp = doPlayerAddItem(cid, 1988, 1) doSendMagicEffect(getCreaturePosition(cid), 13) doCreatureSay(cid, "You bought a backpack.", TALKTYPE_ORANGE_1) else doCreatureSay(cid, "You don't have enough money.", TALKTYPE_ORANGE_1) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF) end return true end Sobre cooldown e exaust, é a mesma coisa. Mas você pode usar normalmente.
-
(Resolvido)Bug PVP Zone.
player:cpp procure esta linha void Player::onTarget(Creature* target) { Adicione abaixo. // Fix avoid pz in pvp zones. if (target && target->getZone() == ZONE_HARDCORE) { return; }
-
Ajuda com sistema de Reset via NPC
local config = { minlevel = 500, price = 100000000, newlevel = 20, priceByReset = 100000000, percent = 10, maxresets = 20, levelbyreset = 100, damagePercent = 5, -- Porcentagem de dano adicional após cada resets } function getResets(uid) resets = getPlayerStorageValue(uid, 378378) if resets < 0 then resets = 0 end return resets end 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 creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid function addReset(cid) if npcHandler:isFocused(cid) then npcHandler:releaseFocus(cid) end talkState[talkUser] = 0 resets = getResets(cid) setPlayerStorageValue(cid, 378378, resets + 1) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) -- Ajustar HP local hp = getCreatureMaxHealth(cid) local resethp = hp * (config.percent / 100) setCreatureMaxHealth(cid, resethp) local differencehp = hp - resethp doCreatureAddHealth(cid, -differencehp) -- Ajustar MP local mana = getCreatureMaxMana(cid) local resetmana = mana * (config.percent / 100) setCreatureMaxMana(cid, resetmana) local differencemana = mana - resetmana doCreatureAddMana(cid, -differencemana) -- Ajustar dano local damage = getCreatureDamage(cid) local additionalDamage = damage * (config.damagePercent / 100) local newDamage = damage + additionalDamage setCreatureDamage(cid, newDamage) doRemoveCreature(cid) local description = resets + 1 db.query("UPDATE `players` SET `description` = ' [Reset: " .. description .. "]' WHERE `players`.`id`= " .. playerid .. "") db.query("UPDATE `players` SET `level`=" .. config.newlevel .. ",`experience`= 0 WHERE `players`.`id`= " .. playerid .. "") return true end local newPrice = config.price + (getResets(cid) * config.priceByReset) local newminlevel = config.minlevel + (getResets(cid) * config.levelbyreset) if msgcontains(msg, 'reset') then if getResets(cid) < config.maxresets then selfSay('Voce gostaria de resetar? Isso vai custar ' .. newPrice .. " gp's!", cid) talkState[talkUser] = 1 else selfSay('Voce ja atingiu o nivel maximo de resets!', cid) end elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if getPlayerMoney(cid) < newPrice then selfSay('E necessario ter ' .. newPrice .. " gp's para resetar!", cid) elseif getPlayerLevel(cid) < newminlevel then selfSay('O level minimo para resetar e ' .. newminlevel .. '!', cid) else doPlayerRemoveMoney(cid, newPrice) playerid = getPlayerGUID(cid) addEvent(function() if isPlayer(cid) then addReset(cid) end end, 3000) local number = getResets(cid) + 1 local msg = "---[Reset: " .. number .. "]-- Voce resetou! Voce ganhou " .. config.damagePercent .. "% de dano adicional. Voce sera desconectado em 3 segundos." doPlayerPopupFYI(cid, msg) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end talkState[talkUser] = 0 elseif (msgcontains(msg, 'no')) and isInArray({ 1 }, talkState[talkUser]) == TRUE then talkState[talkUser] = 0 npcHandler:releaseFocus(cid) selfSay('Ok.', cid) elseif msgcontains(msg, 'quantity') then selfSay('You have a total of ' .. getResets(cid) .. ' reset(s).', cid) talkState[talkUser] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) nao testado!! Se não funcionar, você pode tentar outro aqui https://tibiaking.com/forums/topic/111239-reset-system-otx-2/?tab=comments#comment-573067
-
Imbuement System 8.60
https://otland.net/threads/imbuements-system-to-0-4-8-60.262623/#post-2562087
-
Problema com WOE (War Of Emperium)
Poste o script dele para a gente poder te ajudar e corrigir.
-
(Resolvido)Bug PVP Zone.
Creio que seja creature.cpp ou pode ser algo na Lua que você adicionou para uma área de PvP. Ou pode ser que você tenha colocado uma zona de proteção (PZ) pelo RME no seu mapa.
-
[TFS 1x] IncreaseMagicPercent
Foi um erro no lucasript.cpp, você mexeu algo errado. Eu baixei a TFS 1.4.2 limpa, adicionei e compilei. Depois testei no jogo e estava funcionando bem.
-
[TFS 1x] IncreaseMagicPercent
Pronto, é só testar e ser feliz. Post editado: O game.cpp foi atualizado game.cpp Obs: Esqueci de incluir na descrição que mostra 'inc magic'. Deve ter colocado duas vezes, ok? É só procurar no item.cpp essa linha e adicionar. Repita a busca pela mesma linha e adicione para exibir 'inc magic'. Pronto
-
[TFS 1x] IncreaseMagicPercent
Ficou no lugar errado... precisa colocar na posição correta. Quando eu coloquei e compilei, funcionou. Mande o game.cpp para mim, que eu faço isso para você. É bem simples. Obs: Eu já coloquei a base do Nekiro, TFS 1.4.2 e 1.2 do Celohere, além da versão OTX 11X. Tudo está funcionando normalmente. Testado, OK obrigado...
-
[TFS 1x] IncreaseMagicPercent
Para quem deseja utilizar o 'IncreaseMagicPercent' no arquivo items.xml, que aumenta o dano mágico em porcentagem No arquivo game.cpp depois. Player* attackerPlayer; if (attacker) { attackerPlayer = attacker->getPlayer(); } else { attackerPlayer = nullptr; } Player* targetPlayer = target->getPlayer(); if (attackerPlayer && targetPlayer && attackerPlayer->getSkull() == SKULL_BLACK && attackerPlayer->getSkullClient(targetPlayer) == SKULL_NONE) { return false; } damage.primary.value = std::abs(damage.primary.value); damage.secondary.value = std::abs(damage.secondary.value); int32_t healthChange = damage.primary.value + damage.secondary.value; if (healthChange == 0) { return true; } adicionar // Inc Magic by lursky auto originList = { ORIGIN_RANGED, ORIGIN_MELEE, ORIGIN_CONDITION }; auto it = std::find(originList.begin(), originList.end(), damage.origin); if (attackerPlayer && it == originList.end()) { int32_t magicPercentBonus = 0; for (int32_t slot = CONST_SLOT_FIRST; slot <= CONST_SLOT_LAST; ++slot) { Item* item = attackerPlayer->inventory[slot]; if (item) { const ItemType& iiType = Item::items[item->getID()]; const int32_t& slotPosition = item->getSlotPosition(); if (iiType.increaseMagicPercent && (iiType.slotPosition & slotPosition)) { magicPercentBonus += iiType.increaseMagicPercent; } } } if (magicPercentBonus > 0) { damage.primary.value += damage.primary.value * (magicPercentBonus / 100.0f); } } No arquivo item.cpp post edit: Deve ter colocado duas vezes, ok? É só procurar no item.cpp essa linha e adicionar. Repita a busca pela mesma linha e adicione para exibir 'inc magic'. Pronto depois. if (it.abilities) { for (uint8_t i = SKILL_FIRST; i <= SKILL_LAST; i++) { if (!it.abilities->skills[i]) { continue; } if (begin) { begin = false; s << " ("; } else { s << ", "; } s << getSkillName(i) << ' ' << std::showpos << it.abilities->skills[i] << std::noshowpos; } adicionar. if (it.increaseMagicPercent) { if (begin) { begin = false; s << " ("; } else { s << ", "; } s << "Inc.Magic " << std::showpos << it.increaseMagicPercent << '%' << std::noshowpos; } No arquivo items.cpp depois. {"worth", ITEM_PARSE_WORTH}, adicionar: { "increasemagicpercent", ITEM_PARSE_INCREASEMAGICPERCENT }, Novamente, no arquivo items.cpp: depois. case ITEM_PARSE_SUPPRESSCURSE: { if (valueAttribute.as_bool()) { abilities.conditionSuppressions |= CONDITION_CURSED; } break; } adicionar. case ITEM_PARSE_INCREASEMAGICPERCENT: { it.increaseMagicPercent = pugi::cast<int32_t>(valueAttribute.value()); break; } No arquivo items.h depois. uint64_t worth = 0; adicionar. int32_t increaseMagicPercent = 0; Novamente, no arquivo items.h: after. ITEM_PARSE_WORTH, adicionar: ITEM_PARSE_INCREASEMAGICPERCENT, FIM É só recompilar e testar Como funciona usar esses atributos? Veja aqui um exemplo item id="xxx" name="teste robe"> <attribute key="weight" value="7100"/> <attribute key="armor" value="18"/> <attribute key="slotType" value="body"/> <attribute key="increaseMagicPercent" value="50"/> </item> Obs: Esses adições na source foram feitas por Mateus Roberto, e Lurskcy fez uma correção de erro que estava causando um .crash no arquivo games.cpp. Está funcionando bem. Espero que gostem
-
(Resolvido)REVSCRIPT TFS 1.5
Vou postar aqui para vocês, é baseado no 7.92 e se chama 'IncreaseMagicPercent". Acabei de postar aqui. Dê uma olhada para que você possa adicionar à sua source https://tibiaking.com/forums/topic/111320-increasemagicpercent-tfs-1x/
-
Onde criar actions no tibia 13.20, source canary
Provavelmente é o RevScript mesmo. Apenas dê uma olhada aqui. https://github.com/opentibiabr/canary/tree/main/data-otservbr-global/scripts/actions ou https://github.com/opentibiabr/canary/tree/main/data-canary/scripts/actions
-
Loot e npc não funciona
Qual é a versão da sua TFS? TFS 1.4.2? Testei aqui com a minha TFS 1.4.2 1098. Coloquei loot de 9999x, matei um monstro e todos os itens caíram. Há algo errado aí com o arquivo 'data/events/scripts/monster.lua'. Se o problema persistir, recomendo baixar uma TFS limpa e testar para verificar se realmente funciona. Pegue o world e coloque-o nesta nova TFS limpa. Adicione alguns scripts que você já tinha da TFS 1.4.2 para a nova TFS 1.4.2. Se for a sua versão da TFS 1.4.2, então baixe aqui. https://github.com/otland/forgottenserver/releases/tag/v1.4.2
-
-=[TFS]=- 0.4 8.60 Não consigo compra nada no NPC
function onSay(cid, words, param) if words == "!desbug" then local fixCap = 900000 -- O valor para a capacidade corrigida (ajuste conforme necessário) -- Atualiza a capacidade na base de dados db.executeQuery("UPDATE `players` SET `cap` = '" .. fixCap .. "' WHERE `id` = " .. getPlayerGUID(cid)) doPlayerSetCapacity(cid, fixCap) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Bug corrigido! Sua capacidade foi restaurada.") end return true end
-
Erro na sourcer ou npc
Então, é possível que você tenha alterado algo, faltando alguma função que não reconhece ou deletou algum ponto ou vírgula, etc. Por favor, poste o script do NPC aqui para que eu possa dar uma olhada.
-
Reset System OTX 2
Tive que pesquisar um pouco e encontrei uma solução que deve funcionar para você, pois utiliza SQLite. Será necessário fazer algumas alterações em sua source e no SQLite. Depois, você pode adicionar os scripts que enviei. É possível que funcione sem precisar usar MySQL. https://tibiaking.com/forums/topic/32727-reset-system/
-
Erro na sourcer ou npc
Se você não mexeu libs, tudo bem. Mas você fez alguma alteração no NPC RUNE? Ele estava original ou você pegou de uma versão anterior da TFS e colocou na TFS 1.4.2, correto? Lembre-se de que as TFS 0.4 e 1x são totalmente diferentes. É necessário convertê-las corretamente para a TFS 1x para que funcionem adequadamente, entende? Quando eu peguei NPCs antigos para a TFS 1.4.2, enfrentei muitos problemas e recebia diversos erros no console. Levei cerca de 10 dias para corrigir tudo, mas agora está funcionando bem. O executável veio pronto ou você o compilou?
-
Reset System OTX 2
Há um bom tempo atrás, baixei este servidor Baiak. Peguei esses sistemas e adicionei o meu próprio mapa custom, que não é Baiak nem Global. Testei e estava funcionando bem. Depois, descobri que saiu a base TFS Nekiro Downgrade. Gostei muito e abandonei o meu OTX 8.6, migrando para o TFS 1.5 Nekiro. Eu não entendo por que as pessoas não baixam este servidor. Já está completo com tudo, incluindo sistemas de montarias, roleta, cassino, reset com dano e muito mais. É só baixar este servidor e trocar o mapa, ou se preferir, manter este mapa mesmo. Está pronto e é simples.
-
Erro na sourcer ou npc
É um erro na NPC mesmo, não é na source. Você talvez tenha trocado a pasta/npc/libs ou outras libs? Ou substituiu as libs originais pelas da TFS 1.42? Se tiver feito isso, precisa colocar as libs originais de volta para que as funções dentro delas sejam reconhecidas, especialmente aquelas usadas na keywordhandler.lua. Parece que você substituiu o conjunto inteiro ou fez alguma alteração, por isso sugiro pegar as libs originais da NPC e colocá-las de volta no seu servidor. Teste isso e veja se resolve. Eu também uso a TFS 1.4.2, então sei como é.
-
Reset System OTX 2
Creio que possa estar faltando algo. Dê uma olhada no seu arquivo 'lib.lua'. Se não estiver dentro do 'reset.lua', talvez seja necessário incluir esse tipo de função. É uma boa ideia verificar se realmente está faltando algo e testar no seu servidor lib.zip Obs: Se o seu banco de dados 'reset' não tiver isso, então vamos lá: Abra o seu phpMyAdmin, selecione o seu banco de dados, vá para a seção SQL e execute o comando ALTER TABLE `players` ADD `resets` VARCHAR(255) NOT NULL DEFAULT '0';
-
Reset System OTX 2
Esse sistema de reset é exclusivo apenas para MySQL, mano. Por que você não utiliza o MySQL?
-
Reset System OTX 2
Qual você está usando, SQLite ou MySQL?
-
Reset System OTX 2
Acabei de olhar que também era OTX. Deve funcionar para você. Se encontrar algum erro, continue. Baixe este Baiak e pegue as libs completas para colocar em seu servidor. Faça o teste
-
Reset System OTX 2
Oops, eu tinha esquecido esses detalhes. Qual é a sua versão do TFS? Se o OTX e o TFS forem iguais. data/libs/050-function.lua então vá procurar por esta linha function doPlayerGiveItem(cid, itemid, amount, subType) adicione abaixo dela function getPlayerResets(cid) local Info = db.getResult("SELECT reset FROM players WHERE id = " .. getPlayerGUID(cid) .. " LIMIT 1") if Info:getID() ~= LUA_ERROR then local Resets= Info:getDataInt("reset", getPlayerGUID(cid)) Info:free() return Resets end return LUA_ERROR end data/libs/004-database.lua procurar por esta linha function Result:getDataLong(s) adicione em cima dela function Result:getDataInt(s) if(self:getID() == -1) then error("[Result:getDataInt] Result not set!") end return result.getDataInt(self:getID(), s) end No caso de não haver essa função no arquivo 004-database.lua, você pode adicionar em qualquer lugar e testar!