
Histórico de Curtidas
-
kingdj22 deu reputação a Vodkart em AJUDA COM TABELAS ! monster name = "Name" list = {"Name Um", "Name Dois", "Name Tres"}posta o código de todo o sistema, para que possamos fazer a alteração!
-
kingdj22 recebeu reputação de Vodkart em (Resolvido)GetGainedExperience, como usar a função?cara, em partes, deu certo... porém, ta me dando o bonus conforme o valor total de exp do monstro, que é o que ta me retornando, porém meu server é por rates... Então o valor do bonus ta me dando muito além do que o valor que eu realmente estou ganhando... Ali onde retorna o valor de exp que o monstro deu, tem algum meio de retornar não o valor total de exp que ele da, e sim o valor que o player está ganhando conforme os rates dele?
@Vodkart
Retornando para dizer como foi resolvido... Usei as funções que voce ensinou, e fiz algumas config locais a mais para eu conseguir chegar no resultado que eu queria, que era apenas o bonus de 30% em cima do valor de EXP que o monstro me daria sem rate extra algum, nem o bonus stamina, nem bonus vip, nem bonus castle... Apenas o valor ganho conforme o rate do player, somando 30% a mais... Provavelmente você saberia fazer de uma forma mais simples mas fiz assim alterando as informações que você me deu...
function onKill(cid, target, damage, flags) if not (isMonster(target)) then return true end if (string.lower(getCreatureName(target)) == string.lower(getGlobalStorageValue(monster_name_backup))) then local percent = tonumber(getGlobalStorageValue(74813)) local rate = tonumber(getExperienceStage(getPlayerLevel(cid), getVocationInfo(getPlayerVocation(cid)).experienceMultiplier)) local amount = math.floor((getMonsterInfo(string.lower(getCreatureName(target))).experience)) local bonus = tonumber((amount / 100 * rate)*100) local final = math.floor(bonus / 100 * percent) doPlayerAddExpEx(cid, final) addLoot(getCreaturePosition(target), getCreatureName(target), {}) end return true end PS: Usando a função doPlayerAddExperience não estava recebendo nada de bonus, mas como a função que eu queria usar ja era a AddExpEx, assim fiz, e então ficou como eu queria, só o que vou tentar agora, mas vou tentar estudar para fazer solo e assim aprender, é colocar para que todos os monstros da mesma raça dêem o Bonus, ( Frost Dragon, Castle Frost Dragon, Donate Frost, etc.. ), inclusive vou usar as informações do seu mod Simple Task, que eu tambem uso, para pegar as funções e configs necessárias... Por hora me ajudou 500% ! Tu é o melhor cara, rep+ e topico encerrado já com a solução que eu usei somada a sua ajuda.
-
kingdj22 deu reputação a Vodkart em (Resolvido)GetGainedExperience, como usar a função?na lib tenta deixar assim:
monsters_boosteds = { -- Configuracao dos monstros que irão ter exp e loot aumentados [1] = {monster_name = "Dwarf", exp = 0.05, loot = 7}, [2] = {monster_name = "Goblin", exp = 0.05, loot = 5}, [3] = {monster_name = "Orc", exp = 0.25, loot = 15}, [4] = {monster_name = "Dwarf Soldier", exp = 0.35, loot = 10}, --[5] = {monster_name = "NOME DO MONSTRO", exp = "PORCENTAGEM DE EXP", loot = "PORCENTAGEM DO LOOT"}, }
o onKill
function onKill(cid, target, damage, flags) if not (isMonster(target)) then return true end if (string.lower(getCreatureName(target)) == string.lower(getGlobalStorageValue(monster_name_backup))) then local percent = tonumber(getGlobalStorageValue(74813)) local exp = getExperienceStage(getPlayerLevel(cid), getVocationInfo(getPlayerVocation(cid)).experienceMultiplier) local amount = math.floor(((getMonsterInfo(string.lower(getCreatureName(target))).experience*exp)*percent)) doPlayerAddExperience(cid, amount) addLoot(getCreaturePosition(target), getCreatureName(target), {}) end return true end function addLoot(position, name, ignoredList) local check = false for i = 0, 255 do position.stackpos = i corpse = getTileThingByPos(position) if corpse.uid > 0 and isCorpse(corpse.uid) then check = true break end end if check == true then local newRate = (1 + (getGlobalStorageValue(monster_loot_backup)/100)) * getConfigValue("rateLoot") local mainbp = doCreateItemEx(1987, 1) local monsterLoot = getMonsterLootList(name) for i, loot in pairs(monsterLoot) do if math.random(1, 100000) <= newRate * loot.chance then if #ignoredList > 0 then if (not isInArray(ignoredList, loot.id)) then doAddContainerItem(mainbp, loot.id, loot.countmax and math.random(1, loot.countmax) or 1) end else doAddContainerItem(mainbp, loot.id, loot.countmax and math.random(1, loot.countmax) or 1) end end end doAddContainerItemEx(corpse.uid, mainbp) end end
OBS: O EVENTO TEM QUE SER COMEÇADO DE NOVO PARA ATUALIZAR A EXP NA STORAGE, ou seja, testa só depois que dar o boost exp
-
kingdj22 deu reputação a Vodkart em [Mod] Automatic Raids [Dia E Hora Marcada]Automatic Raids.xml
<?xml version="1.0" encoding="UTF-8"?> <mod name="Automatic Raids" version="1.0" author="Vodkart And xotservx" contact="tibiaking.com" enabled="yes"> <config name="raids_func"><![CDATA[ days = { ["Monday"] = { ["21:30"] = {nome = "Orshabaal", pos = {fromPosition = {x=184, y=55, z=7},toPosition = {x=188, y=58, z=7}},m = {"5 Fire Devil", "2 Orshabaal"}, Time = 15}, ["21:33"] = {nome = "Dragon", pos = {fromPosition = {x=197, y=57, z=7},toPosition = {x=203, y=60, z=7}},m = {"100 Dragon"}, Time = 20} }, ["Sunday"] = { ["10:08"] = {nome = "Demon", pos = {fromPosition = {x=202, y=11, z=7},toPosition = {x=204, y=12, z=7}}, m = {"1 Demon"}, Time = 15}, ["10:46"] = {nome = "Hydra", pos = {fromPosition = {x=197, y=57, z=7},toPosition = {x=203, y=60, z=7}}, m = {"7 Hydra", "4 Cyclops"}, Time = 20} } } ]]></config> <globalevent name="AutomaticRaids" interval="60" event="script"><![CDATA[ domodlib('raids_func') function onThink(interval, lastExecution) if days[os.date("%A")] then hours = tostring(os.date("%X")):sub(1, 5) tb = days[os.date("%A")][hours] if tb then function removeCreature(tb) for x = ((tb.pos.fromPosition.x)-10), ((tb.pos.toPosition.x)+10) do for y = ((tb.pos.fromPosition.y)-10), ((tb.pos.toPosition.y)+10) do local m = getTopCreature({x=x, y=y, z= tb.pos.fromPosition.z}).uid if m ~= 0 and isMonster(m) then doRemoveCreature(m) end end end end doBroadcastMessage("The invasion of " .. tb.nome .. " started") for _,x in pairs(tb.m) do for s = 1, tonumber(x:match("%d+")) do pos = {x = math.random(tb.pos.fromPosition.x, tb.pos.toPosition.x), y = math.random(tb.pos.fromPosition.y, tb.pos.toPosition.y), z = tb.pos.fromPosition.z} doSummonCreature(x:match("%s(.+)"), pos) end end addEvent(removeCreature, tb.Time*60*1000, tb) end end return true end ]]></globalevent> </mod> Configuração: days = { ["Monday"] = { ["21:30"] = {nome = "Orshabaal", pos = {fromPosition = {x=184, y=55, z=7},toPosition = {x=188, y=58, z=7}},m = {"5 Fire Devil", "2 Orshabaal"}, Time = 1}, ["21:33"] = {nome = "Dragon", pos = {fromPosition = {x=197, y=57, z=7},toPosition = {x=203, y=60, z=7}},m = {"100 Dragon"}, Time = 2} }, ["Tuesday"] = { ["10:44"] = {nome = "Demon", pos = {fromPosition = {x=184, y=55, z=7},toPosition = {x=188, y=58, z=7}}, m = {"5 Demon", "8 Fire Devil"}, Time = 1}, ["10:46"] = {nome = "Hydra", pos = {fromPosition = {x=197, y=57, z=7},toPosition = {x=203, y=60, z=7}}, m = {"7 Hydra", "4 Cyclops"}, Time = 2} } } ["DIA"] = { ["HORA DA INVASÃO"] = {nome = "NOME DA INVASÃO", pos = {começo e final da área}, monster = {"MONSTROS"}, Time = para remover os monstro} } O dia da invasão é colocada entre " " e somente dia em inglês e a primeira letra maiúscula, exemplo: "Saturday" Depois são as hora da invasão, que é colocada entre " " e somente a hora e minuto, segundos não precisa exemplo: "15:00" As Posições estão entre { } adicionando as posições x, y e z, é o começo e final da área exemplo: pos = {fromPosition = {x=197, y=57, z=7},toPosition = {x=203, y=60, z=7}} fromPosition -- começo da área onde vai acontecer a raid toPosition -- final da área onde vai acontecer a raid Os monters tem um modo especial de configurar, vc coloca entre { }, e cada monstro entre " ", e entre as " " vc adiciona "QUANTIDADE MONSTRO", e para adicionar mais tipos de monstro se separa por virgulas, exemplo: {"40 Water Elemental", "5 Cyclops"} Time é uma função extra, é para caso ninguém participe do evento os monstros não fiquem pelo mapa, e é em minutos, exemplo: Time = 15
-
kingdj22 recebeu reputação de luanluciano93 em ( PEDIDO ) Upgrader Vip & DonateMano vi que tu tá num tópico de creatureboost la e eu peguei aquele código tbm e n dava a Exp mas fucei nas libs e achei umas funções q dava pra usar so no login do creaturescript q resolveu a Exp. Agora tô no celular mas amanhã vó fazer um tópico postando como ficou o código pra quem também use otx e possa precisar, aí te marco… e a primeira vez q alguém me ajuda aqui nesse fórum, e dahora ver q alguém leu e pensou em ajudar, vou fazer o mesmo com o mínimo q sei.
-
kingdj22 deu reputação a FeeTads em ( PEDIDO ) Upgrader Vip & Donateo pior que eu fiz um que funciona só no creatureScript e DataBase mano kkkkkk ainda mostra no site, se quiser posso te passar
boa mano, ja ajuda quem precisar, vai ser bom pra comunidade
kkkkkkkkkk, pior que eu to aprendendo muita coisa com .lua, sou programador mas mexo com lua faz 1 mes, ai usei teu pedido ai como cobaia tbm kkkkkkkkk, tmj mano, quando precisar de alguma ajuda chama discord ou marca em algum post, o woox e o vodkart dificilmente vão responder os caras são bem ocupados
-
kingdj22 recebeu reputação de FeeTads em ( PEDIDO ) Upgrader Vip & DonateMano vi que tu tá num tópico de creatureboost la e eu peguei aquele código tbm e n dava a Exp mas fucei nas libs e achei umas funções q dava pra usar so no login do creaturescript q resolveu a Exp. Agora tô no celular mas amanhã vó fazer um tópico postando como ficou o código pra quem também use otx e possa precisar, aí te marco… e a primeira vez q alguém me ajuda aqui nesse fórum, e dahora ver q alguém leu e pensou em ajudar, vou fazer o mesmo com o mínimo q sei.
-
kingdj22 deu reputação a FeeTads em ( PEDIDO ) Upgrader Vip & Donateja me passa o IP que eu vou conferir kkkkkkkkkkkkkkkkkkkkk
com esse ultimo script, como ta na desrição ali, 1 NPC faz tudo kkkkkkkkk
-
kingdj22 deu reputação a FeeTads em ( PEDIDO ) Upgrader Vip & Donatecara tem sim como fazer, mas tipo, se o cara tiver 2 bow, 1 free e 1 donate, ele vai dar upgrade apenas no primeiro tlg?
esse script que eu fiz, 1 NPC troca varios itens, só por la no config da linha 1, mas tipo da sim pra fazer 1 npc que troque os 2, mas meio que se o cara tiver o item equipado e 1 free na BP, vai ser trocado o free da bp primeiro, então não sei se isso vai valer a pena, oq tu poderia fazer é replicar esse script e trocar os ID, de free pra donate, e de donate pra super, ai seriam 2 npcs tlg
isso eu consigo fazer sim, simples até kkk vai ser 1 check a mais só, mas mano se tu quiser trocar ideia chama discord, não vou te cobrar por esse script não, mas preciso entender melhor como vc quer isso, ai eu scripto e te mostro por call, vai ser mais facil de eu entender tlg?
*não sei se posso mandar discord, mas eh " FeeTads#0246 ", caso algum mod veja e não puder mandar contato pode apagar*
Discord: FeeTads#0246
local config = { item = {12665, 12661, 1111, 1111, 1111}, --Id dos item free ou necessario pra trocar pelo donate itemDonate = {12653, 12655, 1111, 1111, 1111}, --ID dos item donate itemSuper = {2222,7735,4444,5555,6666,7777}, --ID dos items super donate needSto = true, --só pode trocar 1x por char esse item? storageTroca = 354545, --storage da troca trocarTodos = false --dar upgrade em todos os items que podem ser upgrades na BP? "true" > se tiver 5 item free, vai virar 5 item donate, "false" > vai transformar 1 e sair fora } 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 flag = 0 if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid local msg = string.lower(msg) if isInArray({"upgrade","upgrades", "donate"}, msg) then --se o player digitar essas palavras (você pode alterar como quiser) talkState[talkUser] = 1 end if talkState[talkUser] == 1 then if getPlayerStorageValue(cid, config.storageTroca) < 1 then --checa a storage do player for i=1, #config.itemDonate do --vai do primeiro até a quantidade de items, NÃO ESQUECER DE COLOCAR qtdItems com a mesma quantidade de items da tabela !IMPORTANTE flag = 1 --flag pra caso o char não tenha o item necessário if doPlayerRemoveItem(cid, config.itemDonate[i], 1) == true then --LEMBRANDO o item e o item donate tem que estar na mesma ordem na tabela config.item e config.itemDonate flag = 0 --reseta o flag pra evitar bugs doPlayerAddItem(cid, config.itemSuper[i], 1) --exemplo: se a Wand Free ta no primeiro slot {xxx...}, no itemDonate = {xxx...} tem que estar em primeiro também doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce acaba fazer UM upgrade em sua arma "..getItemInfo(config.itemDonate[i]).name.." e Ganhou um "..getItemInfo(config.itemSuper[i]).name..".") if (config.needSto) then --se só puder trocar 1x no NPC setPlayerStorageValue(cid, config.storageTroca, 1) --seta storage como 1, pro player não conseguir trocar de novo else setPlayerStorageValue(cid, config.storageTroca, 0) --seta como 0, o player pode trocar outro item donate por super end npcHandler:say("Obrigado, bye!", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) -- retorna if config.trocarTodos == false then return true end end end for i=1, #config.item do --vai do primeiro até a quantidade de items, NÃO ESQUECER DE COLOCAR qtdItems com a mesma quantidade de items da tabela !IMPORTANTE flag = 1 --flag pra caso o char não tenha o item necessário if doPlayerRemoveItem(cid, config.item[i], 1) == true then --LEMBRANDO o item e o item donate tem que estar na mesma ordem na tabela config.item e config.itemDonate flag = 0 --reseta o flag pra evitar bugs doPlayerAddItem(cid, config.itemDonate[i], 1) --exemplo: se a Wand Free ta no primeiro slot {xxx...}, no itemDonate = {xxx...} tem que estar em primeiro também doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce acaba fazer UM upgrade em sua arma "..getItemInfo(config.item[i]).name.." e Ganhou um "..getItemInfo(config.itemDonate[i]).name..".") if (config.needSto) then --se só puder trocar 1x no NPC setPlayerStorageValue(cid, config.storageTroca, 1) --seta storage como 1, pro player não conseguir trocar de novo else setPlayerStorageValue(cid, config.storageTroca, 0) --seta como 0, o player pode trocar outro item free por donate end npcHandler:say("Obrigado, bye!", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) -- retorna if config.trocarTodos == false then return true end end end if flag == 1 then talkState[talkUser] = 2 end else npcHandler:say("Desculpe, mas você ja pegou seu item", cid) end end if talkState[talkUser] == 2 then npcHandler:say("Desculpe, mas você não tem o item necessário.", cid) talkState[talkUser] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
dei uma arrumada mais ou menos com oq eu entendi que vc quer.
trocarTodos > adicionei um check pra saber se vc quer que o cara troque mais de 1 item, tipo
o cara tem 2 free axe, se o trocarTodos = true, ele troca os 2 free axe em donate axe
se o trocarTodos = false, ele vai dar upgrade apenas em 1 item (com prioridade no donate) e sair fora
como funciona: ID dos items no escopo, retirado o "qtdItems" que era desnecessário.
PRIORIZA item donate pra > super donate, se não tiver procura por item free > pra item donate
se o player tiver item donate E item free, que podem ser upgrade, vai dar upgrade apenas no donate pro > super donate, ou seja, o player só vai conseguir trocar 1 item 1x, e será priorizado o item donate pro super donate.
needSto = true > deixar true pra caso o player troca apenas 1x, se por "false" o player vai poder trocar varias vezes.
storageTroca pode ser qualquer numero que vc quiser.
!IMPORTANTE!
não colocar item com ID errado, pois a função checa se é possivel remover o item do player, ou seja, se o player tiver o item, ele remove e entra na função pra dar o upgrade, se o ID do item donate/super donate estiver errado, ele vai remover o antigo, e vai tentar dar o upgrade e não vai achar, ai o player vai ficar sem item.
Então é necessário testar todos os items antes de por em vigor.
-
kingdj22 deu reputação a FeeTads em ( PEDIDO ) Upgrader Vip & Donatecara não entendi muito bem essa parte, pq tipo, se o cara tem o bow free, e fazer upgrade com o NPC, ele vai ter o bow donate, ai é só ele falar "upgrade" de novo que vai ganhar o super donate, OU vc explicou de uma forma meio errada kkkkkkkkk
fiz um aqui, testa ai pra ver se funciona, se funcionar larga o rep+ rs
data/npc/nome-do-npc.xml
<?xml version="1.0" encoding="UTF-8"?> <npc name="[NPC] Trader" script="data/npc/scripts/nome-do-script.lua" floorchange="0" walkinterval="0" access="5" level="1" maglevel="1"> <health now="150" max="150"/> <look type="300" skull="2"/> <parameters> <parameter key="module_shop" value="1" /> <parameter key="message_greet" value="Ola |PLAYERNAME|. Diga Upgrade para receber seu item." /> </parameters> </npc>
data/npc/scripts/nome-do-script.lua
--[MAKE BY FETADS Discord: FeeTads#0246]-- local config = { qtdItems = 5, --Quantidade de items que irá ter conforme tabela item = {12665, 12661, 1111, 1111, 1111}, --Id dos item free ou necessario pra trocar pelo donate itemDonate = {12653, 12655, 1111, 1111, 1111}, --ID dos item donate needSto = false, --só pode trocar 1x por char esse item? storageTroca = 354545 --storage da troca } 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 flag = 0 if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid local msg = string.lower(msg) if isInArray({"upgrade","upgrades", "donate"}, msg) then --se o player digitar essas palavras (você pode alterar como quiser) talkState[talkUser] = 1 end if talkState[talkUser] == 1 then if getPlayerStorageValue(cid, config.storageTroca) < 1 then --checa a storage do player local checkitem = #config.item --checkItem recebe a tabela de items pra serem transformados em donate for i=1, config.qtdItems do --vai do primeiro até a quantidade de items, NÃO ESQUECER DE COLOCAR qtdItems com a mesma quantidade de items da tabela !IMPORTANTE flag = 1 --flag pra caso o char não tenha o item necessário if doPlayerRemoveItem(cid, config.item[i], 1) == true then --LEMBRANDO o item e o item donate tem que estar na mesma ordem na tabela config.item e config.itemDonate flag = 0 --reseta o flag pra evitar bugs doPlayerAddItem(cid, config.itemDonate[i], 1) --exemplo: se a Wand Free ta no primeiro slot {xxx...}, no itemDonate = {xxx...} tem que estar em primeiro também doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce acaba fazer UM upgrade em sua arma "..getItemNameById(config.item[i]).." e Ganhou um "..getItemNameById(config.itemDonate[i])..".") if (config.needSto) then --se só puder trocar 1x no NPC setPlayerStorageValue(cid, config.storageTroca, 1) --seta storage como 1, pro player não conseguir trocar de novo else setPlayerStorageValue(cid, config.storageTroca, 0) --seta como 0, o player pode trocar outro item free por donate end npcHandler:say("Obrigado, bye!", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) -- retorna return true end end if flag == 1 then talkState[talkUser] = 2 end else npcHandler:say("Desculpe, mas você ja pegou seu item", cid) end end if talkState[talkUser] == 2 then npcHandler:say("Desculpe, mas você não tem o item necessário.", cid) talkState[talkUser] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
e será necessário ter essa função na lib tbm.
function getItemNameById(itemid) return getItemDescriptionsById(itemid).name end
e essa no 101-compat.lua
getItemDescriptionsById = getItemInfo
-
kingdj22 deu reputação a lordzetros em Alavanca de troca [X itens por Y itens]Olá,
Bom... teve um pedido no Discord da TK feito por algum usuário (não estou recordando o nome) que estava tendo dificuldades em fazer determinado script, então decidi fazê-lo. É algo simples, eu já tinha enviado lá no canal de suporte, porém, como já de conhecimento por muitos, o canal foi removido. Decidi refazer de uma forma melhor e mais prática.
* Sobre o Script *
Quando o jogador utilizar a alavanca para ganhar determinado(s) item(s), ele terá que ter deixado em POSIÇÕES DEFINIDAS alguns itens, sendo assim, possível efetuar a troca. Simples, não? Caso ainda não tenha entendido, tem imagem abaixo de como funciona o mesmo.
* Imagens demonstração *
Tentando efetuar a troca sem tá com os itens posicionados de forma correta...
Efetuando a troca de forma correta.
* Instalando o Script *
Em data/actions/scripts/ crie um arquivo chamado alavanca_troca.lua e cole isto dentro:
--[[ Lordzetros - TK ]] local config_itens = { {id = 2666, pos = {144,63,6}, count = 1}, -- ID DO ITEM NECESSÁRIO, POSIÇÃO QUE DEVE FICAR, QUANTIDADE DE ITEM NECESSÁRIO {id = 2667, pos = {145,63,6}, count = 1}, {id = 2671, pos = {146,63,6}, count = 1}, -- Caso queira colocar outro item, basta seguir esse modelo (ctrl + c) } local config_troca = { msg_falha = "Falha na troca do item. Necessario: %dx %s em sua devida posicao!", msg_sucesso = "A troca foi efetuada com sucesso!", recompensas = {{id = 2003, count = 1}, {id = 2004, count = 1}} -- Para deixar apenas uma recompensa, apenas deixe recompensas = {{id = ID_DO_ITEM_A_GANHAR, count = QUANTIDADE_A_GANHAR}} } function onUse(player, item, fromPosition, target, toPosition, isHotkey) local ax_t = {} for i, v in ipairs(config_itens) do local vt = Tile(Position(v.pos[1], v.pos[2], v.pos[3])) local item_t = vt:getItemById(v.id) if (not item_t or item_t:getCount() < v.count) then player:getPosition():sendMagicEffect(CONST_ME_POFF) player:sendTextMessage(36, config_troca.msg_falha:format(v.count, ItemType(v.id):getName())) return false end table.insert(ax_t, {item_t, v.count}) end for i, v in ipairs(ax_t) do v[1]:remove(v[2]) end for i, v in ipairs(config_troca.recompensas) do player:addItem(v.id, v.count) end player:sendTextMessage(36, config_troca.msg_sucesso) player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_RED) return true end Em seguida, coloque esta linha de código abaixo de uma semelhante em data/actions/actions.xml
<action actionid="30258" script="alavanca_troca.lua" />
Para finalizar, abre seu editor de mapa e coloque em algum alavanca o actionID = 30258
* Configurando o Script *
Tá tudo comentado no código, portanto, vou falar só por cima.
{id = 2666, pos = {144,63,6}, count = 1}
Nesta parte, você deve colocar o id do item necessário, a posição que ele deve ficar e a quantidade.
E nesta parte você configura a recompensa do jogador
recompensas = {{id = 2003, count = 1}, {id = 2004, count = 1}}
Id do item que ele ganhará e quantidade
Enfim, script simples, porém, pode ser útil para muitos, assim como acredito que será para o usuário que solicitou, :). Abraços.
-
kingdj22 deu reputação a FeeTads em Defend The Towers ( Ajuda BUG no DoRemoveCreature/Item )vi um post parecido com o seu, ve se isso resolve mano
-
kingdj22 deu reputação a Emersonssss em Trade OFF - Shop OfflineSegue um lista in-game para quem não usa gesior e queria o sistema !
local config = { levelRequiredToAdd = 20, maxOffersPerPlayer = 5, SendOffersOnlyInPZ = true, blocked_items = {2165, 2152, 2148, 2160, 2166, 2167, 2168, 2169, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2343, 2433, 2640, 6132, 6300, 6301, 9932, 9933} } function onSay(cid, words, param, channel) if(param == '') then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.") return true end local t = string.explode(param, ",") if(t[1] == "add") then if((not t[2]) or (not t[3]) or (not t[4])) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.") return true end if(not tonumber(t[3]) or (not tonumber(t[4]))) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You don't set valid price or items count.") return true end if(string.len(t[3]) > 7 or (string.len(t[4]) > 3)) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "This price or item count is too high.") return true end local item = getItemIdByName(t[2]) if(not item) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item wich such name does not exists.") return true end if(getPlayerLevel(cid) < config.levelRequiredToAdd) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You don't have required (" .. config.levelRequiredToAdd .. ") level.") return true end if(isInArray(config.blocked_items, item)) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "This item is blocked.") return true end if(getPlayerItemCount(cid, item) < (tonumber(t[4]))) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you don't have this item(s).") return true end local check = db.getResult("SELECT `id` FROM `auction_system` WHERE `player` = " .. getPlayerGUID(cid) .. ";") if(check:getID() == -1) then elseif(check:getRows(true) >= config.maxOffersPerPlayer) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry you can't add more offers (max. " .. config.maxOffersPerPlayer .. ")") return true end if(config.SendOffersOnlyInPZ) then if(not getTilePzInfo(getPlayerPosition(cid))) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must be in PZ area when you add offert to database.") return true end end if(tonumber(t[4]) < 1 or (tonumber(t[3]) < 1)) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have to type a number higher than 0.") return true end local itemcount, costgp = math.floor(t[4]), math.floor(t[3]) doPlayerRemoveItem(cid, item, itemcount) db.executeQuery("INSERT INTO `auction_system` (`player`, `item_name`, `item_id`, `count`, `cost`, `date`) VALUES (" .. getPlayerGUID(cid) .. ", \"" .. t[2] .. "\", " .. getItemIdByName(t[2]) .. ", " .. itemcount .. ", " .. costgp ..", " .. os.time() .. ")") doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You successfully add " .. itemcount .." " .. t[2] .." for " .. costgp .. " gps to offerts database.") end if(t[1] == "buy") then if(not tonumber(t[2])) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wrong ID.") return true end local buy = db.getResult("SELECT * FROM `auction_system` WHERE `id` = " .. (tonumber(t[2])) .. ";") if(buy:getID() ~= -1) then if(getPlayerMoney(cid) < buy:getDataInt("cost")) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You don't have enoguh GP.") buy:free() return true end if(getPlayerName(cid) == getPlayerNameByGUID(buy:getDataInt("player"))) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you can't buy your own items.") buy:free() return true end if(getPlayerFreeCap(cid) < getItemWeightById(buy:getDataInt("item_id"), buy:getDataInt("count")))then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You try to buy a " .. buy:getDataString("item_name") .. ". It weight " .. getItemWeightById(buy:getDataInt("item_id"), buy:getDataInt("count")) .. " cap oz. and you have only " .. getPlayerFreeCap(cid) .. " oz. free capacity. Put some items to depot and try again.") buy:free() return true end if(isItemStackable((buy:getDataString("item_id")))) then doPlayerAddItem(cid, buy:getDataString("item_id"), buy:getDataInt("count")) else for i = 1, buy:getDataInt("count") do doPlayerAddItem(cid, buy:getDataString("item_id"), 1) end end doPlayerRemoveMoney(cid, buy:getDataInt("cost")) db.executeQuery("DELETE FROM `auction_system` WHERE `id` = " .. t[2] .. ";") doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You bought " .. buy:getDataInt("count") .. " ".. buy:getDataString("item_name") .. " for " .. buy:getDataInt("cost") .. " gps!") db.executeQuery("UPDATE `players` SET `auction_balance` = `auction_balance` + " .. buy:getDataInt("cost") .. " WHERE `id` = " .. buy:getDataInt("player") .. ";") buy:free() else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wrong ID.") end end if(t[1] == "remove") then if((not tonumber(t[2]))) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wrong ID.") return true end if(config.SendOffersOnlyInPZ) then if(not getTilePzInfo(getPlayerPosition(cid))) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must be in PZ area when you remove offerts from database.") return true end end local delete = db.getResult("SELECT * FROM `auction_system` WHERE `id` = " .. (tonumber(t[2])) .. ";") if(delete:getID() ~= -1) then if(getPlayerGUID(cid) == delete:getDataInt("player")) then db.executeQuery("DELETE FROM `auction_system` WHERE `id` = " .. t[2] .. ";") if(isItemStackable(delete:getDataString("item_id"))) then doPlayerAddItem(cid, delete:getDataString("item_id"), delete:getDataInt("count")) else for i = 1, delete:getDataInt("count") do doPlayerAddItem(cid, delete:getDataString("item_id"), 1) end end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your offert has been deleted from offerts database.") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "This is not your offert!") end delete:free() else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wrong ID.") end end if(t[1] == "withdraw") then local balance = db.getResult("SELECT `auction_balance` FROM `players` WHERE `id` = " .. getPlayerGUID(cid) .. ";") if(balance:getDataInt("auction_balance") < 1) then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You don't have money on your auction balance.") balance:free() return true end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got " .. balance:getDataInt("auction_balance") .. " gps from auction system!") doPlayerAddMoney(cid, balance:getDataInt("auction_balance")) db.executeQuery("UPDATE `players` SET `auction_balance` = '0' WHERE `id` = " .. getPlayerGUID(cid) .. ";") balance:free() end if(t[1] == "list") then local result = db.getResult("SELECT * FROM `auction_system` ORDER BY `auction_system`.`id` ASC") if result:getID() == -1 then return true end local msg = "Trade Offline:\n\n!offer buy, ID\n!offer remove, ID\n!offer add, ItemName, ItemPrice, ItemCount\n\n" while true do local id = result:getDataString("id") local name = getPlayerNameByGUID(result:getDataString("player")) local item_name = getItemNameById(result:getDataString("item_id")) local count = result:getDataString("count") local custo = result:getDataString("cost")/1000 local custo2 = result:getDataString("cost") if isPlayer(cid) then msg = ""..msg.."ID : "..id.."\nItem Name : "..item_name.." - Item Count : "..count.." - Item Cust : "..custo.."k("..custo2.."GP) - Dono : "..name.."\n" end if not result:next() then break end end doPlayerPopupFYI(cid, msg) return true end return true end -
kingdj22 deu reputação a Natanael Beckman em [GlobalEvents] ServeSave - Shutdown/AutomáticoGalera é um script muito simples, porém pra mim é muito ÚTIL.
Abra a pasta data/globalevents/scripts crie um arquivo .lua com o nome GlobalSave.lua, em seguida adicone o code:
function prepareShutdown(minutes) if(minutes <= 0) then doSetGameState(GAMESTATE_SHUTDOWN) return false end if(minutes == 1) then doBroadcastMessage("Server is going down in " .. minutes .. " minute for global save, please log out now!") elseif(minutes <= 3) then doBroadcastMessage("Server is going down in " .. minutes .. " minutes for global save, please log out.") else doBroadcastMessage("Server is going down in " .. minutes .. " minutes for global save.") end shutdownEvent = addEvent(prepareShutdown, 60000, minutes - 1) return true end function onTime() return prepareShutdown(5) -- Quantos minutos pra executar o ServeSave. end Ajustes:
Quando quiser modificar os minutos altere: -return prepareShutdown(5) - (5) = 5 minutos, eu recomendo no mínimo 5 minutos, em outras palavras não mexa. Em globalevents.xml adicione a tag seguinte:
<globalevent name="GlobalSave" time="05:30" event="script" value="GlobalSave.lua"/> No meu ServeSave é feito as 05:30 da manhã, modifique pro horário desejado!
Em config.lua verifique essa regra:
Se tiver TRUE deixa, assim ele fecha o .exe se não tiver no seu config.lua não tem problema closeInstanceOnShutdown = true -
-
-
Esse tutorial é só isso, clique em GOSTEI, e comente no tópico, muito obrigado!
--------------------------------------------------------------------------------------------------------------------------------------------------------
AUTO RESTART
--------------------------------------------------------------------------------------------------------------------------------------------------------
Pra você que utiliza Windows esse é perfeito:
Dezon OT Admin [restarter]
Pra você que utiliza Linux:
Baixe esse arquivo, TFS.SH, bote dentro da pasta do seu OT.
Esse arquivo está configurado pra abrir outro arquivo chamado tfs caso o seu seja outro nome mude pra esse, tfs.
Sempre que for abrir seu OT execute esse comando ./tfs.sh& e assim toda vez que o OT cair ele renicia automaticamente.
-
kingdj22 deu reputação a vine96 em Ajuda - Action que vende itens da BPtinha entrado em contato via mensagem com outro membro aqui do fórum o @Wakon e ele me disponibilizou, fiz umas modificações e está 100%
Para quem tem interesse o script completo é esse:
local items = { [2537] = {value = 4800}, [2377] = {value = 480}, [2663] = {value = 600}, [2472] = {value = 90000}, [2475] = {value = 7200}, [2519] = {value = 8000}, [2497] = {value = 6000}, [2523] = {value = 180000}, [2494] = {value = 108000}, [2400] = {value = 144000}, [2491] = {value = 2500}, [2421] = {value = 108000}, [2646] = {value = 240000}, [2477] = {value = 5000}, [2656] = {value = 10000}, [2498] = {value = 30000}, [2647] = {value = 600}, [2534] = {value = 15000}, [7402] = {value = 15000}, [2466] = {value = 20000}, [2465] = {value = 240}, [2408] = {value = 120000}, [2518] = {value = 1800}, [2500] = {value = 3000}, [2470] = {value = 30000}, [2645] = {value = 30000}, [2434] = {value = 2000}, [2463] = {value = 480}, [2536] = {value = 9000}, [2387] = {value = 240}, [2396] = {value = 1000}, [2381] = {value = 450}, [2528] = {value = 8000}, [2409] = {value = 1800}, [2414] = {value = 9000}, [2427] = {value = 11000}, [2407] = {value = 7200}, [2383] = {value = 960}, [2392] = {value = 4000}, [2488] = {value = 12000}, [2525] = {value = 250}, [2423] = {value = 1000}, [2462] = {value = 4800}, [2520] = {value = 30000}, [2390] = {value = 180000}, [2417] = {value = 500}, [2436] = {value = 6000}, [5741] = {value = 40000}, [2378] = {value = 500}, [2487] = {value = 12000}, [2476] = {value = 5000}, [8891] = {value = 15000}, [2195] = {value = 30000}, [2391] = {value = 7200}, [8889] = {value = 18000}, [2432] = {value = 8000}, [2431] = {value = 108000}, [2492] = {value = 40000}, [2515] = {value = 2000}, [2430] = {value = 2000}, [2393] = {value = 17000}, [7419] = {value = 10000}, [2522] = {value = 120000}, [2514] = {value = 50000}, [7418] = {value = 35000} } function onUse(cid, item, frompos, itemEx, topos) if (itemEx.itemid == item.itemid) then local str = "" for i, k in pairs(items) do str = str ..getItemNameById(i):gsub("%a", string.upper, 1).. ": ".. k.value .. "\n" end doShowTextDialog(cid, 6533, "Item Name: Price\n-----------------------------\n".. str) return true end --local i = items[getItemNameById(itemEx.itemid)] local i = items[itemEx.itemid] if (i) then local count = getPlayerItemCount(cid, itemEx.itemid) if (count > 0) then doPlayerSellItem(cid, itemEx.itemid, count, i.value * count, false) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você vendeu ".. count .." ".. (count == 1 and getItemNameById(itemEx.itemid) or getItemPluralNameById(itemEx.itemid)) .. " por ".. i.value * count .." gold coins.") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você não possuí esse item, o sistema irá vender apenas os items em seu inventário, items equipados não serão vendidos!") end else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Não foi possível vender esse item, use o loot seller nele mesmo para ver a lista de items disponíveis.") doSendMagicEffect(frompos, CONST_ME_POFF) end return true end
-
kingdj22 deu reputação a Rebreak em DUVIDA PARA EDITAR MAPA !esses tipo de texto nao aparece no mapa e sim Globalevents Tiles