-
Total de itens
512 -
Registro em
-
Última visita
-
Dias Ganhos
16
Tudo que brun123 postou
-
Essa script dá muitos loops... eu não sei ao certo o que está causando esse erro, mas provavelmente não deve dar mais nenhum erro (coloquei também pra parar de continuar procurando o corpse quando já é certeza que não vai encontrar): se quiser pode usar um que eu fiz aqui agora, tá mais limpo: function onKill(cid, target) if not isMonster(target) then return true end local configs = { ids = {2148, 2152, 2160, 7588, 7589, 7590, 7591, 7618, 7620, 8473}, premium = true -- só premium usar o auto loot ? [true ou false] } if configs.premium and not isPremium(cid) then return true end local function gatherGold(cid, corpseId, corpsePosition) if not isCreature(cid) then return end local corpse = getTileItemById(corpsePosition, corpseId).uid if corpse <= 1 or not isCorpse(corpse) then return end local slot, corpseMoney = 0, 0 for times = 1, getContainerSize(corpse) do local corpseItem = getContainerItem(corpse, slot) if not isInArray(configs.ids, corpseItem.itemid) then slot = slot + 1 else corpseMoney = corpseMoney + corpseItem.type doRemoveItem(corpseItem.uid) end end corpseMoney = corpseMoney + getPlayerMoney(cid) doPlayerRemoveMoney(cid, getPlayerMoney(cid)) doPlayerAddMoney(cid, corpseMoney) end local name, pos = getCreatureName(target), getThingPos(target) addEvent(gatherGold, 10, cid, getMonsterInfo(name).lookCorpse, pos) return true end
-
tem como fazer assim também: function customFunction(turno) print("Teste") if turno >= 10 then return end -- para a função quando turno chegar a 10 addEvent(customFunction, 1000, turno + 1) -- executa a função novamente, com o parâmetro turno aumentado end
-
o utevo res sumona diretamente a criatura, já sua spell cria um monstro, e depois tenta convencer ele... acontece que nem todos os monstro são "convinceable" (convencíveis), aí essa função falha e o monstro não se torna summon de ninguém. O god tem uma flag que permite convencer qualquer criatura, portanto a função de convencer criaturas nunca falha com god. use essa spell: function onCastSpell(cid, var) if #getCreatureSummons(cid) > 0 then doPlayerSendCancel(cid, "You can only summon one creature.") return false end local summon, useCreateMonster = 0, false if type(doSummonMonster) then summon = doSummonMonster(cid, "Gazer") if summon == 3 then doPlayerSendCancel(cid, "There is not enough room to summon a creature.") return false end summon = getCreatureSummons(cid) summon = summon[#summon] if isCreature(summon) and getCreatureMaster(summon) == cid then doSendMagicEffect(getThingPos(summon), CONST_ME_MAGIC_BLUE) return true else useCreateMonster = true end else useCreateMonster = true end if useCreateMonster then local pos = getThingPos(cid) pos.y = pos.y + 1 summon = doCreateMonster("Gazer", pos, false) if summon == true then doPlayerSendCancel(cid, "There is not enough room to summon a creature.") return false end end if not isCreature(summon) then return false end doConvinceCreature(cid, summon) if getCreatureMaster(summon) ~= cid then doRemoveCreature(summon) return false end doSendMagicEffect(getThingPos(summon), CONST_ME_MAGIC_BLUE) return true end ela verifica se função doSummonMonster existe no seu server e tenta usar ela pra sumonar o monstro, se não coneguir ele tenta criar e convencer o monstro, se ainda assim não conseguir tornar o monstro um summon do player, vai remover o monstro (aí você vai ter que mudar no xml do monstro e deixar ele convinceable) pra fazer a magia gastar mana você tem que mexer no spells.xml
-
Pega o script de novo que eu fiz uns edits nele, e testa com player Aqui funcionou normal
-
a function onEquip é errada mesmo, ela executa duas vezes, você só precisa implementar um códigozinho em lua mesmo pra evitar a dupla execução, quanto ao script de retirar o summon ao remover o colar do slot, não há nenhum erro, mas como "Demon" não é um monstro convinceable, será impossível que você se torne mestre dele usando a função doConvinceCreature, veja se a script funciona assim: local protection = {} local monster = "Demon" function onEquip (cid, item, slot) if protection[cid] then protection[cid] = nil return true end protection[cid] = true local mid = 0 if type(doSummonMonster) then local func_ret = doSummonMonster(cid, monster) if func_ret == 3 then return doPlayerSendCancel(cid, "There is not enough room to summon your monster.") end local s = getCreatureSummons(cid) mid = s[#s] else mid = doCreateMonster(monster, getThingPos(cid), false) if mid == true then return doPlayerSendCancel(cid, "There is not enough room to summon your monster.") end doConvinceCreature(cid, mid) end if not isCreature(mid) then return true end if getCreatureMaster(mid) ~= cid then doRemoveCreature(mid) else doSendMagicEffect(getThingPos(mid), CONST_ME_TELEPORT) end return true end
-
essa script não tem nada de errado e é até meio difícil fazer o server dar crash fazendo apenas modificações em lua... o que faz o servidor dar crash é alguma modificação mal feita no código fonte ou algum código que foi mal programado (bugs nas sources), um exemplo disso é aquele bug nas houses que faz o servidor cair, que inclusive é usado de forma abusiva por players... eu testei aqui e funcionou normalmente, vê se existe algum evento onStatsChange no player
-
local startpos = { {x=106,y=53,z=15}, {x=107,y=53,z=15}, {x=108,y=53,z=15}, {x=109,y=53,z=15}, {x=110,y=53,z=15}, {x=114,y=53,z=15}, {x=115,y=53,z=15}, {x=116,y=53,z=15}, {x=117,y=53,z=15}, {x=118,y=53,z=15}, {x=112,y=58,z=15}, {x=106,y=63,z=15}, {x=107,y=63,z=15}, {x=108,y=63,z=15}, {x=109,y=63,z=15}, {x=110,y=63,z=15}, {x=114,y=63,z=15}, {x=115,y=63,z=15}, {x=116,y=63,z=15}, {x=117,y=63,z=15}, {x=118,y=63,z=15}} local finalpos = { {x=151,y=31,z=15}, {x=152,y=31,z=15}, {x=153,y=31,z=15}, {x=154,y=31,z=15}, {x=155,y=31,z=15}, {x=151,y=32,z=15}, {x=152,y=32,z=15}, {x=153,y=32,z=15}, {x=154,y=32,z=15}, {x=155,y=32,z=15}, {x=155,y=35,z=15}, {x=181,y=123,z=15}, {x=182,y=123,z=15}, {x=183,y=123,z=15}, {x=184,y=123,z=15}, {x=185,y=123,z=15}, {x=181,y=124,z=15}, {x=182,y=124,z=15}, {x=183,y=124,z=15}, {x=184,y=124,z=15}, {x=185,y=124,z=15}} local minlevel = 2500 function onUse(cid, item, frompos, item2, topos) for _ = 1, #startpos do local uid = getTopCreature(startpos[_]).uid if isPlayer(uid) and getPlayerLevel(uid) >= minlevel then doTeleportThing(uid, finalpos[_], false) addEvent(doSendMagicEffect, 10, finalpos[_], CONST_ME_TELEPORT) end end return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945) end
-
dúvida Ajuda Terminar O Meu Evento (Event Of Burned) Função Onstatschange
pergunta respondeu ao Bennyhappy de brun123 em Scripts
você não pode criar variáveis com nomes de números... imagine se pudesse, no caso local x = 1 + 2, como iria saber se é matematicamente igual a 3 ou se está somando a variável 1 com 2... use tabelas, no lugar de: local 0 = {x = pos.x, y = pos.y - math.random(2,3), z = pos.z, stackpos = 255} local 1 = {x = pos.x, y = pos.y + math.random(2,3), z = pos.z, stackpos = 255} local 2 = {x = pos.x - math.random(2,3), y = pos.y, z = pos.z, stackpos = 255} local 3 = {x = pos.x + math.random(2,3), y = pos.y, z = pos.z, stackpos = 255} local 4 = {x = pos.x - math.random(2,3), y = pos.y - math.random(2,3), z = pos.z, stackpos = 255} local 5 = {x = pos.x + math.random(2,3), y = pos.y - math.random(2,3), z = pos.z, stackpos = 255} local 6 = {x = pos.x + math.random(2,3), y = pos.y + math.random(2,3), z = pos.z, stackpos = 255} local 7 = {x = pos.x - math.random(2,3), y = pos.y + math.random(2,3), z = pos.z, stackpos = 255} use: local p = { {x = pos.x, y = pos.y - math.random(2,3), z = pos.z, stackpos = 255}, {x = pos.x, y = pos.y + math.random(2,3), z = pos.z, stackpos = 255}, {x = pos.x - math.random(2,3), y = pos.y, z = pos.z, stackpos = 255}, {x = pos.x + math.random(2,3), y = pos.y, z = pos.z, stackpos = 255}, {x = pos.x - math.random(2,3), y = pos.y - math.random(2,3), z = pos.z, stackpos = 255}, {x = pos.x + math.random(2,3), y = pos.y - math.random(2,3), z = pos.z, stackpos = 255}, {x = pos.x + math.random(2,3), y = pos.y + math.random(2,3), z = pos.z, stackpos = 255}, {x = pos.x - math.random(2,3), y = pos.y + math.random(2,3), z = pos.z, stackpos = 255}} e aqui: doTeleportThing(cid, math.random(0,7), false) troque por: doTeleportThing(cid, p[math.random(0,7)], false) detalhe, se você declarar as posições antes do function onStatsChange, elas vão ser geradas 1 vez aleatoriamente e vão ficar daquele jeito até reiniciar o server... Se quiser que toda vez gere novas posições, tem que declarar elas dentro do function onStasChange -
melhor usar a função getTileItemById no lugar da getThingFromPos, já que pode pegar criaturas (vai dar erro quando tentar usar doRemoveItem em uid de criatura, falando que o item não foi encontrado) e a grande chance é que pegue algum item que algum player jogou no chão
-
callstack overflow é significa que você realizou um loop infinito na mesma função, no caso a stats change, quando a criatura que tem esse evento registrado perde vida, a doTargetCombatHealth faz com que ela perca vida novamente ativando de novo o onstats change, que faz com que a doTargetCombatHealth seja executada de novo e assim vai até o servidor perceber que a mesma função não tem saída e indica o erro. o que o slicer falou está certo, mesmo que você tire esse erro, se deixar o return true, o monstro vai bater o dano normal, digamos que seja 100, mais o valor do doTargetCombatHealth, que seria 130, totalizando 230, colocando return false, você anula o dano de 100 e aí sim você vai ter a aparência de na verdade o monstro estar tirando 130. usa a script assim: local overflow_protection = {} function onStatsChange(cid, attacker, type, combat, value) if isSummon(attacker) and isMonster(cid) and getPlayerStorageValue(getCreatureMaster(attacker), 17823) >= 1 and type == STATSCHANGE_HEALTHLOSS and value >= 1 then if overflow_protection[attacker] then overflow_protection[attacker] = nil return true end local dmg = math.floor(value * 1.3) overflow_protection[attacker] = true doTargetCombatHealth(attacker, cid, COMBAT_PHYSICALDAMAGE, -dmg, -dmg, CONST_ME_NONE) doPlayerSendTextMessage(getCreatureMaster(attacker), MESSAGE_STATUS_CONSOLE_ORANGE, "Your "..getCreatureName(attacker).." deals "..dmg.." damage.") return false end return true end
-
vê se funciona assim: function onUse(cid, item, frompos, item2, topos) local startpositions = { {x=106,y=30,z=15}, {x=107,y=30,z=15}, {x=108,y=30,z=15}, {x=109,y=30,z=15}, {x=110,y=30,z=15}, {x=114,y=30,z=15}, {x=115,y=30,z=15}, {x=116,y=30,z=15}, {x=117,y=30,z=15}, {x=118,y=30,z=15}, {x=112,y=35,z=15}, {x=106,y=40,z=15}, {x=107,y=40,z=15}, {x=108,y=40,z=15}, {x=109,y=40,z=15}, {x=110,y=40,z=15}, {x=114,y=40,z=15}, {x=115,y=40,z=15}, {x=116,y=40,z=15}, {x=117,y=40,z=15}, {x=118,y=40,z=15}} for _, pos in pairs (startpositions) do local creature = getTopCreature(pos).uid if isPlayer(creature) then local newpos = {x = pos.x, y = pos.y, z = pos.z} if pos.y == 30 then newpos.y = 53 elseif pos.y == 35 then newpos.y = 58 elseif pos.y == 40 then newpos.y = 68 end doTeleportThing(creature, newpos, false) addEvent(doSendMagicEffect, 10, newpos, CONST_ME_TELEPORT) end end return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945) end
-
tem que mudar a tag no creaturescripts.xml, de type="death" para type="preparedeath" a function onPrepareDeath não tem esse tanto de parâmetros aí não, experimenta colocar só o cid, deve funcionar
-
Testa esse: local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) function getDamage(cid, level, magic) return -(level * 5 + magic * 12), -(level * 5 + magic * 12 + 55) end setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "getDamage") function onCastSpell(cid, var) local target = getCreatureTarget(cid) if target <= 1 then doPlayerSendCancel(cid, "You need a target.") return false end if not isSightClear(getThingPos(cid), getThingPos(target), false) then doPlayerSendCancel(cid, "You can't reach that place.") return false end local targetPos = getThingPos(target) local directions = {0, 1, 2, 3, 4, 5, 6, 7} local teleportPos = {} for _ = 1, #directions do local random = math.random(#directions) local dir = directions[random] table.remove(directions, random) local newPos = getPosByDir(targetPos, dir) if doTileQueryAdd(cid, newPos, 0, false) == 1 then teleportPos = newPos break end end if teleportPos.x and doTileQueryAdd(cid, teleportPos, 0, false) == 1 then doCombat(cid, combat, var) doTeleportThing(cid, teleportPos, false) return true end doPlayerSendCancel(cid, "You cannot teleport there.") return false end
-
function onThink(interval, lastExecution, thinkInterval) local maxDistance = 10 for _, pid in pairs(getPlayersOnline()) do local summons = getCreatureSummons(pid) if #summons ~= 0 then for _, sid in pairs (summons) do if getThingPos(sid).z ~= getThingPos(pid).z or getDistanceBetween(getThingPos(sid), getThingPos(pid)) > maxDistance then doTeleportThing(sid, getThingPos(pid), false) doSendMagicEffect(getThingPos(sid), 12) end end end end return true end
-
[Encerrado] [Ajuda Script] Pedido Para Analisar O Script
tópico respondeu ao narutochuuu de brun123 em Tópicos Sem Resposta
sem nenhum erro no inventório? o items.xml não influencia nessa especificação do item, tem que verificar por um items.otb, tenta em vez de adicionar o item de id 139 adicionar algum item, tipo uma pokebola (id 2391 se não me engano) pra ver se o script funciona corretinho -
[Encerrado] [Ajuda Script] Pedido Para Analisar O Script
tópico respondeu ao narutochuuu de brun123 em Tópicos Sem Resposta
cara, você deve dizer o que acontece exatamente, aparece algum erro? o player só não recebe o item? as scripts estão ok, veja se o item 139 é realmente pickupable no item.otb, se não for, nã ovai dar pra adicionar o item ao player, é como se você tentasse adicionar uma parede no inventório do player -
[Encerrado] [Ajuda] Bug Estranho! Scripts Feios T_T
tópico respondeu ao iogurteh de brun123 em Tópicos Sem Resposta
você editou alguma coisa nas libs do server que tornou impossível carregar elas, e milhares de funções que estão lá não poderão ser usadas quando você liga o servidor, logo de imediato vai dar um erro, e antes de carregar o mapa tenta tirar print desse erro e postar aqui -
[Encerrado] [Ajuda] Bug Estranho! Scripts Feios T_T
tópico respondeu ao iogurteh de brun123 em Tópicos Sem Resposta
o catch rate você muda em catch.lua, logo no início do script tem uma tabela com os "cr" (catch rate) de cada bola. esse problema aí não é difícil resolver, basta procurar por todas as funções getThingFromPos(alguma_pos) no exp.lua e deixar assim getThingFromPos(alguma_pos, false), que se não encontrar tile naquele lugar não vai aparecer nenhum erro -
[Encerrado] [Duvida] Pda Slicer S/level Pokemons Selvagems
tópico respondeu ao majenkyo de brun123 em Tópicos Sem Resposta
Summons tomam damage reduzido de pokemons selvagens, altere a seguinte constante para modificar: summonReduction = 0.50 0.50 significa que summons vão tomar 50% do dano (vai dividir todo damage por 2, não inclui gyms) se quiser aumentar os status com que os pokemons selvagens nascem, vai em level system.lua e procura por algo mais ou menos assim: setPlayerStorageValue(cid, 1001, 1 + math.random(off * levelRange * 0.7, off * levelRange * 1.4)) setPlayerStorageValue(cid, 1002, 1 + math.random(def * levelRange * 0.7, def * levelRange * 1.4)) setPlayerStorageValue(cid, 1003, math.random(agi * levelRange * 0.7, agi * levelRange * 1.4)) setPlayerStorageValue(cid, 1004, math.random(vit * levelRange * 0.7, vit * levelRange * 1.4)) setPlayerStorageValue(cid, 1005, 1 + math.random(spatk * levelRange * 0.7, spatk * levelRange * 1.4)) setPlayerStorageValue(cid, 1016, 1 + math.random(spdef * levelRange * 0.7, spdef * levelRange * 1.4)) mude todos os 0.7 pra um valor maior e os 1.4 também -
Tem certeza que mudou correto? o getCreatureTarget da função doTargetCombatHealth deve permanecer inalterável, enquando a do doCombat está errada, tente assim: local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, EARTHDAMAGE) setCombatParam(combat, COMBAT_PARAM_EFFECT, 97) setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, 56) function onCastSpell(cid, var) doCreatureSay(cid, "RAZOR LEAF!", TALKTYPE_MONSTER) local MIN = getPlayerStorageValue(getCreatureMaster(cid), 6000)*1 local MAX = getPlayerStorageValue(getCreatureMaster(cid), 6000)*2 local EFF = 3 doTargetCombatHealth(cid, getCreatureTarget(cid), COMBAT_PHYSICALDAMAGE, -MIN, -MAX, EFF) return doCombat(cid, combat, var) end Lembrando que o tipo de dano está COMBAT_PHYSICALDAMAGE, pois o dano é causado pela função doTargetCombatHealth e não pela doCombat, se não der certo use esse: function onCastSpell(cid, var) doCreatureSay(cid, "RAZOR LEAF!", TALKTYPE_MONSTER) local MIN = getPlayerStorageValue(getCreatureMaster(cid), 6000)*1 local MAX = getPlayerStorageValue(getCreatureMaster(cid), 6000)*2 local EFF = 3 doTargetCombatHealth(cid, getCreatureTarget(cid), COMBAT_PHYSICALDAMAGE, -MIN, -MAX, EFF) doSendDistanceShoot(getThingPos(cid), getThingPos(getCreatureTarget(cid)), 56) return true end
-
pedido [Encerrado] Criando Nova Distro Pokemon
tópico respondeu ao impera de brun123 em Tópicos Sem Resposta
se fosse verdade o que você disse sobre ninguém ajudar, não haveria nenhum servidor de pokémon pra você começar a trabalhar num distro open-source... é verdade que pouquíssimos buscam conhecimentos para ajudar e se tornar independente, mas generalizar é equívoco esse onDeath é registrado apenas em summons de players, ou seja, isPlayer(getCreatureMaster(cid)) vai ser sempre true numa script dessa, colocar "if not true then ... end" é como se você não tivesse adicionado nada, pois nunca vai ser executada essa linha... o que faz o corpo do pokémon de players não aparecer é o return false no final do script, e pode perceber que antes do return false ainda tem um doRemoveCreature, você teria que tirar o doRemoveCreature e usar o return true para criar o corpo do pokémon. Sobre não poder dar catch, não me lembro bem, mas caso esteja faltando qualquer informação necessária pra função do catch funcionar, toda a operação vai ser abortada... o script pokeexp.lua (uma script onDeath também) é registrado em todo pokémon que não seja summon de player (isso inclui summons de npcs também, pra ver quais creature events são registrados nos monstros basta ver o arquivo spawn.lua), e quando eles morrem, é especificado no arquivo pra colocar todos os atributos do pokémon no seu corpo, e no final pode até ver, tem o return true. o jeito é registrar essa script em pokémons de players também, e perceba que logo no início do script ainda há uma proteçãozinha extra para se por acaso o monstro que estiver morrendo for summon, a script não executar (isSummon), tem que tirar essa checagem também. -
na função doCombat, muda getCreatureTarget(cid) para cid apenas
-
o do caotic dá erro, porque ele usa o uid de um item num addevent, unique ids de itens não são estáticos. o luck faz com que o item se transforma em outro completamente diferente usando essa linha: doTransformItem(item.uid, item.itemid + 15) o certo seria + 4 Editei o script original, vê se funciona: TILE_SNOW = 670 TILE_FOOTPRINT_I = 6594 TILE_FOOTPRINT_II = 6598 function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor) if(isPlayerGhost(cid)) then return true end if(item.itemid == TILE_SNOW) then doTransformItem(item.uid, TILE_FOOTPRINT_I) elseif(item.itemid == TILE_FOOTPRINT_I) then doTransformItem(item.uid, TILE_FOOTPRINT_II) else doTransformItem(item.uid, TILE_FOOTPRINT_I) end doDecayItem(item.uid) return true end
-
Quem Está Navegando 0 membros estão online
- Nenhum usuário registrado visualizando esta página.