Solutions
-
Naze's post in (Resolvido)Tile por skill was marked as the answertroca o getPlayerLevel(cid) por getPlayerSkillLevel(cid, SKILL_SWORD)
-
Naze's post in (Resolvido)Iniciante em OTservers, tentando editar OTC was marked as the answerSou leigo em otclient pretendo começa a estuda tbm ele logo, mas pode tentar tirar sua duvidas no discord https://discord.gg/nf8MstNq tera mais gente em tempo real para te ajudar.
Mas há bastante material perdido na net, so procurar que vai achar.
-
Naze's post in (Resolvido)Derivado [Pedido] Usar x item em um monstro e ganhar outfit was marked as the answerdessa forma poderá usar mais outfit caso queira, testa ae
local cfg = { {name = "Outfit Dragon", mob = "bug", outfit_male = 367, outfit_female = 366, addon = "1"}, -- name = nome da outfit, mob = nome do monstro {name = "Outfit Lord", mob = "dragon lord", outfit_male = 367, outfit_female = 366, addon = "2"}, -- outfit_male = lookType da outfit de homem, outfit_female = lookType da outfit de mulher {name = "Outfit Frost", mob = "dragon frost", outfit_male = 367, outfit_female = 366, addon = "3"}, -- addon = (1 = somendo addon 1) (2 = somente addon 2) (3 = todos addons) } function onUse(player, item, fromPosition, target, toPositio) local monster = Monster(target) if monster then for i, _ in pairs(cfg) do if (_.mob:lower() == monster:getName():lower()) then local lookType = player:getSex() % 2 and _.outfit_male or _.outfit_female if not player:hasOutfit(lookType, _.addon) then player:addOutfitAddon(lookType, _.addon) player:sendTextMessage(22, "Voce ganhou a ".. _.name ..". Parabens") monster:remove() item:remove(1) return true end player:sendTextMessage(MESSAGE_STATUS_CONSOLE_RED, "Voce ja tem essa outfit") return false end end player:sendTextMessage(MESSAGE_STATUS_CONSOLE_RED, "Esse monstro nao e valido") return false end player:sendTextMessage(MESSAGE_STATUS_CONSOLE_RED, "Isso nao e possivel") return false end
-
Naze's post in (Resolvido)Erro no sistema Porta no Automática igual pxg was marked as the answerTenta dessa forma, apenas coloquei checagem se item existe, se continuar funcionando vai parar os erros.
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor) if getTileItemById(pos, porta[1]).uid > 0 then for i = 1, 2 do addEvent(function() local item = getTileItemById(pos, i == 1 and porta[1] or porta[2]).uid if item > 0 then doTransformItem(item, porta[i + 1]) end end, i * delay) end end return true end function onStepOut(cid, item, position, lastPosition, fromPosition, toPosition, actor) local tab = {} for _, pid in ipairs(getPlayersOnline()) do if getTileInfo(getCreaturePosition(pid)).actionid == action then table.insert(tab, pid) end end if #tab == 0 then if getTileItemById(pos, porta[3]).uid > 0 then for i = 1, 2 do addEvent(function() local item = getTileItemById(pos, i == 1 and porta[3] or porta[2]).uid if item > 0 then doTransformItem(item, porta[i == 1 and 2 or 1]) end end, i * delay) end end end return true end
@EDIT Só postei a funções então só modifica elas mas a variáveis do início continua.
-
Naze's post in (Resolvido)Totem com managain ou lifegain was marked as the answerOq quer não é difícil se realmente quer tenta fazer você precisa criar um movements, onEquip e um onDeEquip com esse item, fazer uma verificação de q se ele não for equipado no slot correto que queria retorna false (return false), caso seja equipado no slot certo, ira dar os efeito q deseja.
Aqui tem um pequeno tutorial basico de movements: link
Aqui tem um script de um item parecido com oq quer se nao igual: link
E procure outros onEquip e onDeEquip e tente entender como funciona q vai conseguir. Qualquer duvida so mandar demoro mais respondo.
@edit, e claro no onDeEquip colocar para retirar os efeitos q colocou na hr de equipar.
-
Naze's post in (Resolvido)Random box send! was marked as the answerlocal rewards = { --{item = {ID_ITEM, COUNT}, {ID_ITEM, COUNT}...}, chance = 0.porcentagem*}, <- NAO ESQUECA DA VIRGULA -- SEGUE OS EXEMPLOS: {item = {{1234, 1}}, chance = 0.02}, -- Da item 1x 1235 e 100x 2160 com 2 % de chance {item = {{5532, 1}, {2160, 100}}, chance = 0.02135}, -- da 1x 1334 e 100x 2160, chance de 2% e uns quebrados {item = {{3454, 1}, {2160, 100}}, chance = 0.10}, -- 10% de chance {item = {{7424, 1}}, chance = 0.02}, {item = {{3644, 1}, {2157, 1}, {7644, 1}}, chance = 0.0005}, } function getReward() local n = math.random() local x = math.random(#rewards) local chance = rewards[x].chance if chance >= n then return rewards[x].item end return getReward() end function onUse(cid, item, fromPos, itemEx, toPos) reward = getReward() str = "" for _, itens in pairs(reward) do doPlayerAddItem(cid, itens[1], itens[2]) str = str.." "..itens[2].."x "..getItemNameById(itens[1]).."," end doPlayerSendTextMessage(cid, 22, "Voce recebeu:"..str.." por abrir a box!") doRemoveItem(item.uid, 1) return true end Nao testei se der erro so mandar q arrumo
-
Naze's post in (Resolvido)Skill Rate/Velocidade para upar skill was marked as the answerÉ possivel, você so precisaria fazer um calculo que anule o calculo feito das 'skill_tries' necessaria pra dar o up, que vc pode achar em "Vocation::getReqSkillTries" no vocation.cpp, Ou modificar essa função para ser um valor fixo pra up.
Nenhuma, como falei na primeira pergunta ela não diminui a velocidade e sim a "experiencia" que vc ganha da skill é cada vez mais necessaria para upar. è a mesma forma que acontece com Level, mas com outros cálculos. No caso é a função "Vocation::getReqSkillTries".
Não entendi direito a pergunta, mas pra essa e qualquer outra do tipo, tudo possível so saber oq e onde modificar,
Tudo é possivel... por script o que citou no topico ja te da um exemplo de como mudar com
doPlayerSetRate(cid, skill, skillRate) -
Naze's post in (Resolvido)EMOTE SPELLS TFS 0.4 was marked as the answerdeixa seu emote spells no config.lua como false
em Spells.cpp procure:
SpeakClasses type = SPEAK_SAY; if(g_config.getBool(ConfigManager::EMOTE_SPELLS)) type = SPEAK_MONSTER_SAY; e abaixo coloque:
std::string value; player->getStorage("474758", value); type = value == "1" ? SPEAK_MONSTER_SAY : type; agora cria uma talkaction tipo !emotespell
e adiciona esse script:
function onSay (cid, words, param) if param == "" then return doPlayerSendTextMessage(cid, 22, "Fale !emotespell on para ativar, e !emotespell off para desativar.") end if param =="on" then setPlayerStorageValue(cid, 474758, 1) doPlayerSendTextMessage(cid, 22, "EmoteSpell Ativado.") return true end if param =="off" then setPlayerStorageValue(cid, 474758, 0) doPlayerSendTextMessage(cid, 22, "EmoteSpell Desativado.") return true end end Testa ae se der erro avisa que arrrumo, tou no trampo entao nao tem como testa.
-
Naze's post in (Resolvido)NPC de task was marked as the answerCara complicado te ajuda vc mando um script limpo avulso, e pediu uma verificação de storage, onde? ao falar hi? ao conversa?
Faz o seguinte vou te manda esse limpo q normalmente uso pra criar npc e ele com verificação de storage das duas forma vc compara e faz do jeito que quiser.
-
Naze's post in (Resolvido)Como retiro o otserv todo do filezilla? was marked as the answerVocê tem q fazer isso atravez do terminal do linux
entra nele e instala zip
sudo apt install zip depois zip mandando
zip -r nomearquivo.zip /pasta no seu caso zip -r otserv.zip /otserv isso vai gerar um arquivo zip, como a pasta sua ta na base do linux, ele provavelmente ira pra /otserv ou para a pasta do usuario q ta logado, se tiver problemas zip a data depois a source o os arquivos solto é leve para passa.
Para extrair depois é comando
unzip nomedoarquivo.zip
-
Naze's post in (Resolvido)Spellbook com descrição was marked as the answerso to com tfs 1.3 então não posso testa, mas tenta ai e me fala oq da
local desc = { ["exori flam"] = "Dano do tipo 'fire' no alvo.", ["exori vis"] = "Dano do tipo 'energy' no alvo.", ["exori ice"] = "Dano do tipo 'ice' no alvo." } function onUse(cid, item, fromPosition, itemEx, toPosition) local t = {} for i = 0, getPlayerInstantSpellCount(cid) - 1 do local spell = getPlayerInstantSpellInfo(cid, i) if(spell.level ~= 0) then if(spell.manapercent > 0) then spell.mana = spell.manapercent .. "%" end table.insert(t, spell) end end table.sort(t, function(a, b) return a.level < b.level end) local text, prevLevel = "", -1 for i, spell in ipairs(t) do local line = "" if(prevLevel ~= spell.level) then if(i ~= 1) then line = "\n" end line = line .. "Spells for Level " .. spell.level .. "\n" prevLevel = spell.level end local description = desc[spell.name] or "Sem descrição." text = text .. line .. " " .. spell.words .. " - " .. spell.name .. " = "..description.." : " .. spell.mana .. "\n" end doShowTextDialog(cid, item.itemid, text) return true end
-
Naze's post in (Resolvido)Script !mount/!unmount precisando de um adicional was marked as the answerSe entendi direito quer apenas q vai com addons no comando?
Uma pesquisa rápida vera vários exemplos da função doSetCreatureOutfit(cid, outfit, -1), que utiliza a tabela a baixo pra pegar a outfit, so adicionar lookAddons = valor.
local outfit = {lookType = 570, lookAddons = 1} -
Naze's post in (Resolvido)erro teleporttiles.lua was marked as the answercoloque essa função na sua lib
function getPosByDir(position, direction, size) local n = size or 1 if(direction == NORTH) then position.y = position.y - n elseif(direction == SOUTH) then position.y = position.y + n elseif(direction == WEST) then position.x = position.x - n elseif(direction == EAST) then position.x = position.x + n elseif(direction == NORTHWEST) then position.y = position.y - n position.x = position.x - n elseif(direction == NORTHEAST) then position.y = position.y - n position.x = position.x + n elseif(direction == SOUTHWEST) then position.y = position.y + n position.x = position.x - n elseif(direction == SOUTHEAST) then position.y = position.y + n position.x = position.x + n end return position end
-
Naze's post in (Resolvido)Melhorando o ataque por reset was marked as the answerSo coloca a storage do reset no lugar que ta escrito STORAGE, assim ele vai heala +1% cada reset, se quiser melhorar tem q refazer a formula
local formula_min = -((lv* 4 + maglv*2) * 1.3) * fator
local formula_max = -((lv* 4 + maglv*2) * 1.9) * fator
o final '* fator' é a porcentagem a cada reset, entao se refizer ela, nao esquece de deixa o final dessa forma.
function getPlayerReset(cid) local qr = db.getResult("SELECT `reset` FROM `players` WHERE `id`= "..getPlayerGUID(cid)..";") rss = qr:getDataInt("reset", getPlayerGUID(cid)) if rss < 0 then rss = 0 end return rss end local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE) setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA) setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH) function getCombatFormulas(cid, lv, maglv) reset = getPlayerReset(cid) fator = (reset/100) +1 local formula_min = -((lv* 4 + maglv*2) * 1.3) * fator local formula_max = -((lv* 4 + maglv*2) * 1.9) * fator if(formula_max < formula_min) then local tmp = formula_max formula_max = formula_min formula_min = tmp end return formula_min, formula_max end setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "getCombatFormulas") function onCastSpell(cid, var) return doCombat(cid, combat, var) end
-
Naze's post in (Resolvido)Npc com erro was marked as the answer@MarkCharlotte Cara esse script seu tem muito erro, se funcionasse, o player nem precisaria entregar os itens pq ele ta setando a storagem so de falar items. E as storage tão tudo diferente, fica melhor vc mudar o valor delas. Refiz ele pra você mas tem uma parte que não entendi oq queria com isso. Mas so posta que ajeito, não consigo testa ele pq to no trampo. Se retorna algum erro so posta ele.
Deixei as storage que ta no script original (1456 e 13256) pq não sei onde usa mais, mas ela nao utiliza em nada pro funcionamento do npc
local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg:lower()) end function onThink() npcHandler:onThink() end local talkState = {} function onCreatureSay(cid, type, msg) if getPlayerStorageValue(cid, 12101) >= 2 then npcHandler:setMessage(MESSAGE_GREET, "Olá "..getCreatureName(cid)..", Você já completou todas as Missões.") npcHandler:setMessage(MESSAGE_WALKAWAY, "Que rude.") npcHandler:setMessage(MESSAGE_FAREWELL, "Até... "..getCreatureName(cid)..".") elseif getPlayerStorageValue(cid, 12101) < 1 then npcHandler:setMessage(MESSAGE_GREET, "Olá "..getCreatureName(cid)..", você deseja fazer a {missao} para aprender a nova magia?") npcHandler:setMessage(MESSAGE_WALKAWAY, "Que rude.") npcHandler:setMessage(MESSAGE_FAREWELL, "Até... "..getCreatureName(cid)..".") elseif getPlayerStorageValue(cid, 12101) == 1 then npcHandler:setMessage(MESSAGE_GREET, "Olá "..getCreatureName(cid)..", você deseja entregar os {itens} para aprender a nova magia?.") npcHandler:setMessage(MESSAGE_WALKAWAY, "Que rude.") npcHandler:setMessage(MESSAGE_FAREWELL, "Até... "..getCreatureName(cid)..".") end npcHandler:onCreatureSay(cid, type, msg) 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 if getPlayerStorageValue(cid,12101) < 1 then if isInArray({"missao", "missoes"}, msg) then selfSay("vá e me traga os itens!",cid) setPlayerStorageValue(cid, 1456,1) setPlayerStorageValue(cid, 12101,1) talkState[talkUser] = 0 end end if getPlayerStorageValue(cid, 12101) == 1 then if isInArray({"itens", "item"}, msg) then if doPlayerRemoveItem(cid, 2160, 20) then setPlayerStorageValue(cid, 13256, 1) setPlayerStorageValue(cid, 12101, 2) else selfSay("Você ainda não tem os itens necessários!", cid) end end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Retirei essa parte, depois me explica oq queria com isso que coloco pra você
if getPlayerStorageValue(cid, 13256) >= 2 then npcHandler:say("Você vai para a ultima missão!.", cid) -- configurar depois
-
Naze's post in (Resolvido)RetPagseguro -- Em branco e nao gera. was marked as the answerResolvido. Conta era antiga.
-
Naze's post in (Resolvido)TFS nao abre depois de load mapa was marked as the answerO erro realmente era devido ao servidor, o ot está puxando mais memória do que era suportável.
Resolvido
-
Naze's post in (Resolvido)Task System 4.0 (Vodkart) - Alterar getCreatureName(target) was marked as the answerExato, por isso quero outra função outro meio de verificar, vou tenta usando HealthMax ou MaxaMax, ai eu faço um "id" com o final da life kkkk uma gambiarra mas talvez de, se alguem tiver uma ideia melhor para verificar o monstro agradeço
@EDIT
Fiz dessa forma com a função getCreatureMaxHealth, e deu certo. Troquei essa linha
if t and getPlayerStorageValue(cid, t.start) > 0 and isInArray(t.monsters_list, getCreatureMaxHealth(target)) and getPlayerStorageValue(cid, task_sys_storages[3]) < t.count then
-
Naze's post in (Resolvido)Script !life e !mana was marked as the answerTesta esse, eu não posso testar agora.
function onSay(cid, words, param) local health, maxhealth = getCreatureHealth(cid), getCreatureMaxHealth(cid) local mana, maxmana = getCreatureMana(cid), getCreatureMaxMana(cid) local text = "HP: ".. health .."/".. maxhealth .."\n MP: ".. mana .."/".. maxmana .."" doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, text) return true end
Se quiser mais completo eu apenas modifiquei esse abaixo, crédito para Vodkart
@edit
Testei e está funcionando só precisa adicionar a tag em talkactions.xml
<talkaction words="!status" event="script" value="status.lua"/>
e se aparecer algum erro com essa msg na distro: unexpected symbol near '?'
Pegue a linha do erro, e reescreva ela da mesma forma que ira resolver.