Tudo que MatteusDeli postou
-
(Resolvido)poção de cura %
@Black Frost21 Bom tarde, acho que é isso: Em data/actions/scripts crie um arquivo chamado healPill.lua e adicione isso dentro: local config = { -- [ID DO ITEM] = { health = Porcentagem de Vida, mana = Porcentagem de Mana}, -- Pilula de mana [XXXX] = { health = 0, mana = 20 }, -- Pilula de saude [YYYY] = { health = 20, mana = 0 }, -- grande Pilula [ZZZZ] = { health = 20, mana = 35 }, } function onUse(cid, item, from, itemEx, to) local pill = config[item.itemid] addHelth(cid, pill.health) addMana(cid, pill.mana) return true end function addHelth(cid, percentageHealth) if (percentageHealth > 0) then local playerMaxHealth = getCreatureMaxHealth(cid) local healthAmount = calculatePercentageRestoration(playerMaxHealth, percentageHealth) doCreatureAddHealth(cid, healthAmount) end end function addMana(cid, percentageMana) if (percentageMana > 0) then local playerMaxMana = getCreatureMaxMana(cid) local manaAmount = calculatePercentageRestoration(playerMaxMana, percentageMana) doCreatureAddMana(cid, manaAmount) end end function calculatePercentageRestoration(value, percentage) return math.ceil(math.abs((value * (percentage / 100)+0.5))) end No arquivo actions.xml adicione isso: <action itemid="XXXX;YYYY;ZZZZ" script="healPill.lua"/> Aonde estão os XXXX;YYYY;ZZZZ são os ids dos itens que serão utilizados para recuperar a vida e a mana, lembre-se de alterar no script também.
-
Pack de Itens sem ser aléatório
@zGiovani Tenta assim, aonde ta a linha: Item(usedItem.uid):remove(count) Substitua por essa: usedItem:remove(count) Se nao funcionar, voce substitui por essa: Item(usedItem):remove(count)
-
Pack de Itens sem ser aléatório
@zGiovani Boa tarde, tente assim: local config = { [6570] = { -- bluePresent {2687, 10}, {6394, 3}, 6280, 6574, 6578, 6575, 6577, 6569, 6576, 6572, 2114, 15439, 16014 }, [6571] = { -- redPresent 6574, 2195, 6394, 6576, 6578, 2114, 15439, 2153, 5944, 2492, 2520, 2156, 5080, 2112, 2498, 2173, 5791 }, [9108] = { -- surpriseBag {2148, 10}, 7487, 2114, 8072, 7735, 8110, 6574, 6394, 7377, 2667, 9693 }, [16094] = { -- surpriseBag {10559, 15},{2670, 15}, 5917, 2385, 11219, 2238, 5928, 5926, 5927, 6095, 5918, 6097, 6098, 5462, 5091 }, [16102] = { -- surpriseBag {6569, 10}, {6541, 10}, {6542, 10}, {6543, 10}, {6544, 10}, {6545, 10}, 6574, 4850, 6570, 6571, 11400 } } local surpriseBag = Action() function surpriseBag.onUse(cid, item, fromPosition, itemEx, toPosition) local player = Player(cid) local present = config[item.itemid] if not present then return false end for index = 1, #present do local gift = present[index] local amount = 1 if type(gift) == "table" then addGiftToPlayer(player, gift[1], gift[2], item) else addGiftToPlayer(player, gift, amount, item) end end return true end function addGiftToPlayer(player, gift, amount, usedItem) local count = 1 player:addItem(gift, amount) Item(usedItem.uid):remove(count) fromPosition:sendMagicEffect(CONST_ME_GIFT_WRAPS) end surpriseBag:id(6570, 6571, 9108, 16094, 16102) surpriseBag:register()
-
(Resolvido)Exausted
@Doidodepeda Boa noite, tente assim: Altere o xml para: Separe cada itemid da potion por ";", como está abaixo <action itemid="7440;7439" script="expPotions.lua"/> Altere o script para esse, está comentado como usar: local expfinal = 1 --Não mude, isso é para a experiencia voltar ao normal. local textoPotionUsada = "em uso" local potions = { -- [ID_POTION] = { tempo = DURAÇÃO, experiencia = EXPERIENCIA, quantidade = QUANTIDADE_DE_POTIONS, texto = 'Voce Ganhou 30 Minutos de Exp [3x]', textofinal = 'Bonus de Exp [3x] Finalizada', storage = STORAGE_UNICO_PARA_CADA_POTION, textoClasse = 22, efeito = 1 }, [7440] = { tempo = 1800, experiencia = 3.0, quantidade = 1, texto = 'Voce Ganhou 30 Minutos de Exp [3x]', textofinal = 'Bonus de Exp [3x] Finalizada', storage = 33330, textoClasse = 22, efeito = 1 }, [7439] = { tempo = 2000, experiencia = 5.0, quantidade = 1, texto = 'Voce Ganhou 30 Minutos de Exp [5x]', textofinal = 'Bonus de Exp [5x] Finalizada', storage = 33331, textoClasse = 22, efeito = 1 } } function onUse(cid, item, frompos, item2, topos) for potionId, potionConfig in pairs(potions) do if item.itemid == potionId then if (getPlayerStorageValue(cid, potionConfig.storage) > os.time()) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, textoPotionUsada) return; end local quantidadePotionPlayer = getPlayerItemCount(cid, potionId) if quantidadePotionPlayer < potionConfig.quantidade or quantidadePotionPlayer <= 0 then return; end doRemoveItem(item.uid, potionConfig.quantidade) doPlayerSetExperienceRate(cid, potionConfig.experiencia) doSendMagicEffect(frompos, potionConfig.efeito) doPlayerSendTextMessage(cid, potionConfig.textoClasse, potionConfig.texto) addEvent(potion, potionConfig.tempo * 1000, cid, potionConfig) setPlayerStorageValue(cid, potionConfig.storage, (os.time() + potionConfig.tempo)) end end end function potion(cid, potionConfig) doPlayerSetExperienceRate(cid, expfinal) doPlayerSendTextMessage(cid, potionConfig.textoClasse, potionConfig.textofinal) end
-
ERRO NO NPC REVIVER
@Muvuka Boa tarde, remova esta linha do script: npcHandler:setMessage(MESSAGE_GREET, "Ola |PLAYERNAME|. Eu posso te {reviver} no local aonde voce morreu recentemente por uma certa quantidade de dinheiro.") No arquivo xml do npc, substitua para isto: <?xml version="1.0" encoding="UTF-8"?> <npc name="Reviver" script="data/npc/scripts/reviver.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="300" head="0" body="0" legs="0" feet="0" corpse="5995"/> <parameters> <parameter key="message_greet" value="Ola |PLAYERNAME|. Eu posso te {reviver} no local aonde voce morreu recentemente por uma certa quantidade de dinheiro."/> </parameters> </npc>
-
(Resolvido)Exausted
@Doidodepeda Boa tarde, tente assim: OBS: Se o script funcionar os créditos é do @So volto tarde, eu só ajustei mais ele foi quem criou. function onUse(cid, item, frompos, item2, topos) local time = 1800 -- Tempo que durará em segundos local texto = 'Voce Ganhou 30 Minutos de Exp [3x]' -- Texto que irá receber ao usar a potion. textofinal = 'Bonus de Exp [3x] Finalizada' -- Texto que irá receber quando o efeito da potion acabar. local exp = 3.0 -- O quanto que você quer que dobre sua experiencia, por exemplo 2 é 2x as rates do seu server. expfinal = 1 --Não mude, isso é para a experiencia voltar ao normal. local stor = 12132 if (getPlayerStorageValue(cid, stor) > os.time()) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "em uso") return; end if item.itemid == 7440 then doRemoveItem(item.uid, 1) doPlayerSetExperienceRate(cid, exp) doSendMagicEffect(frompos, 13) doPlayerSendTextMessage(cid, 22, texto) addEvent(potion, time * 1000, cid) setPlayerStorageValue(cid, stor, (os.time() + time)) end end function potion(pos, cid) doPlayerSetExperienceRate(pos, expfinal) doPlayerSendTextMessage(pos,22, textofinal) end
-
Conexão de MOD Reputation com NPC
@Nego Tchuca Boa tarde, eu testei em um servidor 8.6 com tfs 0.4, acho que vai funcionar no seu. 1° Vá em data/lib e crie um arquivo chamado rep_seller_items.lua e adicione isto dentro: (as configurações estão comentadas nele) -- Caso a coluna "REP" da tabela de players for diferente coloque o nome dela aqui rep_coluna_database = "rep" -- As falas do npc rep_falas_npc = { conversa = { ['trocar'] = 'Veja nossa {lista de items} e confira quantos reps cada um vale.', ['lista_de_items'] = 'Agora, me diga o nome do item que voce quer trocar.', }, sucesso = { ['item_comprado'] = 'Otimo, aqui esta o seu novo item.', }, falha = { ['rep_points_insuficientes'] = 'Desculpe, mais voce nao possui rep points suficientes para trocar por este item.', ['item_nao_encontrado'] = 'Nao encontrei este item, por favor tente outro.' } } -- Items que o npc irá vender rep_items = { { item_id = 2124, quantidade_rep_points = 5}, { item_id = 2472, quantidade_rep_points = 30}, { item_id = 2520, quantidade_rep_points = 10}, } 2° Vá na pasta dos npcs em data/npc e crie um arquivo chamado Rep.xml e adicione isto nele: <npc name="Rep" script="data/npc/scripts/repseller.lua" floorchange="0" access="5"> <health now="150" max="150"/> <look type="143" head="2" body="112" legs="78" feet="116" addons="2" corpse="2212"/> <parameters> <parameter key="message_greet" value="Ola! Voce posso {trocar} seus rep points por itens."/> </parameters></npc> 3° Agora crie um arquivo de script chamado repseller.lua na pasta data/npc/scripts e adicione isto nele: dofile(getDataDir() .. "lib/rep_seller_items.lua") 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) local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if(not npcHandler:isFocused(cid)) then return false end if msgcontains(msg, 'trocar') then npcHandler:say(rep_falas_npc.conversa.trocar, cid) talkState[talkUser] = 1 end if msgcontains(msg, 'lista de items') and talkState[talkUser] == 1 then mostrarListaItems(cid) npcHandler:say(rep_falas_npc.conversa.lista_de_items, cid) talkState[talkUser] = 2 end if talkState[talkUser] == 2 then local item = buscarItemPeloNome(msg) if item == nil then return; end trocarRepPointsPeloItem(cid, item) talkState[talkUser] = 1 end return TRUE end function trocarRepPointsPeloItem(cid, item) local playerRepPoints = buscarRepPoints(cid) if item.quantidade_rep_points > playerRepPoints then npcHandler:say(rep_falas_npc.falha.rep_points_insuficientes, cid) return; end local quantidadeRepPointsParaRemover = playerRepPoints - item.quantidade_rep_points if quantidadeRepPointsParaRemover < 0 then npcHandler:say(rep_falas_npc.falha.rep_points_insuficientes, cid) return; end if removerRepPoints(cid, quantidadeRepPointsParaRemover) then adicionarItemAoPlayer(cid, item) npcHandler:say(rep_falas_npc.sucesso.item_comprado, cid) end end function buscarRepPoints(cid) local sql = "SELECT `"..rep_coluna_database.."` FROM `players` WHERE id = " ..getPlayerGUID(cid)..";" local result = db.getResult(sql) if result:getID() <= -1 then return; end return result:getDataInt(rep_coluna_database) end function removerRepPoints(cid, quantidade) local sql = "UPDATE `players` SET `"..rep_coluna_database.."` = "..quantidade.." WHERE id = "..getPlayerGUID(cid)..";" local result = db.executeQuery(sql) if result == -1 then return false end return true end function mostrarListaItems(cid) local message = '' for index = 1, #rep_items, 1 do local item = rep_items[index] local item_nome = getItemNameById(item.item_id) message = item_nome .. " - " .. item.quantidade_rep_points .. " REP Point(s)" .. "\n" .. message end doPlayerPopupFYI(cid, message) end function adicionarItemAoPlayer(cid, item) doPlayerAddItem(cid, item.item_id) end function buscarItemPeloNome(nome) for index = 1, #rep_items, 1 do local item = rep_items[index] local item_nome = getItemNameById(item.item_id) if (string.lower(nome) == string.lower(item_nome)) then return item end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Espero ter ajudado
-
(Resolvido)8.60 NPC Revive
@Muvuka Boa tarde, as configurações estão comentadas no script do npc. data/npc crie um arquivo chamado reviver.xml e adicione isto dentro: <?xml version="1.0" encoding="UTF-8"?> <npc name="Reviver" script="data/npc/scripts/reviver.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="300" head="0" body="0" legs="0" feet="0" corpse="5995"/> <parameters /> </npc> data/npc/scripts crie um arquivo chamado reviver.lua e adicione isto dentro: local MONEY_AMOUNT = 1000 --Quantidade de dinheiro (em gold coins) que o player necessitará para reviver local MAGIC_EFFECT_TELEPORT = 65 -- Efeito que aparecerá quando o player for teleportado local PLAYER_REBORN_POSITION_X = 66541 local PLAYER_REBORN_POSITION_Y = 66542 local PLAYER_REBORN_POSITION_Z = 66543 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 npcHandler:setMessage(MESSAGE_GREET, "Ola |PLAYERNAME|. Eu posso te {reviver} no local aonde voce morreu recentemente por uma certa quantidade de dinheiro.") 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(msgcontains(msg, 'reviver') or msgcontains(msg, 'revive')) then selfSay('Voce precisa de ' .. MONEY_AMOUNT .. ' gold(s) para ressuscitar no local aonde voce morreu recentemente', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if(getPlayerMoney(cid) >= MONEY_AMOUNT) then doPlayerRemoveMoney(cid, MONEY_AMOUNT) if teleportPlayerToPositionReborn(cid) then doTeleportThing(cid, { x=playerRebornPositionX, y=playerRebornPositionY, z=playerRebornPositionZ }) doSendMagicEffect(getThingPos(cid), MAGIC_EFFECT_TELEPORT) selfSay('Ok, voce foi ressuscitado', cid) end else selfSay('Desculpe, mais voce nao possui o dinheiro suficiente.', cid) end talkState[talkUser] = 0 elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then talkState[talkUser] = 0 selfSay('Ok, ate mais.', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) function teleportPlayerToPositionReborn(cid) local playerRebornPositionX = getPlayerStorageValue(cid, PLAYER_REBORN_POSITION_X) local playerRebornPositionY = getPlayerStorageValue(cid, PLAYER_REBORN_POSITION_Y) local playerRebornPositionZ = getPlayerStorageValue(cid, PLAYER_REBORN_POSITION_Z) if (playerRebornPositionX <= -1 or playerRebornPositionY <= -1 or playerRebornPositionZ <= -1) then selfSay('Voce nao morreu nenhuma vez ainda.', cid) return false end doTeleportThing(cid, { x=playerRebornPositionX, y=playerRebornPositionY, z=playerRebornPositionZ }) return true end Agora em data/creaturescripts/scripts, crie um arquivo chamado reviver.lua e adicione isto dentro dele: local PLAYER_REBORN_POSITION_X = 66541 local PLAYER_REBORN_POSITION_Y = 66542 local PLAYER_REBORN_POSITION_Z = 66543 function onDeath(cid, corpse, deathList) if not isPlayer(cid) then return true end local player_position = getThingPos(cid) setPlayerStorageValue(cid, PLAYER_REBORN_POSITION_X, player_position.x) setPlayerStorageValue(cid, PLAYER_REBORN_POSITION_Y, player_position.y) setPlayerStorageValue(cid, PLAYER_REBORN_POSITION_Z, player_position.z) return TRUE end Em data/creaturescripts abra o arquivo creaturescripts.xml e adicione está linha nele: <event type="death" name="PlayerReborn" event="script" value="reviver.lua"/> Por ultimo registre o evento no arquivo login.lua dentro da pasta data/creaturescripts/scripts adicionando esta linha no arquivo: registerCreatureEvent(cid, "PlayerReborn") Espero ter ajudado.
-
Ajuda Script teleporte
@nelsonjrs Boa tarde, veja se é isso que você quer, a configuração de como usar o script está comentada. Obs: Lembre-se de adicionar a actionId em todos os teleportes. Crie um arquivo chamando room.lua em movements/scripts e adicione este código nele: -- Quantidade de level que o player irá ganhar local LEVEL_AMOUNT = 1 -- Defina a posição do teleport no final da sala, defina um valor único para o storage, assim o player irá ganhar o level apenas uma vez local teleportPositions = { { position = { x=151,y=55,z=7 }, storage = 14521 }, { position = { x=158,y=58,z=7 }, storage = 14522 }, { position = { x=151,y=54,z=7 }, storage = 14523 }, { position = { x=156,y=58,z=7 }, storage = 14524 }, } function onStepIn(cid, item, position, fromPosition) local playerPosition = getThingPos(cid) for _,teleportPosition in ipairs(teleportPositions) do if (checkPlayerPosition(teleportPosition.position, playerPosition)) then playerAddLevel(cid, teleportPosition.storage) end end return true end function checkPlayerPosition(teleportPosition, playerPosition) if (teleportPosition.x == playerPosition.x and teleportPosition.y == playerPosition.y and teleportPosition.z == playerPosition.z) then return true end end function playerAddLevel(player, storage) if (getPlayerStorageValue(player, storage) > 0) then return false end local playerLevel = getPlayerLevel(player) + LEVEL_AMOUNT local playerCalculateExperienceNextLevel = (getExperienceForLevel(playerLevel) - getPlayerExperience(player)) doPlayerAddExperience(player, playerCalculateExperienceNextLevel) setPlayerStorageValue(player, storage, 1) end Vá em movements.xml e adicione está linha nele: <movevent type="StepIn" actionid="3333" event="script" value="room.lua"/>
-
Erro script lootring
@stauro Boa tarde, tente assim Não precisa adicionar a tag script nos monsters, aparentemente o que está dando esse erro é que o alguns monstros nao dropam a bag. local t = { item = 2127, slot = CONST_SLOT_RING, newRate = 5 } local rate = getConfigInfo('rateLoot') function getContentDescription(uid, comma) local ret, i, containers = '', 0, {} while i < getContainerSize(uid) do local v, s = getContainerItem(uid, i), '' local k = getItemInfo(v.itemid) if k.name ~= '' then if v.type > 1 and k.stackable and k.showCount then s = v.type .. ' ' .. getItemInfo(v.itemid).plural else local article = k.article s = (article == '' and '' or article .. ' ') .. k.name end ret = ret .. (i == 0 and not comma and '' or ', ') .. s if isContainer(v.uid) and getContainerSize(v.uid) > 0 then table.insert(containers, v.uid) end else ret = ret .. (i == 0 and not comma and '' or ', ') .. 'an item of type ' .. v.itemid .. ', please report it to gamemaster' end i = i + 1 end for i = 1, #containers do ret = ret .. getContentDescription(containers[i], true) end return ret end local function send(cid, pos, corpseid, monster, party) local corpse = getTileItemById(pos, corpseid).uid local ret = isContainer(corpse) and getContentDescription(corpse) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Loot of ' .. monster .. ': ' .. (ret ~= '' and ret or 'nothing')) if party then for _, pid in ipairs(getPartyMembers(party)) do doPlayerSendChannelMessage(pid, '', 'Loot of ' .. monster .. ': ' .. (ret ~= '' and ret or 'nothing'), TALKTYPE_CHANNEL_W, CHANNEL_PARTY) end end end local function createLoot(i, ext) local item = type(i.id) == 'table' and i.id[math.random(#i.id)] or i.id local random = math.ceil(math.random(100000) / (ext and t.newRate or rate)) local tmpItem if random < i.chance then tmpItem = doCreateItemEx(item, getItemInfo(item).stackable and random % i.count + 1 or 1) end if not tmpItem then return end if i.subType ~= -1 then doItemSetAttribute(tmpItem, 'subType', i.subType) end if i.actionId ~= -1 then doItemSetAttribute(tmpItem, 'aid', i.actionId) end if i.uniqueId ~= -1 then doItemSetAttribute(tmpItem, 'uid', i.uniqueId) end if i.text ~= '' then doItemSetAttribute(tmpItem, 'text', i.text) end return tmpItem end local function createChildLoot(parent, i, ext) if #i == 0 then return true end local size, cap = 0, getContainerCap(parent) for k = 1, #i do if size == cap then break end local tmp = createLoot(i[k], ext) if tmp then if isContainer(tmp) then if i[k].child == nil then break end if createChildLoot(tmp, i[k].child, ext) then doAddContainerItemEx(parent, tmp) size = size + 1 else doRemoveItem(tmp) end else doAddContainerItemEx(parent, tmp) size = size + 1 end end end return size > 0 end local function dropLoot(pos, v, ext) local corpse = getTileItemById(pos, v.lookCorpse).uid if isContainer(corpse) then for i = 1, getContainerSize(corpse) do doRemoveItem(getContainerItem(corpse, 0).uid) end local size, cap = 0, getContainerCap(corpse) for i = 1, #v.loot do if size == cap then break end local tmp = createLoot(v.loot[i], ext) if tmp then if isContainer(tmp) then if createChildLoot(tmp, v.loot[i].child, ext) then doAddContainerItemEx(corpse, tmp) size = size + 1 else doRemoveItem(tmp) end else doAddContainerItemEx(corpse, tmp) size = size + 1 end end end end end function onKill(cid, target, lastHit) if lastHit and isMonster(target) then local v = getMonsterInfo(getCreatureName(target)) if v.lookCorpse > 0 then local master = getCreatureMaster(target) if not master or master == target then addEvent(dropLoot, 0, getThingPos(target), v, getPlayerSlotItem(cid, t.slot).itemid == t.item) end addEvent(send, 100, cid, getThingPos(target), v.lookCorpse, v.description, getPlayerParty(cid)) end end return true end
-
Script encantamento problema charges
@amoxicilina Vá em items/items.xml e procura o item de id 7883 e vê se tem esse atributo nele. Se não funcionar, ai tem que ver se seu otx possui a função doItemSetAttribute() <attribute key="charges" value="1000" />
-
Script encantamento problema charges
@amoxicilina Bom dia, tente assim local luky4 = Action() function luky4.onUse(cid, item, frompos, item2, topos) local config = { charges = 1000, -- Charges } item1pos = {x=32598, y=32436, z=7, stackpos=255} --item1pos item2pos = {x=32599, y=32436, z=7, stackpos=255} --item2pos item3pos = {x=32599, y=32436, z=7, stackpos=255} --item3pos item1 = getThingfromPos(item1pos) item2 = getThingfromPos(item2pos) item3 = getThingfromPos(item3pos) porcentagem = 0 porcent = math.random(1, 100) -- War Hammer -- if item.itemid == 1945 and item1.itemid == 7868 and item2.itemid == 6548 or item1.itemid == 6548 and item2.itemid == 7868 then if math.random(1, 100) >= 1 and math.random(1, 100) <= 15 then doRemoveItem(item1.uid,1) doRemoveItem(item2.uid,1) doSendMagicEffect(item3pos,29) local itemblessed = doCreateItem(7883,1, item3pos) doItemSetAttribute(itemblessed, "charges", config.charges) -- esta parte eu adicionei pra tentar adicionar as charges no item quando ele der sucesso quando for criado, mais não funcionou. doPlayerSendTextMessage(cid,22,'A arma foi blessada com sucesso.') elseif item.uid == 1994 and item.itemid == 1946 then doTransformItem(item.uid,item.itemid-1) else doPlayerSendTextMessage(cid,22,'A arma quebrou.') doRemoveItem(item1.uid,1) doRemoveItem(item2.uid,1) doSendMagicEffect(item3pos,3) end end end
-
Erro script lootring
@stauro Boa noite, tente adicionar essa tag no final antes de fechar o </monster> de qualquer arquivo xml da pasta monster (por exemplo amazon.xml) para ver se vai acontecer esse erro. No NomeDoEventoRegistrado você coloca o nome que você registrou no login.lua ou no creaturescripts.xml que faz executar esse script. <script> <event name="NomeDoEventoRegistrado"/> </script>
-
Reward ao matar players
@Freitas Epilef Boa noite, vê se é isso que você quer local config = { --{exp, item, quantidade} {40000, 2152, 5}, -- menor {90000, 2152, 6}, -- mesmo {110000, 2152, 7}, -- maior } local event = CreatureEvent("PlayerReward") function event.onKill(creature, target) local player = Player(creature) if (player:isPlayer() and target:isPlayer()) then if (target:getLevel() < player:getLevel()) then player:addItem(config[1][2], config[1][3]) player:addExperience(config[1][1]) end elseif (target:getLevel() == player:getLevel()) then player:addItem(config[2][2], config[2][3]) player:addExperience(config[2][1]) end player:addItem(config[3][2], config[3][3]) player:addExperience(config[3][1]) end end event:register() local login = CreatureEvent("RegisterPlayerReward") function login.onLogin(player) player:registerEvent("PlayerReward") return true end login:register()
-
tfs 1.2 converter skullcheck.lua
Eu acho que a query só é executada de fato quando o player está deslogado, então tipo, você tem que forçar o logout dele antes de executar a query, pode ser por isso que a database não foi alterada.
-
Mudar posição na Action
@Enenra Tenta trocar essa linha: local atual = {x = getPlayerPosition(cid).x + 1, y = getPlayerPosition(cid).y + 0, z = getPlayerPosition(cid).z} Por essa : local atual = {x = getPlayerPosition(cid).x, y = getPlayerPosition(cid).y, z = getPlayerPosition(cid).z}
-
mudar script de teleportar de tfs 0.4 para tfs 1.2
@jhonathan wendrell Boa, é isso ai! Com o tempo você vai pegando o jeito e entendendo o que o script tá fazendo, caso precise de ajuda abre um novo post, que se eu não conseguir ajudar, garanto que outra pessoa vai te ajudar.
-
mudar script de teleportar de tfs 0.4 para tfs 1.2
@jhonathan wendrell Então, você usou o comando sendo GOD? Se sim, o efeito não vai ser disparado, agora se você usou sendo player mesmo acredito que irá funcionar. Caso não funcione tem que ver se a sua source possui a função: sendMagicEffect
-
mudar script de teleportar de tfs 0.4 para tfs 1.2
@jhonathan wendrell Boa noite, <talkaction words="/ir" separator=" " script="NOME_DO_ARQUIVO.lua" /> function onSay(player, words, param) local STORAGE_JAIL = 50026 local config = { pz = false, -- players precisam estar em protection zone para usar? (true or false) battle = true, -- players deve estar sem battle (true or false) custo = false, -- se os teleport irão custa (true or false) need_level = false, -- se os teleport irão precisar de level (true or false) premium = false -- se precisa ser premium account (true or false) } --[[ Config lugares]]-- local lugar = { ["formorgar2"] = { pos = {x=2094, y=136, z=8},level = 1,price = 0, premium = 1}, ["wyrm"] = { pos = {x=528, y=1529, z=7},level = 1,price = 0, premium = 1}, ["erech"] = { pos = {x=1070, y=1250, z=5},level = 1,price = 0, premium = 1}, ["veglon"] = { pos = {x=228, y=449, z=7},level = 1,price = 0, premium = 1}, } local a = lugar[param] local STORAGE_IR = 12701 local delay = 1 * 1.2 local lastUse = player:getStorageValue(STORAGE_IR) local ticks = os.time() - lastUse if ticks < delay then return true end player:setStorageValue(STORAGE_IR, os.time()) if not(a) then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "As cidades que voce pode ir sao: edoras, belfallas, ashenport, bree, riv, dol, esg, argond, moria, mordor, forod, condado, dunedain, anfallas, minas.") player:sendTextMessage(MESSAGE_STATUS_CONSOLE_RED, "Lugares onde Apenas VIPS podem ir:") player:sendTextMessage(MESSAGE_STATUS_CONSOLE_RED, "Até Level 30: promoOrc, troll1, troll2, rot, pirata, mino1, mino2, pantano, eriador, dwarf1, dwarf2, macacos1, macacos2, slime1, slime2, slime3, ghoul, bandit1, bandit2, cyc1, cyc2, cyc3, stonegolem, dworc1, eregion.") player:sendTextMessage(MESSAGE_STATUS_CONSOLE_RED, "De level 31 a 100: rhun, dragonvip, erebor, mirkwood, forochel, carn, enedwaith, elven, elven2, wyvern, corsario, dunland, icedunland, beleghost, evendim, bonebeast1, bonebeast2, orc, blacknight1, blacknight2, hero1, hero2, hero3, hydra1, hydra2, hydra3, lich, icewitch1, icewitch2, crystal, barbarian, dragon1, dragon2, vamp, turtle, purga, quara.") player:sendTextMessage(MESSAGE_STATUS_CONSOLE_RED, "Level maior que 100: erech, formorgar, formorgar2, wyrm, veglon, northern, ered, orodruin, ice, nimrais, defiler, behedemon, harlond, northern2.") return true end if (config.premium == true and player:getPremiumDays() <= 0) then player:sendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Apenas contas VIP tem esse recurso.") end if (player:getStorageValue(STORAGE_JAIL) > os.time()) then player:sendTextMessage(MESSAGE_INFO_DESCR, 'Você só pode sair as '.. os.date("%H:%M:%S", player:getStorageValue(STORAGE_JAIL))..' (agora são: ' .. os.date("%H:%M:%S", os.time()) .. ').') return true end if (config.battle == true and player:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT) ~= nil) then player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Você não pode se teleportar em uma batalha.") return true end if a.premium == 1 and player:getPremiumDays() <= 0 then player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Apenas contas VIP podem acessar esse lugar.") return true end local pos = Position(a.pos.x, a.pos.y, a.pos.z) if player:getGroup():getId() >= 3 then player:teleportTo(pos) return true end player:getPosition():sendMagicEffect(27) player:teleportTo(pos) player:getPosition():sendMagicEffect(40) return true end
-
(AJUDA) Colocar tempo em script de pet
@dgozdk Boa noite, pode ser que o seu servidor não possui a função doPlayerSendCancel, nesse caso tente esse outro script. local timeStorage = 45644 -- não mexer local config = { time = 2, -- quanto tempo em segundos o player irá esperar para usar o item novamente enableMessage = true, -- habilitar a mensagem : (true) habilita, (false) não habilita } local currentTime = 60 * config.time function onUse(cid, item, frompos, item2, topos) local dolls = { [11256] = {pet = "Crystal Spider"}, [11207] = {pet = "Ashmunrah"}, [11144] = {pet = "Demon"}, [9019] = {pet = "Vampire"}, } if (os.time() < getPlayerStorageValue(cid, timeStorage)) then if (config.enableMessage) then doPlayerSendTextMessage(cid, 4, "Voce tem que esperar "..config.time.." minuto(s) para usar o pet novamente.") end return end local go = dolls[item.itemid] local summon = getCreatureSummons(cid) --------------------------------------------------- if #summon >= 1 then for _, pid in ipairs(summon) do doRemoveCreature(pid) doCreatureSay(cid, "Can go rest ["..go.pet.."]", TALKTYPE_ORANGE_1) setPlayerStorageValue(cid, timeStorage, os.time() + currentTime) end return true end doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid))) doCreatureSay(cid, "Let battle ["..go.pet.."]", TALKTYPE_ORANGE_1) return true end
-
(AJUDA) Colocar tempo em script de pet
@dgozdk Boa noite, local timeStorage = 45644 -- não mexer local config = { time = 2, -- quanto tempo em minutos o player irá esperar para usar o item novamente enableMessage = true, -- habilitar a mensagem : (true) habilita, (false) não habilita messageText = "Voce tem que esperar TIME minuto(s) para usar o pet novamente." -- mensagem que irá aparecer quando estiver em cooldown o pet, TIME é uma palavra chave para mostrar o tempo } local currentTime = 60 * config.time function onUse(cid, item, frompos, item2, topos) local dolls = { [11256] = {pet = "Crystal Spider"}, [11207] = {pet = "Ashmunrah"}, [11144] = {pet = "Demon"}, [9019] = {pet = "Vampire"}, } if (os.time() < getPlayerStorageValue(cid, timeStorage)) then if (config.enableMessage) then local message = config.messageText:gsub('TIME', config.time) doPlayerSendCancel(cid, message) end return end local go = dolls[item.itemid] local summon = getCreatureSummons(cid) --------------------------------------------------- if #summon >= 1 then for _, pid in ipairs(summon) do doRemoveCreature(pid) doCreatureSay(cid, "Can go rest ["..go.pet.."]", TALKTYPE_ORANGE_1) setPlayerStorageValue(cid, timeStorage, os.time() + currentTime) end return true end doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid))) doCreatureSay(cid, "Let battle ["..go.pet.."]", TALKTYPE_ORANGE_1) return true end
-
[Open Source] Tibia Server C# .NET 5
Perfeito cara parabéns, isso provavelmente vai abrir muitas portas para a extensão dos servidores de tibia e também os derivados!
-
(Resolvido)Problema NPC DAILY
@knepperzik Então o jeito que eu tinha feito é que toda fez que o player logar iria resetar as storages da task, então ele teria que finalizar a task sempre online. Eu fiz uma alteração no script tente fazer desta forma pra ver se funciona, toda vez que o servidor iniciar ele vai zerar todas as storages dos players que começaram a task, segue o script: Primeiro de tudo, vá no arquivo data/creaturescripts/scripts e abra o login.lua e remova as linhas que você adicionou usando o script anterior: Vá em data/globalevents/scripts e crie um arquivo chamado dailyReset.lua e cole isto dentro: Registre o script no globalevents.xml adicionando esta linha nele : Agora, vá em data/npc/scripts e procuro pelo script do NPC daily que se chama tasker (caso tenha mudado o nome então procuro pelo nome que voce alterou) e troque por esse script :
-
(Resolvido)Problema NPC DAILY
@knepperzik Boa tarde, vá até a pasta data/creaturescripts/scripts abra o arquivo login.lua e embaixo aonde está function onLogin(cid) coloque este trecho de código: if getPlayerStorageValue(cid, task_start) > 0 then ClearAllStoragePlayer(cid) setPlayerStorageValue(cid, task_start, -1) end if getPlayerStorageValue(cid, task_finish) > 0 then setPlayerStorageValue(cid, task_finish , -1) end if getPlayerStorageValue(cid, task_start_opcao1) > 0 then setPlayerStorageValue(cid, task_start_opcao1, -1) end if getPlayerStorageValue(cid, task_start_opcao2) > 0 then setPlayerStorageValue(cid, task_start_opcao2, -1) end
-
NPCS de que pega item e de task diarias
Boa tarde, como seria essas missões diárias que o npc 2 vai dar, matar monstro, pegar items?