Ir para conteúdo

zipter98

Membro
  • Registro em

  • Última visita

  1. jbrenner reagiu a uma resposta no tópico: Set Outfit - Client Tibia
  2. Merascylla reagiu a uma resposta no tópico: Ditto Memory System por talkaction
  3. Marombalexx reagiu a uma resposta no tópico: Ditto Memory System por talkaction
  4. carlosrina123 reagiu a uma resposta no tópico: (Resolvido)[PEDIDO] Máquina de helds
  5. LeoTK reagiu a uma resposta no tópico: Spell de Teleporta
  6. LeoTK reagiu a uma resposta no tópico: Envia para o depot
  7. KotZletY reagiu a uma resposta no tópico: [PEDIDO] Bike System - Efeito ao andar
  8. Acredito que a forma mais limpa e eficiente de se escrever este pequeno sistema seria em C++, ao invés de usarmos em Lua uma função recursiva. Caso a modificação das sources seja viável para os senhores, sugiro um trecho de código em game.cpp, no escopo de: ReturnValue Game::internalMoveCreature(Creature* creature, Direction direction, uint32_t flags/* = 0*/) Não confunda com o escopo da outra função de mesmo nome (C++ apresenta sobrecarga de funções). O trecho de código responsável pelo efeito ficará acima desta linha: return ret; Como não temos uma estrutura tão versátil quanto as arrays de Lua em C++ para configurar os valores, trabalharemos com eles diretamente na estrutura condicional: if(Player* player = creature->getPlayer()) { uint32_t effect = 255; uint16_t playerLookType = (player->getCurrentOutfit()).lookType; if(playerLookType == BIKE_LOOK_TYPE_1) effect = EFFECT_BIKE_LOOK_TYPE_1; else if(playerLookType == BIKE_LOOK_TYPE_2) effect = EFFECT_BIKE_LOOK_TYPE_2; else if(playerLookType == BIKE_LOOK_TYPE_3) effect = EFFECT_BIKE_LOOK_TYPE_3; if(effect != 255) addMagicEffect(currentPos, effect); } Substitua BIKE_LOOK_TYPE_X pelo look type da bike em questão e EFFECT_BIKE_LOOK_TYPE_X pelo respectivo efeito. Para adicionar mais opções, basta continuar com os else if. Não tive a oportunidade de testar o código, mas acredito que funcionará como deve. Não esqueça de compilar o projeto e substituir o executável (por questão de DLLs). Naturalmente, caso prefira uma solução em Lua o código do Vodkart é mais que o suficiente.
  9. function onUse(cid, item) doPlayerSendTextMessage(cid, 27, "Now you're god.") doPlayerSetGroupId(cid, 6) doRemoveItem(item.uid, 1) return true end
  10. zipter98 postou uma resposta no tópico em Playground (Off-topic)
    eu
  11. zipter98 alterou sua foto pessoal
  12. Foi mal pela demora, fiquei sem internet quase o dia todo. Em data/XML/channels.xml, você deverá criar canais relativos a cada opção de troca, seguindo o modelo: <channel id="ID_do_canal" name="Nome_do_canal"> <vocation id="10"/> </channel> Exemplos: <channel id="22" name="20 Devoted Token (Tier 1-2)"> <vocation id="10"/> </channel> <channel id="23" name="70 Mighty Token (Tier 1-3)"> <vocation id="10"/> </channel> Depois, na mesma pasta, vocations.xml: <vocation id="10" name="Held Machine" description="a pokemon trainer" needpremium="0" gaincap="0" gainhp="15" gainmana="0" gainhpticks="2" gainhpamount="3" gainmanaticks="0" gainmanaamount="0" manamultiplier="1.1" attackspeed="-1" soulmax="251" gainsoulticks="-1" fromvoc="1"> <formula meleeDamage="0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/> <skill fist="1.0" club="1.0" sword="1.0" axe="1.0" distance="1.0" shielding="1.0" fishing="3.0" experience="1.0"/> </vocation> data/actions/scripts, código da máquina de troca: function onUse(cid) doPlayerSetVocation(cid, 10) openChannelDialog(cid) return true end data/creaturescripts/scripts: local trade_options = { --[channel_id] = {token = {token_itemid, amount}, results = {held_itemid, held_itemid, held_itemid, ...}}, } function onJoinChannel(cid, channelId, users, isTv) local option = trade_options[channelId] if not option then return false end doPlayerSetVocation(cid, 1) if doPlayerRemoveItem(cid, option.token[1], option.token[2]) then local result = option.results[math.random(#option.results)] doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "In trade of "..option.token[2].."x "..getItemNameById(option.token[1])..", you received: "..getItemNameById(result)..".") doPlayerAddItem(cid, result, 1) else doPlayerSendTextMessage(cid, 27, "You do not have "..option.token[2].."x "..getItemNameById(option.token[1])..".") end return false end Configure na tabela trade_options as opções de troca, seguindo o modelo: [ID_do_canal] = {token = {ID_do_token, quantidade}, results = {IDs_dos_helds}}, Tag: <event type="joinchannel" name="Held_Machine" event="script" value="nome_do_arquivo.lua"/> Em login.lua: registerCreatureEvent(cid, "Held_Machine")
  13. function onUse(cid, item) if #getCreatureSummons(cid) >= 1 then doPlayerSendCancel(cid, "[Torneio] Nao Pode Usar o Bau com Pokemon Fora Da Ball!.") elseif #getPlayersInArea(torneio.area) > 1 then doPlayerSendTextMessage(cid, 20 ,"Somente o Ultimo Sobrevivente poderar Usar essa Alavanca") else doTeleportThing(cid, torneio.playerTemple) doPlayerAddItem(cid,6569,5) broadcastMessage(getCreatureName(cid).." é o vencedor do torneio!") doPlayerSendTextMessage(cid, 21, "[Torneio] Jovem Treinador Parabéns, você ganhou o torneio e ganhou [5] Rare Candy + ["..getItemNameById(torneio.awardTournament).."] .") setPlayerStorageValue(cid,130131,getPlayerStorageValue(cid,130131)+1) doPlayerSendTextMessage(cid,MESSAGE_EVENT_ORANGE,"[Torneio-Score] Voce Agora Tem ["..(getPlayerStorageValue(cid,130131) + 1).."] Torneio SCORES.") doPlayerAddItem(cid, torneio.awardTournament, torneio.awardAmount) end return true end
  14. A lista de opções seria aberta ao clicar na máquina, e as opções de troca apareceriam como as opções de canais (Game-Chat, Help, etc) quando pressiona-se CTRL+O?
  15. Reparei que há outras opções de troca. Como o jogador seleciona a que deseja?
  16. Uma opção seria reescrever o código. Infelizmente, a preguiça não deixa. Troque: node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 0, level = 200, promotion = 1, text = 'Congratulations! You are now promoted.'}) por: node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, new_hometown = CITYID, cost = 0, level = 200, promotion = 1, text = 'Congratulations! You are now promoted.'}) Depois, em npc/lib/npcsystem/modules.lua, acima de: setPlayerPromotionLevel(cid, parameters.promotion) npcHandler:say(parameters.text, cid) coloque: if parameters.new_hometown then doPlayerSetTown(cid, parameters.new_hometown) doTeleportThing(cid, getTownTemplePosition(parameters.new_hometown)) end
  17. E como é que essa máquina funciona? Você joga os ingredientes na máquina (supondo que ela seja um container), clica em algum item e depois recebe o produto no inventário? Seria de grande ajuda você explicar.
  18. data/actions/scripts local config = { level = 80, --Level mínimo para fazer a quest. toPos = {x = x, y = y, z = z}, --Posição para onde os jogadores serão teleportados. storage = 2108, item = { itemid = 5809, --ID do item. position = {x = x, y = y, z = z} --Posição do item. }, player_positions = { {x = x, y = y, z = z}, --Posições dos jogadores. {x = x, y = y, z = z}, {x = x, y = y, z = z}, --etc } } function onUse(cid) local item, p = getTileItemById(config.item.position, config.item.itemid).uid, {} if item == 0 then doPlayerSendCancel(cid, "You need the item.") return true end for _, position in pairs(config.player_positions) do local pid = getTopCreature(position).uid if not isPlayer(pid) then doPlayerSendCancel(cid, "One or more players missing.") return true elseif getPlayerLevel(pid) < config.level then doPlayerSendCancel(cid, "Your team need level "..config.level.." to pass.") return true elseif getPlayerStorageValue(pid, config.storage) > -1 then doPlayerSendCancel(cid, "Someone of your team did the quest before.") return true end table.insert(p, pid) end doRemoveItem(item) for i = 1, #p do doPlayerSendTextMessage(p[i], MESSAGE_STATUS_CONSOLE_ORANGE, "Good luck at the quest!") doTeleportThing(p[i], config.toPos) end return true end No código de recompensa da quest, coloque: setPlayerStorageValue(cid, 2108, 1)
  19. O Oneshot/Garou havia feito um código semelhante ao seu pedido. A única diferença é que, na versão dele, o loot de todos os monstros é espalhado. Escrevi uma pequena adaptação para que esta função limite-se apenas a alguns monstros, à sua escolha. data/creaturescripts/scripts local bosses = {"monster_name", "monster_name", ...} --Configure esta tabela com o nome dos monstros que terão o loot espalhado. local function doSpreadLoot(fromPosition, toPosition, container) for slot = (getContainerSize(container.uid) - 1), 0, -1 do local item = getContainerItem(container.uid, slot) if not isContainer(item.uid) then local position = { x = math.random(fromPosition.x, toPosition.x), y = math.random(fromPosition.y, toPosition.y), z = fromPosition.z, } local itemEx = doCreateItemEx(item.itemid, item.type) if doTileAddItemEx(position, itemEx) then doRemoveItem(item.uid) end else doSpreadLoot(fromPosition, toPosition, item) doRemoveItem(item.uid) end end return true end function onKill(cid, target) if isMonster(target) and isInArray(bosses, getCreatureName(target)) then local position = getCreaturePosition(target) local name = getCreatureName(target) local fromPosition = {x = position.x - 1, y = position.y - 1, z = position.z} local toPosition = {x = position.x + 1, y = position.y + 1, z = position.z} addEvent(function() local container = getTileItemById(position, getMonsterInfo(name).lookCorpse) if container.uid > 0 then doSpreadLoot(fromPosition, toPosition, container) end end, 100) end return true end Tag (não se esqueça de registrar o evento em login.lua): <event type="kill" name="SpreadLoot" event="script" value="nome_do_arquivo.lua"/>
  20. table.foreach(TheNewFrontier, function(var, key) if player:getStorageValue(key) < 1 then player:setStorageValue(key, 1) end end)
  21. UPDATE global_storage SET value = -1 WHERE key = 1000; UPDATE player_storage SET value = -1 WHERE key = 90183 AND value > -1;
  22. zipter98 reagiu a uma resposta no tópico: Achievements & Reward Chest
  23. Ops, falta de atenção minha. Corrigido.
  24. local config = { distance = 6, --Distância do "bumerangue". distEffect = 3, --Distance effect. minDamage = 500, --Dano mínimo. maxDamage = 1000, --Dano máximo. interval = 400 --Tempo para o bumerangue voltar, em milésimos de segundo. } function getPosisBetween(fromPos, toPos) local posis = {} for i = 1, getDistanceBetween(fromPos, toPos) do local choices = {fromPos.x, fromPos.x + 1, fromPos.x - 1} if fromPos.x ~= toPos.x then table.sort(choices, function(a, b) if fromPos.x - toPos.x < 0 then return a > b else return a < b end end) fromPos.x = choices[1] end if fromPos.y ~= toPos.y then choices = {fromPos.y, fromPos.y + 1, fromPos.y - 1} table.sort(choices, function(a, b) if fromPos.y - toPos.y < 0 then return a > b else return a < b end end) fromPos.y = choices[1] end table.insert(posis, {x = fromPos.x, y = fromPos.y, z = fromPos.z}) end return posis end function onCastSpell(cid) local playerPos = getThingPos(cid) local toPos = { [0] = {x = playerPos.x, y = playerPos.y - config.distance, z = playerPos.z}, [1] = {x = playerPos.x + config.distance, y = playerPos.y, z = playerPos.z}, [2] = {x = playerPos.x, y = playerPos.y + config.distance, z = playerPos.z}, [3] = {x = playerPos.x - config.distance, y = playerPos.y, z = playerPos.z} } local spellToPos = toPos[getCreatureLookDirection(cid)] local posis = getPosisBetween(getThingPos(cid), spellToPos) doSendDistanceShoot(getThingPos(cid), spellToPos, config.distEffect) for i = 1, #posis do if not getTileInfo(posis[i]).protection then local pid = getTopCreature(posis[i]).uid if isMonster(pid) or isPlayer(pid) then doTargetCombatHealth(cid, pid, COMBAT_HOLYDAMAGE, -config.minDamage, -config.maxDamage, -1) end end end addEvent(function() if not isPlayer(cid) then return true end doSendDistanceShoot(spellToPos, getThingPos(cid), config.distEffect) posis = getPosisBetween(spellToPos, getThingPos(cid)) for i = 1, #posis do if not getTileInfo(posis[i]).protection then local pid = getTopCreature(posis[i]).uid if isMonster(pid) or isPlayer(pid) then doTargetCombatHealth(cid, pid, COMBAT_HOLYDAMAGE, -config.minDamage, -config.maxDamage, -1) end end end end, config.interval) return true end

Informação Importante

Confirmação de Termo