Ir para conteúdo

joaohd

Visconde
  • Total de itens

    361
  • Registro em

  • Última visita

  • Dias Ganhos

    10

Tudo que joaohd postou

  1. joaohd

    Function

    Tem algumas: getItemWeight(uid[, precise]) getItemWeightById(itemid, count[, precise]) Para usar em action, pode fazer assim: function onUse(cid, item) return doPlayerSendTextMessage(cid, 25, "O item pesa " .. getItemWeight(item.uid) .." oz.") end flw
  2. joaohd

    Script Do Tibia Global

    Resolvido por pm. Movido. flw
  3. joaohd

    Script Do Tibia Global

    É um movement. Aqui está: Salve em movements/scripts com o nome swimming.lua: local outfit = {lookType = 267, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0} local BORDERS = { [7943] = {x = 0, y = -2, back = SOUTH}, [7944] = {x = -2, y = 0, back = EAST}, [7945] = {x = 0, y = 2, back = NORTH}, [7946] = {x = 2, y = 0, back = WEST}, [7947] = {x = 2, y = 1, back = WEST}, [7948] = {x = -2, y = 1, back = NORTH}, [7949] = {x = 2, y = -1, back = WEST}, [7950] = {x = -2, y = -1, back = EAST}, [7951] = {x = 2, y = 2, back = WEST}, [7952] = {x = -2, y = 2, back = NORTH}, [7953] = {x = 2, y = -2, back = WEST}, [7954] = {x = -2, y = -2, back = SOUTH} } BORDERS[4828] = BORDERS[7943] BORDERS[4829] = BORDERS[7946] BORDERS[4830] = BORDERS[7945] BORDERS[4831] = BORDERS[7944] function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor) if(not isPlayer(cid)) then return true end local border = BORDERS[item.itemid] if(not border) then return false end local pos, newPos = getCreaturePosition(cid), {} newPos = pos newPos.x = pos.x + border.x newPos.y = pos.y + border.y if(hasCondition(cid, CONDITION_OUTFIT) and getCreatureOutfit(cid).lookType == outfit.lookType) then doMoveCreature(cid, border.back) doRemoveCondition(cid, CONDITION_OUTFIT) else if(doTileQueryAdd(cid, pos, 4) ~= RETURNVALUE_NOERROR) then return false end local tmp = getCreaturePosition(cid) doTeleportThing(cid, newPos) if(not isPlayerGhost(cid)) then doSendMagicEffect(tmp, CONST_ME_POFF) doSendMagicEffect(newPos, CONST_ME_WATERSPLASH) end doRemoveConditions(cid, true) doSetCreatureOutfit(cid, outfit, -1) end return true end E em movements.xml: <movevent type="StepIn" itemid="4828-4831" event="script" value="swimming.lua"/> <movevent type="StepIn" itemid="7943-7954" event="script" value="swimming.lua"/> Script retirado do crystal server. flw
  4. Poste uma imagem do seu erro e também o script que está com problemas. Tópico em local incorreto. Movido. flw
  5. Resolvido. Movido para Pedidos Atendidos. flw
  6. Tente isso: function onUse(cid, item) local c = { coal_pos = {x = 160, y = 54, z = 7}, player_pos = {x = 161, y = 54, z = 7}, to_pos = {x = 200, y = 200, z = 7} } if item.itemid == 1945 then if getCreaturePosition(cid).x == c.player_pos.x and getCreaturePosition(cid).y == c.player_pos.y and getCreaturePosition(cid).z == c.player_pos.z then c.coal_pos.stackpos = 1 if getThingfromPos(c.coal_pos).itemid == 2148 and getThingfromPos(c.coal_pos).type >= 100 then doTransformItem(item.uid, item.itemid+1) doRemoveItem(getThingfromPos(c.coal_pos).uid, 100) doTeleportThing(cid, c.to_pos) elseif getThingfromPos(c.coal_pos).itemid == 2152 and getThingfromPos(c.coal_pos).type >= 1 then doTransformItem(item.uid, item.itemid+1) doRemoveItem(getThingfromPos(c.coal_pos).uid, 1) doTeleportThing(cid, c.to_pos) else doTransformItem(item.uid, item.itemid+1) doPlayerSendCancel(cid,"Você precisa colocar 100gp's no coal.") end else doTransformItem(item.uid, item.itemid+1) doPlayerSendCancel(cid, "Você precisa estar na posição correta.") end elseif item.itemid == 1946 then doTransformItem(item.uid, item.itemid-1) end return true end Caso não dê certo, tente outras stackpos... flw
  7. O getThingfromPos retorna uma tabela, com os campos aid, uid, itemid e type. Caso queira mostrar algo, tente assim: for k,v in pairs(getThingfromPos({x=1040, y=1118, z=10, stackpos=255}) do doPlayerSendTextMessage(cid, 25, k .. v) end flw
  8. Isso não é em scripting. Você tem que editar o items.otb do seu servidor, adicionando a propriedade de agrupável. flw
  9. A função getDistanceBetween só calcula quantos sqm tem de distância entre 2 pontos. Não calcula se ele é andável, se tem rotas alternativas e não retorna as posições que tem entre os pontos. flw
  10. Que bom ver que alguém não pensa somente em servidores de pokemon! As idéias são bastante interessantes e inovadoras. Espero que consiga uma boa equipe que leve o projeto á frente. Tem futuro! Pronto max, agora me deixa em paz? ahshashahsa flw
  11. Inicialmente, vocês precisarão de uma função estilo TraceRoute(fromPos, toPos) que irá fazer o cálculo da distância e verificar se é possível fazer a passagem. Depois, terão que executar um laço nessa função juntamente com o doMoveCreature. Não fiz o script pois o TraceRoute é um pouco complicado e não o tenho completo. flw
  12. joaohd

    Pokedex

    Tente: function isSummon(uid) return isCreature(uid) and getCreatureMaster(uid) ~= uid or false end function onUse(cid, item, fromPos, itemEx, toPos) local pokemon = itemEx.uid local pokemons = { {"Bulbasaur", "1.txt", 11395, 20, 100, 99101}, {"Squirtle", "2.txt", 11401, 20, 500, 99102}, } for _,n in pairs(pokemons) do local Dex = io.open('data/pokedex/' .. n[2],'r') if isSummon(pokemon) then if getCreatureName(pokemon) == n[1] and getPlayerLevel(cid) >= n[4] and getPlayerStorageValue(cid, n[6]) <= 0 then doShowTextDialog(cid, n[3], Dex:read("*all")) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have unlocked " .. n[1] .. " in your pokedex") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have gained " .. n[5] .. " experience points.") doPlayerAddExperience(cid, n[5]) setPlayerStorageValue(cid, n[6], 1) elseif getCreatureName(pokemon) == n[1] and getPlayerLevel(cid) < n[4] and getPlayerStorageValue(cid, n[6]) <= 0 then doShowTextDialog(cid, n[3], Dex:read("*all")) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need level " .. n[4] .. " to unlock this pokemon.") elseif getCreatureName(pokemon) == n[1] and getPlayerStorageValue(cid, n[6]) >= 1 then doShowTextDialog(cid, n[3], Dex:read("*all")) return true end elseif isMonster(pokemon) then if getCreatureName(pokemon) == n[1] and getPlayerStorageValue(cid, n[6]) <= 0 then doShowTextDialog(cid, n[3], Dex:read("*all")) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have unlocked " .. n[1] .. " in your pokedex") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have gained " .. n[5] .. " experience points.") doPlayerAddExperience(cid, n[5]) setPlayerStorageValue(cid, n[6], 1) elseif getCreatureName(pokemon) == n[1] and getPlayerStorageValue(cid, n[6]) >= 1 then doShowTextDialog(cid, n[3], Dex:read("*all")) return true end end end flw
  13. Tente esta: function x(cid, t) function tablesum(tabl) for i = 1,#tabl do x = x and x+tabl[i] or tabl[i] end return x end local y = {} for i = 1, #t do table.insert(y, getPlayerItemCount(cid, t[i])) end return tablesum(y) end Botei o nome de "x". Mude a seu gosto. Estou sem criatividade flw
  14. Tente usar a tag da seguinte maneira: <instant name="Twin Slashes" words="twin slashes" lvl="28" mana="0" prem="0" needtarget="0" direction="0" needweapon="1" exhaustion="900" needlearn="0" script="attack/twin slashes.lua"> <vocation name="Knight"/> flw
  15. joaohd

    Menssagem

    KungLao, seu script tem alguns erros iniciantes. Como sei que está aprendendo, destacarei-os e explicarei o porque do erro: function onthink (interval, lastExecution) A linguagem LUA é case-sensitive, ou seja, faz distinção entre maiúsculas e minúsculas. Então, a letra "t" de onthink, deve ser maiúscula: function onThink(interval, lastExecution) O outro erro foi aqui: dobroadcastMessage(mensagens [math.random(1,table.maxn(mensagens))], cor Você esqueceu de fechar o parênteses da função e novamente o problema com letras maiúsculas. O correto seria: doBroadcast(mensagens[math.random(1, table.maxn(mensagens))], cor) Neste último erro, poderiamos reduzir bastante este comando, porém como ainda está em fase de aprendizado, não explicarei. @Topic O script do KungLao sem erros: --By Kung Lao function onThink (interval, lastExecution) --Configurações local cor =22 --defina cor da mensagem22 = branco local mensagens ={ -- Suas mensagens ficam entre os colchetes... "Mensagem 1", "Mensagem 2", "mensagem X" } --fim das configurações doBroadcastMessage(mensagens[math.random(1,table.maxn(mensagens))], cor) return TRUE end flw
  16. Errata: Me enganei quanto á substituição do "find" por "match", ambos retornaram a mesma coisa, resultando na perpetuação do problema... flw
  17. Se não me engano, esse bug do mew e mewtwo é bem simples de resolver: Onde está: if getItemNameById(item2.itemid):find(i:lower()) then Substitua por: if getItemNameById(item2.itemid):match(i:lower()) then Testem ae... flw
  18. Tente assim: local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) -- OTServ event handling functions start 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 -- OTServ event handling functions end -- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions! local travelNode = keywordHandler:addKeyword({'voltar'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Tem certeza que quer voltar para o Templo?'}) travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 1, cost = 0, destination = {x=1010, y=1025, z=7} }) travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Quando precisar voltar ao Templo, fale comigo!'}) local travelNode2 = keywordHandler:addKeyword({'BOSS'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Tem certeza que quer enfrentar o BOSS?'}) travelNode2:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 1, cost = 0, destination = {x=1052, y=1144, z=8} }) travelNode2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Quando precisar voltar ao Templo, fale comigo!'}) keywordHandler:addKeyword({'templo'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Eu só sirvo para leva-lo ao templo..'}) -- Makes sure the npc reacts when you say hi, bye etc. npcHandler:addModule(FocusModule:new()) flw
  19. joaohd

    Pokedex

    O servidor não possui esta função. Tente esta: function isSummon(uid) return isCreature(uid) and getCreatureMaster(uid) ~= uid or false end flw
  20. Como nao conheço seu vip system, tente usando o exemplo: local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_SOUND_BLUE) setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -400, 0, -800, 0) local arr = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 1, 1, 2, 1, 1, 0, 0, 0}, {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} } local area = createCombatArea(arr) setCombatArea(combat, area) function onCastSpell(cid, var) if isVip(cid) then doSendAnimatedText(getPlayerPosition(cid), "Frozen Song", TEXTCOLOR_RED) doPlayerAddExp(cid,1) doCombat(cid, combat, var) else doPlayerSendCancel(cid, "Voce nao eh vip.") return true end flw end
  21. Tente assim: function onUse(cid, item, frompos, item2, topos) if getPlayerLevel(cid) <= 8 then return doPlayerSendCancel(cid "Levels 8 ou menos não podem usar isso") end doPlayerAddExp(cid, 1000) doPlayerSendTextMessage(cid, 19, "Você ganhou 1000 experiência de bonus") doRemoveItem(item.uid, 1) end flw
  22. Mostre o script de um de seus npcs defeituosos juntamente com a versão do seu servidor... flw
  23. Não tem erro no seu comando. Você usa qual debugger? Alguns debuggers necessitam do uso de um randomseed juntamente ao random, para que seja feita uma alocação diferente e o numero gerado seja realmente aleatorio. flw
  24. O script que eu arrumei nao tem erros sintáticos... ----- Configuração ----- local config = { cost = 10000000, -- Preco do Item item_id = 8858, -- ID do Item quant = 1 } function onUse(cid, item, fromPosition) if doPlayerRemoveItem(cid, config.item_id, config.quant) then doPlayerAddMoney(cid, config.cost*config.quant) doSendMagicEffect(fromPosition, 31) doSendAnimatedText(fromPosition, "Vendido", TEXTCOLOR_RED) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Você Vendeu ".. getItemNameById(config.item_id) .."s por ".. config.cost*config.quant .."gold.") else doPlayerSendCancel(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você precisa de um ".. getItemNameById(config.item_id) .." Para Vende-lo") end return true end Veja se nao fez nada errado... flw
  25. Nossa, ainda usou o sistema de stages q n da pra add mais stages ou consertou?? O script está muito bom, mas dá pra diminuir... Mesmo assim, bom trabalho! flw
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...