
Tudo que Wise postou
-
(Resolvido)Limpando Sala
Tente: function onStepIn(cid) local items = {1903, 1904, 1905} for posx = 490, 496 do for posy = 498, 503 do local pos = {x=posx, y=posy, z=5} for i = 1, #items do local limpar = getTileItemById(pos, items[i]) if limpar.uid > 0 then doRemoveItem(limpar.uid) end end end end return true end
-
comando de tutor e de adm
Adicione à lib do seu servidor: string.explode = function (str, sep, limit) if(type(sep) ~= 'string' or isInArray({tostring(str):len(), sep:len()}, 0)) then return {} end local i, pos, tmp, t = 0, 1, "", {} for s, e in function() return string.find(str, sep, pos) end do tmp = str:sub(pos, s - 1):trim() table.insert(t, tmp) pos = e + 1 i = i + 1 if(limit ~= nil and i == limit) then break end end tmp = str:sub(pos):trim() table.insert(t, tmp) return t end Se não me engano, no TFS 1.0 são 4 groups com 3 "módulos de acesso". Seriam eles Player (none/0), Tutor (1), Senior Tutor (2) e God (3). Você pode aplicar as flags/custom flags como te indiquei anteriormente, aos groups de Tutor (2) e Senior Tutor (3), pelo seu groups.xml.
-
[DÚVIDA] Ativar action por comando
Falha minha, um erro de atenção, e sim, provavelmente foi isso mesmo. Agora que notei que eu errei ao declarar uma variável na tabela. Códigos da action: function onUse(cid, item) local gstor = 54321 if getGlobalStorageValue(gstor) < 1 then return doPlayerSendCancel(cid, "This system is disabled.") end if getItemAttribute(item.uid, "corpseowner") ~= cid then return doPlayerSendCancel(cid, "You're not the owner.") end local items = {} for x = 0, (getContainerSize(item.uid)) do local itens = getContainerItem(item.uid, x) table.insert(items, {i=itens.itemid, q=itens.type}) doRemoveItem(itens.uid) end for y = 1, #items do doPlayerAddItemStacking(cid, items[y].i, items[y].q) doPlayerSendTextMessage(cid, 20, "Looted "..items[y].q.."x "..getItemNameById(items[y].i)..".") end if #items < 1 then return false end return true end Códigos da talkaction: local t = { ['enabled'] = {evalue = 1, dvalue = 0, msg = {'The action is now enabled.', 'The action is already enabled.'}}, ['disabled'] = {evalue = 0, dvalue = 1, msg = {'The action is now disabled.', 'The action is already disabled.'}} } function onSay(cid, words, param) local p = string.lower(param) local gstor = 54321 if p == '' then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You can use the following parameters: enabled/disabled.') elseif not t[p] or not tostring(p) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Invalid parameter specified.') elseif getGlobalStorageValue(gstor) == t[p].dvalue then setGlobalStorageValue(gstor, t[p].evalue) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, t[p].msg[1]) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, t[p].msg[2]) end return true end
-
[DÚVIDA] Ativar action por comando
Veja: if getGlobalStorageValue(gstor) < 1 then return doPlayerSendCancel(cid, "This system is disabled.") end Caso a estrutura de controle seja true, ou seja, caso o valor da global storage seja menor que 1 (desativado), então retornará aquela mensagem. Aqui: local t = { ['enabled'] = {evalue = 1, dvalue = 0, msg = {'The action is now enabled.', 'The action is already enabled.'}}, ['disabled'] = {evalue = 0, dvalue = 1, msg = {'The action is now disabled.', 'The action is already disabled.'}} } Caso o parâmetro usado seja enabled e a global storage for igual a 0 (desativado), então o valor da mesma será setado para como sendo 1 (ativado). Se o parâmetro usado for disabled, o inverso acontece. Tente desse modo invertido que fiz acima, se não der, refaço tudo depois que eu voltar. Abraços e tenha um bom natal.
-
[DÚVIDA] Ativar action por comando
Cara, o escopo que envolve a checagem da global storage só envia a mensagem caso o mesmo seja true, não tem nada a ver. E usando somente a storage, não vai dar pra determinar um "controle" geral da action, a storage se aplica em um creature ID específico e não para todos (como a global storage). O problema estava no valor da global storage, acabei esquecendo que por padrão (caso não esteja sendo usada em algum outro script), seria menor que 1 e resultaria nisso. Não tinha necessidade de eu postar uma tag, já que você tem esse action script, bastava substituir os códigos do mesmo. Enfim, tente invertendo os valores da global storage. Substitua seu action script: function onUse(cid, item) local gstor = 54321 if getGlobalStorageValue(gstor) < 1 then return doPlayerSendCancel(cid, "This system is disabled.") end if getItemAttribute(item.uid, "corpseowner") ~= cid then return doPlayerSendCancel(cid, "You're not the owner.") end local items = {} for x = 0, (getContainerSize(item.uid)) do local itens = getContainerItem(item.uid, x) table.insert(items, {i=itens.itemid, q=itens.type}) doRemoveItem(itens.uid) end for y = 1, #items do doPlayerAddItemStacking(cid, items[y].i, items[y].q) doPlayerSendTextMessage(cid, 20, "Looted "..items[y].q.."x "..getItemNameById(items[y].i)..".") end if #items < 1 then return false end return true end Substitua os códigos do talkaction script action.lua: local t = { ['enabled'] = {evalue = 1, dvalue = 0, msg = {'The action is now enabled.', 'The action is already enabled.'}}, ['disabled'] = {evalue = 0, dvalue = 1, msg = {'The action is now disabled.', 'The action is already disabled.'}} } function onSay(cid, words, param) local p = string.lower(param) local gstor = 54321 if p == '' then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You can use the following parameters: enabled/disabled.') elseif not t[p] or not tostring(p) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Invalid parameter specified.') elseif getGlobalStorageValue(gstor) == t[p].dvalue then setGlobalStorageValue(gstor, t[p].evalue) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, t[p].msg[1]) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, t[p].msg[2]) end return true end Se já há uma estrutura de controle que determina o retorno do callback através de um valor de uma global storage, qual a necessidade de aplicar ao creature ID um valor de uma storage?
-
(Resolvido)Premium para X level alcançado
@lordmentos Se o seu pedido foi atendido, por favor clique no botão que está localizado abaixo do post de quem te ajudou. Automaticamente ele irá ficar destacado como a melhor resposta e o tópico ficará com o prefixo "Resolvido" no início do título.
-
[DÚVIDA] Ativar action por comando
Habilitar/desabilitar uma action, no geral? Use uma global storage, é mais simples assim. Substitua o action script: function onUse(cid, item) local gstor = 54321 if getGlobalStorageValue(gstor) < 1 then return doPlayerSendCancel(cid, "This system is disabled.") end if getItemAttribute(item.uid, "corpseowner") ~= cid then return doPlayerSendCancel(cid, "You're not the owner.") end local items = {} for x = 0, (getContainerSize(item.uid)) do local itens = getContainerItem(item.uid, x) table.insert(items, {i=itens.itemid, q=itens.type}) doRemoveItem(itens.uid) end for y = 1, #items do doPlayerAddItemStacking(cid, items[y].i, items[y].q) doPlayerSendTextMessage(cid, 20, "Looted "..items[y].q.."x "..getItemNameById(items[y].i)..".") end if #items < 1 then return false end return true end action.lua (data/talkactions/scripts): local t = { ['enabled'] = {evalue = 1, dvalue = 0, msg = {'The action is now enabled.', 'The action is already enabled.'}}, ['disabled'] = {evalue = 0, dvalue = 1, msg = {'The action is now disabled.', 'The action is already disabled.'}} } function onSay(cid, words, param) local p = string.lower(param) local gstor = 54321 if p == '' then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You can use the following parameters: enabled/disabled.') elseif not t[p] or not tostring(p) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Invalid parameter specified.') elseif getGlobalStorageValue(gstor) == t[p].dvalue then setGlobalStorageValue(gstor, t[p].evalue) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, t[p].msg[1]) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, t[p].msg[2]) end return true end Tag - talkactions.xml (data/talkactions): <talkaction log="yes" words="/action" access="4" event="script" value="action.lua"/>
-
[ AJUDA ] Previlegio de VIP
Tente: losepromotion.lua (data/creaturescripts/scripts): function onThink(cid) local stor = 33335 if getPlayerStorageValue(cid, stor) - os.time() < 1 and getPlayerPromotionLevel(cid) > 1 then doPlayerSetPromotionLevel(cid, 1) end return true end Tag - creaturescripts.xml (data/creaturescripts): <event type="think" name="LosePromotion" event="script" value="losepromotion.lua"/> Registre o creature event em login.lua (data/creaturescripts/scripts): registerCreatureEvent(cid, "LosePromotion")
-
(Resolvido)Summon
@Frenesy Sem problemas. Se preferir usar só o do callback onCombat que postei, não terá necessidade de outros creature events (dá pra ter o summon como target, mas não é possível atacá-lo e ele não recebe quaisquer danos). Abraços.
-
npc com bloqueio de pokebals e tempo pra terminar a quest. e teleporta o player pra local determinado.
Você pode observar que na função: doTeleportThing(cid, config.Saffari2_Pos.Enter) a posição não está disponível no mesmo script que o do npc, portanto, é bem provável que você tenha um arquivo na sua lib (data/lib) que contenha os dados do seu sistema de "saffari". Procure lá, é nesse arquivo que você vai poder modificar a variável da tabela que contém a posição na qual o player é teleportado pelo npc.
-
(Pedido) Não poder deslogar estando em: Surf, Ride e Fly!
Sim, dá pra fazer um creature event que determine um tempo de "Idle", e caso cid tenha os valores das storages dos sistemas, ele é teleportado e setado (após um tempo estipulado) como fora da habilidade em questão. Mas aqui é o tópico de outro membro, amigo. Crie um tópico para seu próprio pedido/dúvida.
-
(Resolvido)Summon
Certo. Fica mais simples com o creature event combat. ownsummon.lua (data/creaturescripts/scripts): function onCombat(cid, target) if isSummon(target) and getCreatureMaster(target) == cid then return false end return true end Tag - creaturescripts.xml (data/creaturescripts): <event type="combat" name="OwnSummon" script="ownsummon.lua"/> Registre o creature event em login.lua (data/creaturescripts/scripts): registerCreatureEvent(cid, "OwnSummon")
-
[Pedido] Saga System
Só não garanto sobre a criatura não se movimentar, pois há variações causadas por outros cids no local. Tente: saga.lua (data/creaturescripts/scripts): local monster = 'Demon' -- name local stor = 8000 -- storage function onCombat(cid, target) if (isPlayer(cid)) then if (isMonster(target) and (getCreatureName(target) == monster and (getPlayerStorageValue(cid, stor) == 1 or 3))) then return false end elseif (isMonster(cid)) then if (isPlayer(target) and (getPlayerStorageValue(target, stor) == 1 or 3)) then return false end end return true end function onKill(cid, target) if isMonster(target) and getCreatureName(target) == monster and getPlayerStorageValue(cid, stor) == 2 then setPlayerStorageValue(cid, stor, 3) end return true end Tags - creaturescripts.xml (data/creaturescripts): <event type="combat" name="SagaCombat" event="script" value="saga.lua"/> <event type="kill" name="SagaKill" event="script" value="saga.lua"/> Registre os creature events tanto em login.lua (data/creaturescripts/scripts): registerCreatureEvent(cid, "SagaCombat") registerCreatureEvent(cid, "SagaKill") Quanto no arquivo XML do monster: <script> <event name="SagaCombat"/> </script>
-
(Resolvido)[ PEDIDO ] SCRIPTS P/ QUEST de DUPLO ITEM
Descarte os unique IDs. Vamos usar então, action IDs. Nesse caso, determinei como sendo os action IDs dos baús: 54001 = Sorcerer / Druid / Master Sorcerer / Elder Druid. 54002 = Paladin / Royal Paladin. 54003 = Knight / Elite Knight - Sword 54004 = Knight / Elite Knight - Club 54005 = Knight / Elite Knight - Axe Altere como preferir. Eu não testei chests.lua (data/actions/scripts): local t = { -- [actionID] = {vocs = {vocationIDs}, items = {itemIDs}} [54001] = {vocs = {1, 2, 5, 6}, items = {7424}}, -- mages [54002] = {vocs = {3, 7}, items = {8858, 2352}}, -- paladins [54003] = {vocs = {4, 8}, items = {7417}}, -- knights/sword [54004] = {vocs = {4, 8}, items = {7450}}, -- knights/club [54005] = {vocs = {4, 8}, items = {8926}} -- knights/axe } function onUse(cid, item, fromPos, toPos) local storage = 54321 local u = t[item.actionid] if not u then return false end if isInArray(u.vocs, getPlayerVocation(cid)) then if getPlayerStorageValue(cid, storage) < 1 then setPlayerStorageValue(cid, storage, 1) for i = 1, #u.items do doPlayerAddItem(cid, u.items[i], 1) end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You got your reward for completing the quest.') else doPlayerSendCancel(cid, 'You already have done this quest.') end else doPlayerSendCancel(cid, 'Your vocation is not allowed to do this quest.') end return true end Tag - actions.xml (data/actions): <action actionid="54001-54005" event="script" value="chests.lua"/>
-
(Resolvido)Tempo em teleport
Aí estão os valores usados nos metamétodos da função exhaustion, sendo a storage e o tempo em segundos, respectivamente.
-
[Action] Quest
Colocar o action ID no item? Você criou um arquivo em actions e colocou uma action tag em talkactions(?). Amigo, doPlayerAddItem é uma função. Tags em arquivos do open tibia, são usadas na linguagem XML (extensible markup language). Lembre-se, são apenas observações e não críticas. Está indo muito bem, ajudando vários membros, parabéns. Apenas tente estar mais certo das informações que repassa. Abraços. @falling Altere a tabela com o ID e a quantidade do item (códigos do membro danihcv). local item = {5432, 1} -- {itemID, count} local pos1 = {x=1,y=1,z=1} local pos2 = {x=2,y=1,z=1} function onUse(cid) doPlayerAddItem(cid, item[1], item[2]) doSummonCreature("Warlock", pos1) doSummonCreature("Warlock", pos2) return true end
-
Red/Black skull Remover
Não, relaxa. O aperfeiçoamento vem com a prática, continue assim ;]
-
Red/Black skull Remover
Legal, amigo. Mas dá pra simplificar, não acha? function onSay(cid) local t = {[5] = {cost = 500, name = 'Black'}, [4] = {cost = 300, name = 'Red'}, [3] = {cost = 100, name = 'White'}} local skull = t[getCreatureSkullType(cid)] if skull then if doPlayerRemoveMoney(cid, skull.cost*10000) then doCreatureSetSkullType(cid, 0) doSendMagicEffect(getThingPos(cid), 14) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Você removeu seu '..skull.name..' Skull por '..skull.cost..' crystal coins!') else doPlayerSendCancel(cid, 'Você precisa de '..skull.cost..' crystal coins para remover seu '..skull.name..' Skull.') end else doPlayerSendCancel(cid, 'Você não tem Skull para remover.') end return true end Continue assim. E quando desenvolvê-los, poste aqui no fórum sempre que possível, você vai estar contribuindo muito ;] PS: Adicionei o white skull à tabela por impulso rs
-
[Potion]
@Leolinduxo Nesse caso, o valor da condição de exhaust é calculado a partir do valor que você determinou em timeBetweenExActions (config.lua), subtraindo 100. Ex: Se em config.lua está: timeBetweenExActions = 1000 O valor de exhaust será: 1000 - 100 = 900 milissegundos. Você pode determinar o valor do tempo de exhaustion como quiser, basta alterar a condição. Ex: local MIN_HEALTH = 200 local MAX_HEALTH = 400 local MIN_MANA = 110 local MAX_MANA = 190 local EMPTY_POTION = 7635 local E_TIME = 700 -- exhaustion in milliseconds local exhaust = createConditionObject(CONDITION_EXHAUST) setConditionParam(exhaust, CONDITION_PARAM_TICKS, E_TIME) function onUse(cid, item, fromPosition, itemEx, toPosition) if not isPlayer(itemEx.uid) then return false end if hasCondition(cid, CONDITION_EXHAUST_HEAL) then return doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED) end if not isPaladin(itemEx.uid) or getPlayerLevel(itemEx.uid) < 80 and not getPlayerCustomFlagValue(itemEx.uid, PlayerCustomFlag_GamemasterPrivileges) then return doCreatureSay(itemEx.uid, "Only paladins of level 80 or above may drink this fluid.", TALKTYPE_ORANGE_1) end if doCreatureAddHealth(itemEx.uid, math.random(MIN_HEALTH, MAX_HEALTH)) == LUA_ERROR or doPlayerAddMana(itemEx.uid, math.random(MIN_MANA, MAX_MANA)) == LUA_ERROR then return false end doAddCondition(cid, exhaust) doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE) doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1) doRemoveItem(item.uid, 1) doPlayerAddItem(cid, EMPTY_POTION, 1) return true end
-
[PEDIDO]UMBRAL CREATION!
Bater osso? Você quer o umbral creation como o do Tibia Global? (NPC Eruaran)
-
(Resolvido)Summon
@Orochi Elf Bem pensado. Nesse caso, o summon não teria sua saúde alterada, porém o player ainda iria conseguir tê-lo como target. Legal, bom para treinar à distância ;]
-
(Resolvido)Summon
Posso te ajudar com essa parte. ownsummon.lua (data/creaturescripts/scripts): function onAttack(cid, target) if isSummon(target) and getCreatureMaster(target) == cid then return doPlayerSendCancel(cid, 'You cannot attack your own summon.') and false end return true end Tag - creaturescripts.xml (data/creaturescripts): <event type="attack" name="OwnSummon" script="ownsummon.lua"/> Registre o creature event em login.lua (data/creaturescripts/scripts): registerCreatureEvent(cid, "OwnSummon")
-
(Resolvido)[ PEDIDO ] SCRIPTS P/ QUEST de DUPLO ITEM
Então, eu precisaria apenas saber a storage usada pra determinar essa escolha única, pra fazer uso compatível dela nesse novo baú que você quer. Bom, você pode identificar como disse, procurando pelo actionID ou uniqueID que utilizou no baú, em actions.xml. Tente procurar de novo, e se não conseguir, me informe cada item de cada baú que eu refaço pra você.
-
(Resolvido)getCreatureSummons(cid)
@Frenesy Se a sua dúvida foi solucionada, por favor clique no botão que está localizado abaixo do post de quem te ajudou. Automaticamente ele irá ficar destacado como a melhor resposta e o tópico ficará com o prefixo "Resolvido" no início do título.
-
(Resolvido)Não Mostra Guild
look.lua (data/creaturescripts/scripts): function onLook(cid, thing, position, lookDistance) if isPlayer(thing.uid) and thing.uid ~= cid then doPlayerSetSpecialDescription(thing.uid,'[Frags: '..getPlayerFrags(thing.uid)..']') return true elseif thing.uid == cid then doPlayerSetSpecialDescription(cid,'[Frags: '..getPlayerFrags(cid)..']') local string = 'You see yourself.' if getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION) then string = string..' You are '.. getPlayerGroupName(cid) ..'.' elseif getPlayerVocation(cid) ~= 0 then string = string..' You are '.. getPlayerVocationName(cid) ..'.' else string = string..' You have no vocation.' end string = string..getPlayerSpecialDescription(cid)..'' if getPlayerNameByGUID(getPlayerPartner(cid), false, false) ~= nil then string = string..' You are '.. (getPlayerSex(cid) == 0 and 'wife' or 'husband') ..' of '.. getPlayerNameByGUID(getPlayerPartner(cid)) ..'.' end if getPlayerGuildId(cid) > 0 then string = string..' You are ' .. (getPlayerGuildRank(cid) == '' and 'a member' or getPlayerGuildRank(cid)) ..' of the '.. getPlayerGuildName(cid) string = getPlayerGuildNick(cid) ~= '' and string..' ('.. getPlayerGuildNick(cid) ..').' or string..'.' end if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEECREATUREDETAILS) then string = string..'nHealth: ['.. getCreatureHealth(cid) ..' / '.. getCreatureMaxHealth(cid) ..'], Mana: ['.. getCreatureMana(cid) ..' / '.. getCreatureMaxMana(cid) ..'].' string = string..'nIP: '.. doConvertIntegerToIp(getPlayerIp(cid)) ..'.' end if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION) then string = string..'nPosition: [X:'.. position.x..'] [Y:'.. position.y..'] [Z:'.. position.z..'].' end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string) return false end return true end Tag - creaturescripts.xml (data/creaturescripts): <event type="look" name="Look" event="script" value="look.lua"/> Registre o creature event em login.lua (data/creaturescripts/scripts): registerCreatureEvent(cid, "Look")