
Solutions
-
Wakon's post in (Resolvido)Script que mude o ID do item was marked as the answerSiga esse tutorial:http://www.tibiaking.com/forum/topic/15337-criando-dois-items-com-a-mesma-sprite/
E sim, pode entrar normalmente com o cliente padrão do Tibia, irá mudar o ID mas irá usar a mesma sprite, então não tem problema .
O tópico foi movido para a área correta, preste mais atenção da próxima vez!
Leia as regras do fórum: http://tibiaking.com/forum/topic/1281-regras-gerais/?p=7680
Este tópico foi movido:
De: "OTServ → Suporte OTServ → Suporte de Scripts"
Para: "OTServ → Suporte OTServ → Suporte de OTServ Geral"
-
Wakon's post in (Resolvido)[Ajuda]Talkaction parecida com /goto was marked as the answerOlha, fiz um novo aqui pra você ( se não se importar ), testei ele aqui na base de testes e está normal conforme meus testes, caso apresente algum erro, me avise!
http://hastebin.com/etegodexun.coffee
Troquei as config para testar, ai você altera do jeito que você quiser .
-
Wakon's post in (Resolvido)Teleporte para cidadão de X cidade was marked as the answerEm "Data/movements/scripts", copie e cole um arquivo.lua e renomeie para nome_desejado.lua, apague tudo e cole:
local config = { [9056] = 4, -- Aqui você coloca em [ACTIONID] = TOWNID. Exemplo ActionID 9056 vira morador da town 4. [9057] = 2, [9058] = 1 } function onStepIn(cid, item, position, fromPosition) if not isPlayer(cid) then return true end local townId = config[item.actionid] doPlayerSetTown(cid, townId) doTeleportThing(cid, getTownTemplePosition(townId)) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You are now a citizen of '.. getTownName(townId) ..'.') return true end Em "Data/movements", abra o arquivo movements.xml e adicione a tag:
<movevent type="StepIn" actionid="9056-9058" event="script" value="nome_desejado.lua"/> Na tag você coloca o nome do script em value="nome_desejado.lua" e coloca as actionid citadas no script, no exemplo está para funcionar da actionID 9056 até a 9058.
-
Wakon's post in (Resolvido)Aol diferente was marked as the answerEm "Data/creaturescripts/scripts", copie e cole um arquivo.LUA e renomeie para aolDeath.lua, apague tudo e cole:
local t = { aol = 2173, newAmulet = 2161 } function onDeath(cid, corpse, deathList) if (getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).itemid == t.aol) then doPlayerRemoveItem(cid, t.aol, 1) doPlayerAddItem(cid, t.newAmulet, 1) end return true end Em "Data/creaturescripts", abra o arquivo creaturescripts.xml e adicione a tag:
<event type="death" name="aolDeath" event="script" value="aoldeath.lua"/> Novamente em "Data/creaturescripts/scripts", abra o arquivo login.lua e adicione:
registerCreatureEvent(cid, "aolDeath") Se der algum problema, me avise!
-
Wakon's post in (Resolvido)[PEDIDO] NPC ou ITEM que de Storage was marked as the answerEm "Data/npc/scripts", copie e cole um arquivo.lua e renomeie para newArea.lua, apague tudo e cole:
local storage = 55105 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 msg = msg:lower(); local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msgcontains(msg, 'new area') or msgcontains(msg, 'acess') then if getPlayerStorageValue(cid, storage) >= 1 then selfSay("Você já tem acesso a New Area.", cid) else doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE) selfSay("Pronto, você obteve minha bencão, mais não vou me responsabilizar por você na New Area. Boa Sorte!", cid) setPlayerStorageValue(cid, storage, 1) end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Em "Data/npc", copie e cole um arquivo.xml e renomeie para nome_do_npc.xml, apague tudo e cole:
<?xml version="1.0" encoding="UTF-8"?> <npc name="NOMEDONPC" script="data/npc/scripts/newArea.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="149" head="57" body="59" legs="40" feet="76" addons="0"/> <parameters> <parameter key="message_greet" value="Olá |PLAYERNAME|, deseja receber minha permissão para ir a {New Area}?"/> </parameters> </npc> Não esqueça de mudar o nome do NPC no XML, se der algum problema, me avise .
-
Wakon's post in (Resolvido)Script de level maximo com storage. was marked as the answerEm "Data/creaturescripts/scripts", copie e cole um arquivo.LUA e renomeie para maxLevel.lua, apague tudo e cole:
local t = { storage = {44440, 4}, -- Storage e valor necessário. maxLevel = 25 -- Level máximo. } function onAdvance(cid, skill, oldLevel, newLevel) if skill == SKILL__LEVEL then if getPlayerStorageValue(cid, t.storage[1]) ~= t.storage[2] then if newLevel >= t.maxLevel then doPlayerAddExp(cid, getExperienceForLevel(t.maxLevel)-getPlayerExperience(cid)) doPlayerSendCancel(cid, "Você atingiu o level máximo, faça a quest para continuar upando.") end end end return true end Agora em "Data/creaturescripts", abra o arquivo creaturescripts.xml e adicione a tag:
<event type="advance" name="maxLevel" event="script" value="maxLevel.lua"/> Novamente em "Data/creaturescripts/scripts", abra o arquivo login.lua e adicione:
registerCreatureEvent(cid, "maxLevel") Caso dê algum problema ou falte algo, me avise.
-
Wakon's post in (Resolvido)Pedido, was marked as the answer"Data/creaturescripts/scripts", battleremove.lua:
function onThink(cid, interval) if(getTilePzInfo(getCreaturePosition(cid))) then doRemoveCondition(cid, CONDITION_INFIGHT) end end "Data/creaturescripts", creaturescripts.xml:
<event type="think" name="BattleRemove" event="script" value="battleremove.lua"/> "Data/creaturescripts/scripts", no arquivo login.lua, adicione:
registerCreatureEvent(cid, "BattleRemove") -
Wakon's post in (Resolvido)Piso que desloga e loga em outra pocição was marked as the answerEm "Data/movements/scripts", copie e cole um arquivo.LUA e renomeie para o nome_desejado.lua, apague tudo e cole:
local t = { pos = {x = 160, y = 54, z = 7} -- Local para onde o player será teleportado ao pisar no tile. } function onStepIn(cid, item, pos, fromPosition) doTeleportThing(cid, t.pos) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT) doRemoveCreature(cid) return true end Em "Data/movements", abra o arquivo movements.xml e adicione a TAG:
<movevent type="StepIn" actionid="25203" event="script" value="nome_desejado.lua" /> Em actionid="25203", você pode trocar a actionID para outra caso queira, depois é só colocar ela no piso.
Em value="nome_desejado.lua", coloque o nome do script que você colocou na pasta "Data/movements/scripts".
-
Wakon's post in (Resolvido)Script para Premium Account was marked as the answerColoque um return no script de rank, após a callback function onSay(cid, words, param) coloque:
if not isPremium(cid) then doPlayerSendCancel(cid, "Apenas usuários premium podem utilizar este comando.") return true end -
Wakon's post in (Resolvido)Ajuda Item para ir ao templo was marked as the answerEm "Data/actions/scripts" crie o arquivo.lua e cole:
local t = { delay = 5, -- Tempo em segundos para usar novamente. storage = 45555 -- Storage para utilizar. } function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerStorageValue(cid, t.storage) < os.time() then doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) setPlayerStorageValue(cid, t.storage, t.delay + os.time()) doRemoveItem(item.uid) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT) doSendMagicEffect(fromPosition, CONST_ME_TELEPORT) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você precisa aguardar ".. getPlayerStorageValue(cid, t.storage) - os.time() .." segundo(s) para usar novamente.") end return true end Em "Data/actions", abra o actions.xml e adicione a TAG:
<action itemid="10063" event="script" value="arquivo.lua"/> Não esqueça de mudar o value para o nome do script na tag.
-
Wakon's post in (Resolvido)item infinito was marked as the answerfunction onUse(cid, item, fromPosition, itemEx, toPosition) ITEM = 12779 local storage = 50000 local wait = 1.5 local pos1 = {x = getPlayerPosition(cid).x + 1, y = getPlayerPosition(cid).y + 0, z = getPlayerPosition(cid).z} if fromPosition.x ~= CONTAINER_POSITION and exhaustion.get(cid, storage) == FALSE then REG_HEALTH = 100000 REG_MANA = 100000 doPlayerAddMana(cid, REG_MANA) doCreatureAddHealth(cid, REG_HEALTH) doCreatureSay(cid, 'Aaahhh! Bem Melhor!', TALKTYPE_ORANGE_1) doSendMagicEffect(pos1, 82) exhaustion.set(cid, storage, wait) elseif item.itemid == ITEM and exhaustion.get(cid, storage) == FALSE then REG_HEALTH = 100000 REG_MANA = 100000 doPlayerAddMana(cid, REG_MANA) doCreatureAddHealth(cid, REG_HEALTH) doCreatureSay(cid, 'Aaahhh! Bem Melhor!', TALKTYPE_ORANGE_1) doSendMagicEffect(pos1, 82) exhaustion.set(cid, storage, wait) else doPlayerSendCancel(cid, "You are exhausted.") end return true end
-
Wakon's post in (Resolvido)NPCs de bless [um rep por cada] was marked as the answerIsso acontece pois você está tentando calcular o valor do level fora da callback, então cid não está definido.
NPC:
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) -- TAB -- local t = { palavras = {"bless", "first", "first bless"}, -- Palavras chaves para começar o dialogo. bless = 2, -- Numero da bless {1 a 5}. level = 50, -- Level necessário. price = getPlayerLevel(cid) * 250 -- Preço da bless. } -- TAB -- if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid msg = msg:lower(); if isInArray(t.palavras, msg) then if getPlayerBlessing(cid, t.bless) == false then if getPlayerLevel(cid) >= t.level then selfSay("Você deseja receber a benção The Spiritual Shielding por ".. t.price .." golds coins?", cid) talkState[talkUser] = 1 else selfSay("Você precisa ser level ".. t.level .. " para receber esta benção.", cid) end else selfSay("Você já tem essa benção.", cid) end elseif msgcontains(msg, "yes") then if talkState[talkUser] == 1 then if doPlayerRemoveMoney(cid, t.price) then selfSay("Você recebeu a benção The Spiritual Shielding.", cid) doPlayerAddBlessing(cid, t.bless) talkState[talkUser] = 0 else selfSay("Você não tem ".. t.price .." golds coins.", cid) talkState[talkUser] = 0 end end elseif msgcontains(msg, "no") then if talkState[talkUser] == 1 then selfSay("Ok...", cid) end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Talk:
local bless = {1, 2, 3, 4, 5} function onSay(cid, words, param) local cost = getPlayerLevel(cid) * 1500 if isPremium(cid) == FALSE then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Purchase at the NPC, only VIP players can use this command!") return TRUE end for i = 1, table.maxn(bless) do if(getPlayerBlessing(cid, bless[i])) then doPlayerSendCancel(cid, "You have all blesses.") return TRUE end end if(doPlayerRemoveMoney(cid, cost) == TRUE) then for i = 1, table.maxn(bless) do doPlayerAddBlessing(cid, bless[i]) end doCreatureSay(cid, "BLESS" ,19) doSendMagicEffect(getPlayerPosition(cid), 29) else doPlayerSendCancel(cid, "You dont have money.") end return TRUE end -
Wakon's post in (Resolvido)Ajuda Aqui! was marked as the answerVá em "Data/creaturescripts", abra o arquivo creaturescripts.xml e verifique os script's que tem o type login (type="login").
Depois de verificar, vá em "Data/creaturescripts/scripts", abra os scripts que tem login e procure pela sua mensagem, altere como desejar ou se quiser retirar me passe o script.
-
Wakon's post in (Resolvido)[Pedido] Comando para comprar montaria was marked as the answer"nesse mesmo script eu queria colocar um por exemplo:", por isso dei essa explicação '-'.
local mounts = { ["shadow draptor"] = {price = 1000000, id = 13}, ["donkey"] = {price = 10000, id = 14} } function onSay(cid, words, param) local param = string.lower(param) local st = mounts[param] if not st then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "A montaria ".. param .." não existe.") end if(param ~= st) then if doPlayerRemoveMoney(cid, st.price) then doPlayerAddMount(cid, st.id) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você precisa de ".. st.price .." para comprar a montaria ".. param ..".") end end return true end <talkaction words="!mount" event="script" value="nome_do_script.lua"/> Comando: !mount shadow draptor
@Edit
Dei uma editada no script, assim você pode configurar facilmente e adicionar outras montarias, caso queira.
-
Wakon's post in (Resolvido)Adaptar script de ring pra amulet was marked as the answerTesta ai:
-
Wakon's post in (Resolvido)[PEDIDO] !changesex por 1kk was marked as the answerTenta assim:
-
Wakon's post in (Resolvido)Scroll was marked as the answerEm "Data/actions/scripts", copie e cole um arquivo.LUA e renomeie para o nome desejado(ex: ScrollTP.lua), apague tudo e cole:
local t = { storage = 33333, -- Storage utilizada. temp = 5 -- Tempo em minutos para utilizar novamente. } function onUse(cid, item) if getPlayerStorageValue(cid, t.storage) < os.time() then if getCreatureCondition(cid, CONDITION_INFIGHT) == false then doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT) setPlayerStorageValue(cid, t.storage, t.temp * 60 + os.time()) doRemoveItem(item.uid, 1) else doPlayerSendCancel(cid, "You can't use in battle.") end else doPlayerSendCancel(cid, "You need wait "..math.ceil((getPlayerStorageValue(cid, t.storage) - os.time())/60).." minute(s) to use again.") end return true end Em "Data/actions", abra o arquivo actions.xml e adicione a tag:
<action itemid="id_do_scroll" event="script" value="nome_desejado.lua"/> Se der algum problema, me avise .
-
Wakon's post in (Resolvido)Script !buyvip ganha storage was marked as the answerEm "Data/talkactions/scripts", copie e cole um arquivo.LUA e renomeie para buyvip.lua, apague tudo e cole:
local t = { price = 1000000, -- Preço a ser cobrado. storage = 12333 -- Storage que irá ganhar. } function onSay(cid, words, param, channel) if getPlayerStorageValue(cid, t.storage) < 1 then if doPlayerRemoveMoney(cid, t.price) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Parabéns, agora você tem acesso a área VIP.") setPlayerStorageValue(cid, t.storage, 1) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você precisa de "..t.price.." gold coins para comprar VIP.") end else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você já é VIP!") end return true end Em "Data/talkactions", abra o arquivo talkactions.xml e adicione a TAG:
<talkaction words="!buyvip" event="script" value="buyvip.lua"/> Se der algum problema, me avise .
-
Wakon's post in (Resolvido)[Pedido] Vitaminas com limite was marked as the answerFiz um aqui pra você, se não estiver do jeito que você quer explique melhor!
function onUse(cid, item, frompos, item2, topos) local summon = getCreatureSummons(cid)[1] local tabela_status = { [13365] = {name="offense", value = 10, max = 30}, [13366] = {name="defense", value = 10, max = 30}, [13367] = {name="speed", value = 10, max = 40}, [13368] = {name="vitality", value = 10, max = 30}, [13369] = {name="specialattack", value = 10, max = 30} } if #getCreatureSummons(cid) < 1 then doPlayerSendTextMessage((cid), 27, "[Apricorn] Solte-o Seu Pokemon Para Dar o Apricorn!.") return false end local pb = getPlayerSlotItem(cid, 8) local pokename = getItemAttribute(pb.uid, "poke") local status = tabela_status[item.itemid] local pbstat= getItemAttribute(pb.uid, status.name) local st = pbstat + tabela_status[item.itemid].value if pbstat < status.max then doItemSetAttribute(pb.uid, status.name , st) doSendFlareEffect(getThingPos(summon)) doSendAnimatedText(getThingPos(summon), "Apricorn!", 215) doPlayerSendTextMessage((cid), 27, "[Apricorn] Seu Pokemon "..pokename.." Ganhou "..status.value.." "..status.name.." points!") doSendFlareEffect(getThingPos(cid)) doRemoveItem(item.uid, 1) else doPlayerSendTextMessage(cid, 27, "O atributo "..status.name.." chegou ao limite.") end return true end -
Wakon's post in (Resolvido)[PEDIDO] Redbull was marked as the answerOpa foi mal eu troquei o item, tente agora:
local limite = 2500 -- limite não passar de 1000 --{nova velocidade, tempo que durará em segundos} local speedCfg = {2500, 3} local food = {[2672] = {150, "Glup Glup"}} function onUse(cid, item, fromPosition, itemEx, toPosition) if exhaustion.check(cid, 23007) == false then exhaustion.set(cid, 23007, 5) else return doPlayerSendCancel(cid, "Tempo de espera: " ..exhaustion.get(cid, 23007).."") end if food[item.itemid] ~= nil then if (getPlayerFood(cid) + food[item.itemid][1]) >= limite then doPlayerSendCancel(cid, "You are full.") else doPlayerFeed(cid, food) local speed = getCreatureSpeed(cid) setPlayerStorageValue(cid, Speed_Storage, speed - speedCfg[1]) doChangeSpeed(cid, -speed) doChangeSpeed(cid, speedCfg[1]) addEvent(function() if isCreature(cid) then doChangeSpeed(cid, getPlayerStorageValue(cid, Speed_Storage)) end end, speedCfg[2]*1000) doSendAnimatedText(getCreaturePosition(cid), food[item.itemid][2], TEXTCOLOR_WHITE) doSendMagicEffect(getCreaturePosition(cid), 25) doRemoveItem(item.uid, 1) doSendAnimatedText(getCreaturePosition(cid), "REDBUUUULL", TEXTCOLOR_BLUE) end return true end return true end -
Wakon's post in (Resolvido)Ajuda Plss PDA was marked as the answerVocê tem que editar a Town no mapa (CTRL+T), assim que você configurar as cidades corretamente com cada posição, você altera no config.lua:
newPlayerTownId = 1 Lembre-se que é essencial você configurar as Town do seu servidor, para não bugar sistemas e configurar o Depot Chest.
-
Wakon's post in (Resolvido)[PEDIDO] Addon summoner was marked as the answerNPC:
Em "Data/npc/scripts", crie nome_do_arquivo.lua e cole:
Em "Data/npc", crie nome_do_npc.xml e cole:
Vou ver se consigo fazer o segundo pedido e caso eu consiga eu edito aqui!
Não está perfeito pois não manjo dessa função ainda:
Em "Data/actions/scripts", crie nome_do_script.lua e cole:
Em "Data/actions", abra o arquivo actions.xml e adicione a tag:
<action itemid="5957" script="nome_do_script.lua" /> Se der algum problema, me avise .
-
Wakon's post in (Resolvido)Como Modificar os Itens Iniciais was marked as the answerTem dois scripts para firstitems, um deles deve estar ativado e você está modificando o outro.
Um fica em "/mods" como firstitems.xml e o outro em "Data/creaturescripts/scripts" como firstitems.lua, tente modificar um deles.
-
Wakon's post in (Resolvido)Sistema de Rod Level! was marked as the answerDesculpe a demora para responder, tente assim:
-
Wakon's post in (Resolvido)Action + storage was marked as the answer"Data/actions/scripts":
local t = { istorage = 49000, -- Storage para não ficar ganhando toda hora, só mexa se necessário. level = 50, -- Level necessário. storage = {40955, 1}, -- Storage que irá ganhar e valor. vocation = {2, 6} -- Vocações que podem utilizar. } function onUse(cid) if getPlayerStorageValue(cid, t.istorage) < 1 then if getPlayerLevel(cid) >= t.level then if isInArray(t.vocation, getPlayerVocation(cid)) then setPlayerStorageValue(cid, t.storage[1], t.storage[2]) setPlayerStorageValue(cid, t.istorage, 1) doPlayerSendTextMessage(cid, 25, "Ativado.") else doPlayerSendCancel(cid, "Você não tem a vocação necessária para utilizar este item.") end else doPlayerSendCancel(cid, "Você precisa ser level "..t.level.." para utilizar.") end else doPlayerSendTextMessage(cid, 25, "Você já ativou.") end return true end TAG:
<action itemid="IDDOITEM" script="nome_do_script.lua" />